rds

package
v0.9.113 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 7 Imported by: 8

Documentation

Overview

Package rds defines the RDS services of BCE. The supported APIs are all defined in sub-package

rds.go - the rds APIs definition supported by the RDS service

util.go - define the utilities for api package of RDS service

Index

Constants

View Source
const (
	URI_PREFIX       = bce.URI_PREFIX + "v1"
	DEFAULT_ENDPOINT = "rds.bj.baidubce.com"
	REQUEST_RDS_URL  = "/instance"
)

Variables

This section is empty.

Functions

func Aes128EncryptUseSecreteKey

func Aes128EncryptUseSecreteKey(sk string, data string) (string, error)

Types

type Account

type Account struct {
	AccountName        string              `json:"accountName"`
	Remark             string              `json:"remark"`
	Status             string              `json:"status"`
	Type               string              `json:"type"`
	AccountType        string              `json:"accountType"`
	DatabasePrivileges []DatabasePrivilege `json:"databasePrivileges"`
	Desc               string              `json:"desc"`
}

type AutoRenewArgs added in v0.9.43

type AutoRenewArgs struct {
	InstanceIds       []string `json:"instanceIds"`
	AutoRenewTimeUnit string   `json:"autoRenewTimeUnit"`
	AutoRenewTime     int      `json:"autoRenewTime"`
}

type BackupPolicy

type BackupPolicy struct {
	BackupDays    string `json:"backupDays"`
	BackupTime    string `json:"backupTime"`
	Persistent    bool   `json:"persistent"`
	ExpireInDays  int    `json:"expireInDays"`
	FreeSpaceInGB int    `json:"freeSpaceInGb"`
}

type Billing

type Billing struct {
	PaymentTiming string      `json:"paymentTiming"`
	Reservation   Reservation `json:"reservation,omitempty"`
}

type Client

type Client struct {
	*bce.BceClient
}

Client of RDS service is a kind of BceClient, so derived from BceClient

func NewClient

func NewClient(ak, sk, endPoint string) (*Client, error)

func (*Client) AutoRenew added in v0.9.43

func (c *Client) AutoRenew(args *AutoRenewArgs) error

autoRenew - create autoRenew

PARAMS:

  • Args: *autoRenewArgs

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) CreateAccount

func (c *Client) CreateAccount(instanceId string, args *CreateAccountArgs) error

CreateAccount - create a account with the specific parameters

PARAMS:

  • instanceId: the specific instanceId
  • args: the arguments to create a account

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) CreateRds

func (c *Client) CreateRds(args *CreateRdsArgs) (*CreateResult, error)

CreateRds - create a RDS with the specific parameters

PARAMS:

  • args: the arguments to create a rds

RETURNS:

  • *InstanceIds: the result of create RDS, contains new RDS's instanceIds
  • error: nil if success otherwise the specific error

func (*Client) CreateRdsProxy

func (c *Client) CreateRdsProxy(args *CreateRdsProxyArgs) (*CreateResult, error)

CreateRdsProxy - create a proxy RDS with the specific parameters

PARAMS:

  • args: the arguments to create a readReplica rds

RETURNS:

  • *InstanceIds: the result of create a readReplica RDS, contains the readReplica RDS's instanceIds
  • error: nil if success otherwise the specific error

func (*Client) CreateReadReplica

func (c *Client) CreateReadReplica(args *CreateReadReplicaArgs) (*CreateResult, error)

CreateReadReplica - create a readReplica RDS with the specific parameters

PARAMS:

  • args: the arguments to create a readReplica rds

RETURNS:

  • *InstanceIds: the result of create a readReplica RDS, contains the readReplica RDS's instanceIds
  • error: nil if success otherwise the specific error

func (*Client) DeleteAccount

func (c *Client) DeleteAccount(instanceId, accountName string) error

DeleteAccount - delete an account of a RDS instance

PARAMS:

  • instanceIds: the specific instanceIds
  • accountName: the specific account's name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DeleteRds

func (c *Client) DeleteRds(instanceIds string) error

DeleteRds - delete a rds

PARAMS:

  • instanceIds: the specific instanceIds

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) GetAccount

func (c *Client) GetAccount(instanceId, accountName string) (*Account, error)

GetAccount - get an account of a RDS instance with the specific parameters

PARAMS:

  • instanceId: the specific rds Instance's ID
  • accountName: the specific account's name

RETURNS:

  • *Account: the account's meta
  • error: nil if success otherwise the specific error

func (*Client) GetBackupDetail added in v0.9.97

func (c *Client) GetBackupDetail(instanceId string, backupId string) (*Snapshot, error)

GetBackupDetail - get backup detail of the instance's backup

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: id of the instance
  • backupId: id of the backup

RETURNS:

  • *Snapshot: result of the backup detail
  • error: nil if success otherwise the specific error

func (*Client) GetBackupList added in v0.9.29

func (c *Client) GetBackupList(instanceId string, args *GetBackupListArgs) (*GetBackupListResult, error)

GetBackupList - get backup list of the instance

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: id of the instance

RETURNS:

  • *GetBackupListResult: result of the backup list
  • error: nil if success otherwise the specific error

func (*Client) GetDetail

func (c *Client) GetDetail(instanceId string) (*Instance, error)

GetDetail - get a specific rds Instance's detail

PARAMS:

  • instanceId: the specific rds Instance's ID

RETURNS:

  • *Instance: the specific rdsInstance's detail
  • error: nil if success otherwise the specific error

func (*Client) GetSecurityIps added in v0.9.37

func (c *Client) GetSecurityIps(instanceId string) (*GetSecurityIpsResult, error)

GetSecurityIps - get all SecurityIps

PARAMS:

  • instanceId: the specific rds Instance's ID

RETURNS:

  • *GetSecurityIpsResult: all security IP
  • error: nil if success otherwise the specific error

func (*Client) GetZoneList added in v0.9.29

func (c *Client) GetZoneList() (*GetZoneListResult, error)

GetZoneList - list all zone

PARAMS:

  • cli: the client agent which can perform sending request

RETURNS:

  • *GetZoneListResult: result of the zone list
  • error: nil if success otherwise the specific error

func (*Client) ListAccount

func (c *Client) ListAccount(instanceId string) (*ListAccountResult, error)

ListAccount - list all account of a RDS instance with the specific parameters

PARAMS:

  • instanceId: the specific rds Instance's ID

RETURNS:

  • *ListAccountResult: the result of list all account, contains all accounts' meta
  • error: nil if success otherwise the specific error

func (*Client) ListParameters added in v0.9.37

func (c *Client) ListParameters(instanceId string) (*ListParametersResult, error)

ListParameters - list all parameters of a RDS instance

PARAMS:

  • instanceId: the specific rds Instance's ID

RETURNS:

  • *ListParametersResult: the result of list all parameters
  • error: nil if success otherwise the specific error

func (*Client) ListRds

func (c *Client) ListRds(args *ListRdsArgs) (*ListRdsResult, error)

ListRds - list all RDS with the specific parameters

PARAMS:

  • args: the arguments to list all RDS

RETURNS:

  • *ListRdsResult: the result of list all RDS, contains all rds' meta
  • error: nil if success otherwise the specific error

func (*Client) ListSubnets added in v0.9.29

func (c *Client) ListSubnets(args *ListSubnetsArgs) (*ListSubnetsResult, error)

ListsSubnet - list all Subnets

PARAMS:

  • cli: the client agent which can perform sending request
  • args: the arguments to list all subnets, not necessary

RETURNS:

  • *ListSubnetsResult: result of the subnet list
  • error: nil if success otherwise the specific error

func (*Client) ModifyBackupPolicy added in v0.9.97

func (c *Client) ModifyBackupPolicy(instanceId string, args *ModifyBackupPolicyArgs) error

ModifyBackupPolicy - modify backup policy

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: id of the instance
  • args: the arguments to modify public access

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) ModifyEndpoint added in v0.9.29

func (c *Client) ModifyEndpoint(instanceId string, args *ModifyEndpointArgs) error

ModifyEndpoint - modify the prefix of endpoint

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: id of the instance
  • args: the arguments to modify endpoint

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) ModifyPublicAccess added in v0.9.29

func (c *Client) ModifyPublicAccess(instanceId string, args *ModifyPublicAccessArgs) error

ModifyPublicAccess - modify public access

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: id of the instance
  • args: the arguments to modify public access

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) ModifySyncMode added in v0.9.29

func (c *Client) ModifySyncMode(instanceId string, args *ModifySyncModeArgs) error

UpdateSyncMode - update sync mode of a specified instance

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: id of the instance
  • args: the arguments to update syncMode

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) RebootInstance added in v0.9.29

func (c *Client) RebootInstance(instanceId string) error

RebootInstance - reboot a specified instance

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: id of the instance to be rebooted

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) Request added in v0.9.107

func (c *Client) Request(method, uri string, body interface{}) (interface{}, error)

func (*Client) ResizeRds

func (c *Client) ResizeRds(instanceId string, args *ResizeRdsArgs) error

ResizeRds - resize an RDS with the specific parameters

PARAMS:

  • instanceId: the specific instanceId
  • args: the arguments to resize an RDS

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) UpdateInstanceName added in v0.9.29

func (c *Client) UpdateInstanceName(instanceId string, args *UpdateInstanceNameArgs) error

UpdateInstanceName - update name of a specified instance

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: id of the instance
  • args: the arguments to update instanceName

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) UpdateParameter added in v0.9.37

func (c *Client) UpdateParameter(instanceId, Etag string, args *UpdateParameterArgs) error

UpdateParameter - update Parameter

PARAMS:

  • instanceId: the specific rds Instance's ID
  • Etag: get latest etag by ListParameters
  • Args: *UpdateParameterArgs

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) UpdateSecurityIps added in v0.9.37

func (c *Client) UpdateSecurityIps(instanceId, Etag string, args *UpdateSecurityIpsArgs) error

UpdateSecurityIps - update SecurityIps

PARAMS:

  • instanceId: the specific rds Instance's ID
  • Etag: get latest etag by GetSecurityIps
  • Args: all SecurityIps

RETURNS:

  • error: nil if success otherwise the specific error

type CreateAccountArgs

type CreateAccountArgs struct {
	ClientToken        string              `json:"-"`
	AccountName        string              `json:"accountName"`
	Password           string              `json:"password"`
	AccountType        string              `json:"accountType,omitempty"`
	DatabasePrivileges []DatabasePrivilege `json:"databasePrivileges,omitempty"`
	Desc               string              `json:"desc,omitempty"`
	Type               string              `json:"type,omitempty"`
}

type CreateRdsArgs

type CreateRdsArgs struct {
	ClientToken       string           `json:"-"`
	Billing           Billing          `json:"billing"`
	PurchaseCount     int              `json:"purchaseCount,omitempty"`
	InstanceName      string           `json:"instanceName,omitempty"`
	Engine            string           `json:"engine"`
	EngineVersion     string           `json:"engineVersion"`
	Category          string           `json:"category,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"`
	AutoRenewTimeUnit string           `json:"autoRenewTimeUnit,omitempty"`
	AutoRenewTime     int              `json:"autoRenewTime,omitempty"`
	BgwGroupId        string           `json:"bgwGroupId,omitempty"`
}

type CreateRdsProxyArgs

type CreateRdsProxyArgs struct {
	ClientToken      string           `json:"-"`
	Billing          Billing          `json:"billing"`
	SourceInstanceId string           `json:"sourceInstanceId"`
	InstanceName     string           `json:"instanceName,omitempty"`
	NodeAmount       int              `json:"nodeAmount"`
	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"`
}

type CreateReadReplicaArgs

type CreateReadReplicaArgs 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"`
}

type CreateResult

type CreateResult struct {
	InstanceIds []string `json:"instanceIds"`
}

type DatabasePrivilege

type DatabasePrivilege struct {
	DbName   string `json:"dbName"`
	AuthType string `json:"authType"`
}

type Endpoint

type Endpoint struct {
	Address string `json:"address"`
	Port    int    `json:"port"`
	VnetIp  string `json:"vnetIp"`
	InetIp  string `json:"inetIp"`
}

type GetBackupListArgs added in v0.9.29

type GetBackupListArgs struct {
	Marker  string
	MaxKeys int
}

type GetBackupListResult added in v0.9.29

type GetBackupListResult struct {
	Marker      string     `json:"marker"`
	MaxKeys     int        `json:"maxKeys"`
	IsTruncated bool       `json:"isTruncated"`
	NextMarker  string     `json:"nextMarker"`
	Backups     []Snapshot `json:"backups"`
}

type GetSecurityIpsResult added in v0.9.37

type GetSecurityIpsResult struct {
	Etag        string   `json:"etag"`
	SecurityIps []string `json:"securityIps"`
}

type GetZoneListResult added in v0.9.29

type GetZoneListResult struct {
	Zones []ZoneName `json:"zones"`
}

type Instance

type Instance struct {
	InstanceId         string       `json:"instanceId"`
	InstanceName       string       `json:"instanceName"`
	Engine             string       `json:"engine"`
	EngineVersion      string       `json:"engineVersion"`
	Category           string       `json:"category"`
	InstanceStatus     string       `json:"instanceStatus"`
	CpuCount           int          `json:"cpuCount"`
	MemoryCapacity     float64      `json:"memoryCapacity"`
	VolumeCapacity     int          `json:"volumeCapacity"`
	NodeAmount         int          `json:"nodeAmount"`
	UsedStorage        float64      `json:"usedStorage"`
	PublicAccessStatus string       `json:"publicAccessStatus"`
	InstanceCreateTime string       `json:"instanceCreateTime"`
	InstanceExpireTime string       `json:"instanceExpireTime"`
	Endpoint           Endpoint     `json:"endpoint"`
	SyncMode           string       `json:"syncMode"`
	BackupPolicy       BackupPolicy `json:"backupPolicy"`
	Region             string       `json:"region"`
	InstanceType       string       `json:"instanceType"`
	SourceInstanceId   string       `json:"sourceInstanceId"`
	SourceRegion       string       `json:"sourceRegion"`
	ZoneNames          []string     `json:"zoneNames"`
	VpcId              string       `json:"vpcId"`
	Subnets            []Subnet     `json:"subnets"`
	Topology           Topology     `json:"topology"`
	Task               string       `json:"task"`
	PaymentTiming      string       `json:"paymentTiming"`
	BgwGroupId         string       `json:"bgwGroupId"`
}

type KVParameter added in v0.9.37

type KVParameter struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type ListAccountResult

type ListAccountResult struct {
	Accounts []Account `json:"accounts"`
}

type ListParametersResult added in v0.9.37

type ListParametersResult struct {
	Etag       string      `json:"etag"`
	Parameters []Parameter `json:"parameters"`
}

type ListRdsArgs

type ListRdsArgs struct {
	Marker  string
	MaxKeys int
}

type ListRdsResult

type ListRdsResult struct {
	Marker      string     `json:"marker"`
	MaxKeys     int        `json:"maxKeys"`
	IsTruncated bool       `json:"isTruncated"`
	NextMarker  string     `json:"nextMarker"`
	Instances   []Instance `json:"instances"`
}

type ListSubnetsArgs added in v0.9.29

type ListSubnetsArgs struct {
	VpcId    string `json:"vpcId"`
	ZoneName string `json:"zoneName"`
}

type ListSubnetsResult added in v0.9.29

type ListSubnetsResult struct {
	Subnets []Subnet `json:"subnets"`
}

type ModifyBackupPolicyArgs added in v0.9.97

type ModifyBackupPolicyArgs struct {
	BackupDays   string `json:"backupDays"`
	BackupTime   string `json:"backupTime"`
	Persistent   bool   `json:"persistent"`
	ExpireInDays int    `json:"expireInDays"`
}

type ModifyEndpointArgs added in v0.9.29

type ModifyEndpointArgs struct {
	Address string `json:"address"`
}

type ModifyPublicAccessArgs added in v0.9.29

type ModifyPublicAccessArgs struct {
	PublicAccess bool `json:"publicAccess"`
}

type ModifySyncModeArgs added in v0.9.29

type ModifySyncModeArgs struct {
	SyncMode string `json:"syncMode"`
}

type Parameter added in v0.9.37

type Parameter struct {
	Name          string `json:"name"`
	DefaultValue  string `json:"defaultValue"`
	Value         string `json:"value"`
	PendingValue  string `json:"pendingValue"`
	Type          string `json:"type"`
	Dynamic       string `json:"dynamic"`
	Modifiable    string `json:"modifiable"`
	AllowedValues string `json:"allowedValues"`
	Desc          string `json:"desc"`
}

type Reservation

type Reservation struct {
	ReservationLength   int    `json:"reservationLength,omitempty"`
	ReservationTimeUnit string `json:"reservationTimeUnit,omitempty"`
}

type ResizeRdsArgs

type ResizeRdsArgs struct {
	CpuCount       int     `json:"cpuCount"`
	MemoryCapacity float64 `json:"memoryCapacity"`
	VolumeCapacity int     `json:"volumeCapacity"`
	NodeAmount     int     `json:"nodeAmount,omitempty"`
	IsDirectPay    bool    `json:"isDirectPay,omitempty"`
}

type Snapshot added in v0.9.44

type Snapshot struct {
	SnapshotId          string `json:"backupId"`
	SnapshotSizeInBytes int64  `json:"backupSize"`
	SnapshotType        string `json:"backupType"`
	SnapshotStatus      string `json:"backupStatus"`
	SnapshotStartTime   string `json:"backupStartTime"`
	SnapshotEndTime     string `json:"backupEndTime"`
	DownloadUrl         string `json:"downloadUrl"`
	DownloadExpires     string `json:"downloadExpires"`
}

type Subnet

type Subnet struct {
	Name     string `json:"name"`
	SubnetId string `json:"subnetId"`
	ZoneName string `json:"zoneName"`
	Cidr     string `json:"cidr"`
	VpcId    string `json:"vpcId"`
}

type SubnetMap

type SubnetMap struct {
	ZoneName string `json:"zoneName"`
	SubnetId string `json:"subnetId"`
}

type Topology

type Topology struct {
	Rdsproxy    []string `json:"rdsproxy"`
	Master      []string `json:"master"`
	ReadReplica []string `json:"readReplica"`
}

type UpdateInstanceNameArgs added in v0.9.29

type UpdateInstanceNameArgs struct {
	InstanceName string `json:"instanceName"`
}

type UpdateParameterArgs added in v0.9.37

type UpdateParameterArgs struct {
	Parameters []KVParameter `json:"parameters"`
}

type UpdateSecurityIpsArgs added in v0.9.37

type UpdateSecurityIpsArgs struct {
	SecurityIps []string `json:"securityIps"`
}

type ZoneName added in v0.9.29

type ZoneName struct {
	ZoneNames []string `json:"zoneNames"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL