Skip to content

Commit

Permalink
Update features in rds
Browse files Browse the repository at this point in the history
  • Loading branch information
duanliguo committed Dec 3, 2024
1 parent 570958b commit feab912
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bce/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions doc/RDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:支付方式为后付费时不需要设置,预付费时必须设置;必选
Expand Down Expand Up @@ -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 个只读实例
Expand Down
10 changes: 9 additions & 1 deletion services/rds/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -224,6 +231,7 @@ func TestClient_CreateReadReplica(t *testing.T) {
PaymentTiming: "Postpaid",
},
ClientToken: getClientToken(),
Subnets: sub,
}
time.Sleep(30 * time.Second)
isAvailable(RDS_ID)
Expand Down
21 changes: 21 additions & 0 deletions services/rds/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
2 changes: 1 addition & 1 deletion services/rds/rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit feab912

Please sign in to comment.