From 9508e2ef0c0406a48211af9b686806e5171f5fcb Mon Sep 17 00:00:00 2001 From: edisonxiang Date: Fri, 29 Jun 2018 09:29:48 +0800 Subject: [PATCH] add fix in service broker --- openstack/client.go | 8 ++++++-- openstack/dcs/v1/instances/requests.go | 18 ++++++++++++------ openstack/dcs/v1/instances/results.go | 2 ++ openstack/dms/v1/instances/requests.go | 4 ++-- openstack/dms/v1/products/requests.go | 4 ++-- openstack/dms/v1/products/results.go | 2 +- openstack/dms/v1/products/urls.go | 4 ++-- openstack/dms/v1/queues/results.go | 22 +++++++++++----------- 8 files changed, 38 insertions(+), 26 deletions(-) diff --git a/openstack/client.go b/openstack/client.go index 90e917331..be72250fe 100644 --- a/openstack/client.go +++ b/openstack/client.go @@ -496,13 +496,17 @@ func NewAntiDDoSV2(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) // NewDMSServiceV1 creates a ServiceClient that may be used to access the v1 Distributed Message Service. func NewDMSServiceV1(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) (*golangsdk.ServiceClient, error) { - sc, err := initClientOpts(client, eo, "dms") + sc, err := initClientOpts(client, eo, "network") + sc.Endpoint = strings.Replace(sc.Endpoint, "vpc", "dms", 1) + sc.ResourceBase = sc.Endpoint + "v1.0/" + client.ProjectID + "/" return sc, err } // NewDCSServiceV1 creates a ServiceClient that may be used to access the v1 Distributed Cache Service. func NewDCSServiceV1(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) (*golangsdk.ServiceClient, error) { - sc, err := initClientOpts(client, eo, "dcs") + sc, err := initClientOpts(client, eo, "network") + sc.Endpoint = strings.Replace(sc.Endpoint, "vpc", "dcs", 1) + sc.ResourceBase = sc.Endpoint + "v1.0/" + client.ProjectID + "/" return sc, err } diff --git a/openstack/dcs/v1/instances/requests.go b/openstack/dcs/v1/instances/requests.go index 8015f1d7c..1cbee26a5 100644 --- a/openstack/dcs/v1/instances/requests.go +++ b/openstack/dcs/v1/instances/requests.go @@ -26,7 +26,7 @@ type CreateOps struct { Engine string `json:"engine" required:"true"` // Cache engine version, which is 3.0.7. - EngineVersion string `json:"engine_version,omitempty"` + EngineVersion string `json:"engine_version"` // Indicates the message storage space. // Cache capacity. @@ -38,6 +38,9 @@ type CreateOps struct { // 64, 128, 256, 512, or 1024 GB. Capacity int `json:"capacity" required:"true"` + // Indicate if no password visit cache instance is allowed. + NoPasswordAccess string `json:"no_password_access,omitempty"` + // Indicates the password of an instance. // An instance password must meet the following complexity requirements: @@ -52,6 +55,9 @@ type CreateOps struct { // Special characters, such as `~!@#$%^&*()-_=+\|[{}]:'",<.>/? Password string `json:"password,omitempty"` + // When NoPasswordAccess is flase, the AccessUser is enabled. + AccessUser string `json:"access_user,omitempty"` + // Tenant's VPC ID. VPCID string `json:"vpc_id" required:"true"` @@ -70,7 +76,7 @@ type CreateOps struct { // Backup policy. // This parameter is available for master/standby DCS instances. - InstanceBackupPolicy InstanceBackupPolicy `json:"instance_backup_policy,omitempty"` + InstanceBackupPolicy *InstanceBackupPolicy `json:"instance_backup_policy,omitempty"` // Indicates the time at which a maintenance time window starts. // Format: HH:mm:ss @@ -153,11 +159,11 @@ type UpdateOpts struct { // Brief description of the DCS instance. // A brief description supports up to 1024 characters. - Description string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` // Backup policy. // This parameter is available for master/standby DCS instances. - InstanceBackupPolicy InstanceBackupPolicy `json:"instance_backup_policy,omitempty"` + InstanceBackupPolicy *InstanceBackupPolicy `json:"instance_backup_policy,omitempty"` // Time at which the maintenance time window starts. // Format: HH:mm:ss @@ -185,7 +191,7 @@ func Update(client *golangsdk.ServiceClient, id string, opts UpdateOptsBuilder) return } - _, r.Err = client.Put(updateURL(client, id), body, &r.Body, &golangsdk.RequestOpts{ + _, r.Err = client.Put(updateURL(client, id), body, nil, &golangsdk.RequestOpts{ OkCodes: []int{204}, }) return @@ -270,7 +276,7 @@ func Extend(client *golangsdk.ServiceClient, id string, opts ExtendOptsBuilder) return } - _, r.Err = client.Post(extendURL(client, id), body, &r.Body, &golangsdk.RequestOpts{ + _, r.Err = client.Post(extendURL(client, id), body, nil, &golangsdk.RequestOpts{ OkCodes: []int{204}, }) return diff --git a/openstack/dcs/v1/instances/results.go b/openstack/dcs/v1/instances/results.go index 235d78a67..99043e900 100644 --- a/openstack/dcs/v1/instances/results.go +++ b/openstack/dcs/v1/instances/results.go @@ -59,6 +59,8 @@ type Instance struct { OrderID string `json:"order_id"` MaintainBegin string `json:"maintain_begin"` MaintainEnd string `json:"maintain_end"` + NoPasswordAccess string `json:"no_password_access"` + AccessUser string `json:"access_user"` } // UpdateResult is a struct from which can get the result of update method diff --git a/openstack/dms/v1/instances/requests.go b/openstack/dms/v1/instances/requests.go index 29cc9a277..6e3f770eb 100644 --- a/openstack/dms/v1/instances/requests.go +++ b/openstack/dms/v1/instances/requests.go @@ -113,7 +113,7 @@ type UpdateOpts struct { // Indicates the description of an instance. // It is a character string containing not more than 1024 characters. - Description string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` // Indicates the time at which a maintenance time window starts. // Format: HH:mm:ss @@ -141,7 +141,7 @@ func Update(client *golangsdk.ServiceClient, id string, opts UpdateOptsBuilder) return } - _, r.Err = client.Put(updateURL(client, id), body, &r.Body, &golangsdk.RequestOpts{ + _, r.Err = client.Put(updateURL(client, id), body, nil, &golangsdk.RequestOpts{ OkCodes: []int{204}, }) return diff --git a/openstack/dms/v1/products/requests.go b/openstack/dms/v1/products/requests.go index 5542f6e0f..424b9113a 100644 --- a/openstack/dms/v1/products/requests.go +++ b/openstack/dms/v1/products/requests.go @@ -5,7 +5,7 @@ import ( ) // Get products -func Get(client *golangsdk.ServiceClient) (r GetResult) { - _, r.Err = client.Get(getURL(client), &r.Body, nil) +func Get(client *golangsdk.ServiceClient, engine string) (r GetResult) { + _, r.Err = client.Get(getURL(client, engine), &r.Body, nil) return } diff --git a/openstack/dms/v1/products/results.go b/openstack/dms/v1/products/results.go index 333e87ba1..36938c325 100644 --- a/openstack/dms/v1/products/results.go +++ b/openstack/dms/v1/products/results.go @@ -35,7 +35,7 @@ type Detail struct { // ProductInfo for dms type ProductInfo struct { Storage string `json:"storage"` - NodeNum int `json:"node_num"` + NodeNum string `json:"node_num"` ProductID string `json:"product_id"` SpecCode string `json:"spec_code"` } diff --git a/openstack/dms/v1/products/urls.go b/openstack/dms/v1/products/urls.go index 6ac6acc75..2d133d847 100644 --- a/openstack/dms/v1/products/urls.go +++ b/openstack/dms/v1/products/urls.go @@ -10,7 +10,7 @@ import ( const resourcePath = "products" // getURL will build the get url of get function -func getURL(client *golangsdk.ServiceClient) string { +func getURL(client *golangsdk.ServiceClient, engine string) string { // remove projectid from endpoint - return strings.Replace(client.ServiceURL(resourcePath), "/"+client.ProjectID, "", -1) + return strings.Replace(client.ServiceURL(resourcePath+"?engine="+engine), "/"+client.ProjectID, "", -1) } diff --git a/openstack/dms/v1/queues/results.go b/openstack/dms/v1/queues/results.go index 17b9c6523..ae005b997 100644 --- a/openstack/dms/v1/queues/results.go +++ b/openstack/dms/v1/queues/results.go @@ -31,17 +31,17 @@ type DeleteResult struct { // Queue response type Queue struct { - ID string `json:"id"` - Name string `json:"name"` - Created string `json:"created"` - Description string `json:"description"` - QueueMode string `json:"queue_mode"` - Reservation int `json:"reservation"` - MaxMsgSizeByte int `json:"max_msg_size_byte"` - ProducedMessages int `json:"produced_messages"` - RedrivePolicy string `json:"redrive_policy"` - MaxConsumeCount int `json:"max_consume_count"` - GroupCount int `json:"group_count"` + ID string `json:"id"` + Name string `json:"name"` + Created float64 `json:"created"` + Description string `json:"description"` + QueueMode string `json:"queue_mode"` + Reservation int `json:"reservation"` + MaxMsgSizeByte int `json:"max_msg_size_byte"` + ProducedMessages int `json:"produced_messages"` + RedrivePolicy string `json:"redrive_policy"` + MaxConsumeCount int `json:"max_consume_count"` + GroupCount int `json:"group_count"` } // GetResult contains the body of getting detailed