instances

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

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

Types

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.
	// A brief description supports up to 1024 characters.
	Description string `json:"description,omitempty"`

	// Cache engine, which is Redis.
	Engine string `json:"engine" required:"true"`

	// Cache engine version, which is 3.0.7.
	EngineVersion string `json:"engine_version"`

	// Unit: GB.
	// For a DCS Redis instance in single-node or master/standby mode,
	// the cache capacity can be 2 GB, 4 GB, 8 GB, 16 GB, 32 GB, or 64 GB.
	// For a DCS Redis instance in cluster mode, the cache capacity can be
	// 64, 128, 256, 512, or 1024 GB.
	Capacity int `json:"capacity" required:"true"`

	// Indicate if no password visit cache instance is allowed.
	NoPasswordAccess string `json:"no_password_access,omitempty"`

	// Password of a DCS instance.
	// The password of a DCS Redis instance must meet
	// the following complexity requirements:
	// A string of 6–32 characters.
	// Contains at least two of the following character types:
	// Uppercase letters
	// Lowercase letters
	// Digits
	// Special characters, such as `~!@#$%^&*()-_=+\|[{}]:'",<.>/?
	Password string `json:"password,omitempty"`

	// When NoPasswordAccess is flase, the AccessUser is enabled.
	AccessUser string `json:"access_user,omitempty"`

	// Tenant's VPC ID.
	VPCID string `json:"vpc_id" required:"true"`

	// Tenant's security group ID.
	SecurityGroupID string `json:"security_group_id,omitempty"`

	// Subnet ID.
	SubnetID string `json:"subnet_id" required:"true"`

	// IDs of the AZs where cache nodes reside.
	// In the current version, only one AZ ID can be set in the request.
	AvailableZones []string `json:"available_zones" required:"true"`

	// Product ID used to differentiate DCS instance types.
	ProductID string `json:"product_id" required:"true"`

	// Backup policy.
	// This parameter is available for master/standby DCS instances.
	InstanceBackupPolicy *InstanceBackupPolicy `json:"instance_backup_policy,omitempty"`

	// Indicates the time at which a maintenance time window starts.
	// Format: HH:mm:ss
	MaintainBegin string `json:"maintain_begin,omitempty"`

	// Indicates the time at which a maintenance time window ends.
	// Format: HH:mm:ss
	MaintainEnd string `json:"maintain_end,omitempty"`
}

CreateOps is a struct that contains all the parameters.

func (CreateOps) ToInstanceCreateMap

func (ops CreateOps) ToInstanceCreateMap() (map[string]interface{}, error)

ToInstanceCreateMap is used for type convert

type CreateOpsBuilder

type CreateOpsBuilder interface {
	ToInstanceCreateMap() (map[string]interface{}, error)
}

CreateOpsBuilder is used for creating instance parameters. any struct providing the parameters should implement this interface

type CreateResult

type CreateResult struct {
	golangsdk.Result
}

CreateResult is a struct that contains all the return parameters of creation

func Create

func Create(client *golangsdk.ServiceClient, ops CreateOpsBuilder) (r CreateResult)

Create an instance with given parameters.

func (CreateResult) Extract

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

Extract from CreateResult

type DcsPage

type DcsPage struct {
	pagination.SinglePageBase
}

func (DcsPage) IsEmpty

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

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

DeleteResult is a struct which contains the result of deletion

func Delete

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

Delete an instance by id

type ExtendOpts

type ExtendOpts struct {
	// New specifications (memory space) of the DCS instance.
	// The new specification value to which the DCS instance
	// will be scaled up must be greater than the current specification value.
	// Unit: GB.
	NewCapacity int `json:"new_capacity" required:"true"`

	// New order ID.
	OrderID string `json:"order_id,omitempty"`
}

ExtendOpts is a struct which represents the parameters of extend function

func (ExtendOpts) ToExtendMap

func (opts ExtendOpts) ToExtendMap() (map[string]interface{}, error)

ToExtendMap is used for type convert

type ExtendOptsBuilder

type ExtendOptsBuilder interface {
	ToExtendMap() (map[string]interface{}, error)
}

ExtendOptsBuilder is an interface which can build the map paramter of extend function

type ExtendResult

type ExtendResult struct {
	golangsdk.Result
}

ExtendResult is a struct from which can get the result of extend method

func Extend

func Extend(client *golangsdk.ServiceClient, id string, opts ExtendOptsBuilder) (r ExtendResult)

Extend is extending for a dcs instance

type GetResult

type GetResult struct {
	golangsdk.Result
}

GetResult contains the body of getting detailed

func Get

func Get(client *golangsdk.ServiceClient, id string) (r GetResult)

Get a instance with detailed information by id

func (GetResult) Extract

func (r GetResult) Extract() (*Instance, error)

Extract from GetResult

type Instance

type Instance struct {
	Name                 string               `json:"name"`
	Engine               string               `json:"engine"`
	Capacity             int                  `json:"capacity"`
	IP                   string               `json:"ip"`
	Port                 int                  `json:"port"`
	Status               string               `json:"status"`
	Description          string               `json:"description"`
	InstanceID           string               `json:"instance_id"`
	ResourceSpecCode     string               `json:"resource_spec_code"`
	EngineVersion        string               `json:"engine_version"`
	InternalVersion      string               `json:"internal_version"`
	ChargingMode         int                  `json:"charging_mode"`
	VPCID                string               `json:"vpc_id"`
	VPCName              string               `json:"vpc_name"`
	CreatedAt            string               `json:"created_at"`
	ErrorCode            string               `json:"error_code"`
	ProductID            string               `json:"product_id"`
	SecurityGroupID      string               `json:"security_group_id"`
	SecurityGroupName    string               `json:"security_group_name"`
	SubnetID             string               `json:"subnet_id"`
	SubnetName           string               `json:"subnet_name"`
	SubnetCIDR           string               `json:"subnet_cidr"`
	AvailableZones       []string             `json:"available_zones"`
	MaxMemory            int                  `json:"max_memory"`
	UsedMemory           int                  `json:"used_memory"`
	InstanceBackupPolicy InstanceBackupPolicy `json:"instance_backup_policy"`
	UserID               string               `json:"user_id"`
	UserName             string               `json:"user_name"`
	OrderID              string               `json:"order_id"`
	MaintainBegin        string               `json:"maintain_begin"`
	MaintainEnd          string               `json:"maintain_end"`
	NoPasswordAccess     string               `json:"no_password_access"`
	AccessUser           string               `json:"access_user"`
}

Instance response

type InstanceBackupPolicy

type InstanceBackupPolicy struct {
	// Retention time.
	// Unit: day.
	// Range: 1–7.
	SaveDays int `json:"save_days" required:"true"`

	// Backup type. Options:
	// auto: automatic backup.
	// manual: manual backup.
	BackupType string `json:"backup_type" required:"true"`

	// Backup plan.
	PeriodicalBackupPlan PeriodicalBackupPlan `json:"periodical_backup_plan" required:"true"`
}

InstanceBackupPolicy for dcs

type InstanceCreate

type InstanceCreate struct {
	InstanceID string `json:"instance_id"`
}

InstanceCreate response

type ListDcsBuilder

type ListDcsBuilder interface {
	ToDcsListDetailQuery() (string, error)
}

type ListDcsInstanceOpts

type ListDcsInstanceOpts 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 (ListDcsInstanceOpts) ToDcsListDetailQuery

func (opts ListDcsInstanceOpts) ToDcsListDetailQuery() (string, error)

type ListDcsResponse

type ListDcsResponse struct {
	Instances  []Instance `json:"instances"`
	TotalCount int        `json:"instance_num"`
}

func ExtractDcsInstances

func ExtractDcsInstances(r pagination.Page) (ListDcsResponse, error)

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

type Password

type Password struct {
	// Whether the password is successfully changed:
	// Values:
	// Success: The password is successfully changed.
	// passwordFailed: The old password is incorrect.
	// Locked: This account has been locked.
	// Failed: Failed to change the password.
	Result         string `json:"result"`
	Message        string `json:"message"`
	RetryTimesLeft string `json:"retry_times_left"`
	LockTime       string `json:"lock_time"`
	LockTimesLeft  string `json:"lock_time_left"`
}

Password response

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

PeriodicalBackupPlan for dcs

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

func (UpdateOpts) ToInstanceUpdateMap

func (opts UpdateOpts) ToInstanceUpdateMap() (map[string]interface{}, error)

ToInstanceUpdateMap is used for type convert

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToInstanceUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder is an interface which can build the map paramter of update function

type UpdatePasswordOpts

type UpdatePasswordOpts struct {
	// Old password. It may be empty.
	OldPassword string `json:"old_password" required:"true"`

	// New password.
	// Password complexity requirements:
	// A string of 6–32 characters.
	// Must be different from the old password.
	// Contains at least two types of the following characters:
	// Uppercase letters
	// Lowercase letters
	// Digits
	// Special characters `~!@#$%^&*()-_=+\|[{}]:'",<.>/?
	NewPassword string `json:"new_password" required:"true"`
}

UpdatePasswordOpts is a struct which represents the parameters of update function

func (UpdatePasswordOpts) ToPasswordUpdateMap

func (opts UpdatePasswordOpts) ToPasswordUpdateMap() (map[string]interface{}, error)

ToPasswordUpdateMap is used for type convert

type UpdatePasswordOptsBuilder

type UpdatePasswordOptsBuilder interface {
	ToPasswordUpdateMap() (map[string]interface{}, error)
}

UpdatePasswordOptsBuilder is an interface which can build the map paramter of update password function

type UpdatePasswordResult

type UpdatePasswordResult struct {
	golangsdk.Result
}

UpdatePasswordResult is a struct from which can get the result of update password method

func UpdatePassword

func UpdatePassword(client *golangsdk.ServiceClient, id string, opts UpdatePasswordOptsBuilder) (r UpdatePasswordResult)

UpdatePassword is updating password for a dcs instance

func (UpdatePasswordResult) Extract

func (r UpdatePasswordResult) Extract() (*Password, error)

Extract from UpdatePasswordResult

type UpdateResult

type UpdateResult struct {
	golangsdk.Result
}

UpdateResult is a struct from which can get the result of update method

func Update

func Update(client *golangsdk.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

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

Jump to

Keyboard shortcuts

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