rds

package
v0.9.22 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

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 BackupPolicy

type BackupPolicy struct {
	BackupDays    string `json:"backupDays"`
	BackupTime    string `json:"backupTime"`
	Persistent    bool   `json:"persistent"`
	ExpireInDays  string `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) 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) 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) 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) 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) 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

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

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 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"`
	PaymentTiming      string       `json:"paymentTiming"`
}

type ListAccountResult

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

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

Jump to

Keyboard shortcuts

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