lifecycle

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOps) (string, error)

Create an instance with given parameters.

func Delete

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

Delete an instance by id

func Extend

func Extend(client *golangsdk.ServiceClient, id string, opts ExtendOpts) (err error)

Extend is extending for a dcs instance

func Update

func Update(client *golangsdk.ServiceClient, id string, opts UpdateOpts) (err error)

Update is a method which can be able to update the instance via accessing to the service with Put method and parameters

Types

type BackupPolicy

type BackupPolicy struct {
	BackupPolicyId string               `json:"backup_policy_id"`
	CreatedAt      string               `json:"created_at"`
	UpdatedAt      string               `json:"updated_at"`
	Policy         InstanceBackupPolicy `json:"policy"`
	TenantId       string               `json:"tenant_id"`
}

type BatchDeleteBody

type BatchDeleteBody struct {
	// IDs of DCS instances to be deleted.
	// This parameter is set only when the allFailure parameter in the URI is set to false or another value.
	// A maximum of 50 instances can be deleted at a time.
	Instances []string `json:"instances,omitempty"`
}

type BatchDeleteOpts

type BatchDeleteOpts struct {
	// An indicator of whether all DCS instances failed to be created will be deleted. Options:
	// Options:
	// true: all instances that fail to be created are deleted. In this case, the instances parameter in the request can be empty.
	// false or other values: The DCS instances specified by the instances parameter in the API request will be deleted.
	AllFailure *bool `q:"allFailure"`
	Body       BatchDeleteBody
}

type BatchOpsResult

type BatchOpsResult struct {
	// Instance deletion result. Options: success and failed
	Result string `json:"result,omitempty"`
	// DCS instance ID.
	Instance string `json:"instance,omitempty"`
}

func BatchDelete

func BatchDelete(client *golangsdk.ServiceClient, opts BatchDeleteOpts) ([]BatchOpsResult, error)

type CreateOps

type CreateOps struct {
	// DCS instance name.
	// An instance name is a string of 4–64 characters
	// that contain letters, digits, underscores (_), and hyphens (-).
	// An instance name must start with letters.
	Name string `json:"name" required:"true"`
	// Brief description of the DCS instance.
	// The description supports up to 1024 characters.
	// The backslash (\) and quotation mark (") are special characters for JSON messages.
	// When using these characters in a parameter value,
	// add the escape character (\) before the characters, for example, \\ and \".
	Description string `json:"description,omitempty"`
	// Cache engine, which is Redis.
	Engine string `json:"engine" required:"true"`
	// Cache engine version. If the cache engine is Redis, the value can be 3.0, 4.0, or 5.0.
	EngineVersion string `json:"engine_version" required:"true"`
	// DCS instance specification code.
	// To obtain the value, go to the instance creation page on the DCS console,
	// and view Flavor Name in the Instance Specification table.
	SpecCode string `json:"spec_code" required:"true"`
	// Cache capacity. Unit: GB.
	// For a single-node or master/standby DCS Redis 3.0 instance,
	// the value can be 2, 4, 8, 16, 32, or 64. For a Proxy Cluster DCS Redis 3.0 instance,
	// the value can be 64, 128, 256, 512, or 1024.
	// For a single-node or master/standby DCS Redis 4.0 or 5.0 instance,
	// the value can be 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 24, 48, or 64.
	// For a Redis Cluster DCS Redis 4.0 or 5.0 instance,
	// the value can be 4, 8, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, or 1024.
	Capacity float64 `json:"capacity" required:"true"`
	// Password of a DCS instance.
	// The password of a DCS Redis instance must meet the following complexity requirements:
	// Must be a string consisting of 8 to 32 characters.
	// Must be different from the old password.
	// Contains at least three of the following character types:
	// Lowercase letters
	// Uppercase letters
	// Digits
	// Special characters (`~!@#$^&*()-_=+\|{}:,<.>/?)
	Password string `json:"password,omitempty"`
	// VPC ID.
	// Obtain the value by using either of the following methods:
	// Method 1: Log in to VPC console and view the VPC ID in the VPC details.
	// Method 2: Call the API for querying VPCs.
	// For details, see the "Querying VPCs" section in the Virtual Private Cloud API Reference.
	VPCId string `json:"vpc_id" required:"true"`
	// ID of the security group which the instance belongs to.
	// This parameter is mandatory when the engine is Redis and engine_version is 3.0.
	// DCS Redis 3.0 instances support security group access control.
	// This parameter is optional when the engine is Redis and engine_version is 4.0 or 5.0.
	// DCS Redis 4.0 and 5.0 instances do not support security groups.
	// Obtain the value by using either of the following methods:
	// Method 1: Log in to the VPC console and view the security group ID on the security group details page.
	// Method 2: Call the API for querying security groups. For details,
	// see the "Querying Security Groups" section in the Virtual Private Cloud API Reference.
	SecurityGroupID string `json:"security_group_id,omitempty"`
	// Network ID of the subnet.
	// Obtain the value by using either of the following methods:
	// Method 1: Log in to VPC console and click the target subnet on the Subnets tab page.
	// You can view the network ID on the displayed page.
	// Method 2: Call the API for querying subnets.
	// For details, see the "Querying Subnets" section in the Virtual Private Cloud API Reference.
	SubnetID string `json:"subnet_id" required:"true"`
	// ID of the AZ where the cache node resides and which has available resources.
	// For details on how to obtain the value, see Querying AZ Information.
	// Check whether the AZ has available resources.
	// Master/Standby, Proxy Cluster, and Redis Cluster DCS instances support cross-AZ deployment.
	// You can specify an AZ for the standby node. When specifying AZs for nodes,
	// use commas (,) to separate multiple AZs. For details, see the example request.
	AvailableZones []string `json:"available_zones" required:"true"`
	// Backup policy.
	// This parameter is available for master/standby and cluster DCS instances.
	InstanceBackupPolicy *InstanceBackupPolicy `json:"instance_backup_policy,omitempty"`
	// An indicator of whether to enable public access for a DCS Redis instance.
	EnablePublicIp *bool `json:"enable_publicip,omitempty"`
	// ID of the elastic IP address bound to a DCS Redis instance.
	// This parameter is mandatory if public access is enabled (that is, enable_publicip is set to true).
	PublicIpId string `json:"publicip_id,omitempty"`
	// IP address that is manually specified for a DCS instance.
	PrivateIps []string `json:"private_ips,omitempty"`
	// An indicator of whether to enable SSL for public access to a DCS Redis instance.
	EnableSsl *bool `json:"enable_ssl,omitempty"`
	// Time at which the maintenance time window starts.
	// Format: hh:mm:ss.
	// The start time and end time of the maintenance time window
	// must indicate the time segment of a supported maintenance time window.
	// For details on how to query the time segments of supported maintenance time windows,
	// see Querying Maintenance Time Window.
	// The start time must be set to 22:00:00, 02:00:00, 06:00:00, 10:00:00, 14:00:00, or 18:00: 00.
	// Parameters maintain_begin and maintain_end must be set in pairs.
	// If parameter maintain_start is left blank, parameter maintain_end is also blank.
	// In this case, the system automatically set the start time to 02:00:00.
	MaintainBegin string `json:"maintain_begin,omitempty"`
	// The end time is four hours later than the start time.
	// For example, if the start time is 22:00:00, the end time is 02:00:00.
	// ...In this case, the system automatically set the end time to 06:00:00.
	MaintainEnd string `json:"maintain_end,omitempty"`
	// Port customization, which is supported only by Redis 4.0 and Redis 5.0 instances and not by Redis 3.0 instances.
	// If this parameter is not sent or is left empty when you create a Redis 4.0 or 5.0 instance,
	// the default port 6379 will be used. To customize a port, specify a port number in the range from 1 to 65535.
	Port int32 `json:"port,omitempty"`
	// Critical command renaming, which is supported only by Redis 4.0 and Redis 5.0 instances and not by Redis 3.0 instances.
	// If this parameter is not sent or is left empty when you create a Redis 4.0 or 5.0 instance, no critical command will be renamed.
	// Currently, only COMMAND, KEYS, FLUSHDB, FLUSHALL, and HGETALL commands can be renamed.
	RenameCommands *interface{} `json:"rename_commands,omitempty"`
	// An indicator of whether a DCS instance can be accessed in password-free mode.
	// true: indicates that a DCS instance can be accessed without a password.
	// false: indicates that a DCS instance can be accessed only after password authentication.
	NoPasswordAccess string `json:"no_password_access"`
}

type ExtendOpts

type ExtendOpts struct {
	// New specification (memory space) of the DCS instance.
	// The new specification to which the DCS instance will be scaled up must be greater than the current specification.
	// Unit: GB.
	NewCapacity int `json:"new_capacity" required:"true"`
	// DCS instance specification code.
	// This parameter is optional for DCS Redis 3.0 instances.
	// This parameter is mandatory for DCS Redis 4.0 and Redis 5.0 instances.
	SpecCode string `json:"spec_code" required:"true"`
}

ExtendOpts is a struct which represents the parameters of extend function

type Instance

type Instance struct {
	// DCS instance name.
	Name string `json:"name"`
	// DCS instance engine.
	Engine string `json:"engine"`
	// DCS instance cache capacity. Unit: GB.
	Capacity int `json:"capacity"`
	// Cache capacity of a small-scale, single-node DCS instance.
	CapacityMinor string `json:"capacity_minor"`
	// IP address for connecting to the DCS instance For a cluster instance,
	// multiple IP addresses are returned and separated by commas (,).
	// For example, 192.168.0.1,192.168.0.2.
	IP string `json:"ip"`
	// Port number of the cache node.
	Port int `json:"port"`
	// Cache instance status.
	Status string `json:"status"`
	// true: This instance is a libos instance.
	// false: This instance is not a libos instance.
	Libos bool `json:"libos"`
	// Brief description of the DCS instance.
	Description string `json:"description"`
	// Total memory size.
	// Unit: MB.
	MaxMemory int `json:"max_memory"`
	// Size of the used memory.
	// Unit: MB.
	UsedMemory int `json:"used_memory"`
	// DCS instance ID.
	InstanceID string `json:"instance_id"`
	// Resource specifications.
	// For example:
	// dcs.single_node: indicates a DCS instance in single-node mode.
	// dcs.master_standby: indicates a DCS instance in master/standby mode.
	// dcs.cluster: indicates a DCS instance in cluster mode.
	ResourceSpecCode string `json:"resource_spec_code"`
	// Cache engine version.
	EngineVersion string `json:"engine_version"`
	// Internal DCS version.
	InternalVersion string `json:"internal_version"`
	// Billing mode. 0: pay-per-use.
	ChargingMode int `json:"charging_mode"`
	// VPC ID.
	VPCID string `json:"vpc_id"`
	// VPC name.
	VPCName string `json:"vpc_name"`
	// Time at which the DCS instance is created.
	// For example, 2017-03-31T12:24:46.297Z.
	CreatedAt string `json:"created_at"`
	// Error code returned when the DCS instance fails to be created or is abnormal.
	ErrorCode string `json:"error_code"`
	// User ID.
	UserID string `json:"user_id"`
	// Username.
	UserName string `json:"user_name"`
	// Time at which the maintenance time window starts.
	// Format: hh:mm:ss.
	MaintainBegin string `json:"maintain_begin"`
	// Time at which the maintenance time window ends.
	// Format: hh:mm:ss.
	MaintainEnd string `json:"maintain_end"`
	// An indicator of whether a DCS instance can be accessed in password-free mode.
	// true: indicates that a DCS instance can be accessed without a password.
	// false: indicates that a DCS instance can be accessed only after password authentication.
	NoPasswordAccess string `json:"no_password_access"`
	// Username used for accessing a DCS instance with password authentication.
	AccessUser string `json:"access_user"`
	// An indicator of whether public access is enabled for a DCS Redis instance. Options:
	EnablePublicIp bool `json:"enable_publicip"`
	// ID of the elastic IP address bound to a DCS Redis instance.
	// The parameter value is null if public access is disabled.
	PublicIpId string `json:"publicip_id"`
	// Elastic IP address bound to a DCS Redis instance.
	// The parameter value is null if public access is disabled.
	PublicIpAddress string `json:"publicip_address"`
	// An indicator of whether to enable SSL for public access to a DCS Redis instance.
	EnableSsl bool `json:"enable_ssl"`
	// An indicator of whether an upgrade task has been created for a DCS instance.
	ServiceUpgrade bool `json:"service_upgrade"`
	// Upgrade task ID.
	// If the value of service_upgrade is set to true, the value of this parameter is the ID of the upgrade task.
	// If the value of service_upgrade is set to false, the value of this parameter is empty.
	ServiceTaskId string `json:"service_task_id"`
	// Edition of DCS for Redis. Options:
	// generic: standard edition
	// libos: high-performance edition
	ProductType string `json:"product_type"`
	// CPU architecture. Options: x86_64 and aarch_64.
	CpuType string `json:"cpu_type"`
	// Memory type. Options: DRAM and SCM.
	StorageType string `json:"storage_type"`
	// DCS instance type. Options:
	// single: single-node
	// ha: master/standby
	// cluster: Redis Cluster
	// proxy: Proxy Cluster
	CacheMode string `json:"cache_mode"`
	// Time when the instance started running. 2022-07-06T09:32:16.502Z
	LaunchedAt string `json:"launched_at"`
	// AZ where a cache node resides. The value of this parameter in the response contains an AZ ID.
	AvailableZones []string `json:"available_zones"`
	// Subnet ID.
	SubnetID string `json:"subnet_id"`
	// Security group ID.
	SecurityGroupID string `json:"security_group_id"`
	// Backend address of a cluster instance.
	BackendAddrs string `json:"backend_addrs"`
	// Cloud service type code.
	CloudServiceTypeCode string `json:"cloud_service_type_code"`
	// Cloud resource type code.
	CloudResourceTypeCode string `json:"cloud_resource_type_code"`
	// Security group name.
	SecurityGroupName string `json:"security_group_name"`
	// Subnet name.
	SubnetName string `json:"subnet_name"`
	// Subnet segment.
	SubnetCIDR string `json:"subnet_cidr"`
	// Order ID.
	OrderID string `json:"order_id"`
	// Backup policy.
	// This parameter is available for master/standby and cluster DCS instances.
	InstanceBackupPolicy BackupPolicy `json:"instance_backup_policy"`
	// Instance tag key and value.
	Tags []tags.ResourceTag `json:"tags"`
	// Product specification code.
	SpecCode string `json:"spec_code"`
	// Domain name of the instance.
	DomainName string `json:"domain_name"`
	// Read-only domain name.
	ReadonlyDomainName string `json:"readonly_domain_name"`
	// Scenario where the instance is frozen.
	FreezeScene string `json:"freeze_scene"`
	// Update time. 2022-07-06T09:32:16.502Z
	UpdateAt string `json:"update_at"`
	// Task status.
	TaskStatus string `json:"task_status"`
	// Whether the instance is free of charge.
	IsFree bool `json:"is_free"`
	// AZs with available resources.
	AzCodes []string `json:"az_codes"`
	// Role in cross-region DR.
	CrrRole string `json:"crr_role"`
	// Product specification code.
	InQuerySpecCode string `json:"inquery_spec_code"`
	// Whether slow query logs are supported.
	SupportSlowLogFlag string `json:"support_slow_log_flag"`
	// IPv6 address.
	Ipv6 string `json:"ipv6"`
	// Whether IPv6 is enabled.
	EnableIpv6 bool `json:"enable_ipv6"`
	// Number of databases in the instance.
	DbNumber int `json:"db_number"`
	// Whether ACL is supported.
	SupportAcl bool `json:"support_acl"`
	// Task response.
	Task string `json:"task"`
	// Number of shards.
	ShardingCount int `json:"sharding_count"`
}

func Get

func Get(client *golangsdk.ServiceClient, id string) (*Instance, error)

Get a instance with detailed information by id

type InstanceBackupPolicy

type InstanceBackupPolicy struct {
	// Retention time.
	// Unit: day.
	// Range: 1–7.
	SaveDays int `json:"save_days"`
	// Backup type. Options:
	// auto: automatic backup.
	// manual: manual backup.
	BackupType string `json:"backup_type"`
	// Backup plan.
	PeriodicalBackupPlan PeriodicalBackupPlan `json:"periodical_backup_plan" required:"true"`
}

type ListDcsInstanceOpts

type ListDcsInstanceOpts struct {
	// Instance ID.
	Id string `q:"id"`
	// DCS instance name.
	Name string `q:"name"`
	// Number of DCS instances displayed on each page.
	// Minimum value: 1
	// Maximum value: 2000
	// If this parameter is left unspecified, a maximum of 1000 DCS instances are displayed on each page.
	Limit int `q:"limit"`
	// Start number for querying DCS instances. It cannot be lower than 1.
	// By default, the start number is 1.
	Start int `q:"start"`
	// DCS instance status.
	Status string `q:"status"`
	// An indicator of whether to perform an exact or fuzzy match based on instance name.
	// Options:
	// true: exact match
	// false: fuzzy match
	// Default value: false.
	IsExactMatchName bool `q:"isExactMatchName"`
	// IP address for connecting to the DCS instance
	Ip string `q:"ip"`
	// 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 (,).
	Tags map[string]string `q:"tags"`
}

type ListDcsResponse

type ListDcsResponse struct {
	// Array of DCS instance details.
	Instances []Instance `json:"instances"`
	// Number of DCS instances.
	TotalCount int `json:"instance_num"`
}

func List

func List(client *golangsdk.ServiceClient, opts ListDcsInstanceOpts) (*ListDcsResponse, error)

type PeriodicalBackupPlan

type PeriodicalBackupPlan struct {
	// Time at which backup starts.
	// "00:00-01:00" indicates that backup starts at 00:00:00.
	BeginAt string `json:"begin_at" required:"true"`
	// Interval at which backup is performed.
	// Currently, only weekly backup is supported.
	PeriodType string `json:"period_type" required:"true"`
	// Day in a week on which backup starts.
	// Range: 1–7. Where: 1 indicates Monday; 7 indicates Sunday.
	BackupAt []int `json:"backup_at" required:"true"`
	// Time zone in which backup is performed.
	// Value range: GMT–12:00 to GMT+12:00. If this parameter is left blank,
	// the current time zone of the DCS-Server VM is used by default.
	TimezoneOffset string `json:"timezone_offset,omitempty"`
}

type UpdateOpts

type UpdateOpts struct {
	// DCS instance name.
	// An instance name is a string of 4–64 characters
	// that contain letters, digits, underscores (_), and hyphens (-).
	// An instance name must start with letters.
	Name string `json:"name,omitempty"`
	// Brief description of the DCS instance.
	// A brief description supports up to 1024 characters.
	Description string `json:"description,omitempty"`
	// Backup policy.
	// This parameter is available for master/standby DCS instances.
	InstanceBackupPolicy *InstanceBackupPolicy `json:"instance_backup_policy,omitempty"`
	// Time at which the maintenance time window starts.
	// Format: HH:mm:ss
	MaintainBegin string `json:"maintain_begin,omitempty"`
	// Time at which the maintenance time window ends.
	// Format: HH:mm:ss
	MaintainEnd string `json:"maintain_end,omitempty"`
	// Security group ID.
	SecurityGroupID string `json:"security_group_id,omitempty"`
}

UpdateOpts is a struct which represents the parameters of update function

Jump to

Keyboard shortcuts

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