cloudservers

package
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListDetail

func ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

ListDetail makes a request against the API to list servers accessible to you.

Types

type Address

type Address struct {
	Version string `json:"version"`
	Addr    string `json:"addr"`
	MacAddr string `json:"OS-EXT-IPS-MAC:mac_addr"`
	PortID  string `json:"OS-EXT-IPS:port_id"`
	Type    string `json:"OS-EXT-IPS:type"`
}

type BatchChangeOpts

type BatchChangeOpts struct {
	AdminPass string    `json:"adminpass,omitempty"`
	KeyName   string    `json:"keyname,omitempty"`
	UserID    string    `json:"userid,omitempty"`
	ImageID   string    `json:"imageid" required:"true"`
	Servers   []Server  `json:"servers" required:"true"`
	MetaData  *MetaData `json:"metadata,omitempty"`
}

BatchChangeOpts defining the configuration to batch change OS of servers

func (BatchChangeOpts) ToServerBatchChangeMap

func (opts BatchChangeOpts) ToServerBatchChangeMap() (map[string]interface{}, error)

ToServerBatchChangeMap builds a request body from BatchChangeOpts.

type BatchChangeOptsBuilder

type BatchChangeOptsBuilder interface {
	// Returns value that can be passed to json.Marshal
	ToServerBatchChangeMap() (map[string]interface{}, error)
}

BatchChangeOptsBuilder allows extensions to add additional parameters to the BatchChangeOpts request.

type BatchChangeResult

type BatchChangeResult struct {
	gophercloud.Result
}

BatchChangeResult defining the result struct of batch change OS function.

func BatchChangeOS

func BatchChangeOS(client *gophercloud.ServiceClient, opts BatchChangeOptsBuilder) (r BatchChangeResult)

BatchChangeOS batch change OS of servers based on the configuration defined in the BatchChangeOpts struct.

func (BatchChangeResult) ExtractJob

func (r BatchChangeResult) ExtractJob() (*Job, error)

ExtractJob defining the result of batch change OS function by extracting job.

type BatchOperateError

type BatchOperateError struct {
	BasicError    errorObj      `json:"error"`
	InternalError []internalErr `json:"internalError"`
}

func (BatchOperateError) Error

func (e BatchOperateError) Error() string

Error,Implement the Error() interface.

func (BatchOperateError) ErrorCode

func (e BatchOperateError) ErrorCode() string

ErrorCode,Error code converted to string type.

func (BatchOperateError) Message

func (e BatchOperateError) Message() string

Message,Return error message.

type BatchRebootOpts

type BatchRebootOpts struct {
	// Type is the type of reboot to perform on the server.
	Type    Type     `json:"type" required:"true"`
	Servers []Server `json:"servers" required:"true"`
}

BatchRebootOpts defining the configuration to batch reboot servers

func (BatchRebootOpts) ToServerBatchRebootMap

func (opts BatchRebootOpts) ToServerBatchRebootMap() (map[string]interface{}, error)

ToServerBatchRebootMap builds a request body from BatchRebootOpts.

type BatchRebootOptsBuilder

type BatchRebootOptsBuilder interface {
	// Returns value that can be passed to json.Marshal
	ToServerBatchRebootMap() (map[string]interface{}, error)
}

BatchRebootOptsBuilder allows extensions to add additional parameters to the BatchRebootOpts request.

type BatchStartOpts

type BatchStartOpts struct {
	Servers []Server `json:"servers" required:"true"`
}

BatchStartOpts defining the configuration to batch start servers

func (BatchStartOpts) ToServerBatchStartMap

func (opts BatchStartOpts) ToServerBatchStartMap() (map[string]interface{}, error)

ToServerBatchStartMap builds a request body from BatchStartOpts.

type BatchStartOptsBuilder

type BatchStartOptsBuilder interface {
	// Returns value that can be passed to json.Marshal
	ToServerBatchStartMap() (map[string]interface{}, error)
}

BatchStartOptsBuilder allows extensions to add additional parameters to the BatchStartOpts request.

type BatchStopOpts

type BatchStopOpts struct {
	// Type is the type of stop to perform on the server.
	Type    Type     `json:"type,omitempty"`
	Servers []Server `json:"servers" required:"true"`
}

BatchStopOpts defining the configuration to batch stop servers

func (BatchStopOpts) ToServerBatchStopMap

func (opts BatchStopOpts) ToServerBatchStopMap() (map[string]interface{}, error)

ToServerBatchStopMap builds a request body from BatchStopOpts.

type BatchStopOptsBuilder

type BatchStopOptsBuilder interface {
	// Returns value that can be passed to json.Marshal
	ToServerBatchStopMap() (map[string]interface{}, error)
}

BatchStopOptsBuilder allows extensions to add additional parameters to the BatchStopOpts request.

type BatchTagCreateOpts

type BatchTagCreateOpts struct {
	Tags []TagCreate `json:"tags" required:"true"`
}

BatchTagCreateOpts defining the configuration for batch server tags action

func (BatchTagCreateOpts) ToTagBatchCreateMap

func (opts BatchTagCreateOpts) ToTagBatchCreateMap() (map[string]interface{}, error)

ToTagBatchCreateMap builds a request body from BatchTagActionOpts.

type BatchTagCreateOptsBuilder

type BatchTagCreateOptsBuilder interface {
	// Returns value that can be passed to json.Marshal
	ToTagBatchCreateMap() (map[string]interface{}, error)
}

BatchTagCreateOptsBuilder allows extensions to add additional parameters to the BatchTagActionOpts request.

type BatchTagDeleteOpts

type BatchTagDeleteOpts struct {
	Tags []TagDelete `json:"tags" required:"true"`
}

BatchTagDeleteOpts defining the configuration for batch server tags action

func (BatchTagDeleteOpts) ToTagBatchDeleteMap

func (opts BatchTagDeleteOpts) ToTagBatchDeleteMap() (map[string]interface{}, error)

ToTagBatchDeleteMap builds a request body from BatchTagActionOpts.

type BatchTagDeleteOptsBuilder

type BatchTagDeleteOptsBuilder interface {
	// Returns value that can be passed to json.Marshal
	ToTagBatchDeleteMap() (map[string]interface{}, error)
}

BatchTagDeleteOptsBuilder allows extensions to add additional parameters to the BatchTagActionOpts request.

type BatchUpdateOpts

type BatchUpdateOpts struct {
	Name    string   `json:"name" required:"true"`
	DryRun  bool     `json:"dry_run,omitempty"`
	Servers []Server `json:"servers" required:"true"`
}

BatchUpdateOpts defining the configuration to batch update servers

func (BatchUpdateOpts) ToServerBatchUpdateMap

func (opts BatchUpdateOpts) ToServerBatchUpdateMap() (map[string]interface{}, error)

ToServerBatchUpdateMap builds a request body from BatchUpdateOpts.

type BatchUpdateOptsBuilder

type BatchUpdateOptsBuilder interface {
	// Returns value that can be passed to json.Marshal
	ToServerBatchUpdateMap() (map[string]interface{}, error)
}

BatchUpdateOptsBuilder allows extensions to add additional parameters to the BatchUpdateOpts request.

type BatchUpdateResp

type BatchUpdateResp struct {
	Response []ServerID `json:"response"`
}

BatchUpdateResp defines struct of batch update response.

type BatchUpdateResult

type BatchUpdateResult struct {
	gophercloud.Result
}

BatchUpdateResult defining the result struct of batch updating.

func BatchUpdate

func BatchUpdate(client *gophercloud.ServiceClient, opts BatchUpdateOpts) (r BatchUpdateResult)

BatchUpdate makes a request against the API to batch update servers.

func (BatchUpdateResult) ExtractBatchUpdate

func (r BatchUpdateResult) ExtractBatchUpdate() (BatchUpdateResp, error)

ExtractBatchUpdate defining the result by extracting response.

type CloudServer

type CloudServer struct {
	Status              string               `json:"status"`
	Updated             time.Time            `json:"updated"`
	HostID              string               `json:"hostId"`
	Addresses           map[string][]Address `json:"addresses"`
	ID                  string               `json:"id"`
	Name                string               `json:"name"`
	AccessIPv4          string               `json:"accessIPv4"`
	AccessIPv6          string               `json:"accessIPv6"`
	Created             time.Time            `json:"created"`
	Tags                []string             `json:"tags"`
	Description         string               `json:"description"`
	Locked              *bool                `json:"locked"`
	ConfigDrive         string               `json:"config_drive"`
	TenantID            string               `json:"tenant_id"`
	UserID              string               `json:"user_id"`
	HostStatus          string               `json:"host_status"`
	EnterpriseProjectID string               `json:"enterprise_project_id"`
	SysTags             []SysTags            `json:"sys_tags"`
	Flavor              Flavor               `json:"flavor"`
	Metadata            Metadata             `json:"metadata"`
	SecurityGroups      []SecurityGroups     `json:"security_groups"`
	KeyName             string               `json:"key_name"`
	Image               Image                `json:"image"`
	Progress            *int                 `json:"progress"`
	PowerState          *int                 `json:"OS-EXT-STS:power_state"`
	VMState             string               `json:"OS-EXT-STS:vm_state"`
	TaskState           string               `json:"OS-EXT-STS:task_state"`
	DiskConfig          string               `json:"OS-DCF:diskConfig"`
	AvailabilityZone    string               `json:"OS-EXT-AZ:availability_zone"`
	LaunchedAt          string               `json:"OS-SRV-USG:launched_at"`
	TerminatedAt        string               `json:"OS-SRV-USG:terminated_at"`
	RootDeviceName      string               `json:"OS-EXT-SRV-ATTR:root_device_name"`
	RamdiskID           string               `json:"OS-EXT-SRV-ATTR:ramdisk_id"`
	KernelID            string               `json:"OS-EXT-SRV-ATTR:kernel_id"`
	LaunchIndex         *int                 `json:"OS-EXT-SRV-ATTR:launch_index"`
	ReservationID       string               `json:"OS-EXT-SRV-ATTR:reservation_id"`
	Hostname            string               `json:"OS-EXT-SRV-ATTR:hostname"`
	UserData            string               `json:"OS-EXT-SRV-ATTR:user_data"`
	Host                string               `json:"OS-EXT-SRV-ATTR:host"`
	InstanceName        string               `json:"OS-EXT-SRV-ATTR:instance_name"`
	HypervisorHostname  string               `json:"OS-EXT-SRV-ATTR:hypervisor_hostname"`
	VolumeAttached      []VolumeAttached     `json:"os-extended-volumes:volumes_attached"`
	OsSchedulerHints    OsSchedulerHints     `json:"os:scheduler_hints"`
}

CloudServer is only used for method that requests details on a single server, by ID. Because metadata struct must be a map.

type CloudServerDetail

type CloudServerDetail struct {
	Servers []NewCloudServer `json:"servers"`
	Count   int              `json:"count"`
}

CloudServerDetail defines struct of server detail list result.

func ExtractCloudServers

func ExtractCloudServers(r pagination.Page) (CloudServerDetail, error)

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

type CloudServerPage

type CloudServerPage struct {
	pagination.OffsetPage
}

CloudServerPage is a pagination.Pager that is returned from a call to the List function.

func (CloudServerPage) IsEmpty

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

IsEmpty returns true if a ListResult contains no services.

type ErrResult

type ErrResult struct {
	gophercloud.ErrResult
}

func BatchCreateServerTags

func BatchCreateServerTags(client *gophercloud.ServiceClient, serverID string, opts BatchTagCreateOptsBuilder) (r ErrResult)

BatchCreateServerTags requests to batch create server tags

func BatchDeleteServerTags

func BatchDeleteServerTags(client *gophercloud.ServiceClient, serverID string, opts BatchTagDeleteOptsBuilder) (r ErrResult)

BatchDeleteServerTags requests to batch delete server tags

func ConfigServerRecovery

func ConfigServerRecovery(client *gophercloud.ServiceClient, serverID string, opts string) (r ErrResult)

type Flavor

type Flavor struct {
	Disk  string `json:"disk"`
	Vcpus string `json:"vcpus"`
	RAM   string `json:"ram"`
	ID    string `json:"id"`
	Name  string `json:"name"`
}

type GetResult

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

GetResult is the response from a Get operation. Call its Extract method to interpret it as a Server.

func Get

func Get(client *gophercloud.ServiceClient, serverID string) (r GetResult)

Get requests details on a single server, by ID.

func (GetResult) Extract

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

type Image

type Image struct {
	ID string `json:"id"`
}

Image defines a image struct in details of a server.

type Job

type Job struct {
	ID string `json:"job_id"`
}

Job defining the struct of job.

type JobResult

type JobResult struct {
	gophercloud.Result
}

JobResult defining the result struct of job.

func BatchReboot

func BatchReboot(client *gophercloud.ServiceClient, opts BatchRebootOpts) (r JobResult)

BatchReboot makes a request against the API to batch reboot servers.

func BatchStart

func BatchStart(client *gophercloud.ServiceClient, opts BatchStartOpts) (r JobResult)

BatchStart makes a request against the API to batch start servers.

func BatchStop

func BatchStop(client *gophercloud.ServiceClient, opts BatchStopOpts) (r JobResult)

BatchStop makes a request against the API to batch stop servers.

func (JobResult) ExtractJob

func (r JobResult) ExtractJob() (Job, error)

ExtractJob defining the result by extracting job.

type ListOpts

type ListOpts struct {
	// Offset is the current page number.
	Offset int `q:"offset"`

	// Flavor is the ID of the flavor.
	Flavor string `q:"flavor"`

	// Name is the name of the server.
	Name string `q:"name"`

	// Status is the value of the status of the server so that you can filter on
	// "ACTIVE" for example.
	Status string `q:"status"`

	// Limit is an integer value for the limit of values to return.
	Limit int `q:"limit"`

	// Tags is used to filter out the servers with the specified tags
	Tags string `q:"tags"`

	// NotTags queries the cloud server that does not contain this value in the tag field.
	NotTags string `q:"not-tags"`

	// When you create an elastic cloud server in batches, you can specify the returned ID to query the elastic cloud server created in batches.
	ReservationID string `q:"reservation_id"`

	// EnterpriseProjectID specifies the server that is bound to an enterprise project.
	EnterpriseProjectID string `q:"enterprise_project_id"`
}

ListOpts allows the filtering and sorting of collections through the API. Filtering is achieved by passing in struct field values that map to the server attributes you want to see returned.

func (ListOpts) ToServerListDetailQuery

func (opts ListOpts) ToServerListDetailQuery() (string, error)

ToServerListDetailQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToServerListDetailQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type MetaData

type MetaData struct {
	UserData string `json:"user_data,omitempty"`
}

MetaData defining the metadata configuration in BatchChangeOpts struct.

type Metadata

type Metadata struct {
	ChargingMode      string `json:"charging_mode"`
	OrderID           string `json:"metering.order_id"`
	ProductID         string `json:"metering.product_id"`
	VpcID             string `json:"vpc_id"`
	EcmResStatus      string `json:"EcmResStatus"`
	ImageID           string `json:"metering.image_id"`
	Imagetype         string `json:"metering.imagetype"`
	Resourcespeccode  string `json:"metering.resourcespeccode"`
	ImageName         string `json:"image_name"`
	OsBit             string `json:"os_bit"`
	LockCheckEndpoint string `json:"lock_check_endpoint"`
	LockSource        string `json:"lock_source"`
	LockSourceID      string `json:"lock_source_id"`
	LockScene         string `json:"lock_scene"`
	VirtualEnvType    string `json:"virtual_env_type"`
}

Metadata is only used for method that requests details on a single server, by ID. Because metadata struct must be a map.

type NewCloudServer

type NewCloudServer struct {
	CloudServer
	Metadata map[string]string `json:"metadata"`
}

NewCloudServer defines the response from details on a single server, by ID.

type OsSchedulerHints

type OsSchedulerHints struct {
	Group []string `json:"group"`
}

type ProjectTagsResult

type ProjectTagsResult struct {
	gophercloud.Result
}

ProjectTagsResult defining the result struct of project tags.

func ListProjectTags

func ListProjectTags(client *gophercloud.ServiceClient) (r ProjectTagsResult)

ListProjectTags makes a request against the API to list project tags accessible to you.

func (ProjectTagsResult) Extract

func (r ProjectTagsResult) Extract() (Tags, error)

Extract defining the result of listing tags by extracting

type Recovery

type Recovery struct {
	SupportAutoRecovery string `json:"support_auto_recovery"`
}

type RecoveryResult

type RecoveryResult struct {
	gophercloud.Result
}

func GetServerRecoveryStatus

func GetServerRecoveryStatus(client *gophercloud.ServiceClient, serverID string) (r RecoveryResult)

func (RecoveryResult) Extract

func (r RecoveryResult) Extract() (*Recovery, error)

type ResourceTag

type ResourceTag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

ResourceTag defining the struct of server tag element.

type SecurityGroups

type SecurityGroups struct {
	Name string `json:"name"`
}

type Server

type Server struct {
	ID string `json:"id" required:"true"`
}

Server defining the server configuration in BatchChangeOpts struct.

type ServerID

type ServerID struct {
	ID string `json:"id"`
}

ServerID defines struct of batch update response element.

type ServerTags

type ServerTags struct {
	Tags []ResourceTag `json:"tags"`
}

ServerTags defining the struct of tags.

type ServerTagsResult

type ServerTagsResult struct {
	gophercloud.Result
}

ServerTagsResult defining the result struct of server tags.

func ListServerTags

func ListServerTags(client *gophercloud.ServiceClient, serverID string) (r ServerTagsResult)

ListServerTags makes a request against the API to list server tags accessible to you.

func (ServerTagsResult) Extract

func (r ServerTagsResult) Extract() (ServerTags, error)

Extract defining the result of listing tags by extracting

type SysTags

type SysTags struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Tag

type Tag struct {
	Key    string   `json:"key"`
	Values []string `json:"values"`
}

Tag defining the struct of tag element.

type TagCreate

type TagCreate struct {
	Key   string `json:"key" required:"true"`
	Value string `json:"value" required:"true"`
}

TagCreate defining the key and value of a tag for creating

type TagDelete

type TagDelete struct {
	Key   string `json:"key" required:"true"`
	Value string `json:"value,omitempty"`
}

TagDelete defining the key and value of a tag for deleting

type Tags

type Tags struct {
	Tags []Tag `json:"tags"`
}

Tags defining the struct of tags.

type Type

type Type string

Type describes the mechanisms by which a server reboot or stop can be requested.

const (
	Soft Type = "SOFT"
	Hard Type = "HARD"
)

These constants determine how a server should be rebooted or stopped.

type VolumeAttached

type VolumeAttached struct {
	ID                  string `json:"id"`
	DeleteOnTermination string `json:"delete_on_termination"`
	BootIndex           string `json:"bootIndex"`
	Device              string `json:"device"`
}

Jump to

Keyboard shortcuts

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