Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit d66485d

Browse files
committed
append the sdk content of bcs
1 parent 0d41222 commit d66485d

File tree

3 files changed

+79
-45
lines changed

3 files changed

+79
-45
lines changed

openstack/bcs/v2/blockchains/requests.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateRe
131131
return
132132
}
133133

134-
_, r.Err = client.Post(createURL(client), b, &r.Body, &golangsdk.RequestOpts{
134+
_, r.Err = client.Post(rootURL(client), b, &r.Body, &golangsdk.RequestOpts{
135135
OkCodes: []int{200, 202},
136136
})
137137
return
@@ -158,7 +158,7 @@ func (opts DeleteOpts) ToInstanceDeleteQuery() (string, error) {
158158

159159
//Delete is a method to delete an existing bcs instance
160160
func Delete(client *golangsdk.ServiceClient, opts DeleteOptsBuilder, id string) (r DeleteResult) {
161-
url := deleteURL(client, id)
161+
url := resourceURL(client, id)
162162
if opts != nil {
163163
query, err := opts.ToInstanceDeleteQuery()
164164
if err != nil {
@@ -177,7 +177,7 @@ func Delete(client *golangsdk.ServiceClient, opts DeleteOptsBuilder, id string)
177177

178178
//Get is a method to obtain the detailed information of an existing bcs instance
179179
func Get(client *golangsdk.ServiceClient, id string) (r ShowResult) {
180-
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
180+
_, r.Err = client.Get(resourceURL(client, id), &r.Body, nil)
181181
return
182182
}
183183

@@ -189,7 +189,7 @@ func GetStatus(client *golangsdk.ServiceClient, id string) (r StatusResult) {
189189

190190
//List is a method to obtain the detailed information list of all existing bcs instance
191191
func List(client *golangsdk.ServiceClient) (r ListResult) {
192-
_, r.Err = client.Get(listURL(client), &r.Body, nil)
192+
_, r.Err = client.Get(rootURL(client), &r.Body, nil)
193193
return
194194
}
195195

@@ -232,7 +232,7 @@ func Update(client *golangsdk.ServiceClient, opts UpdateOptsBuilder, id string)
232232
return
233233
}
234234

235-
_, r.Err = client.Post(updateURL(client, id), b, nil, &golangsdk.RequestOpts{
235+
_, r.Err = client.Post(resourceURL(client, id), b, nil, &golangsdk.RequestOpts{
236236
OkCodes: []int{200, 202},
237237
})
238238
return

openstack/bcs/v2/blockchains/results.go

Lines changed: 68 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,45 @@ type BCSInstance struct {
5454
}
5555

5656
type Basic struct {
57-
ID string `json:"id"`
58-
Name string `json:"name"`
59-
Version string `json:"version"`
60-
VersionType int `json:"version_type"`
61-
ServiceType string `json:"service_type"`
62-
PurchaseType string `json:"purchase_type"`
63-
SignAlgorithm string `json:"sign_algorithm"`
64-
Consensus string `json:"consensus"`
65-
ChargingMode int `json:"charging_mode"`
66-
DatabaseType string `json:"database_type"`
67-
ClusterID string `json:"cluster_id"`
68-
ClusterName string `json:"cluster_name"`
69-
ClusterType string `json:"cluster_type"`
70-
ClusterAvailabilityZone string `json:"cluster_az"`
71-
CreatedTime string `json:"created_time"`
72-
DeployType string `json:"deploy_type"`
73-
IsCrossRegion bool `json:"is_cross_region"`
74-
IsSupportRollback bool `json:"is_support_rollback"`
75-
IsSupportRestful bool `json:"is_support_restful"`
76-
IsOldService bool `json:"is_old_service"`
77-
OldServiceVersion string `json:"old_service_version"`
78-
AgentPortalAddress []string `json:"agent_portal_addrs"`
79-
Status string `json:"status"`
80-
ProcessStatus string `json:"process_status"`
57+
ID string `json:"id"`
58+
Name string `json:"name"`
59+
KernelType string `json:"kernel_type"`
60+
Version string `json:"version"`
61+
VersionType int `json:"version_type"`
62+
VolumeType string `json:"volume_type"`
63+
ServiceType string `json:"service_type"`
64+
PurchaseType string `json:"purchase_type"`
65+
SignAlgorithm string `json:"sign_algorithm"`
66+
Consensus string `json:"consensus"`
67+
ChargingMode int `json:"charging_mode"`
68+
DatabaseType string `json:"database_type"`
69+
ClusterID string `json:"cluster_id"`
70+
ClusterName string `json:"cluster_name"`
71+
ClusterType string `json:"cluster_type"`
72+
ClusterPlatformType string `json:"cluster_platform_type"`
73+
ClusterAvailabilityZone string `json:"cluster_az"`
74+
CreatedTime string `json:"created_time"`
75+
DeployType string `json:"deploy_type"`
76+
DeployScale int `json:"deploy_scale"`
77+
DeployStatus int `json:"deploy_status"`
78+
DetailStatus DetailStatus `json:"detail_status"`
79+
IsCrossRegion bool `json:"is_cross_region"`
80+
IsSupportRollback bool `json:"is_support_rollback"`
81+
IsSupportRestful bool `json:"is_support_restful"`
82+
IsSupportTc3 bool `json:"is_support_tc3"`
83+
IsOldService bool `json:"is_old_service"`
84+
OldServiceVersion string `json:"old_service_version"`
85+
AgentPortalAddress []string `json:"agent_portal_addrs"`
86+
Status string `json:"status"`
87+
ProcessStatus string `json:"process_status"`
88+
Tc3TaskServerPortalAddrs []string `json:"tc3_taskserver_portal_addrs"`
89+
TotalDeployPeer int `json:"total_deploy_peer"`
90+
OrderStatus int `json:"order_status"`
91+
OrderInfo OrderInfo `json:"order_info"`
92+
OrderFadeCache int `json:"order_fade_cache"`
93+
OrderFadeEnable bool `json:"order_fade_enable"`
94+
IEFClusterInfo IEFCluster `json:"ief_cluster_info"`
95+
IEFAPIVersion string `json:"iefapi_version"`
8196
}
8297

8398
type Channel struct {
@@ -107,6 +122,9 @@ type CouchDB struct {
107122

108123
type DMSKafka struct {
109124
Address []string `json:"addr"`
125+
Name string `json:"name"`
126+
Status string `json:"status"`
127+
NodeCount int `json:"node_cnt"`
110128
OrderFadeEnable bool `json:"order_fade_enable"`
111129
OrderFadeCache int `json:"order_fade_cache"`
112130
}
@@ -115,6 +133,13 @@ type IEF struct {
115133
DeployMode int `json:"deploy_mode"`
116134
}
117135

136+
type IEFCluster struct {
137+
GroupID string `json:"group_id"`
138+
GroupName string `json:"group_name"`
139+
InstanceID string `json:"instance_id"`
140+
InstanceName string `json:"instance_name"`
141+
}
142+
118143
type SFS struct {
119144
Name string `json:"name"`
120145
PVCName string `json:"pvc_name"`
@@ -131,6 +156,25 @@ type OBS struct {
131156
Address string `json:"addr"`
132157
}
133158

159+
type DetailStatus struct {
160+
AgentStatus string `json:"agent_status"`
161+
ConsensusStatus string `json:"consensus_status"`
162+
OrgStatus string `json:"org_status"`
163+
PeerStatus string `json:"peer_status"`
164+
PluginStatus string `json:"plugin_status"`
165+
}
166+
167+
type OrderInfo struct {
168+
Delete int `json:"delete"`
169+
Operate int `json:"operate"`
170+
OrderID string `json:"order_id"`
171+
OrderStatus int `json:"order_status"`
172+
OrderType int `json:"order_type"`
173+
Release int `json:"release"`
174+
ResourceErrorCode string `json:"resource_error_code"`
175+
ResourceStatus int `json:"resource_status"`
176+
}
177+
134178
func (r ShowResult) Extract() (*BCSInstance, error) {
135179
var res BCSInstance
136180
err := r.ExtractInto(&res)

openstack/bcs/v2/blockchains/urls.go

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,16 @@ package blockchains
22

33
import "github.com/huaweicloud/golangsdk"
44

5-
func createURL(c *golangsdk.ServiceClient) string {
6-
return c.ServiceURL("blockchains")
7-
}
8-
9-
func listURL(c *golangsdk.ServiceClient) string {
10-
return c.ServiceURL("blockchains")
11-
}
12-
13-
func getURL(c *golangsdk.ServiceClient, instanceID string) string {
14-
return c.ServiceURL("blockchains", instanceID)
15-
}
5+
const resourcePath = "blockchains"
166

17-
func updateURL(c *golangsdk.ServiceClient, instanceID string) string {
18-
return c.ServiceURL("blockchains", instanceID)
7+
func rootURL(c *golangsdk.ServiceClient) string {
8+
return c.ServiceURL(resourcePath)
199
}
2010

21-
func deleteURL(c *golangsdk.ServiceClient, instanceID string) string {
22-
return c.ServiceURL("blockchains", instanceID)
11+
func resourceURL(c *golangsdk.ServiceClient, instanceID string) string {
12+
return c.ServiceURL(resourcePath, instanceID)
2313
}
2414

2515
func extraURL(c *golangsdk.ServiceClient, instanceID string, extra string) string {
26-
return c.ServiceURL("blockchains", instanceID, extra)
16+
return c.ServiceURL(resourcePath, instanceID, extra)
2717
}

0 commit comments

Comments
 (0)