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 Status string `json:"status"`
43 Version string `json:"version"`
44 Instances []XappInstance `json:"instances"`
47 type XappInstance struct {
48 Name string `json:"name"`
49 Status string `json:"status"`
51 Port int `json:"port"`
52 TxMessages []string `json:"txMessages"`
53 RxMessages []string `json:"rxMessages"`
56 type XappManager struct {
59 sd SubscriptionDispatcher
64 type Helmer interface {
66 Install(name string) (xapp Xapp, err error)
67 Status(name string) (xapp Xapp, err error)
68 StatusAll() (xapps []Xapp, err error)
69 List() (xapps []string, err error)
70 Delete(name string) (xapp Xapp, err error)
79 type SubscriptionReq struct {
81 TargetUrl string `json:"targetUrl"`
82 EventType string `json:"eventType"`
83 MaxRetries int `json:"maxRetries"`
84 RetryTimer int `json:"retryTimer"`
87 type SubscriptionResp struct {
89 Version int `json:"version"`
90 EventType string `json:"eventType"`
93 type SubscriptionNotif struct {
95 Version int `json:"version"`
96 EventType string `json:"eventType"`
97 XappData []Xapp `json:"xapp"`
100 type Subscription struct {
102 resp SubscriptionResp
105 type SubscriptionDispatcher struct {
107 subscriptions cmap.ConcurrentMap
112 type MessageTypes struct {
113 TxMessages []string `yaml:"txMessages"`
114 RxMessages []string `yaml:"rxMessages"`
117 type EventType string
120 Created EventType = "created"
121 Updated EventType = "updated"
122 Deleted EventType = "deleted"
126 MdclogErr = 1 //! Error level log entry
127 MdclogWarn = 2 //! Warning level log entry
128 MdclogInfo = 3 //! Info level log entry
129 MdclogDebug = 4 //! Debug level log entry