-
Notifications
You must be signed in to change notification settings - Fork 6
/
results.go
266 lines (229 loc) · 7.93 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
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
package blockchains
import "github.com/huaweicloud/terraform-provider-hcs/huaweicloudstack/sdk/huaweicloud"
type commonResult struct {
golangsdk.Result
}
//CreateResult is a struct that represents the result of CreateNewBlockchain
type CreateResult struct {
commonResult
}
type CreateResponse struct {
ID string `json:"blockchain_id"`
Name string `json:"blockchain_name"`
}
func (r CreateResult) Extract() (*CreateResponse, error) {
var res CreateResponse
err := r.ExtractInto(&res)
return &res, err
}
//DeleteResult is a struct that represents the result of DeleteBlockchain
type DeleteResult struct {
commonResult
}
func (r DeleteResult) Extract() error {
return r.Err
}
//ShowResult is a struct that represents the result of ShowBlockchainDetail
type ShowResult struct {
commonResult
}
type BCSInstance struct {
Basic Basic `json:"basic_info"`
Channels []Channel `json:"channels"`
Peer []Peer `json:"peer_info"`
LightPeer []Peer `json:"loght_peer_info"`
Orderer Peer `json:"orderer_info"`
CouchDB CouchDB `json:"couch_db_info"`
DMSKafka DMSKafka `json:"dms_kafka_info"`
IEF IEF `json:"ief_info"`
SFS SFS `json:"sfs_info"`
Agent Peer `json:"agent_info"`
RestfulAPI Peer `json:"restapi_info"`
PVC PVC `json:"evs_pvc_info"`
TaskServer Peer `json:"tc3_taskserver_info"`
OBS OBS `json:"obs_bucket_info"`
}
type Basic struct {
ID string `json:"id"`
Name string `json:"name"`
KernelType string `json:"kernel_type"`
Version string `json:"version"`
VersionType int `json:"version_type"`
VolumeType string `json:"volume_type"`
ServiceType string `json:"service_type"`
PurchaseType string `json:"purchase_type"`
SignAlgorithm string `json:"sign_algorithm"`
Consensus string `json:"consensus"`
ChargingMode int `json:"charging_mode"`
DatabaseType string `json:"database_type"`
ClusterID string `json:"cluster_id"`
ClusterName string `json:"cluster_name"`
ClusterType string `json:"cluster_type"`
ClusterPlatformType string `json:"cluster_platform_type"`
ClusterAvailabilityZone string `json:"cluster_az"`
CreatedTime string `json:"created_time"`
DeployType string `json:"deploy_type"`
DeployScale int `json:"deploy_scale"`
DeployStatus int `json:"deploy_status"`
DetailStatus DetailStatus `json:"detail_status"`
IsCrossRegion bool `json:"is_cross_region"`
IsSupportRollback bool `json:"is_support_rollback"`
IsSupportRestful bool `json:"is_support_restful"`
IsSupportTc3 bool `json:"is_support_tc3"`
IsOldService bool `json:"is_old_service"`
OldServiceVersion string `json:"old_service_version"`
AgentPortalAddress []string `json:"agent_portal_addrs"`
Status string `json:"status"`
ProcessStatus string `json:"process_status"`
Tc3TaskServerPortalAddrs []string `json:"tc3_taskserver_portal_addrs"`
TotalDeployPeer int `json:"total_deploy_peer"`
OrderStatus int `json:"order_status"`
OrderInfo OrderInfo `json:"order_info"`
OrderFadeCache int `json:"order_fade_cache"`
OrderFadeEnable bool `json:"order_fade_enable"`
IEFClusterInfo IEFCluster `json:"ief_cluster_info"`
IEFAPIVersion string `json:"iefapi_version"`
}
type Channel struct {
Name string `json:"name"`
OrgNames []string `json:"org_names"`
OrgNameHash []string `json:"org_name_hash"`
Peers map[string][]string `json:"peers"`
}
type Peer struct {
Name string `json:"name"`
NodeCount int `json:"node_cnt"`
Status string `json:"status"`
StatusDetail string `json:"status_detail"`
PVCName string `json:"pvc_name"`
Address []PeerAddress `json:"address"`
}
type PeerAddress struct {
DomainPort string `json:"domain_port"`
IPPort string `json:"ip_port"`
}
type CouchDB struct {
User string `json:"user"`
}
type DMSKafka struct {
Address []string `json:"addr"`
Name string `json:"name"`
Status string `json:"status"`
NodeCount int `json:"node_cnt"`
OrderFadeEnable bool `json:"order_fade_enable"`
OrderFadeCache int `json:"order_fade_cache"`
}
type IEF struct {
DeployMode int `json:"deploy_mode"`
}
type IEFCluster struct {
GroupID string `json:"group_id"`
GroupName string `json:"group_name"`
InstanceID string `json:"instance_id"`
InstanceName string `json:"instance_name"`
}
type SFS struct {
Name string `json:"name"`
PVCName string `json:"pvc_name"`
Address string `json:"addr"`
Type string `json:"type"`
}
type PVC struct {
DeployMode int `json:"deploy_mode"`
}
type OBS struct {
Name string `json:"name"`
Address string `json:"addr"`
}
type DetailStatus struct {
AgentStatus string `json:"agent_status"`
ConsensusStatus string `json:"consensus_status"`
OrgStatus string `json:"org_status"`
PeerStatus string `json:"peer_status"`
PluginStatus string `json:"plugin_status"`
}
type OrderInfo struct {
Delete int `json:"delete"`
Operate int `json:"operate"`
OrderID string `json:"order_id"`
OrderStatus int `json:"order_status"`
OrderType int `json:"order_type"`
Release int `json:"release"`
ResourceErrorCode string `json:"resource_error_code"`
ResourceStatus int `json:"resource_status"`
}
func (r ShowResult) Extract() (*BCSInstance, error) {
var res BCSInstance
err := r.ExtractInto(&res)
return &res, err
}
//ListResult is a struct that represents the result of ListBlockchain
type ListResult struct {
commonResult
}
type BlockChain struct {
ID string `json:"id"`
Name string `json:"name"`
}
func (r ListResult) Extract() (*[]BlockChain, error) {
var s struct {
BlockChains []BlockChain `json:"blockchains"`
}
err := r.ExtractInto(&s)
return &s.BlockChains, err
}
//StatusResult is a struct that represents the result of ShowBlockchainStatus
type StatusResult struct {
commonResult
}
type Status struct {
BCSStatus StatusDetail `json:"bcs"`
EIPStatus StatusDetail `json:"eip"`
SFSStatus StatusDetail `json:"sfs"`
OBSStatus StatusDetail `json:"obs"`
KafkaStatus StatusDetail `json:"kafka"`
CCEStatus CCEEngine `json:"cce"`
}
type CCEEngine struct {
Cluster StatusDetail `json:"cluster"`
Network StatusDetail `json:"network"`
SecurityGroup StatusDetail `json:"security_group"`
}
type StatusDetail struct {
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Status string `json:"status"`
Detail string `json:"detail"`
}
func (r StatusResult) Extract() (*Status, error) {
var s Status
err := r.ExtractInto(&s)
return &s, err
}
//NodesResult is a struct that represents the result of ShowBlockchainNode
type NodesResult struct {
commonResult
}
type Org struct {
OrgMSPID string `json:"org_msp_id"`
OrgDomain string `json:"org_domain"`
Peers map[string]Node `json:"peers"`
}
type Node struct {
Port string `json:"ip_port"`
Channels []string `json:"channels"`
}
func (r NodesResult) Extract() (*map[string]Org, error) {
var s struct {
NodeOrgs map[string]Org `json:"node_orgs"`
}
err := r.ExtractInto(&s)
return &s.NodeOrgs, err
}
//UpdateResult is a struct which represents the result of UpdateBlockchain
type UpdateResult struct {
commonResult
}
func (r UpdateResult) Extract() error {
return r.Err
}