instances

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNode added in v0.5.27

func AddNode(client *golangsdk.ServiceClient, opts AddNodeOpts) (*string, error)

func BindEIP added in v0.5.27

func BindEIP(client *golangsdk.ServiceClient, opts BindEIPOpts) (*string, error)

func ChangePassword added in v0.5.27

func ChangePassword(client *golangsdk.ServiceClient, opts ChangePasswordOpt) error

func CreateClientNetwork added in v0.9.4

func CreateClientNetwork(client *golangsdk.ServiceClient, instanceId string, opts NetworkRangesOpts) (err error)

func Delete

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

func EnableConfigIp added in v0.5.27

func EnableConfigIp(client *golangsdk.ServiceClient, opts EnableConfigIpOpts) error

func ExtractJob added in v0.9.4

func ExtractJob(err error, raw *http.Response) (*string, error)

func ModifyInternalIp added in v0.5.27

func ModifyInternalIp(client *golangsdk.ServiceClient, opts ModifyInternalIpOpts) (*string, error)

func ModifyPort added in v0.5.27

func ModifyPort(client *golangsdk.ServiceClient, opts ModifyPortOpt) (*string, error)

func ModifySG added in v0.5.27

func ModifySG(client *golangsdk.ServiceClient, opts ModifySGOpt) (*string, error)

func ModifySpec added in v0.5.27

func ModifySpec(client *golangsdk.ServiceClient, opts ModifySpecOpt) (*string, error)

func Restart added in v0.5.27

func Restart(client *golangsdk.ServiceClient, opts RestartOpts) (*string, error)

func RestoreToOriginal added in v0.9.4

func RestoreToOriginal(client *golangsdk.ServiceClient, opts RestoreToOriginalOpts) (*string, error)

func RestoreToPIT added in v0.9.4

func RestoreToPIT(client *golangsdk.ServiceClient, opts RestoreToPITOpts) (*string, error)

func ScaleStorage added in v0.5.27

func ScaleStorage(client *golangsdk.ServiceClient, opts ScaleStorageOpt) (*string, error)

func SetRecyclePolicy added in v0.9.4

func SetRecyclePolicy(client *golangsdk.ServiceClient, instanceId string, opts RecyclePolicyOpts) (err error)

func SwitchSSL added in v0.5.27

func SwitchSSL(client *golangsdk.ServiceClient, opts SSLOpt) (*string, error)

func Switchover added in v0.5.27

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

func UnBindEIP added in v0.5.27

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

func UpdateName added in v0.5.27

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

Types

type AddNodeOpts added in v0.5.27

type AddNodeOpts struct {
	Type       string      `json:"type" required:"true"`
	SpecCode   string      `json:"spec_code" required:"true"`
	Num        int         `json:"num" required:"true"`
	Volume     *VolumeNode `json:"volume,omitempty"`
	InstanceId string      `json:"-"`
}

type BackupStrategy

type BackupStrategy struct {
	// Specifies the backup time window. Automated backups will be triggered during the backup time window.
	// 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.
	// If this parameter is not transferred, the default backup time window is set to 00:00-01:00.
	// Example value:
	//23:00-00:00
	StartTime string `json:"start_time" required:"true"`
	// Specifies the number of days to retain the generated backup files.
	// The value range is from 0 to 732.
	// If this parameter is set to 0, the automated backup policy is not set.
	// If this parameter is not transferred, the automated backup policy is enabled by default. Backup files are stored for seven days by default.
	KeepDays *int `json:"keep_days,omitempty"`
	// Specifies the backup cycle configuration. Data will be automatically backed up on the selected days every week.
	// Value range: The value is a number separated by DBS case commas (,). The number indicates the week.
	// The restrictions on the backup retention period are as follows:
	// This parameter is not transferred if its value is set to 0.
	// If you set the retention period to 1 to 6 days, data is automatically backed up each day of the week.
	// Set the parameter value to 1,2,3,4,5,6,7.
	// If you set the retention period to 7 to 732 days, select at least one day of the week for the backup cycle.
	// Example value: 1,2,3,4
	Period string `json:"period,omitempty"`
}

type BackupStrategyOpt

type BackupStrategyOpt struct {
	StartTime string `json:"start_time" required:"true"`
	KeepDays  string `json:"keep_days,omitempty"`
	Period    string `json:"period,omitempty"`
}

type BindEIPOpts added in v0.5.27

type BindEIPOpts struct {
	PublicIpId string `json:"public_ip_id" required:"true"`
	PublicIp   string `json:"public_ip" required:"true"`
	NodeId     string `json:"-"`
}

type ChangePasswordOpt added in v0.5.27

type ChangePasswordOpt struct {
	UserPwd    string `json:"user_pwd" required:"true"`
	InstanceId string `json:"-"`
}

type Collections added in v0.9.4

type Collections struct {
	// Specifies the original table name before the restoration.
	OldName string `json:"old_name" required:"true"`
	// Specifies the table name after the restoration.
	NewName string `json:"new_name,omitempty"`
	// Specifies the collection restoration time point.
	// The value is a UNIX timestamp, in milliseconds. The time zone is UTC.
	RestoreCollectionTime string `json:"restore_collection_time,omitempty"`
}

type CreateOpts

type CreateOpts struct {
	// Specifies the DB instance name. Instance name, which can be the same as an existing name.
	// The instance name must contain 4 to 64 characters and must start with a letter. It is case sensitive and can contain letters, digits, hyphens (-), and underscores (_). It cannot contain other special characters.
	Name string `json:"name" required:"true"`
	// Specifies the database information.
	DataStore DataStore `json:"datastore" required:"true"`
	// Specifies the region ID.
	// The value cannot be empty.
	Region string `json:"region" required:"true"`
	// Specifies the AZ ID. You can select multiple AZs to create a cross-AZ cluster based on az_status returned by the API described in Querying Database Specifications.
	AvailabilityZone string `json:"availability_zone" required:"true"`
	// Specifies the VPC ID.
	VpcId string `json:"vpc_id" required:"true"`
	// Specifies the network ID of the subnet.
	SubnetId string `json:"subnet_id" required:"true"`
	// Specifies the security group ID.
	SecurityGroupId string `json:"security_group_id" required:"true"`
	// Database access port
	// Value range: 2100-9500, 27017, 27018, and 27019.
	// If this parameter is not transferred, the port of the created DB instance is 8635 by default.
	Port string `json:"port,omitempty"`
	// Specifies the database password.
	// The value must be 8 to 32 characters in length and contain uppercase letters (A to Z), lowercase letters (a to z), digits (0 to 9), and special characters, such as ~!@#%^*-_=+?
	// Enter a strong password to improve security, preventing security risks such as brute force cracking.
	Password string `json:"password" required:"true"`
	// Specifies the key ID used for disk encryption. The string must comply with UUID regular expression rules.
	// If this parameter is not transferred, disk encryption is not performed.
	DiskEncryptionId string `json:"disk_encryption_id,omitempty"`
	// Specifies the instance type. Cluster, replica set, and single node instances are supported.
	// Valid value:
	// Sharding
	// ReplicaSet
	// Single
	Mode string `json:"mode" required:"true"`
	// Specifies the instance specifications.
	Flavor []Flavor `json:"flavor" required:"true"`
	// Specifies the advanced backup policy.
	BackupStrategy BackupStrategy `json:"backup_strategy" required:"true"`
	// Specifies whether to enable or disable SSL.
	// Valid value:
	// The value 0 indicates that SSL is disabled by default.
	// The value 1 indicates that SSL is enabled by default.
	// If this parameter is not transferred, SSL is enabled by default.
	Ssl string `json:"ssl_option,omitempty"`
	// Tag list
	// A maximum of 20 tags can be added for each instance.
	Tags []tags.ResourceTag `json:"tags,omitempty"`
}

type DataStore

type DataStore struct {
	// Specifies the database type. The value is DDS-Community.
	Type string `json:"type" required:"true"`
	// Specifies the database version. Versions 4.2, 4.0, and 3.4 are supported. The value can be 4.2, 4.0, or 3.4.
	Version string `json:"version" required:"true"`
	// Specifies the storage engine. DDS supports the WiredTiger and RocksDB storage engines.
	// If the database version is 4.2 and the storage engine is RocksDB, the value is rocksDB.
	// If the database version is 4.0 or 3.4 and the storage engine is WiredTiger, the value is wiredTiger.
	StorageEngine string `json:"storage_engine" required:"true"`
}

type EnableConfigIpOpts added in v0.5.27

type EnableConfigIpOpts struct {
	Type       string `json:"type" required:"true"`
	TargetId   string `json:"target_id,omitempty"`
	Password   string `json:"password" required:"true"`
	InstanceId string `json:"-"`
}

type Flavor

type Flavor struct {
	// Specifies the node type.
	// Valid value:
	// For a cluster instance, the value can be mongos, shard, or config.
	// For a replica set instance, the value is replica.
	// For a single node instance, the value is single.
	Type string `json:"type" required:"true"`
	// Specifies node quantity.
	// Valid value:
	// mongos: The value ranges from 2 to 32.
	// mongos: The value ranges from 2 to 32.
	// config: The value is 1.
	// replica: The number of nodes can be 3, 5, or 7.
	// single: The value is 1.
	Num int `json:"num" required:"true"`
	// Specifies the disk type.
	// Valid value: ULTRAHIGH, which indicates the type SSD.
	// This parameter is valid for the shard and config nodes of a cluster instance, replica set instances, and single node instances. This parameter is invalid for mongos nodes. Therefore, you do not need to specify the storage space for mongos nodes.
	Storage string `json:"storage,omitempty"`
	// Specifies the disk size.
	// This parameter is mandatory for all nodes except mongos. This parameter is invalid for the mongos nodes.
	// The value must be a multiple of 10. The unit is GB.
	// For a cluster instance, the storage space of a shard node can be 10 to 2000 GB, and the config storage space is 20 GB. This parameter is invalid for mongos nodes. Therefore, you do not need to specify the storage space for mongos nodes.
	// For a replica set instance, the value ranges from 10 to 2000.
	// For a single node instance, the value ranges from 10 to 1000.
	Size int `json:"size,omitempty"`
	// Specifies the resource specification code. For details about how to obtain the value, see the response values of spec_code in Querying Database Specifications.
	// In a cluster instance, multiple specifications need to be specified. All specifications must be of the same series, that is, general-purpose (s6), enhanced (c3), or enhanced II (c6).
	SpecCode string `json:"spec_code" required:"true"`
}

type FlavorOpt

type FlavorOpt struct {
	// Specifies the node type.
	// Valid value:
	// For a cluster instance, the value can be mongos, shard, or config.
	// For a replica set instance, the value is replica.
	// For a single node instance, the value is single.
	Type string `json:"type" required:"true"`
	// Specifies node quantity.
	// Valid value:
	// mongos: The value ranges from 2 to 32.
	// mongos: The value ranges from 2 to 32.
	// config: The value is 1.
	// replica: The number of nodes can be 3, 5, or 7.
	// single: The value is 1.
	Num string `json:"num" required:"true"`
	// Specifies the disk type.
	// Valid value: ULTRAHIGH, which indicates the type SSD.
	// This parameter is valid for the shard and config nodes of a cluster instance, replica set instances, and single node instances. This parameter is invalid for mongos nodes. Therefore, you do not need to specify the storage space for mongos nodes.
	Storage string `json:"storage,omitempty"`
	// Specifies the disk size.
	// This parameter is mandatory for all nodes except mongos. This parameter is invalid for the mongos nodes.
	// The value must be a multiple of 10. The unit is GB.
	// For a cluster instance, the storage space of a shard node can be 10 to 2000 GB, and the config storage space is 20 GB. This parameter is invalid for mongos nodes. Therefore, you do not need to specify the storage space for mongos nodes.
	// For a replica set instance, the value ranges from 10 to 2000.
	// For a single node instance, the value ranges from 10 to 1000.
	Size string `json:"size,omitempty"`
	// Specifies the resource specification code. For details about how to obtain the value, see the response values of spec_code in Querying Database Specifications.
	// In a cluster instance, multiple specifications need to be specified. All specifications must be of the same series, that is, general-purpose (s6), enhanced (c3), or enhanced II (c6).
	SpecCode string `json:"spec_code" required:"true"`
}

type Group

type Group struct {
	// Indicates the node type.
	//
	// Valid value:
	//
	// shard
	// config
	// mongos
	// replica
	// single
	Type string `json:"type"`
	//
	Id string `json:"id"`
	//
	Name string `json:"name"`
	//
	Status string `json:"status"`
	// Indicates the volume information.
	Volume Volume `json:"volume"`
	// Indicates node information.
	Nodes []Nodes `json:"nodes"`
}

type Instance

type Instance struct {
	// Indicates the DB instance ID.
	Id string `json:"id"`
	// Same as the request parameter.
	Name string `json:"name"`
	// Indicates the database information, which is the same as the request parameter.
	DataStore DataStore `json:"datastore"`
	// Indicates the creation time in the following format: yyyy-mm-dd hh:mm:ss.
	CreatedAt string `json:"created"`
	// Indicates the DB instance status. The value is creating.
	Status string `json:"status"`
	// Indicates the region ID, which is the same as the request parameter.
	Region string `json:"region"`
	// Indicates the AZ ID, which is the same as the request parameter.
	AvailabilityZone string `json:"availability_zone"`
	// Indicates the VPC ID, which is the same as the request parameter.
	VpcId string `json:"vpc_id"`
	// Indicates the network ID of the subnet, which is the same as the request parameter.
	SubnetId string `json:"subnet_id"`
	// Indicates the security group ID, which is the same as the request parameter.
	SecurityGroupId string `json:"security_group_id"`
	// Indicates the database port.
	Port int `json:"port"`
	// Indicates the ID of the disk encryption key, which is the same as the request parameter.
	DiskEncryptionId string `json:"disk_encryption_id"`
	// Indicates the instance type, which is the same as the request parameter.
	Mode string `json:"mode"`
	// Indicates the instance specification, which is the same as the request parameter.
	Flavor []FlavorOpt `json:"flavor"`
	// Indicates the advanced backup policy, which is the same as the request parameter.
	BackupStrategy BackupStrategyOpt `json:"backup_strategy"`
	// Indicates whether to enable SSL, which functions the same as the request parameter.
	Ssl string `json:"ssl_option"`
	// Indicates the ID of the workflow for creating a DB instance.
	JobId string `json:"job_id"`
	// Tag list, which is the same as the request parameter.
	Tags []tags.ResourceTag `json:"tags"`
}

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*Instance, error)

func RestoreToNew added in v0.9.4

func RestoreToNew(client *golangsdk.ServiceClient, opts RestoreOpts) (*Instance, error)

type InstanceResponse

type InstanceResponse struct {
	// Indicates the DB instance ID.
	Id string `json:"id"`
	// Indicates the DB instance name.
	Name string `json:"name"`
	// Instance remarks
	Remark string `json:"remark"`
	// Indicates the DB instance status.
	//
	// Valid value:
	//
	// normal: indicates that the instance is running properly.
	// abnormal: indicates that the instance is abnormal.
	// creating: indicates that the instance is being created.
	// data_disk_full: The storage space is full.
	// createfail: indicates that the instance failed to be created.
	// enlargefail: indicates that nodes failed to be added to the instance.
	// NOTE:
	// Actions that are being executed on an instance, for example, rebooting, which are essentially different from the instance status. For details, see the actions field in this table.
	Status string `json:"status"`
	// Indicates the database port number. The port range is 2100 to 9500.
	Port int `json:"port,string"`
	// Indicates the instance type, which is the same as the request parameter.
	Mode string `json:"mode"`
	// Indicates the region where the DB instance is deployed.
	Region string `json:"region"`
	// Indicates the database information.
	DataStore DataStore `json:"datastore"`
	// Indicates the storage engine. The value is wiredTiger.
	Engine string `json:"engine"`
	// Indicates the DB instance creation time.
	Created string `json:"created"`
	// Indicates the time when a DB instance is updated.
	Updated string `json:"updated"`
	// Indicates the default username. The value is rwuser.
	DbUserName string `json:"db_user_name"`
	// Indicates that SSL is enabled or not.
	//
	// 1: indicate that SSL is enabled.
	// 0: indicate that SSL is disabled.
	Ssl int `json:"ssl"`
	// Indicates the VPC ID.
	VpcId string `json:"vpc_id"`
	// Indicates the network ID of the subnet.
	SubnetId string `json:"subnet_id"`
	// Indicates the security group ID.
	SecurityGroupId string `json:"security_group_id"`
	// Indicates the backup policy.
	BackupStrategy BackupStrategy `json:"backup_strategy"`
	// Indicates the maintenance time window.
	MaintenanceWindow string `json:"maintenance_window"`
	// Indicates group information.
	Groups []Group `json:"groups"`
	// Indicates the disk encryption key ID. This parameter is returned only when the instance disk is encrypted.
	DiskEncryptionId string `json:"disk_encryption_id"`
	// Indicates the time zone.
	TimeZone string `json:"time_zone"`
	// Action that is being executed on an instance.
	//
	// Valid value:
	//
	// RESTARTING: The instance is being restarted.
	// RESTORE: restoring.
	// RESIZE_FLAVOR: The specifications are being changed.
	// RESTORE_TO_NEW_INSTANCE: The instance is being restored.
	// MODIFY_VPC_PEER: Cross-subnet access is being configured.
	// CREATE: creating
	// FROZEN: The account is frozen.
	// RESIZE_VOLUME: The storage is being scaled up.
	// RESTORE_CHECK: The restoration is being checked.
	// RESTORE_FAILED_HANGUP: The restoration failed.
	// CLOSE_AUDIT_LOG: Disabling audit log.
	// OPEN_AUDIT_LOG: Enabling audit log.
	// CREATE_IP_SHARD: The shard IP address is being enabled.
	// CREATE_IP_CONFIG: The config IP address is being enabled.
	// GROWING: The node is being scaled up.
	// SET_CONFIGURATION: Parameters are being modified.
	// RESTORE_TABLE: The database is being backed up.
	// MODIFY_SECURITYGROUP: A security group is being changed.
	// BIND_EIP: The EIP is being changed.
	// UNBIND_EIP: The EIP is being unbound.
	// SWITCH_SSL: The SSL is being switched.
	// SWITCH_PRIMARY: A primary/standby switchover is being performed.
	// CHANGE_DBUSER_PASSWORD: The password is being changed.
	// MODIFY_PORT: The port is being changed.
	// MODIFY_IP: The private IP address is being changed.
	// DELETE_INSTANCE: The instance is being deleted.
	// REBOOT: The system is restarting.
	// BACKUP: The backup is in progress.
	// MIGRATE_AZ: The AZ is being changed.
	// RESTORING: The backup is in progress.
	// PWD_RESETING: The password is being reset.
	// UPGRADE_DATABASE: The patch is being upgraded.
	// DATA_MIGRATION: Data is being migrated.
	// SHARD_GROWING: The shard is being scaled out.
	// APPLY_CONFIGURATION: A parameter group is being changed.
	// RESET_PASSWORD: The password is being reset.
	// GROWING_REVERT: Nodes are being deleted.
	// SHARD_GROWING_REVERT: Shards are being deleted.
	// LOG_PLAINTEXT_SWITCH: The slow query log configuration is being modified.
	// CREATE_DATABASE_USER: The database user is being created.
	// CREATE_DATABASE_ROLE: The database role is being created.
	// MODIFY_NAME: The name is being changed.
	// MODIFY_PRIVATE_DNS: The private zone is being modified.
	// MODIFY_OP_LOG_SIZE: The oplog size is being changed.
	// ADD_READONLY_NODES: Read replicas are being scaled up.
	Actions []string `json:"actions"`
	// The value is set to "0".
	PayMode string `json:"pay_mode"`
	// Tag list
	Tags []tags.ResourceTag `json:"tags"`
}

type JobId added in v0.5.27

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

type ListInstanceOpts

type ListInstanceOpts struct {
	// Specifies the instance ID, which can be obtained by calling the API for querying instances and details.
	Id string `q:"id"`
	// Specifies the DB instance name.
	//
	// If you use asterisk (*) at the beginning of the name, fuzzy search results are returned. Otherwise, the exact results are returned.
	//
	// NOTE:
	// The asterisk (*) is a reserved character in the system and cannot be used alone.
	Name string `q:"name"`
	// Specifies the instance type.
	//
	// Sharding indicates the cluster instance.
	// ReplicaSet indicate the replica set instance.
	// Single indicates the single node instance.
	Mode string `q:"mode"`
	// Specifies the database type. The value is DDS-Community.
	DataStoreType string `q:"datastore_type"`
	// Specifies the VPC ID.
	VpcId string `q:"vpc_id"`
	// Specifies the network ID of the subnet.
	SubnetId string `q:"subnet_id"`
	//
	// Specifies the index position. The query starts from the next instance creation time indexed by this parameter under a specified project. If offset is set to N, the resource query starts from the N+1 piece of data.
	//
	// The value must be greater than or equal to 0. If this parameter is not transferred, offset is set to 0 by default, indicating that the query starts from the latest created DB instance.
	Offset int `q:"offset"`
	// Specifies the maximum allowed number of DB instances.
	//
	// The value ranges from 1 to 100. If this parameter is not transferred, the first 100 DB instances are queried by default.
	Limit int `q:"limit"`
	// Query based on the instance tag key and value.
	//
	// {key} indicates the tag key, and {value} indicates the tag value. A maximum of 20 key-value pairs are supported. The key cannot be empty or duplicate, but the value can be empty.
	//
	// To query instances with multiple tag keys and values, separate key-value pairs with commas (,).
	Tags string `q:"tags"`
}

type ListRecycledOpts added in v0.9.4

type ListRecycledOpts struct {
	// 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 `q:"offset"`
	// Number of records displayed on each page. The default value is 100.
	Limit int `q:"limit"`
}

type ListRecycledResponse added in v0.9.4

type ListRecycledResponse struct {
	Instances  []RecycledInstanceResponse `json:"instances"`
	TotalCount int                        `json:"total_count"`
}

func ListRecycledInstances added in v0.9.4

func ListRecycledInstances(client *golangsdk.ServiceClient, opts ListRecycledOpts) (*ListRecycledResponse, error)

type ListResponse added in v0.5.27

type ListResponse struct {
	Instances  []InstanceResponse `json:"instances"`
	TotalCount int                `json:"total_count"`
}

func List

type ModifyInternalIpOpts added in v0.5.27

type ModifyInternalIpOpts struct {
	NewIp      string `json:"new_ip" required:"true"`
	NodeId     string `json:"node_id" required:"true"`
	InstanceId string `json:"-"`
}

type ModifyPortOpt added in v0.5.27

type ModifyPortOpt struct {
	Port       int    `json:"port" required:"true"`
	InstanceId string `json:"-"`
}

type ModifySGOpt added in v0.5.27

type ModifySGOpt struct {
	SecurityGroupId string `json:"security_group_id" required:"true"`
	InstanceId      string `json:"-"`
}

type ModifySpecOpt added in v0.5.27

type ModifySpecOpt struct {
	TargetType     string `json:"target_type,omitempty"`
	TargetId       string `json:"target_id" required:"true"`
	TargetSpecCode string `json:"target_spec_code" required:"true"`
	InstanceId     string `json:"-"`
}

type NetworkRangesOpts added in v0.9.4

type NetworkRangesOpts struct {
	// CIDR block where the client is located
	NetworkRanges []string `json:"client_network_ranges" required:"true"`
}

type Nodes

type Nodes struct {
	// Indicates the node ID.
	Id string `json:"id"`
	// Indicates the node name.
	Name string `json:"name"`
	// Indicates the node status.
	//
	// Valid value:
	//
	// normal: The instance is running properly.
	// abnormal: The instance is abnormal.
	// backup: The instance is being backed up.
	// frozen: The instance has been frozen.
	// unfrozen: The instance is being unfrozen.
	// restore_table: Database- and table-level backup and restoration are being performed for the DB instance.
	// reboot: The instance is being restarted.
	// upgrade_database: The instance version is being upgraded.
	// resize_flavor: The instance class is being changed.
	// resize_volume: The instance storage is being scaled up.
	// restore: The instance is being restored.
	// bind_eip: An EIP is being bound to the instance.
	Status string `json:"status"`
	// Indicates the node role.
	//
	// Valid value:
	// master: This value is returned for the mongos node.
	// Primary: This value is returned for the primary shard and config nodes, the primary node of a replica set, and a single node.
	// Secondary: This value is returned for the secondary shard and config nodes, and the secondary node of a replica set.
	// Hidden: This value is returned for the hidden shard and config nodes, and the hidden node of a replica set.
	// unknown. This value is returned when the node is abnormal.
	Role string `json:"role"`
	// Indicates the private IP address of a node. By default, this parameter is valid only for mongos nodes, replica set instances, and single node instances. The value exists only after ECSs are created successfully. Otherwise, the value is "".
	//
	// CAUTION:
	// After the shard or config IP address is enabled, private IP addresses are assigned to the primary and secondary shard or config nodes of the cluster instance.
	PrivateIP string `json:"private_ip"`
	// Indicates the EIP that has been bound. This parameter is valid only for mongos nodes of cluster instances, primary nodes and secondary nodes of replica set instances, and single node instances.
	PublicIP string `json:"public_ip"`
	// Indicates the resource specification code.
	SpecCode string `json:"spec_code"`
	// Indicates the AZ.
	AvailabilityZone string `json:"availability_zone"`
}

type RecyclePolicy added in v0.9.4

type RecyclePolicy struct {
	// The recycling policy is enabled and cannot be disabled.
	// true: The recycling policy is enabled.
	Enabled *bool `json:"enabled" required:"true"`
	// Policy retention duration (1 to 7 days).
	// The value is a positive integer. If this parameter is left blank, the policy is retained for 7 days by default.
	RetentionPeriodInDays int `json:"retention_period_in_days,omitempty"`
}

func GetRecyclePolicy added in v0.9.4

func GetRecyclePolicy(client *golangsdk.ServiceClient) (*RecyclePolicy, error)

type RecyclePolicyOpts added in v0.9.4

type RecyclePolicyOpts struct {
	// CIDR block where the client is located
	RecyclePolicy *RecyclePolicy `json:"recycle_policy" required:"true"`
}

type RecycledInstanceResponse added in v0.9.4

type RecycledInstanceResponse struct {
	// Indicates the DB instance ID.
	Id string `json:"id"`
	// Indicates the DB instance name.
	Name string `json:"name"`
	// Instance type. Cluster, replica set, and single node instances are supported. The value can be:
	// Sharding
	// ReplicaSet
	// Single
	Mode string `json:"mode"`
	// Database information.
	Datastore DataStore `json:"datastore"`
	// Billing mode.
	// 0: indicates the instance is billed on a pay-per-use basis.
	// 1: indicates the instance is billed based on a yearly/monthly basis.
	PayMode string `json:"pay_mode"`
	// Backup ID.
	BackupId string `json:"backup_id"`
	// Creation time.
	CreatedAt string `json:"created_at"`
	// Deletion time.
	DeletedAt string `json:"deleted_at"`
	// Retention end time.
	RetainedUntil string `json:"retained_until"`
	// Instance backup recycling status.
	Status string `json:"status"`
}

type RestartOpts added in v0.5.27

type RestartOpts struct {
	// Specifies the instance ID, which can be obtained by calling the API for querying instances.
	InstanceId string `json:"-"`
	// Specifies the type of the object to restart.
	//
	// This parameter is mandatory when you restart one or more nodes of a cluster instance.
	// Set the value to mongos if mongos nodes are restarted.
	// Set the value to shard if shard nodes are restarted.
	// Set the value to config if config nodes are restarted.
	// This parameter is not transferred when the DB instance is restarted.
	TargetType string `json:"target_type,omitempty"`
	// Specifies the ID of the object to be restarted, which can be obtained by calling the API for querying instances. If you do not have an instance, you can call the API used for creating an instance.
	//
	// In a cluster instance, the value is the ID of the node to restart.
	// When you restart the entire DB instance, the value is the DB instance ID.
	TargetId string `json:"target_id" required:"true"`
}

type RestoreCollections added in v0.9.4

type RestoreCollections struct {
	// Specifies the database name.
	Database string `json:"database" required:"true"`
	// Specifies the collection information.
	Collections []Collections `json:"collections,omitempty"`
	// Specifies the database restoration time point.
	RestoreDatabaseTime string `json:"restore_database_time,omitempty"`
}

type RestoreOpts added in v0.9.4

type RestoreOpts struct {
	// Specifies the DB instance name. Instance name, which can be the same as an existing name.
	//
	// The instance name must contain 4 to 64 characters and must start with a letter. It is case sensitive and can contain letters, digits, hyphens (-), and underscores (_). It cannot contain other special characters.
	Name string `json:"name" required:"true"`
	// Specifies the AZ ID. You can select multiple AZs to create a cross-AZ cluster based on az_status returned by the API described in Querying Database Specifications.
	AvailabilityZone string `json:"availability_zone" required:"true"`
	// Specifies the VPC ID.
	VpcId string `json:"vpc_id" required:"true"`
	// Specifies the network ID of the subnet.
	SubnetId string `json:"subnet_id" required:"true"`
	// Specifies the security group ID.
	SecurityGroupId string `json:"security_group_id" required:"true"`
	// Specifies the database password.
	// The value must be 8 to 32 characters in length and contain uppercase letters (A to Z), lowercase letters (a to z), digits (0 to 9), and special characters, such as ~!@#%^*-_=+?
	// Enter a strong password to improve security, preventing security risks such as brute force cracking.
	Password string `json:"password,omitempty"`
	// Specifies the key ID used for disk encryption. The string must comply with UUID regular expression rules.
	// If this parameter is not transferred, disk encryption is not performed.
	DiskEncryptionId string `json:"disk_encryption_id,omitempty"`
	// Specifies the instance specifications.
	Flavor []Flavor `json:"flavor" required:"true"`
	// Specifies the advanced backup policy.
	BackupStrategy BackupStrategy `json:"backup_strategy,omitempty"`
	// Specifies whether to enable or disable SSL.
	// Valid value:
	// The value 0 indicates that SSL is disabled by default.
	// The value 1 indicates that SSL is enabled by default.
	// If this parameter is not transferred, SSL is enabled by default.
	Ssl string `json:"ssl_option,omitempty"`
	// Specifies the advanced backup policy.
	RestorePoint RestorePoint `json:"restore_point" required:"true"`
}

type RestorePoint added in v0.9.4

type RestorePoint struct {
	// Specifies the instance ID, which can be obtained by calling the API for querying instances.
	// If you do not have an instance, you can call the API used for creating an instance.
	// This parameter is optional when type is set to backup.
	// This parameter is mandatory when type is set to timestamp.
	InstanceId string `json:"instance_id,omitempty"`
	// Specifies the recovery mode. The enumerated values are as follows:
	// backup: indicates restoration from backup files. In this mode, backup_id is mandatory when type is optional.
	// timestamp: indicates point-in-time restoration. In this mode, restore_time is mandatory when type is mandatory.
	Type string `json:"type,omitempty"`
	// Specifies the ID of the backup to be restored.
	// This parameter must be specified when the backup file is used for restoration.
	BackupId string `json:"backup_id,omitempty"`
	// Specifies the time point of data restoration in the UNIX timestamp.
	// The unit is millisecond and the time zone is UTC.
	RestoreTime int `json:"restore_time,omitempty"`
}

type RestoreToOriginalOpts added in v0.9.4

type RestoreToOriginalOpts struct {
	// Specifies the instance from which the backup was created
	Source Source `json:"source" required:"true"`
	// Specifies the instance to which the backup is restored.
	Target Target `json:"target" required:"true"`
}

type RestoreToPITOpts added in v0.9.4

type RestoreToPITOpts struct {
	// Specifies the database information.
	RestoreCollections []RestoreCollections `json:"restore_collections" required:"true"`
}

type SSLOpt added in v0.5.27

type SSLOpt struct {
	SSL        string `json:"ssl_option" required:"true"`
	InstanceId string `json:"-"`
}

type ScaleStorageOpt added in v0.5.27

type ScaleStorageOpt struct {
	// Specifies the role ID.
	//
	// For a cluster instance, this parameter is set to the ID of the shard group.
	// This parameter is not transferred for replica set and single node instances.
	GroupId string `json:"group_id,omitempty"`
	// Specifies the requested disk capacity. The value must be an integer multiple of 10 and greater than the current storage space.
	//
	// In a cluster instance, this parameter indicates the storage space of shard nodes. The value range is from 10 GB to 2000 GB.
	// In a replica set instance, this parameter indicates the disk capacity of the DB instance to be expanded. The value range is from 10 GB to 2000 GB.
	// In a single node instance, this parameter indicates the disk capacity of the DB instance to be expanded. The value range is from 10 GB to 1000 GB.
	Size string `json:"size" required:"true"`
	// Specifies the instance
	InstanceId string `json:"-"`
}

type Source added in v0.9.4

type Source struct {
	// Specifies the instance ID, which can be obtained by calling the API for querying instances.
	InstanceId string `json:"instance_id,omitempty"`
	// Specifies the recovery mode. The enumerated values are as follows:
	// backup: indicates restoration from backup files. In this mode, backup_id is mandatory when type is optional.
	// timestamp: indicates point-in-time restoration. In this mode, restore_time is mandatory when type is mandatory.
	Type string `json:"type,omitempty"`
	// Specifies the ID of the backup to be restored.
	// This parameter must be specified when the backup file is used for restoration.
	BackupId string `json:"backup_id,omitempty"`
	// Specifies the time point of data restoration in the UNIX timestamp.
	// The unit is millisecond and the time zone is UTC.
	RestoreTime *int `json:"restore_time,omitempty"`
}

type Target added in v0.9.4

type Target struct {
	// Specifies ID of the DB instance to be restored from a backup.
	InstanceId string `json:"instance_id,omitempty"`
}

type UpdateNameOpt added in v0.5.27

type UpdateNameOpt struct {
	NewInstanceName string `json:"new_instance_name" required:"true"`
	InstanceId      string `json:"-"`
}

type Volume

type Volume struct {
	// Indicates the disk size. Unit: GB
	Size string `json:"size"`
	// Indicates the disk usage. Unit: GB
	Used string `json:"used"`
}

type VolumeNode added in v0.5.27

type VolumeNode struct {
	Size int `json:"size"`
}

Jump to

Keyboard shortcuts

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