instances

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestOpts = golangsdk.RequestOpts{
	MoreHeaders: map[string]string{"Content-Type": "application/json", "X-Language": "en-us"},
}

Functions

func DisableAutoExpand

func DisableAutoExpand(c *golangsdk.ServiceClient, instanceId string) error

DisableAutoExpand is a method used to remove the volume automatic expansion configuration of RDS instance.

func EnableAutoExpand

func EnableAutoExpand(c *golangsdk.ServiceClient, opts EnableAutoExpandOpts) error

EnableAutoExpand is a method used to configure the volume automatic expansion of RDS instance.

func List

func List(client *golangsdk.ServiceClient, opts ListRdsBuilder) pagination.Pager

func ListErrorLog

func ListErrorLog(client *golangsdk.ServiceClient, opts DbErrorlogBuilder, instanceID string) pagination.Pager

func ListSlowLog

func ListSlowLog(client *golangsdk.ServiceClient, opts DbSlowLogBuilder, instanceID string) pagination.Pager

Types

type ActionInstanceBuilder

type ActionInstanceBuilder interface {
	ToActionInstanceMap() (map[string]interface{}, error)
}

type AutoExpansion

type AutoExpansion struct {
	// Whether the automatic expansion is enabled.
	SwitchOption bool `json:"switch_option"`
	// The upper limit of automatic expansion of storage, in GB.
	// This parameter is mandatory when switch_option is set to true.
	// The value ranges from 40 GB to 4,000 GB and must be no less than the current storage of the instance.
	LimitSize int `json:"limit_size"`
	// The threshold to trigger automatic expansion.
	// If the available storage drops to this threshold or 10 GB, the automatic expansion is triggered.
	// This parameter is mandatory when switch_option is set to true.
	// The valid values are as follows:
	// + 10
	// + 15
	// + 20
	TriggerThreshold int `json:"trigger_threshold"`
}

AutoExpansion is an object that represents the automatic expansion configuration.

func GetAutoExpand

func GetAutoExpand(c *golangsdk.ServiceClient, instanceId string) (*AutoExpansion, error)

GetAutoExpand is a method used to obtain the automatic expansion configuarion of instance storage.

type BackupStrategy

type BackupStrategy struct {
	StartTime string `json:"start_time" required:"true"`
	KeepDays  int    `json:"keep_days,omitempty"`
}

type ChargeInfo

type ChargeInfo struct {
	ChargeMode  string `json:"charge_mode" required:"true"`
	PeriodType  string `json:"period_type,omitempty"`
	PeriodNum   int    `json:"period_num,omitempty"`
	IsAutoRenew bool   `json:"is_auto_renew,omitempty"`
	IsAutoPay   bool   `json:"is_auto_pay,omitempty"`
}

type ChargeResponse

type ChargeResponse struct {
	ChargeMode string `json:"charge_mode"`
}

type ConfigParams

type ConfigParams struct {
	Name        string `json:"name"`
	Value       string `json:"value"`
	Restart     bool   `json:"restart_required"`
	ReadOnly    bool   `json:"readonly"`
	ValueRange  string `json:"value_range"`
	Type        string `json:"type"`
	Description string `json:"description"`
}

type CreateOpts

type CreateOpts struct {
	Name                string             `json:"name"  required:"true"`
	Datastore           *Datastore         `json:"datastore" required:"true"`
	Ha                  *Ha                `json:"ha,omitempty"`
	ConfigurationId     string             `json:"configuration_id,omitempty"`
	Port                string             `json:"port,omitempty"`
	Password            string             `json:"password" required:"true"`
	BackupStrategy      *BackupStrategy    `json:"backup_strategy,omitempty"`
	EnterpriseProjectId string             `json:"enterprise_project_id,omitempty"`
	DiskEncryptionId    string             `json:"disk_encryption_id,omitempty"`
	FlavorRef           string             `json:"flavor_ref" required:"true"`
	Volume              *Volume            `json:"volume" required:"true"`
	Region              string             `json:"region" required:"true"`
	AvailabilityZone    string             `json:"availability_zone" required:"true"`
	VpcId               string             `json:"vpc_id" required:"true"`
	SubnetId            string             `json:"subnet_id" required:"true"`
	SecurityGroupId     string             `json:"security_group_id" required:"true"`
	ChargeInfo          *ChargeInfo        `json:"charge_info,omitempty"`
	TimeZone            string             `json:"time_zone,omitempty"`
	FixedIp             string             `json:"data_vip,omitempty"`
	Collation           string             `json:"collation,omitempty"`
	UnchangeableParam   *UnchangeableParam `json:"unchangeable_param,omitempty"`
}

func (CreateOpts) ToInstancesCreateMap

func (opts CreateOpts) ToInstancesCreateMap() (map[string]interface{}, error)

type CreateRdsBuilder

type CreateRdsBuilder interface {
	ToInstancesCreateMap() (map[string]interface{}, error)
}

type CreateReplicaOpts

type CreateReplicaOpts struct {
	Name                string      `json:"name"  required:"true"`
	ReplicaOfId         string      `json:"replica_of_id" required:"true"`
	EnterpriseProjectId string      `json:"enterprise_project_id,omitempty"`
	DiskEncryptionId    string      `json:"disk_encryption_id,omitempty"`
	FlavorRef           string      `json:"flavor_ref" required:"true"`
	Volume              *Volume     `json:"volume" required:"true"`
	Region              string      `json:"region,omitempty"`
	AvailabilityZone    string      `json:"availability_zone" required:"true"`
	ChargeInfo          *ChargeInfo `json:"charge_info,omitempty"`
}

func (CreateReplicaOpts) ToInstancesCreateMap

func (opts CreateReplicaOpts) ToInstancesCreateMap() (map[string]interface{}, error)

type CreateResponse

type CreateResponse struct {
	Instance Instance `json:"instance"`
	JobId    string   `json:"job_id"`
	OrderId  string   `json:"order_id"`
}

type CreateResult

type CreateResult struct {
	// contains filtered or unexported fields
}

func Create

func Create(client *golangsdk.ServiceClient, opts CreateRdsBuilder) (r CreateResult)

func CreateReplica

func CreateReplica(client *golangsdk.ServiceClient, opts CreateRdsBuilder) (r CreateResult)

func (CreateResult) Extract

func (r CreateResult) Extract() (*CreateResponse, error)

type Datastore

type Datastore struct {
	Type    string `json:"type" required:"true"`
	Version string `json:"version" required:"true"`
}

type DbErrorlogBuilder

type DbErrorlogBuilder interface {
	DbErrorlogQuery() (string, error)
}

type DbErrorlogOpts

type DbErrorlogOpts struct {
	StartDate string `q:"start_date"`
	EndDate   string `q:"end_date"`
	Offset    string `q:"offset"`
	Limit     string `q:"limit"`
	Level     string `q:"level"`
}

func (DbErrorlogOpts) DbErrorlogQuery

func (opts DbErrorlogOpts) DbErrorlogQuery() (string, error)

type DbSlowLogBuilder

type DbSlowLogBuilder interface {
	ToDbSlowLogListQuery() (string, error)
}

type DbSlowLogOpts

type DbSlowLogOpts struct {
	StartDate string `q:"start_date"`
	EndDate   string `q:"end_date"`
	Offset    string `q:"offset"`
	Limit     string `q:"limit"`
	Level     string `q:"level"`
}

func (DbSlowLogOpts) ToDbSlowLogListQuery

func (opts DbSlowLogOpts) ToDbSlowLogListQuery() (string, error)

type DeleteInstanceBuilder

type DeleteInstanceBuilder interface {
	ToInstancesDeleteMap() (map[string]interface{}, error)
}

type DeleteOpts

type DeleteOpts struct {
	InstanceId string `json:"instance_id" required:"true"`
}

func (DeleteOpts) ToInstancesDeleteMap

func (opts DeleteOpts) ToInstancesDeleteMap() (map[string]interface{}, error)

type DeleteResponse

type DeleteResponse struct {
	JobId string `json:"job_id"`
}

type DeleteResult

type DeleteResult struct {
	// contains filtered or unexported fields
}

func Delete

func Delete(client *golangsdk.ServiceClient, instanceId string) (r DeleteResult)

func (DeleteResult) Extract

func (r DeleteResult) Extract() (*DeleteResponse, error)

type EnableAutoExpandOpts

type EnableAutoExpandOpts struct {
	// The instnace ID.
	InstanceId string `json:"-" required:"true"`
	// The upper limit of automatic expansion of storage, in GB.
	// This parameter is mandatory when switch_option is set to true.
	// The value ranges from 40 GB to 4,000 GB and must be no less than the current storage of the instance.
	LimitSize int `json:"limit_size" required:"true"`
	// The threshold to trigger automatic expansion.
	// If the available storage drops to this threshold or 10 GB, the automatic expansion is triggered.
	// This parameter is mandatory when switch_option is set to true.
	// The valid values are as follows:
	// + 10
	// + 15
	// + 20
	TriggerThreshold int `json:"trigger_threshold" required:"true"`
}

EnableAutoExpandOpts is the structure used to enable the volume automatic expansion of RDS instance.

type Engine

type Engine struct {
	Versions []VersionInfo `json:"dataStores"`
}

func ListEngine

func ListEngine(client *golangsdk.ServiceClient, dbName string) (*Engine, error)

type EnlargeVolumeOpts

type EnlargeVolumeOpts struct {
	EnlargeVolume *EnlargeVolumeSize `json:"enlarge_volume" required:"true"`
}

func (EnlargeVolumeOpts) ToActionInstanceMap

func (opts EnlargeVolumeOpts) ToActionInstanceMap() (map[string]interface{}, error)

type EnlargeVolumeResp

type EnlargeVolumeResp struct {
	JobId string `json:"job_id"`
}

type EnlargeVolumeResult

type EnlargeVolumeResult struct {
	// contains filtered or unexported fields
}

func EnlargeVolume

func EnlargeVolume(client *golangsdk.ServiceClient, opts ActionInstanceBuilder, instanceId string) (r EnlargeVolumeResult)

func (EnlargeVolumeResult) Extract

type EnlargeVolumeSize

type EnlargeVolumeSize struct {
	Size int `json:"size" required:"true"`
}

type ErrorLogPage

type ErrorLogPage struct {
	pagination.SinglePageBase
}

func (ErrorLogPage) IsEmpty

func (r ErrorLogPage) IsEmpty() (bool, error)

IsEmpty returns true if a ListResult contains no services.

type ErrorLogResp

type ErrorLogResp struct {
	ErrorLogList []Errorlog `json:"error_log_list"`
	TotalRecord  int        `json:"total_record"`
}

func ExtractErrorLog

func ExtractErrorLog(r pagination.Page) (ErrorLogResp, error)

type ErrorLogResult

type ErrorLogResult struct {
	golangsdk.Result
}

type ErrorResponse

type ErrorResponse struct {
	ErrorCode string `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
}

func RestRootPassword

func RestRootPassword(c *golangsdk.ServiceClient, instanceID string, opts RestRootPasswordOpts) (*ErrorResponse, error)

type Errorlog

type Errorlog struct {
	Time    string `json:"time"`
	Level   string `json:"level"`
	Content string `json:"content"`
}

type GetConfigurationResp

type GetConfigurationResp struct {
	DatastoreVersion string         `json:"datastore_version_name"`
	DatastoreName    string         `json:"datastore_name"`
	Parameters       []ConfigParams `json:"configuration_parameters"`
}

type GetConfigurationResult

type GetConfigurationResult struct {
	// contains filtered or unexported fields
}

func GetConfigurations

func GetConfigurations(c *golangsdk.ServiceClient, instanceID string) (r GetConfigurationResult)

func (GetConfigurationResult) Extract

type Ha

type Ha struct {
	Mode            string `json:"mode" required:"true"`
	ReplicationMode string `json:"replication_mode,omitempty"`
}

type Instance

type Instance struct {
	Id                  string         `json:"id"`
	Name                string         `json:"name"`
	Status              string         `json:"status"`
	Datastore           Datastore      `json:"datastore"`
	Ha                  Ha             `json:"ha"`
	ConfigurationId     string         `json:"configuration_id"`
	Port                string         `json:"port"`
	BackupStrategy      BackupStrategy `json:"backup_strategy"`
	EnterpriseProjectId string         `json:"enterprise_project_id"`
	DiskEncryptionId    string         `json:"disk_encryption_id"`
	FlavorRef           string         `json:"flavor_ref"`
	Volume              Volume         `json:"volume"`
	Region              string         `json:"region"`
	AvailabilityZone    string         `json:"availability_zone"`
	VpcId               string         `json:"vpc_id"`
	SubnetId            string         `json:"subnet_id"`
	SecurityGroupId     string         `json:"security_group_id"`
	ChargeInfo          ChargeResponse `json:"charge_info"`
}

type Job

type Job struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Status     string `json:"status"`
	Created    string `json:"created"`
	Ended      string `json:"ended"`
	Process    string `json:"process"`
	FailReason string `json:"fail_reason"`
}

type ListJob

type ListJob struct {
	Job Job `json:"job"`
}

type ListOpts

type ListOpts struct {
	Id            string `q:"id"`
	Name          string `q:"name"`
	Type          string `q:"type"`
	DataStoreType string `q:"datastore_type"`
	VpcId         string `q:"vpc_id"`
	SubnetId      string `q:"subnet_id"`
	Offset        int    `q:"offset"`
	Limit         int    `q:"limit"`
}

func (ListOpts) ToRdsListDetailQuery

func (opts ListOpts) ToRdsListDetailQuery() (string, error)

type ListRdsBuilder

type ListRdsBuilder interface {
	ToRdsListDetailQuery() (string, error)
}

type ListRdsResponse

type ListRdsResponse struct {
	Instances  []RdsInstanceResponse `json:"instances"`
	TotalCount int                   `json:"total_count"`
}

func ExtractRdsInstances

func ExtractRdsInstances(r pagination.Page) (ListRdsResponse, error)

ExtractRdsInstances is a function that takes a ListResult and returns the instances' information.

type ListRdsResult

type ListRdsResult struct {
	// contains filtered or unexported fields
}

type ModifyConfigurationOpts

type ModifyConfigurationOpts struct {
	Values map[string]string `json:"values" required:"true"`
}

type ModifyConfigurationResp

type ModifyConfigurationResp struct {
	JobId   string `json:"job_id"`
	Restart bool   `json:"restart_required"`
}

type ModifyConfigurationResult

type ModifyConfigurationResult struct {
	// contains filtered or unexported fields
}

func ModifyConfiguration

func ModifyConfiguration(c *golangsdk.ServiceClient, instanceID string, opts ModifyConfigurationOpts) (r ModifyConfigurationResult)

func (ModifyConfigurationResult) Extract

type Nodes

type Nodes struct {
	Id               string `json:"id"`
	Name             string `json:"name"`
	Role             string `json:"role"`
	Status           string `json:"status"`
	AvailabilityZone string `json:"availability_zone"`
}

type RDSJobBuilder

type RDSJobBuilder interface {
	ToRDSJobQuery() (string, error)
}

type RDSJobOpts

type RDSJobOpts struct {
	JobID string `q:"id"`
}

func (RDSJobOpts) ToRDSJobQuery

func (opts RDSJobOpts) ToRDSJobQuery() (string, error)

type RDSJobResult

type RDSJobResult struct {
	// contains filtered or unexported fields
}

func GetRDSJob

func GetRDSJob(client *golangsdk.ServiceClient, opts RDSJobBuilder) (r RDSJobResult)

func (RDSJobResult) Extract

func (r RDSJobResult) Extract() (ListJob, error)

type RdsInstanceResponse

type RdsInstanceResponse struct {
	Id                  string             `json:"id"`
	Name                string             `json:"name"`
	Status              string             `json:"status"`
	PrivateIps          []string           `json:"private_ips"`
	PublicIps           []string           `json:"public_ips"`
	Port                int                `json:"port"`
	Type                string             `json:"type"`
	Ha                  Ha                 `json:"ha"`
	Region              string             `json:"region"`
	DataStore           Datastore          `json:"datastore"`
	Created             string             `json:"created"`
	Updated             string             `json:"updated"`
	DbUserName          string             `json:"db_user_name"`
	VpcId               string             `json:"vpc_id"`
	SubnetId            string             `json:"subnet_id"`
	SecurityGroupId     string             `json:"security_group_id"`
	FlavorRef           string             `json:"flavor_ref"`
	Volume              Volume             `json:"volume"`
	SwitchStrategy      string             `json:"switch_strategy"`
	BackupStrategy      BackupStrategy     `json:"backup_strategy"`
	ChargeInfo          ChargeResponse     `json:"charge_info"`
	MaintenanceWindow   string             `json:"maintenance_window"`
	Nodes               []Nodes            `json:"nodes"`
	RelatedInstance     []RelatedInstance  `json:"related_instance"`
	DiskEncryptionId    string             `json:"disk_encryption_id"`
	EnterpriseProjectId string             `json:"enterprise_project_id"`
	TimeZone            string             `json:"time_zone"`
	Tags                []tags.ResourceTag `json:"tags"`
}

type RdsPage

type RdsPage struct {
	pagination.SinglePageBase
}

func (RdsPage) IsEmpty

func (r RdsPage) IsEmpty() (bool, error)

type RebootResp

type RebootResp struct {
	JobId string `json:"job_id"`
}

type RebootResult

type RebootResult struct {
	// contains filtered or unexported fields
}

func RebootInstance

func RebootInstance(c *golangsdk.ServiceClient, instanceID string) (r RebootResult)

func (RebootResult) Extract

func (r RebootResult) Extract() (*RebootResp, error)

type RelatedInstance

type RelatedInstance struct {
	Id   string `json:"id"`
	Type string `json:"type"`
}

type RenameInstanceOpts

type RenameInstanceOpts struct {
	Name string `json:"name" required:"true"`
}

func (RenameInstanceOpts) ToActionInstanceMap

func (opts RenameInstanceOpts) ToActionInstanceMap() (map[string]interface{}, error)

type RenameResult

type RenameResult struct {
	// contains filtered or unexported fields
}

func Rename

func Rename(client *golangsdk.ServiceClient, opts ActionInstanceBuilder, instanceId string) (r RenameResult)

type ResizeFlavor

type ResizeFlavor struct {
	JobId   string `json:"job_id"`
	OrderId string `json:"order_id"`
}

type ResizeFlavorOpts

type ResizeFlavorOpts struct {
	ResizeFlavor *SpecCode `json:"resize_flavor" required:"true"`
}

func (ResizeFlavorOpts) ToActionInstanceMap

func (opts ResizeFlavorOpts) ToActionInstanceMap() (map[string]interface{}, error)

type ResizeFlavorResult

type ResizeFlavorResult struct {
	// contains filtered or unexported fields
}

func Resize

func Resize(client *golangsdk.ServiceClient, opts ActionInstanceBuilder, instanceId string) (r ResizeFlavorResult)

func (ResizeFlavorResult) Extract

func (r ResizeFlavorResult) Extract() (*ResizeFlavor, error)

type RestRootPasswordOpts

type RestRootPasswordOpts struct {
	DbUserPwd string `json:"db_user_pwd" required:"true"`
}

type RestartInstanceOpts

type RestartInstanceOpts struct {
	Restart string `json:"restart" required:"true"`
}

func (RestartInstanceOpts) ToActionInstanceMap

func (opts RestartInstanceOpts) ToActionInstanceMap() (map[string]interface{}, error)

type RestartResponse

type RestartResponse struct {
	JobId string `json:"job_id"`
}

type RestartResult

type RestartResult struct {
	// contains filtered or unexported fields
}

func Restart

func Restart(client *golangsdk.ServiceClient, opts ActionInstanceBuilder, instanceId string) (r RestartResult)

func (RestartResult) Extract

func (r RestartResult) Extract() (*RestartResponse, error)

type SingleToHaRds

type SingleToHaRds struct {
	AzCodeNewNode string `json:"az_code_new_node" required:"true"`
	Password      string `json:"password,omitempty"`
}

type SingleToHaRdsOpts

type SingleToHaRdsOpts struct {
	SingleToHa *SingleToHaRds `json:"single_to_ha" required:"true"`
}

func (SingleToHaRdsOpts) ToActionInstanceMap

func (opts SingleToHaRdsOpts) ToActionInstanceMap() (map[string]interface{}, error)

type SingleToHaResponse

type SingleToHaResponse struct {
	JobId string `json:"job_id"`
}

type SingleToHaResult

type SingleToHaResult struct {
	// contains filtered or unexported fields
}

func SingleToHa

func SingleToHa(client *golangsdk.ServiceClient, opts ActionInstanceBuilder, instanceId string) (r SingleToHaResult)

func (SingleToHaResult) Extract

func (r SingleToHaResult) Extract() (*SingleToHaResponse, error)

type SlowLogPage

type SlowLogPage struct {
	pagination.SinglePageBase
}

func (SlowLogPage) IsEmpty

func (r SlowLogPage) IsEmpty() (bool, error)

IsEmpty returns true if a ListResult contains no services.

type SlowLogResp

type SlowLogResp struct {
	Slowloglist []Slowloglist `json:"slow_log_list"`
	TotalRecord int           `json:"total_record"`
}

func ExtractSlowLog

func ExtractSlowLog(r pagination.Page) (SlowLogResp, error)

ExtractCloudServers is a function that takes a ListResult and returns the services' information.

type Slowloglist

type Slowloglist struct {
	Count        string `json:"count"`
	Time         string `json:"time"`
	Locktime     string `json:"lock_time"`
	Rowssent     string `json:"rows_sent"`
	Rowsexamined string `json:"rows_examined"`
	Database     string `json:"database"`
	Users        string `json:"users"`
	QuerySample  string `json:"query_sample"`
	Type         string `json:"type"`
}

type SpecCode

type SpecCode struct {
	Speccode  string `json:"spec_code" required:"true"`
	IsAutoPay bool   `json:"is_auto_pay,omitempty"`
}

type UnchangeableParam

type UnchangeableParam struct {
	LowerCaseTableNames string `json:"lower_case_table_names"`
}

type VersionInfo

type VersionInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Volume

type Volume struct {
	Type string `json:"type" required:"true"`
	Size int    `json:"size" required:"true"`
}

Jump to

Keyboard shortcuts

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