This repository has been archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
results.go
152 lines (136 loc) · 4.23 KB
/
results.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
package channels
import (
"github.com/huaweicloud/golangsdk"
"github.com/huaweicloud/golangsdk/pagination"
)
type commonResult struct {
golangsdk.Result
}
// GetResult represents the result of a create operation.
type CreateResult struct {
commonResult
}
// UdpateResult represents the result of a update operation.
type UpdateResult struct {
commonResult
}
// GetResult represents the result of a update operation.
type GetResult struct {
commonResult
}
type VpcChannel struct {
// VPC channel name.
// A VPC channel name can contain 3 to 64 characters, starting with a letter.
// Only letters, digits, hyphens (-), and underscores (_) are allowed.
// Chinese characters must be in UTF-8 or Unicode format.
Name string `json:"name"`
// VPC channel type.
// 1: private network ELB channel (to be deprecated)
// 2: fast channel with the load balancing function
Type int `json:"type"`
// Host port of the VPC channel.
// This parameter is valid only when the VPC channel type is set to 2.
// This parameter is required if the VPC channel type is set to 2.
// The value range is 1–65535.
Port int `json:"port"`
// Distribution algorithm.
// 1: WRR (default)
// 2: WLC
// 3: SH
// 4: URI hashing
// This parameter is mandatory if the VPC channel type is set to 2.
BalanceStrategy int `json:"balance_strategy"`
// Member type of the VPC channel.
// ip
// ecs (default)
// This parameter is required if the VPC channel type is set to 2.
MemberType string `json:"member_type"`
// Time when the VPC channel is created.
CreateTime string `json:"create_time"`
// VPC channel ID.
Id string `json:"id"`
// VPC channel status.
// 1: normal
// 2: abnormal
Status int `json:"status"`
// ID of a private network ELB channel.
// This parameter is valid only when the VPC channel type is set to 1.
ElbId string `json:"elb_id"`
// Backend server list. Only one backend server is included if the VPC channel type is set to 1.
Members []MemberInfo `json:"members"`
// Health check details.
VpcHealthConfig VpcHealthConfig `json:"vpc_health_config"`
}
func (r commonResult) Extract() (*VpcChannel, error) {
var s VpcChannel
err := r.ExtractInto(&s)
return &s, err
}
// The ChannelPage represents the result of a List operation.
type ChannelPage struct {
pagination.SinglePageBase
}
// ExtractChannels its Extract method to interpret it as a channel array.
func ExtractChannels(r pagination.Page) ([]VpcChannel, error) {
var s []VpcChannel
err := r.(ChannelPage).Result.ExtractIntoSlicePtr(&s, "vpc_channels")
return s, err
}
type DeleteResult struct {
golangsdk.ErrResult
}
type MemberResult struct {
golangsdk.Result
}
type AddBackendResult struct {
MemberResult
}
type GetBackendResult struct {
MemberResult
}
type Member struct {
// VPC channel name.
// A VPC channel name can contain 3 to 64 characters, starting with a letter.
// Only letters, digits, hyphens (-), and underscores (_) are allowed.
// Chinese characters must be in UTF-8 or Unicode format.
Name string `json:"name"`
// VPC channel type.
// 1: private network ELB channel (to be deprecated)
// 2: fast channel with the load balancing function
Type int `json:"type"`
// Host port of the VPC channel.
// This parameter is valid only when the VPC channel type is set to 2. The value range is 1–65535.
// This parameter is required if the VPC channel type is set to 2.
Port int `json:"port"`
// Distribution algorithm.
// 1: WRR (default)
// 2: WLC
// 3: SH
// 4: URI hashing
// This parameter is mandatory if the VPC channel type is set to 2.
BalanceStrategy int `json:"balance_strategy"`
// Member type of the VPC channel.
// ip
// ecs (default)
// This parameter is required if the VPC channel type is set to 2.
MemberType string `json:"member_type"`
// Time when the VPC channel is created.
CreateTime string `json:"create_time"`
// VPC channel ID.
Id string `json:"id"`
// VPC channel status.
// 1: normal
// 2: abnormal
Status int `json:"status"`
// ID of a private network ELB channel.
// This parameter is valid only when the VPC channel type is set to 1.
ElbId string `json:"elb_id"`
}
func (r MemberResult) Extract() ([]Member, error) {
var s []Member
err := r.ExtractIntoStructPtr(&s, "members")
return s, err
}
type RemoveResult struct {
golangsdk.ErrResult
}