forked from huaweicloud/huaweicloud-sdk-go-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_microservice_import_req.go
197 lines (158 loc) · 5.17 KB
/
model_microservice_import_req.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
package model
import (
"github.com/dysodeng/huaweicloud-sdk-go-v3/core/utils"
"errors"
"github.com/dysodeng/huaweicloud-sdk-go-v3/core/converter"
"strings"
)
// MicroserviceImportReq 导入微服务的请求对象
type MicroserviceImportReq struct {
GroupInfo *MicroserviceGroup `json:"group_info"`
// 微服务中心类型。 - CSE:CSE微服务注册中心 - CCE: CCE云容器引擎(工作负载) - CCE_SERVICE: CCE云容器引擎(Service)
ServiceType MicroserviceImportReqServiceType `json:"service_type"`
// API网关访问微服务的请求协议 - HTTP - HTTPS
Protocol *MicroserviceImportReqProtocol `json:"protocol,omitempty"`
// 导入的api列表
Apis []MicroserviceApiCreate `json:"apis"`
// APIG请求后端服务的超时时间。最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000,默认5000 单位:毫秒。
BackendTimeout *int32 `json:"backend_timeout,omitempty"`
// API的认证方式,默认无认证[,site暂不支持IAM认证。](tag:Site) - NONE:无认证 - APP:APP认证 - IAM:IAM认证
AuthType *MicroserviceImportReqAuthType `json:"auth_type,omitempty"`
// 是否支持跨域,默认不支持 - true:支持 - false:不支持
Cors *bool `json:"cors,omitempty"`
CseInfo *MicroServiceInfoCseCreate `json:"cse_info,omitempty"`
CceInfo *MicroServiceInfoCceCreate `json:"cce_info,omitempty"`
CceServiceInfo *MicroServiceInfoCceServiceCreate `json:"cce_service_info,omitempty"`
}
func (o MicroserviceImportReq) String() string {
data, err := utils.Marshal(o)
if err != nil {
return "MicroserviceImportReq struct{}"
}
return strings.Join([]string{"MicroserviceImportReq", string(data)}, " ")
}
type MicroserviceImportReqServiceType struct {
value string
}
type MicroserviceImportReqServiceTypeEnum struct {
CSE MicroserviceImportReqServiceType
CCE MicroserviceImportReqServiceType
CCE_SERVICE MicroserviceImportReqServiceType
}
func GetMicroserviceImportReqServiceTypeEnum() MicroserviceImportReqServiceTypeEnum {
return MicroserviceImportReqServiceTypeEnum{
CSE: MicroserviceImportReqServiceType{
value: "CSE",
},
CCE: MicroserviceImportReqServiceType{
value: "CCE",
},
CCE_SERVICE: MicroserviceImportReqServiceType{
value: "CCE_SERVICE",
},
}
}
func (c MicroserviceImportReqServiceType) Value() string {
return c.value
}
func (c MicroserviceImportReqServiceType) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *MicroserviceImportReqServiceType) UnmarshalJSON(b []byte) error {
myConverter := converter.StringConverterFactory("string")
if myConverter == nil {
return errors.New("unsupported StringConverter type: string")
}
interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
if err != nil {
return err
}
if val, ok := interf.(string); ok {
c.value = val
return nil
} else {
return errors.New("convert enum data to string error")
}
}
type MicroserviceImportReqProtocol struct {
value string
}
type MicroserviceImportReqProtocolEnum struct {
HTTP MicroserviceImportReqProtocol
HTTPS MicroserviceImportReqProtocol
}
func GetMicroserviceImportReqProtocolEnum() MicroserviceImportReqProtocolEnum {
return MicroserviceImportReqProtocolEnum{
HTTP: MicroserviceImportReqProtocol{
value: "HTTP",
},
HTTPS: MicroserviceImportReqProtocol{
value: "HTTPS",
},
}
}
func (c MicroserviceImportReqProtocol) Value() string {
return c.value
}
func (c MicroserviceImportReqProtocol) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *MicroserviceImportReqProtocol) UnmarshalJSON(b []byte) error {
myConverter := converter.StringConverterFactory("string")
if myConverter == nil {
return errors.New("unsupported StringConverter type: string")
}
interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
if err != nil {
return err
}
if val, ok := interf.(string); ok {
c.value = val
return nil
} else {
return errors.New("convert enum data to string error")
}
}
type MicroserviceImportReqAuthType struct {
value string
}
type MicroserviceImportReqAuthTypeEnum struct {
NONE MicroserviceImportReqAuthType
APP MicroserviceImportReqAuthType
IAM MicroserviceImportReqAuthType
}
func GetMicroserviceImportReqAuthTypeEnum() MicroserviceImportReqAuthTypeEnum {
return MicroserviceImportReqAuthTypeEnum{
NONE: MicroserviceImportReqAuthType{
value: "NONE",
},
APP: MicroserviceImportReqAuthType{
value: "APP",
},
IAM: MicroserviceImportReqAuthType{
value: "IAM",
},
}
}
func (c MicroserviceImportReqAuthType) Value() string {
return c.value
}
func (c MicroserviceImportReqAuthType) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *MicroserviceImportReqAuthType) UnmarshalJSON(b []byte) error {
myConverter := converter.StringConverterFactory("string")
if myConverter == nil {
return errors.New("unsupported StringConverter type: string")
}
interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
if err != nil {
return err
}
if val, ok := interf.(string); ok {
c.value = val
return nil
} else {
return errors.New("convert enum data to string error")
}
}