cloudservers

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2019 License: Apache-2.0 Imports: 5 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 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 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 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 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 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 SysTags

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

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