2 ==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================================
23 "github.com/gorilla/mux"
24 cmap "github.com/orcaman/concurrent-map"
28 type CmdOptions struct {
34 type Resource struct {
37 HandlerFunc http.HandlerFunc
41 Name string `json:"name"`
42 ConfigName string `json:"configName, omitempty"`
43 Namespace string `json:"namespace, omitempty"`
44 Status string `json:"status"`
45 Version string `json:"version"`
46 Instances []XappInstance `json:"instances"`
49 type XappInstance struct {
50 Name string `json:"name"`
51 Status string `json:"status"`
53 Port int `json:"port"`
54 TxMessages []string `json:"txMessages"`
55 RxMessages []string `json:"rxMessages"`
58 type XappManager struct {
61 sd SubscriptionDispatcher
66 type Helmer interface {
68 Install(m ConfigMetadata) (xapp Xapp, err error)
69 Status(name string) (xapp Xapp, err error)
70 StatusAll() (xapps []Xapp, err error)
71 List() (xapps []string, err error)
72 Delete(name string) (xapp Xapp, err error)
81 type SubscriptionReq struct {
83 TargetUrl string `json:"targetUrl"`
84 EventType string `json:"eventType"`
85 MaxRetries int `json:"maxRetries"`
86 RetryTimer int `json:"retryTimer"`
89 type SubscriptionResp struct {
91 Version int `json:"version"`
92 EventType string `json:"eventType"`
95 type SubscriptionNotif struct {
97 Version int `json:"version"`
98 EventType string `json:"eventType"`
99 XappData []Xapp `json:"xapp"`
102 type Subscription struct {
104 resp SubscriptionResp
107 type SubscriptionDispatcher struct {
109 subscriptions cmap.ConcurrentMap
114 type MessageTypes struct {
115 TxMessages []string `yaml:"txMessages"`
116 RxMessages []string `yaml:"rxMessages"`
119 type EventType string
122 Created EventType = "created"
123 Updated EventType = "updated"
124 Deleted EventType = "deleted"
128 MdclogErr = 1 //! Error level log entry
129 MdclogWarn = 2 //! Warning level log entry
130 MdclogInfo = 3 //! Info level log entry
131 MdclogDebug = 4 //! Debug level log entry