Merge "mecm-mepm uninstall playbook added"
[ealt-edge.git] / mep / mepagent / pkg / model / instance.go
1 /*
2  *  Copyright 2020 Huawei Technologies Co., Ltd.
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  */
16
17 // define the type information
18 package model
19
20 type AppInstanceInfo struct {
21         AppInstanceId                            string                                    `yaml:"appInstanceId" json:"appInstanceId"`
22         MepGWIP                                  string                                    `yaml:"mepGWIP" json:"mepGWIP"`
23         HttpGWPORT                               string                                    `yaml:"httpGWPORT" json:"httpGWPORT"`
24         HttpsGWPORT                              string                                    `yaml:"httpsGWPORT" json:"httpsGWPORT"`
25         MepGWROUTES                              string                                    `yaml:"mepGWROUTES" json:"mepGWROUTES"`
26         ServiceInfoPosts                         []ServiceInfoPost                         `yaml:"serviceInfoPosts" json:"serviceInfoPosts"`
27         SerAvailabilityNotificationSubscriptions []SerAvailabilityNotificationSubscription `yaml:"serAvailabilityNotificationSubscriptions" json:"serAvailabilityNotificationSubscriptions"`
28 }
29
30 type ServiceInfoPost struct {
31         SerInstanceId     string         `yaml:"serInstanceId" json:"serInstanceId"`
32         SerName           string         `yaml:"serName" json:"serName"`
33         SerCategory       CategoryRef    `yaml:"serCategory" json:"serCategory"`
34         Version           string         `yaml:"version" json:"version"`
35         State             ServiceState   `yaml:"state" json:"state"`
36         TransportId       string         `yaml:"transportId" json:"transportId"`
37         TransportInfo     TransportInfo  `yaml:"transportInfo" json:"transportInfo"`
38         Serializer        SerializerType `yaml:"serializer" json:"serializer"`
39         ScopeOfLocality   LocalityType   `yaml:"scopeOfLocality" json:"scopeOfLocality"`
40         ConsumedLocalOnly bool           `yaml:"consumedLocalOnly" json:"consumedLocalOnly"`
41         IsLocal           bool           `yaml:"isLocal" json:"isLocal"`
42 }
43
44 type CategoryRef struct {
45         Href    string `yaml:"href" json:"href"`
46         Id      string `yaml:"id" json:"id"`
47         Name    string `yaml:"name" json:"name"`
48         Version string `yaml:"version" json:"version"`
49 }
50
51 type ServiceState string
52
53 const (
54         ACTIVE   ServiceState = "ACTIVE"
55         INACTIVE ServiceState = "INACTIVE"
56 )
57
58 type TransportInfo struct {
59         Id               string           `yaml:"id" json:"id"`
60         Name             string           `yaml:"name" json:"name"`
61         Description      string           `yaml:"description" json:"description"`
62         TransportType    TransportType    `yaml:"type" json:"type"`
63         Protocol         string           `yaml:"protocol" json:"protocol"`
64         Version          string           `yaml:"version" json:"version"`
65         Endpoint         EndPointInfoUris `yaml:"endpoint" json:"endpoint"`
66         Security         SecurityInfo     `yaml:"security" json:"security"`
67         ImplSpecificInfo ImplSpecificInfo `yaml:"implSpecificInfo" json:"implSpecificInfo"`
68 }
69
70 type TransportType string
71
72 const (
73         REST_HTTP      TransportType = "REST_HTTP"
74         MB_TOPIC_BASED TransportType = "MB_TOPIC_BASED"
75         MB_ROUTING     TransportType = "MB_ROUTING"
76         MB_PUBSUB      TransportType = "MB_PUBSUB"
77         RPC            TransportType = "RPC"
78         RPC_STREAMING  TransportType = "RPC_STREAMING"
79         WEBSOCKET      TransportType = "WEBSOCKET"
80 )
81
82 type EndPointInfoUris struct {
83         Uris []string `yaml:"uris" json:"uris"`
84 }
85
86 type SecurityInfo struct {
87         OAuth2Info SecurityInfoOAuth2Info `yaml:"oAuth2Info" json:"oAuth2Info"`
88 }
89
90 type SecurityInfoOAuth2Info struct {
91         GrantTypes    []SecurityInfoOAuth2InfoGrantType `yaml:"grantTypes" json:"grantTypes"`
92         TokenEndpoint string                            `yaml:"tokenEndpoint" json:"tokenEndpoint"`
93 }
94
95 type SecurityInfoOAuth2InfoGrantType string
96
97 const (
98         AUTHORIZATION_CODE SecurityInfoOAuth2InfoGrantType = "OAUTH2_AUTHORIZATION_CODE"
99         IMPLICIT_GRANT     SecurityInfoOAuth2InfoGrantType = "OAUTH2_IMPLICIT_GRANT"
100         RESOURCE_OWNER     SecurityInfoOAuth2InfoGrantType = "OAUTH2_RESOURCE_OWNER"
101         CLIENT_CREDENTIALS SecurityInfoOAuth2InfoGrantType = "OAUTH2_CLIENT_CREDENTIALS"
102 )
103
104 type ImplSpecificInfo struct {
105 }
106
107 type SerializerType string
108
109 const (
110         JSON      SerializerType = "JSON"
111         XML       SerializerType = "XML"
112         PROTOBUF3 SerializerType = "PROTOBUF3"
113 )
114
115 type LocalityType string
116
117 const (
118         MEC_SYSTEM LocalityType = "MEC_SYSTEM"
119         MEC_HOST   LocalityType = "MEC_HOST"
120         NFVI_POP   LocalityType = "NFVI_POP"
121         ZONE       LocalityType = "ZONE"
122         ZONE_GROUP LocalityType = "ZONE_GROUP"
123         NFVI_NODE  LocalityType = "NFVI_NODE"
124 )
125
126 type SerAvailabilityNotificationSubscription struct {
127         SubscriptionType  string                                                   `yaml:"subscriptionType" json:"subscriptionType"`
128         CallbackReference string                                                   `yaml:"callbackReference" json:"callbackReference"`
129         Links             Self                                                     `yaml:"links" json:"links"`
130         FilteringCriteria SerAvailabilityNotificationSubscriptionFilteringCriteria `yaml:"filteringCriteria" json:"filteringCriteria"`
131 }
132
133 type Self struct {
134         Self LinkType `yaml:"self" json:"self"`
135 }
136
137 type LinkType struct {
138         Href string `yaml:"href" json:"href"`
139 }
140
141 type SerAvailabilityNotificationSubscriptionFilteringCriteria struct {
142         SerInstanceIds []string       `yaml:"serInstanceIds" json:"serInstanceIds"`
143         SerNames       []string       `yaml:"serNames" json:"serNames"`
144         SerCategories  []CategoryRef  `yaml:"serCategories" json:"serCategories"`
145         States         []ServiceState `yaml:"states" json:"states"`
146         IsLocal        bool           `yaml:"isLocal" json:"isLocal"`
147 }