instance

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteInstance

func DeleteInstance(client *golangsdk.ServiceClient, instanceId string) (*string, error)

DeleteInstance return ID of DB instance deletion task

func DeleteReplica

func DeleteReplica(client *golangsdk.ServiceClient, instanceId string, nodeId string) (*string, error)

func ResetPassword

func ResetPassword(client *golangsdk.ServiceClient, opts ResetPwdOpts) (err error)

func UpdateName

func UpdateName(client *golangsdk.ServiceClient, opts UpdateNameOpts) (*string, error)

Types

type BackupStrategy

type BackupStrategy struct {
	// Automated backup start time. The automated backup will be triggered within one hour after the time specified by this parameter.
	// The value cannot be empty. It must be a valid value in the "hh:mm-HH:MM" format. The current time is in the UTC format.
	// The HH value must be 1 greater than the hh value.
	// The values of mm and MM must be the same and must be set to 00.
	// Example value: 21:00-22:00
	StartTime string `json:"start_time"`
	// Automated backup retention days. The value ranges from 1 to 732.
	KeepDays string `json:"keep_days,omitempty"`
}

type ChargeInfo

type ChargeInfo struct {
	// Billing mode. Value: postPaid
	ChargeMode string `json:"charge_mode"`
	// Order ID
	OrderId string `json:"order_id"`
}

type CreateInstanceOpts

type CreateInstanceOpts struct {
	// Billing mode
	ChargeInfo *ChargeInfo `json:"charge_info,omitempty"`
	// Region ID The value cannot be empty. To obtain this value, see Regions and Endpoints.
	Region string `json:"region" required:"true"`
	// Instance name Instances of the same type can have same names under the same tenant.
	// The name consists of 4 to 64 characters and starts with a letter.
	// It is case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_).
	Name string `json:"name" required:"true"`
	// Database information
	Datastore Datastore `json:"datastore" required:"true"`
	// Instance type, which is case-insensitive. Currently, its value can only be Cluster.
	Mode string `json:"mode" required:"true"`
	// Specification code. For details, see Querying Database Specifications.
	FlavorRef string `json:"flavor_ref" required:"true"`
	// VPC ID. To obtain this value, use either of the following methods:
	// Method 1: Log in to the VPC console and view the VPC ID on the VPC details page.
	// Method 2: See section "Querying VPCs" in the Virtual Private Cloud API Reference.
	VpcId string `json:"vpc_id" required:"true"`
	// Network ID of the subnet. To obtain this value, use either of the following methods:
	// Method 1: Log in to the VPC console and click the target subnet on the Subnets page to view the network ID on the displayed page.
	// Method 2: See section "Querying Subnets" in the Virtual Private Cloud API Reference.
	SubnetId string `json:"subnet_id" required:"true"`
	// Security group ID If the network ACL is enabled for the subnet used by the created instance, this parameter is optional.
	// If the network ACL is not enabled, this parameter is mandatory.
	// Method 1: Log in to VPC console. Choose Access Control > Security Groups in the navigation pane on the left.
	// On the displayed page, click the target security group. You can view the security group ID on the displayed page.
	// Method 2: See section "Querying Security Groups" in the Virtual Private Cloud API Reference.
	SecurityGroupId string `json:"security_group_id,omitempty"`
	// Parameter template ID
	ConfigurationId string `json:"configuration_id,omitempty"`
	// Database password. Value range: The password consists of 8 to 32 characters and contains at least three types of the following:
	// uppercase letters, lowercase letters, digits, and special characters (~!@#%^*-_=+?).
	// Enter a strong password to improve security, preventing security risks such as brute force cracking.
	// If you enter a weak password, the system automatically determines that the password is invalid.
	Password string `json:"password" required:"true"`
	// Automated backup policy
	BackupStrategy *BackupStrategy `json:"backup_strategy,omitempty"`
	// UTC time zone. l If this parameter is not specified, UTC is used by default.
	// If this parameter is specified, the value ranges from UTC-12:00 to UTC+12:00 at the full hour.
	// For example, the parameter can be UTC+08:00 rather than UTC+08:30.
	TimeZone string `json:"time_zone,omitempty"`
	// AZ type. The value can be Single or multi.
	AvailabilityZoneMode string `json:"availability_zone_mode"`
	// Primary AZ
	MasterAvailabilityZone string `json:"master_availability_zone,omitempty"`
	// Number of created read replicas. The value ranges from 1 to 9. An instance contains up to 15 read replicas.
	SlaveCount *int `json:"slave_count"`
	// Volume information.
	// Missing in documentation
	Volume *MysqlVolume `json:"volume,omitempty"`
	// Tag list. Instances are created based on tag keys and values.
	// {key} indicates the tag key. It must be unique and cannot be empty.
	// {value} indicates the tag value, which can be empty. To create instances with multiple tag keys and values,
	// separate key-value pairs with commas (,). Up to 10 key-value pairs can be added.
	Tags []MysqlTags `json:"tags,omitempty"`
	// Dedicated resource pool ID. This parameter can be displayed only after the dedicated resource pool is enabled.
	DedicatedResourceId string `json:"dedicated_resource_id,omitempty"`
}

type CreateInstanceResponse

type CreateInstanceResponse struct {
	// Instance information
	Instance InstResponse `json:"instance"`
	// Instance creation task ID This parameter is returned only for the creation of pay-per-use instances.
	JobId string `json:"job_id"`
}

type CreateNodeOpts

type CreateNodeOpts struct {
	// Instance ID, which is compliant with the UUID format.
	InstanceId string
	// Read replica failover priority ranging from 1 to 16.
	// The total number of primary node and read replicas is less than or equal to 16.
	Priorities []int `json:"priorities"`
}

type CreateNodeResponse

type CreateNodeResponse struct {
	// Instance ID
	InstanceId string `json:"instance_id"`
	// Node name list
	NodeNames []string `json:"node_names"`
	// Instance creation task ID
	// This parameter is returned only for the creation of pay-per-use instances.
	JobId string `json:"job_id"`
	// Order ID. This parameter is returned only for the creation of yearly/monthly instances.
	OrderId string `json:"order_id"`
}

func CreateReplica

func CreateReplica(client *golangsdk.ServiceClient, opts CreateNodeOpts) (*CreateNodeResponse, error)

type Datastore

type Datastore struct {
	// DB engine. Currently, only gaussdb-mysql is supported.
	Type string `json:"type" required:"true"`
	// DB engine version For details about supported database versions, see Querying Version Information About a DB Engine.
	Version string `json:"version" required:"true"`
}

type FlavorInfo

type FlavorInfo struct {
	// Number of vCPUs
	Vcpus string `json:"vcpus"`
	// Memory size in GB
	Ram string `json:"ram"`
}

type GetInstanceInfo

type GetInstanceInfo struct {
	// Instance ID
	Id string `json:"id"`
	// Project ID of a tenant in a region
	ProjectId string `json:"project_id"`
	// DB instance remarks
	Alias string `json:"alias"`
	// The number of nodes.
	NodeCount int `json:"node_count"`
	// Instance name
	Name string `json:"name"`
	// Instance status
	Status string `json:"status"`
	// Private IP address for write It is a blank string until an ECS is created.
	PrivateIps []string `json:"private_ips"`
	// Public IP address string
	PublicIps string `json:"public_ips"`
	// Database port
	Port string `json:"port"`
	// Instance type. The value is Cluster.
	Type string `json:"type"`
	// Region where the instance is deployed
	Region string `json:"region"`
	// Database information
	Datastore Datastore `json:"datastore"`
	// Used backup space in GB
	BackupUsedSpace float64 `json:"backup_used_space"`
	// Creation time in the "yyyy-mm-ddThh:mm:ssZ" format.
	// T is the separator between the calendar and the hourly notation of time.
	// Z indicates the time zone offset. For example, for French Winter Time (FWT), the time offset is shown as +0200.
	// The value is empty unless the instance creation is complete.
	Created string `json:"created"`
	// Update time. The format is the same as that of the created field.
	// The value is empty unless the instance creation is complete.
	Updated string `json:"updated"`
	// Private IP address for write
	PrivateWriteIps []string `json:"private_write_ips"`
	// Default username
	DbUserName string `json:"db_user_name"`
	// VPC ID
	VpcId string `json:"vpc_id"`
	// Network ID of the subnet
	SubnetId string `json:"subnet_id"`
	// Security group ID
	SecurityGroupId string `json:"security_group_id"`
	// ID of the parameter template used for creating an instance or ID of the latest parameter template that is applied to an instance.
	ConfigurationId string `json:"configuration_id"`
	// Specification code
	FlavorRef string `json:"flavor_ref"`
	// Specification description
	FlavorInfo FlavorInfo `json:"flavor_info"`
	// Node information
	Nodes *[]NodeInfo `json:"nodes"`
	// AZ type. It can be single or multi.
	AzMode string `json:"az_mode"`
	// Primary AZ
	MasterAzCode string `json:"master_az_code"`
	// Maintenance window in the UTC format
	MaintenanceWindow string `json:"maintenance_window"`
	// Storage disk information
	Volume VolumeInfo `json:"volume"`
	// Backup policy
	BackupStrategy BackupStrategy `json:"backup_strategy"`
	// Time zone
	TimeZone string `json:"time_zone"`
	// Billing mode, which is yearly/monthly or pay-per-use (default setting).
	ChargeInfo ChargeInfo `json:"charge_info"`
	// Dedicated resource pool ID. This parameter is returned only when the instance belongs to a dedicated resource pool.
	DedicatedResourceId string `json:"dedicated_resource_id"`
	// Tag list
	Tags []TagItem `json:"tags"`
	// Proxy information
	Proxies *[]Proxies `json:"proxies"`
}

func GetInstance

func GetInstance(client *golangsdk.ServiceClient, id string) (*GetInstanceInfo, error)

type InstResponse

type InstResponse struct {
	// Instance ID
	Id string `json:"id"`
	// Instance name. Instances of the same type can have same names under the same tenant.
	// The name consists of 4 to 64 characters and starts with a letter.
	// It is case-insensitive and contains only letters, digits, hyphens (-), and underscores (_).
	Name string `json:"name"`
	// Instance status Value: creating.
	Status string `json:"status"`
	// Database information
	Datastore Datastore `json:"datastore"`
	// Instance type. Currently, only the cluster type is supported.
	Mode string `json:"mode"`
	// Parameter template ID.
	ConfigurationId string `json:"configuration_id"`
	// Database port, which is the same as the request parameter.
	Port string `json:"port"`
	// Automated backup policy
	BackupStrategy BackupStrategy `json:"backup_strategy"`
	// Region ID, which is the same as the request parameter.
	Region string `json:"region"`
	// AZ mode, which is the same as the request parameter.
	AvailabilityZoneMode string `json:"availability_zone_mode"`
	// Primary AZ ID.
	MasterAvailabilityZone string `json:"master_availability_zone"`
	// VPC ID, which is the same as the request parameter.
	VpcId string `json:"vpc_id"`
	// Security group ID, which is the same as the request parameter.
	SecurityGroupId string `json:"security_group_id"`
	// Subnet ID, which is the same as the request parameter.
	SubnetId string `json:"subnet_id"`
	// Specification code, which is the same as the request parameter.
	FlavorRef string `json:"flavor_ref"`
	// Billing mode, which is yearly/monthly or pay-per-use (default setting).
	ChargeInfo ChargeInfo `json:"charge_info"`
}

type InstanceSpecResponse

type InstanceSpecResponse struct {
	// Job ID for changing instance specifications.
	// This parameter is returned only when you change the specifications of a pay-per-use instance.
	JobId string `json:"job_id"`
	// Order ID for changing instance specifications.
	// This parameter is returned only when you change the specification of a yearly/monthly instance.
	OrderId string `json:"order_id"`
}

func UpdateInstance

func UpdateInstance(client *golangsdk.ServiceClient, opts UpdateSpecOpts) (*InstanceSpecResponse, error)

type InstancesListInfo

type InstancesListInfo struct {
	// Instance ID
	Id string `json:"id"`
	// Project ID of a tenant in a region
	ProjectId string `json:"project_id"`
	// The number of nodes.
	NodeCount int `json:"node_count"`
	// Instance name
	Name string `json:"name"`
	// Instance status
	Status string `json:"status"`
	// Private IP address for write It is a blank string until an ECS is created.
	PrivateIps []string `json:"private_ips"`
	// Public IP address list
	PublicIps []string `json:"public_ips"`
	// Database port
	Port string `json:"port"`
	// Instance type. The value is Cluster.
	Type string `json:"type"`
	// Region where the instance is deployed
	Region string `json:"region"`
	// Database information
	Datastore Datastore `json:"datastore"`
	// Used backup space in GB
	BackupUsedSpace float64 `json:"backup_used_space"`
	// Creation time in the "yyyy-mm-ddThh:mm:ssZ" format.
	// T is the separator between the calendar and the hourly notation of time.
	// Z indicates the time zone offset. For example, for French Winter Time (FWT), the time offset is shown as +0200.
	// The value is empty unless the instance creation is complete.
	Created string `json:"created"`
	// Update time. The format is the same as that of the created field.
	// The value is empty unless the instance creation is complete.
	Updated string `json:"updated"`
	// Private IP address for write
	PrivateWriteIps []string `json:"private_write_ips"`
	// Default username
	DbUserName string `json:"db_user_name"`
	// VPC ID
	VpcId string `json:"vpc_id"`
	// Network ID of the subnet
	SubnetId string `json:"subnet_id"`
	// Security group ID
	SecurityGroupId string `json:"security_group_id"`
	// ID of the parameter template used for creating an instance or ID of the latest parameter template that is applied to an instance.
	ConfigurationId string `json:"configuration_id"`
	// Specification code
	FlavorRef string `json:"flavor_ref"`
	// Specification description
	FlavorInfo FlavorInfo `json:"flavor_info"`
	// AZ type. It can be single or multi.
	AzMode string `json:"az_mode"`
	// Primary AZ
	MasterAzCode string `json:"master_az_code"`
	// Maintenance window in the UTC format
	MaintenanceWindow string `json:"maintenance_window"`
	// Storage disk information
	Volume VolumeInfo `json:"volume"`
	// Backup policy
	BackupStrategy BackupStrategy `json:"backup_strategy"`
	// Time zone
	TimeZone string `json:"time_zone"`
	// Billing mode, which is yearly/monthly or pay-per-use (default setting).
	ChargeInfo ChargeInfo `json:"charge_info"`
	// Dedicated resource pool ID. This parameter is returned only when the instance belongs to a dedicated resource pool.
	DedicatedResourceId string `json:"dedicated_resource_id"`
	// Tag list
	Tags []TagItem `json:"tags"`
}

type ListInstancesOpts

type ListInstancesOpts struct {
	// Instance ID The asterisk (*) is reserved for the system. If the instance ID starts with *,
	// it indicates that fuzzy match is performed based on the value following *.
	// Otherwise, the exact match is performed based on the instance ID. The value cannot contain only asterisks (*).
	Id string `json:"id,omitempty"`
	// Instance name The asterisk (*) is reserved for the system. If the instance name starts with *,
	// it indicates that fuzzy match is performed based on the value following *.
	// Otherwise, the exact match is performed based on the instance name. The value cannot contain only asterisks (*).
	Name string `json:"name,omitempty"`
	// Instance type to be queried. Currently, its value can only be Cluster.
	Type string `json:"type,omitempty"`
	// DB type. Currently, only gaussdb-mysql is supported.
	DatastoreType string `json:"datastore_type,omitempty"`
	// VPC ID
	// Method 1: Log in to the VPC console and view the VPC ID on the VPC details page.
	// Method 2: See section "Querying VPCs" in the Virtual Private Cloud API Reference.
	VpcId string `json:"vpc_id,omitempty"`
	// Network ID of the subnet
	// Method 1: Log in to the VPC console and click the target subnet on the Subnets page to view the network ID on the displayed page.
	// Method 2: See section "Querying Subnets" under "APIs" or section "Querying Networks" under "OpenStack Neutron APIs" in the Virtual Private Cloud API Reference.
	SubnetId string `json:"subnet_id,omitempty"`
	// Private IP address
	PrivateIp string `json:"private_ip,omitempty"`
	// Index offset. If offset is set to N, the resource query starts from the N+1 piece of data.
	// The default value is 0, indicating that the query starts from the first piece of data. The value must be a positive integer.
	Offset int `json:"offset,omitempty"`
	// Number of records to be queried. The default value is 100. The value must be a positive integer.
	// The minimum value is 1 and the maximum value is 100.
	Limit int `json:"limit,omitempty"`
	// Query based on the instance tag key and value. {key} indicates the tag key, and {value} indicates the tag value.
	// To query instances with multiple tag keys and values, separate key-value pairs with commas (,).
	// The key must be unique. Multiple keys are in AND relationship.
	Tags string `json:"tags,omitempty"`
}

type ListInstancesResponse

type ListInstancesResponse struct {
	// Instance list information.
	Instances []InstancesListInfo `json:"instances"`
	// Total number of records.
	TotalCount int `json:"total_count"`
}

type MysqlTags

type MysqlTags struct {
	// Tag key. The value can contain up to 36 unicode characters. The value cannot be an empty string, a space, or left blank.
	// Only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_) are allowed.
	Key string `json:"key"`
	// Tag value. It contains up to 43 Unicode characters. The value can be an empty string.
	// Only uppercase letters, lowercase letters, digits, periods (.), hyphens (-), and underscores (_) are allowed.
	Value string `json:"value"`
}

type MysqlVolume

type MysqlVolume struct {
	// Storage space. The default value is 40 in GB.
	// The value ranges from 40 GB to 128,000 GB and must be a multiple of 10.
	Size string `json:"size"`
}

type NodeInfo

type NodeInfo struct {
	// Instance ID
	Id string `json:"id"`
	// Node name
	Name string `json:"name"`
	// Node type, which can be master or slave.
	Type string `json:"type"`
	// Node status
	Status string `json:"status"`
	// Database port
	Port int `json:"port"`
	// Private IP address for read of the node
	PrivateReadIps []string `json:"private_read_ips"`
	// Storage disk information
	Volume *NodeVolumeInfo `json:"volume"`
	// AZ
	AzCode string `json:"az_code"`
	// Region where the instance is located
	RegionCode string `json:"region_code"`
	// Creation time yyyy-mm-ddThh:mm:ssZ
	Created string `json:"created"`
	// Update time
	Updated string `json:"updated"`
	// Specification code
	FlavorRef string `json:"flavor_ref"`
	// Maximum number of connections
	MaxConnections string `json:"max_connections"`
	// Number of vCPUs
	Vcpus string `json:"vcpus"`
	// Memory size in GB
	Ram string `json:"ram"`
	// Whether to reboot the instance for the parameter modifications to take effect.
	NeedRestart bool `json:"need_restart"`
	// Failover priority
	Priority int `json:"priority"`
}

type NodeVolumeInfo

type NodeVolumeInfo struct {
	// Disk type
	Type string `json:"type"`
	// Used disk size in GB
	Used string `json:"used"`
}

type Proxies

type Proxies struct {
	PoolId  string `json:"pool_id"`
	Name    string `json:"name"`
	Address string `json:"address"`
}

type ResetPwdOpts

type ResetPwdOpts struct {
	// Instance ID, which is compliant with the UUID format.
	InstanceId string
	// Database password.
	// Value range:
	// The password consists of 8 to 32 characters and contains at least three types of the following:
	// uppercase letters, lowercase letters, digits, and special characters (~!@#$%^*-_=+?,()&).
	// Enter a strong password to improve security, preventing security risks such as brute force cracking.
	// If you enter a weak password, the system automatically determines that the password is invalid.
	Password string `json:"password"`
}

type ResizeFlavor

type ResizeFlavor struct {
	// Specification code
	SpecCode string `json:"spec_code"`
}

type TagItem

type TagItem struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type UpdateNameOpts

type UpdateNameOpts struct {
	// Instance ID, which is compliant with the UUID format.
	InstanceId string
	// Instance name
	// Instances of the same type can have same names under the same tenant.
	// The name consists of 4 to 64 characters and starts with a letter.
	// It is case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_).
	Name string `json:"name"`
}

type UpdateSpecOpts

type UpdateSpecOpts struct {
	// Instance ID, which is compliant with the UUID format.
	InstanceId string
	// Specification change information.
	ResizeFlavor ResizeFlavor `json:"resize_flavor"`
	// Whether the order will be automatically paid after yearly/monthly instances are changed.
	// true: The order will be automatically paid from your account. The default value is true.
	// false: The order will be manually paid.
	IsAutoPay *string `json:"is_auto_pay,omitempty"`
}

type VolumeInfo

type VolumeInfo struct {
	// Disk type
	Type string `json:"type"`
	// Used disk size in GB
	Size string `json:"size"`
}

Jump to

Keyboard shortcuts

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