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
8 changes: 6 additions & 2 deletions openstack/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
18 changes: 12 additions & 6 deletions openstack/dcs/v1/instances/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:

Expand All @@ -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"`

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions openstack/dcs/v1/instances/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions openstack/dms/v1/instances/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions openstack/dms/v1/products/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion openstack/dms/v1/products/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
4 changes: 2 additions & 2 deletions openstack/dms/v1/products/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
22 changes: 11 additions & 11 deletions openstack/dms/v1/queues/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down