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
63 type Helmer interface {
64 Install(name string) (xapp Xapp, err error)
65 Status(name string) (xapp Xapp, err error)
66 StatusAll() (xapps []Xapp, err error)
67 List() (xapps []string, err error)
68 Delete(name string) (xapp Xapp, err error)
77 type SubscriptionReq struct {
79 TargetUrl string `json:"targetUrl"`
80 EventType string `json:"eventType"`
81 MaxRetries int `json:"maxRetries"`
82 RetryTimer int `json:"retryTimer"`
85 type SubscriptionResp struct {
87 Version int `json:"version"`
88 EventType string `json:"eventType"`
91 type SubscriptionNotif struct {
93 Version int `json:"version"`
94 EventType string `json:"eventType"`
95 XappData Xapp `json:"xapp"`
98 type Subscription struct {
100 resp SubscriptionResp
103 type SubscriptionDispatcher struct {
105 subscriptions cmap.ConcurrentMap
108 type MessageTypes struct {
109 TxMessages []string `yaml:"txMessages"`
110 RxMessages []string `yaml:"rxMessages"`
113 type EventType string
116 Created EventType = "created"
117 Updated EventType = "updated"
118 Deleted EventType = "deleted"
122 Mdclog_err = 1 //! Error level log entry
123 Mdclog_warn = 2 //! Warning level log entry
124 Mdclog_info = 3 //! Info level log entry
125 Mdclog_debug = 4 //! Debug level log entry