instances

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

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

Types

type BackupStrategy

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

type BackupStrategyOpt

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

type ChargeInfo

type ChargeInfo struct {
	ChargeMode  string `json:"charge_mode" required:"true"`
	PeriodType  string `json:"period_type,omitempty"`
	PeriodNum   int    `json:"period_num,omitempty"`
	IsAutoRenew bool   `json:"is_auto_renew,omitempty"`
	IsAutoPay   bool   `json:"is_auto_pay,omitempty"`
}

type Configuration

type Configuration struct {
	Type string `json:"type" required:"true"`
	Id   string `json:"configuration_id" required:"true"`
}

type CreateInstanceBuilder

type CreateInstanceBuilder interface {
	ToInstancesCreateMap() (map[string]interface{}, error)
}

type CreateOpts

type CreateOpts struct {
	Name                string          `json:"name"  required:"true"`
	DataStore           DataStore       `json:"datastore" required:"true"`
	Region              string          `json:"region" required:"true"`
	AvailabilityZone    string          `json:"availability_zone" required:"true"`
	VpcId               string          `json:"vpc_id" required:"true"`
	SubnetId            string          `json:"subnet_id" required:"true"`
	SecurityGroupId     string          `json:"security_group_id" required:"true"`
	Password            string          `json:"password" required:"true"`
	Port                string          `json:"port,omitempty"`
	DiskEncryptionId    string          `json:"disk_encryption_id,omitempty"`
	Ssl                 string          `json:"ssl_option,omitempty"`
	Mode                string          `json:"mode" required:"true"`
	Configuration       []Configuration `json:"configurations,omitempty"`
	Flavor              []Flavor        `json:"flavor" required:"true"`
	BackupStrategy      BackupStrategy  `json:"backup_strategy,omitempty"`
	EnterpriseProjectID string          `json:"enterprise_project_id,omitempty"`
	ChargeInfo          *ChargeInfo     `json:"charge_info,omitempty"`
}

func (CreateOpts) ToInstancesCreateMap

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

type CreateResult

type CreateResult struct {
	// contains filtered or unexported fields
}

func Create

func Create(client *golangsdk.ServiceClient, opts CreateInstanceBuilder) (r CreateResult)

func (CreateResult) Extract

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

type DataStore

type DataStore struct {
	Type          string `json:"type" required:"true"`
	Version       string `json:"version" required:"true"`
	StorageEngine string `json:"storage_engine" required:"true"`
}

type DeleteInstance

type DeleteInstance struct {
	InstanceId string `json:"instance_id" required:"true"`
}

func (DeleteInstance) ToInstancesDeleteMap

func (opts DeleteInstance) ToInstancesDeleteMap() (map[string]interface{}, error)

type DeleteInstanceBuilder

type DeleteInstanceBuilder interface {
	ToInstancesDeleteMap() (map[string]interface{}, error)
}

type DeleteInstanceResponse

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

type DeleteInstanceResult

type DeleteInstanceResult struct {
	// contains filtered or unexported fields
}

func Delete

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

func (DeleteInstanceResult) Extract

type Flavor

type Flavor struct {
	Type     string `json:"type" required:"true"`
	Num      int    `json:"num" required:"true"`
	Storage  string `json:"storage,omitempty"`
	Size     int    `json:"size,omitempty"`
	SpecCode string `json:"spec_code" required:"true"`
}

type FlavorOpt

type FlavorOpt struct {
	Type     string `json:"type" required:"true"`
	Num      string `json:"num" required:"true"`
	Storage  string `json:"storage,omitempty"`
	Size     string `json:"size,omitempty"`
	SpecCode string `json:"spec_code" required:"true"`
}

type Group

type Group struct {
	Type   string  `json:"type"`
	Id     string  `json:"id"`
	Name   string  `json:"name"`
	Status string  `json:"status"`
	Volume Volume  `json:"volume"`
	Nodes  []Nodes `json:"nodes"`
}

type Instance

type Instance struct {
	OrderId             string            `json:"order_id"`
	Id                  string            `json:"id"`
	Name                string            `json:"name"`
	DataStore           DataStore         `json:"datastore"`
	Status              string            `json:"status"`
	Region              string            `json:"region"`
	AvailabilityZone    string            `json:"availability_zone"`
	VpcId               string            `json:"vpc_id"`
	SubnetId            string            `json:"subnet_id"`
	SecurityGroupId     string            `json:"security_group_id"`
	DiskEncryptionId    string            `json:"disk_encryption_id"`
	Ssl                 string            `json:"ssl_option"`
	Mode                string            `json:"mode"`
	Flavor              []FlavorOpt       `json:"flavor"`
	BackupStrategy      BackupStrategyOpt `json:"backup_strategy"`
	EnterpriseProjectID string            `json:"enterprise_project_id"`
}

type InstancePage

type InstancePage struct {
	pagination.SinglePageBase
}

func (InstancePage) IsEmpty

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

type InstanceResponse

type InstanceResponse struct {
	Id                  string         `json:"id"`
	Name                string         `json:"name"`
	Status              string         `json:"status"`
	Port                string         `json:"port"`
	Mode                string         `json:"mode"`
	Region              string         `json:"region"`
	DataStore           DataStore      `json:"datastore"`
	Engine              string         `json:"engine"`
	Created             string         `json:"created"`
	Updated             string         `json:"updated"`
	DbUserName          string         `json:"db_user_name"`
	Ssl                 int            `json:"ssl"`
	VpcId               string         `json:"vpc_id"`
	SubnetId            string         `json:"subnet_id"`
	SecurityGroupId     string         `json:"security_group_id"`
	BackupStrategy      BackupStrategy `json:"backup_strategy"`
	MaintenanceWindow   string         `json:"maintenance_window"`
	Groups              []Group        `json:"groups"`
	DiskEncryptionId    string         `json:"disk_encryption_id"`
	TimeZone            string         `json:"time_zone"`
	Actions             []string       `json:"actions"`
	EnterpriseProjectID string         `json:"enterprise_project_id"`
}

type ListInstanceBuilder

type ListInstanceBuilder interface {
	ToInstanceListDetailQuery() (string, error)
}

type ListInstanceOpts

type ListInstanceOpts struct {
	Id            string `q:"id"`
	Name          string `q:"name"`
	Mode          string `q:"mode"`
	DataStoreType string `q:"datastore_type"`
	VpcId         string `q:"vpc_id"`
	SubnetId      string `q:"subnet_id"`
	Offset        int    `q:"offset"`
	Limit         int    `q:"limit"`
}

func (ListInstanceOpts) ToInstanceListDetailQuery

func (opts ListInstanceOpts) ToInstanceListDetailQuery() (string, error)

type ListInstanceResponse

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

func ExtractInstances

func ExtractInstances(r pagination.Page) (ListInstanceResponse, error)

type ListInstanceResult

type ListInstanceResult struct {
	// contains filtered or unexported fields
}

type Nodes

type Nodes struct {
	Id               string `json:"id"`
	Name             string `json:"name"`
	Status           string `json:"status"`
	Role             string `json:"role"`
	PrivateIP        string `json:"private_ip"`
	PublicIP         string `json:"public_ip"`
	SpecCode         string `json:"spec_code"`
	AvailabilityZone string `json:"availability_zone"`
}

type PortOpts

type PortOpts struct {
	Port int `json:"port"`
}

PortOpts is the structure required by the UpdatePort method to modify the database access port.

type PortUpdateResp

type PortUpdateResp struct {
	// Job ID.
	JobId string `json:"job_id"`
	// Database access port.
	Port int `json:"port"`
}

PortUpdateResp is the structure that represents the detail of the database user.

func UpdatePort

func UpdatePort(c *golangsdk.ServiceClient, instanceId string, port int) (*PortUpdateResp, error)

UpdatePort is a method to update the database access port using given parameters.

type SpecOpts

type SpecOpts struct {
	TargetType     string `json:"target_type,omitempty"`
	TargetID       string `json:"target_id" required:"true"`
	TargetSpecCode string `json:"target_spec_code" required:"true"`
}

type UpdateInstanceResult

type UpdateInstanceResult struct {
	// contains filtered or unexported fields
}

func Update

func Update(client *golangsdk.ServiceClient, instanceId string, opts []UpdateOpt) (r UpdateInstanceResult)

func (UpdateInstanceResult) Extract

func (r UpdateInstanceResult) Extract() (*UpdateResp, error)

type UpdateNodeNumOpts

type UpdateNodeNumOpts struct {
	Type      string      `json:"type" required:"true"`
	SpecCode  string      `json:"spec_code" required:"true"`
	Num       int         `json:"num" required:"true"`
	Volume    *VolumeOpts `json:"volume,omitempty"`
	IsAutoPay bool        `json:"is_auto_pay,omitempty"`
}

type UpdateOpt

type UpdateOpt struct {
	Param  string
	Value  interface{}
	Action string
	Method string
}

UpdateOpt defines the basic information for update APIs URI: <Method> base_url/<Action> Request body: {<Param>: <Value>} the supported value for Method including: "post" and "put"

type UpdateResp

type UpdateResp struct {
	JobId   string `json:"job_id"`
	OrderId string `json:"order_id"`
}

type UpdateSpecOpts

type UpdateSpecOpts struct {
	Resize    SpecOpts `json:"resize" required:"true"`
	IsAutoPay bool     `json:"is_auto_pay,omitempty"`
}

type UpdateVolumeOpts

type UpdateVolumeOpts struct {
	Volume    VolumeOpts `json:"volume" required:"true"`
	IsAutoPay bool       `json:"is_auto_pay,omitempty"`
}

type Volume

type Volume struct {
	Size string `json:"size"`
	Used string `json:"used"`
}

type VolumeOpts

type VolumeOpts struct {
	GroupID string `json:"group_id,omitempty"`
	Size    *int   `json:"size,omitempty"`
}

Jump to

Keyboard shortcuts

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