diff --git a/bce/config.go b/bce/config.go index 243b4c81..cd632ec2 100644 --- a/bce/config.go +++ b/bce/config.go @@ -26,7 +26,7 @@ import ( // Constants and default values for the package bce const ( - SDK_VERSION = "0.9.202" + SDK_VERSION = "0.9.203" URI_PREFIX = "/" // now support uri without prefix "v1" so just set root path DEFAULT_DOMAIN = "baidubce.com" DEFAULT_PROTOCOL = "http" diff --git a/doc/RDS.md b/doc/RDS.md index 14b00491..b8039dfa 100644 --- a/doc/RDS.md +++ b/doc/RDS.md @@ -315,7 +315,7 @@ for _, e := range result.InstanceIds { ```go // import "github.com/baidubce/bce-sdk-go/services/rds" -args := &rds.CreateReadReplicaArgs{ +args := &rds.CreateRDSReadReplicaArgs{ //主实例ID,必选 SourceInstanceId: "sourceInstanceId" // 计费相关参数,PaymentTiming取值为 预付费:Prepaid,后付费:Postpaid;Reservation:支付方式为后付费时不需要设置,预付费时必须设置;必选 @@ -363,8 +363,8 @@ for _, e := range result.InstanceIds { > 注意: > - 需要在云数据库 RDS 主实例的基础上进行创建 > - 实例可选套餐详见(https://cloud.baidu.com/doc/RDS/s/9jwvz0wd3) -> - 仅数据库类型为 MySQL 的主实例支持创建只读实例 -> - 只读实例的数据库引擎和数据库版本与主实例相同,无需设置,主实例版本最低是 MySQL 5.6 +> - 仅数据库类型为 MySQL、PostgreSql 的主实例支持创建只读实例 +> - 只读实例的数据库引擎和数据库版本与主实例相同,无需设置,主实例版本最低是 MySQL 5.6、PostgreSql 10 > - 只读实例的磁盘容量不能小于主实例的磁盘容量 > - 只读实例的 vpcId 需跟主实例一致 > - 一个云数据库 RDS 实例,最多只能有 5 个只读实例 diff --git a/services/rds/client_test.go b/services/rds/client_test.go index 11d635ec..66fb309f 100644 --- a/services/rds/client_test.go +++ b/services/rds/client_test.go @@ -215,7 +215,14 @@ func TestClient_UpdateAccountPrivileges(t *testing.T) { ExpectEqual(t.Errorf, nil, err) } func TestClient_CreateReadReplica(t *testing.T) { - args := &CreateReadReplicaArgs{ + subnets := SubnetMap{ + ZoneName: "cn-bj-d", + SubnetId: "sbn-dqafncqsy3y4", + } + var sub = []SubnetMap{ + subnets, + } + args := &CreateRDSReadReplicaArgs{ SourceInstanceId: RDS_ID, CpuCount: 1, MemoryCapacity: 2, @@ -224,6 +231,7 @@ func TestClient_CreateReadReplica(t *testing.T) { PaymentTiming: "Postpaid", }, ClientToken: getClientToken(), + Subnets: sub, } time.Sleep(30 * time.Second) isAvailable(RDS_ID) diff --git a/services/rds/model.go b/services/rds/model.go index 92d641db..93318083 100644 --- a/services/rds/model.go +++ b/services/rds/model.go @@ -110,6 +110,27 @@ type CreateReadReplicaArgs struct { ResourceGroupId string `json:"resourceGroupId,omitempty"` } +type CreateRDSReadReplicaArgs struct { + ClientToken string `json:"-"` + Billing Billing `json:"billing"` + PurchaseCount int `json:"purchaseCount,omitempty"` + SourceInstanceId string `json:"sourceInstanceId"` + InstanceName string `json:"instanceName,omitempty"` + CpuCount int `json:"cpuCount"` + MemoryCapacity float64 `json:"memoryCapacity"` + VolumeCapacity int `json:"volumeCapacity"` + ZoneNames []string `json:"zoneNames,omitempty"` + VpcId string `json:"vpcId,omitempty"` + IsDirectPay bool `json:"isDirectPay,omitempty"` + Subnets []SubnetMap `json:"subnets,omitempty"` + Tags []model.TagModel `json:"tags,omitempty"` + DiskIoType string `json:"diskIoType,omitempty"` + Ovip string `json:"ovip,omitempty"` + EntryPort string `json:"entryPort,omitempty"` + ResourceGroupId string `json:"resourceGroupId,omitempty"` + IsInheritMasterAuthip bool `json:"isInheritMasterAuthip,omitempty"` +} + type CreateRdsProxyArgs struct { ClientToken string `json:"-"` Billing Billing `json:"billing"` diff --git a/services/rds/rds.go b/services/rds/rds.go index ebb40c96..3e715c80 100644 --- a/services/rds/rds.go +++ b/services/rds/rds.go @@ -74,7 +74,7 @@ func (c *Client) CreateRds(args *CreateRdsArgs) (*CreateResult, error) { // RETURNS: // - *InstanceIds: the result of create a readReplica RDS, contains the readReplica RDS's instanceIds // - error: nil if success otherwise the specific error -func (c *Client) CreateReadReplica(args *CreateReadReplicaArgs) (*CreateResult, error) { +func (c *Client) CreateReadReplica(args *CreateRDSReadReplicaArgs) (*CreateResult, error) { if args == nil { return nil, fmt.Errorf("unset args") }