instances

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: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

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

Types

type CreateOpts added in v0.5.1

type CreateOpts struct {
	// Indicates the name of an instance.
	// An instance name starts with a letter,
	// consists of 4 to 64 characters, and supports
	// only letters, digits, and hyphens (-).
	Name string `json:"name" required:"true"`

	// Indicates the description of an instance.
	// It is a character string containing not more than 1024 characters.
	Description string `json:"description,omitempty"`

	// Indicates a message engine.
	// Currently, only kafka is supported.
	Engine string `json:"engine" required:"true"`

	// Indicates the version of a message engine.
	EngineVersion string `json:"engine_version" required:"true"`

	// Indicates the message storage space.
	StorageSpace int `json:"storage_space" required:"true"`

	// Indicates the password of an instance.
	// An instance password must meet the following complexity requirements:
	// Must be 6 to 32 characters long.
	// Must contain at least two of the following character types:
	// Lowercase letters
	// Uppercase letters
	// Digits
	// Special characters (`~!@#$%^&*()-_=+\|[{}]:'",<.>/?)
	Password string `json:"password,omitempty"`

	// Indicates a username.
	// A username consists of 1 to 64 characters
	// and supports only letters, digits, and hyphens (-).
	AccessUser string `json:"access_user,omitempty"`

	// Indicates the ID of a VPC.
	VpcID string `json:"vpc_id" required:"true"`

	// Indicates the ID of a security group.
	SecurityGroupID string `json:"security_group_id" required:"true"`

	// Indicates the ID of a subnet.
	SubnetID string `json:"subnet_id" required:"true"`

	// Indicates the ID of an AZ.
	// The parameter value can be left blank or an empty array.
	AvailableZones []string `json:"available_zones" required:"true"`

	// Indicates a product ID.
	ProductID string `json:"product_id" required:"true"`

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

	// This parameter is mandatory when a Kafka instance is created.
	// Indicates the maximum number of topics in a Kafka instance.
	PartitionNum int `json:"partition_num,omitempty"`

	// Indicates whether to enable SSL-encrypted access.
	SslEnable bool `json:"ssl_enable,omitempty"`

	// Indicates whether to enable public access for the instance.
	EnablePublicIp *bool `json:"enable_publicip,omitempty"`

	// Indicates the public network bandwidth. Unit: Mbit/s
	PublicBandwidth string `json:"public_bandwidth,omitempty"`

	// This parameter is mandatory if the engine is kafka.
	// Indicates the baseline bandwidth of a Kafka instance, that is,
	// the maximum amount of data transferred per unit time. Unit: Mbit/s.
	Specification string `json:"specification,omitempty"`

	// Indicates the action to be taken when the memory usage reaches the disk capacity threshold.
	// Options:
	// produce_reject: New messages cannot be created.
	// time_base: The earliest messages are deleted.
	RetentionPolicy string `json:"retention_policy,omitempty"`

	// Indicates the storage I/O specification. For details on how to select a disk type
	StorageSpecCode string `json:"storage_spec_code,omitempty"`
}

CreateOpts is a struct that contains all the parameters.

func (CreateOpts) ToInstanceCreateMap added in v0.5.1

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

ToInstanceCreateMap is used for type convert

type CreateOptsBuilder added in v0.5.1

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

CreateOptsBuilder 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, opts CreateOptsBuilder) (r CreateResult)

Create an instance with given parameters.

func (CreateResult) Extract

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

Extract from CreateResult

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 DmsPage

type DmsPage struct {
	pagination.SinglePageBase
}

func (DmsPage) IsEmpty

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

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 an 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"`
	EngineVersion     string   `json:"engine_version"`
	Specification     string   `json:"specification"`
	StorageSpace      int      `json:"storage_space"`
	PartitionNum      string   `json:"partition_num"`
	UsedStorageSpace  int      `json:"used_storage_space"`
	ConnectAddress    string   `json:"connect_address"`
	Port              int      `json:"port"`
	Status            string   `json:"status"`
	Description       string   `json:"description"`
	InstanceID        string   `json:"instance_id"`
	ResourceSpecCode  string   `json:"resource_spec_code"`
	Type              string   `json:"type"`
	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"`
	UserID            string   `json:"user_id"`
	UserName          string   `json:"user_name"`
	AccessUser        string   `json:"access_user"`
	TotalStorageSpace int      `json:"total_storage_space"`
	StorageResourceID string   `json:"storage_resource_id"`
	StorageSpecCode   string   `json:"storage_spec_code"`
	RetentionPolicy   string   `json:"retention_policy"`
	KafkaPublicStatus string   `json:"kafka_public_status"`
	PublicBandwidth   int      `json:"public_bandwidth"`
	SslEnable         bool     `json:"ssl_enable"`
	ServiceType       string   `json:"service_type"`
	StorageType       string   `json:"storage_type"`
	OrderID           string   `json:"order_id"`
	MaintainBegin     string   `json:"maintain_begin"`
	MaintainEnd       string   `json:"maintain_end"`
}

Instance response

type InstanceCreate

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

InstanceCreate response

type ListDmsBuilder

type ListDmsBuilder interface {
	ToDmsListDetailQuery() (string, error)
}

type ListDmsInstanceOpts

type ListDmsInstanceOpts struct {
	Id                  string `q:"id"`
	Name                string `q:"name"`
	Engine              string `q:"engine"`
	Status              string `q:"status"`
	IncludeFailure      string `q:"includeFailure"`
	ExactMatchName      string `q:"exactMatchName"`
	EnterpriseProjectID int    `q:"enterprise_project_id"`
}

func (ListDmsInstanceOpts) ToDmsListDetailQuery

func (opts ListDmsInstanceOpts) ToDmsListDetailQuery() (string, error)

type ListDmsResponse

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

func ExtractDmsInstances

func ExtractDmsInstances(r pagination.Page) (*ListDmsResponse, error)

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

type UpdateOpts

type UpdateOpts struct {
	// Indicates the name of an instance.
	// An instance name starts with a letter,
	// consists of 4 to 64 characters,
	// and supports only letters, digits, and hyphens (-).
	Name string `json:"name,omitempty"`

	// Indicates the description of an instance.
	// It is a character string containing not more than 1024 characters.
	Description *string `json:"description,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"`

	// Indicates the ID of a security group.
	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 parameter of update function

type UpdateResult

type UpdateResult struct {
	golangsdk.ErrResult
}

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