Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions openstack/bcs/v2/blockchains/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateRe
return
}

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

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

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

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

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

Expand Down Expand Up @@ -232,7 +232,7 @@ func Update(client *golangsdk.ServiceClient, opts UpdateOptsBuilder, id string)
return
}

_, r.Err = client.Post(updateURL(client, id), b, nil, &golangsdk.RequestOpts{
_, r.Err = client.Post(resourceURL(client, id), b, nil, &golangsdk.RequestOpts{
OkCodes: []int{200, 202},
})
return
Expand Down
92 changes: 68 additions & 24 deletions openstack/bcs/v2/blockchains/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,45 @@ type BCSInstance struct {
}

type Basic struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
VersionType int `json:"version_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"`
ClusterAvailabilityZone string `json:"cluster_az"`
CreatedTime string `json:"created_time"`
DeployType string `json:"deploy_type"`
IsCrossRegion bool `json:"is_cross_region"`
IsSupportRollback bool `json:"is_support_rollback"`
IsSupportRestful bool `json:"is_support_restful"`
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"`
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 {
Expand Down Expand Up @@ -107,6 +122,9 @@ type CouchDB struct {

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"`
}
Expand All @@ -115,6 +133,13 @@ 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"`
Expand All @@ -131,6 +156,25 @@ type OBS struct {
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)
Expand Down
24 changes: 7 additions & 17 deletions openstack/bcs/v2/blockchains/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@ package blockchains

import "github.com/huaweicloud/golangsdk"

func createURL(c *golangsdk.ServiceClient) string {
return c.ServiceURL("blockchains")
}

func listURL(c *golangsdk.ServiceClient) string {
return c.ServiceURL("blockchains")
}

func getURL(c *golangsdk.ServiceClient, instanceID string) string {
return c.ServiceURL("blockchains", instanceID)
}
const resourcePath = "blockchains"

func updateURL(c *golangsdk.ServiceClient, instanceID string) string {
return c.ServiceURL("blockchains", instanceID)
func rootURL(c *golangsdk.ServiceClient) string {
return c.ServiceURL(resourcePath)
}

func deleteURL(c *golangsdk.ServiceClient, instanceID string) string {
return c.ServiceURL("blockchains", instanceID)
func resourceURL(c *golangsdk.ServiceClient, instanceID string) string {
return c.ServiceURL(resourcePath, instanceID)
}

func extraURL(c *golangsdk.ServiceClient, instanceID string, extra string) string {
return c.ServiceURL("blockchains", instanceID, extra)
func extraURL(c *golangsdk.ServiceClient, instanceID, extra string) string {
return c.ServiceURL(resourcePath, instanceID, extra)
}