-
Notifications
You must be signed in to change notification settings - Fork 44
/
model_pool_resp.go
216 lines (171 loc) · 5.38 KB
/
model_pool_resp.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"errors"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
"strings"
)
// PoolResp 后端云服务器组响应体
type PoolResp struct {
// 后端云服务器组的ID
Id string `json:"id"`
// 后端云服务器组所在的项目ID。
ProjectId string `json:"project_id"`
// 后端云服务器组所在的项目ID。
TenantId string `json:"tenant_id"`
// 后端云服务器组的名称。
Name string `json:"name"`
// 后端云服务器组的描述信息
Description string `json:"description"`
// 后端云服务器组的管理状态。只支持设定为true,该字段的值无实际意义。
AdminStateUp bool `json:"admin_state_up"`
// 后端云服务器组绑定的负载均衡器ID的列表。
Loadbalancers []ResourceList `json:"loadbalancers"`
// 后端云服务器组关联的监听器ID的列表。
Listeners []ResourceList `json:"listeners"`
// 后端云服务器组关联的后端云服务器ID的列表。
Members []ResourceList `json:"members"`
// 后端云服务器组关联的健康检查的ID。
HealthmonitorId string `json:"healthmonitor_id"`
SessionPersistence *SessionPersistence `json:"session_persistence"`
// 后端云服务器组的后端协议。
Protocol PoolRespProtocol `json:"protocol"`
// 后端云服务器组的负载均衡算法,取值:ROUND_ROBIN:加权轮询算法;LEAST_CONNECTIONS:加权最少连接算法;SOURCE_IP:源IP算法。当该字段的取值为SOURCE_IP时,后端云服务器组绑定的后端云服务器的weight字段无效。
LbAlgorithm PoolRespLbAlgorithm `json:"lb_algorithm"`
// 修改保护状态, 取值: - nonProtection: 不保护,默认值为nonProtection - consoleProtection: 控制台修改保护
ProtectionStatus *PoolRespProtectionStatus `json:"protection_status,omitempty"`
// 设置保护的原因 >仅当protection_status为consoleProtection时有效。
ProtectionReason *string `json:"protection_reason,omitempty"`
}
func (o PoolResp) String() string {
data, err := utils.Marshal(o)
if err != nil {
return "PoolResp struct{}"
}
return strings.Join([]string{"PoolResp", string(data)}, " ")
}
type PoolRespProtocol struct {
value string
}
type PoolRespProtocolEnum struct {
UDP PoolRespProtocol
TCP PoolRespProtocol
HTTP PoolRespProtocol
}
func GetPoolRespProtocolEnum() PoolRespProtocolEnum {
return PoolRespProtocolEnum{
UDP: PoolRespProtocol{
value: "UDP",
},
TCP: PoolRespProtocol{
value: "TCP",
},
HTTP: PoolRespProtocol{
value: "HTTP",
},
}
}
func (c PoolRespProtocol) Value() string {
return c.value
}
func (c PoolRespProtocol) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *PoolRespProtocol) 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 PoolRespLbAlgorithm struct {
value string
}
type PoolRespLbAlgorithmEnum struct {
ROUND_ROBIN PoolRespLbAlgorithm
LEAST_CONNECTIONS PoolRespLbAlgorithm
SOURCE_IP PoolRespLbAlgorithm
}
func GetPoolRespLbAlgorithmEnum() PoolRespLbAlgorithmEnum {
return PoolRespLbAlgorithmEnum{
ROUND_ROBIN: PoolRespLbAlgorithm{
value: "ROUND_ROBIN",
},
LEAST_CONNECTIONS: PoolRespLbAlgorithm{
value: "LEAST_CONNECTIONS",
},
SOURCE_IP: PoolRespLbAlgorithm{
value: "SOURCE_IP",
},
}
}
func (c PoolRespLbAlgorithm) Value() string {
return c.value
}
func (c PoolRespLbAlgorithm) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *PoolRespLbAlgorithm) 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 PoolRespProtectionStatus struct {
value string
}
type PoolRespProtectionStatusEnum struct {
NON_PROTECTION PoolRespProtectionStatus
CONSOLE_PROTECTION PoolRespProtectionStatus
}
func GetPoolRespProtectionStatusEnum() PoolRespProtectionStatusEnum {
return PoolRespProtectionStatusEnum{
NON_PROTECTION: PoolRespProtectionStatus{
value: "nonProtection",
},
CONSOLE_PROTECTION: PoolRespProtectionStatus{
value: "consoleProtection",
},
}
}
func (c PoolRespProtectionStatus) Value() string {
return c.value
}
func (c PoolRespProtectionStatus) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *PoolRespProtectionStatus) 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")
}
}