Documentation ¶
Index ¶
- func GetJobEntity(client *golangsdk.ServiceClient, jobID string, label string) (interface{}, error)
- func GetOrderResource(client *golangsdk.ServiceClient, orderID string) (interface{}, error)
- func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func WaitForJobSuccess(client *golangsdk.ServiceClient, secs int, jobID string) error
- func WaitForOrderDeleteSuccess(client *golangsdk.ServiceClient, secs int, orderID string) error
- func WaitForOrderSuccess(client *golangsdk.ServiceClient, secs int, orderID string) error
- type Address
- type BandWidth
- type CloudServer
- type CreateOpts
- type CreateOptsBuilder
- type DataVolume
- type DeleteOpts
- type DeleteOrderOpts
- type DeleteOrderResponse
- type DeleteOrderResult
- type Eip
- type EipExtendParam
- type Flavor
- type GetResult
- type Image
- type JobEntity
- type JobResponse
- type JobResult
- type JobStatus
- type ListOpts
- type ListOptsBuilder
- type MetaData
- type Metadata
- type NewCloudServer
- type Nic
- type OrderResponse
- type OrderResult
- type OrderStatus
- type OsSchedulerHints
- type PublicIp
- type ResizeExtendParam
- type ResizeOpts
- type ResizeOptsBuilder
- type Resource
- type RootVolume
- type SchedulerHints
- type SecurityGroup
- type SecurityGroups
- type Server
- type ServerExtendParam
- type ServerPage
- type ServerTags
- type SubJob
- type SysTags
- type VolumeAttached
- type VolumeExtendParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJobEntity ¶
func GetJobEntity(client *golangsdk.ServiceClient, jobID string, label string) (interface{}, error)
func GetOrderResource ¶
func GetOrderResource(client *golangsdk.ServiceClient, orderID string) (interface{}, error)
func List ¶
func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager
List makes a request against the API to list servers accessible to you.
func WaitForJobSuccess ¶
func WaitForJobSuccess(client *golangsdk.ServiceClient, secs int, jobID string) error
func WaitForOrderDeleteSuccess ¶
func WaitForOrderDeleteSuccess(client *golangsdk.ServiceClient, secs int, orderID string) error
func WaitForOrderSuccess ¶
func WaitForOrderSuccess(client *golangsdk.ServiceClient, secs int, orderID string) error
Types ¶
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.
func ExtractServers ¶
func ExtractServers(r pagination.Page) ([]CloudServer, error)
ExtractServers interprets the results of a single page from a List() call, producing a slice of CloudServer entities.
type CreateOpts ¶
type CreateOpts struct { ImageRef string `json:"imageRef" required:"true"` FlavorRef string `json:"flavorRef" required:"true"` Name string `json:"name" required:"true"` UserData []byte `json:"-"` // AdminPass sets the root user password. If not set, a randomly-generated // password will be created and returned in the response. AdminPass string `json:"adminPass,omitempty"` KeyName string `json:"key_name,omitempty"` VpcId string `json:"vpcid" required:"true"` Nics []Nic `json:"nics" required:"true"` PublicIp *PublicIp `json:"publicip,omitempty"` Count int `json:"count,omitempty"` IsAutoRename *bool `json:"isAutoRename,omitempty"` RootVolume RootVolume `json:"root_volume" required:"true"` DataVolumes []DataVolume `json:"data_volumes,omitempty"` SecurityGroups []SecurityGroup `json:"security_groups,omitempty"` AvailabilityZone string `json:"availability_zone" required:"true"` ExtendParam *ServerExtendParam `json:"extendparam,omitempty"` MetaData *MetaData `json:"metadata,omitempty"` SchedulerHints *SchedulerHints `json:"os:scheduler_hints,omitempty"` Tags []string `json:"tags,omitempty"` ServerTags []ServerTags `json:"server_tags,omitempty"` }
func (CreateOpts) ToServerCreateMap ¶
func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error)
ToServerCreateMap assembles a request body based on the contents of a CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type DataVolume ¶
type DataVolume struct { VolumeType string `json:"volumetype" required:"true"` Size int `json:"size" required:"true"` MultiAttach *bool `json:"multiattach,omitempty"` PassThrough *bool `json:"hw:passthrough,omitempty"` Extendparam *VolumeExtendParam `json:"extendparam,omitempty"` }
type DeleteOpts ¶
type DeleteOpts struct { Servers []Server `json:"servers" required:"true"` DeletePublicIP bool `json:"delete_publicip,omitempty"` DeleteVolume bool `json:"delete_volume,omitempty"` }
func (DeleteOpts) ToServerDeleteMap ¶
func (opts DeleteOpts) ToServerDeleteMap() (map[string]interface{}, error)
ToServerDeleteMap assembles a request body based on the contents of a DeleteOpts.
type DeleteOrderOpts ¶
type DeleteOrderOpts struct { ResourceIds []string `json:"resourceIds" required:"true"` UnSubType int `json:"unSubType" required:"true"` }
func (DeleteOrderOpts) ToServerDeleteOrderMap ¶
func (opts DeleteOrderOpts) ToServerDeleteOrderMap() (map[string]interface{}, error)
ToServerDeleteOrderMap assembles a request body based on the contents of a DeleteOrderOpts.
type DeleteOrderResponse ¶
type DeleteOrderResponse struct {
OrderIDs []string `json:"orderIds"`
}
type DeleteOrderResult ¶
func DeleteOrder ¶
func DeleteOrder(client *golangsdk.ServiceClient, opts DeleteOrderOpts) (r DeleteOrderResult)
DeleteOrder requests a server to be deleted to the user in the current tenant.
func (DeleteOrderResult) ExtractDeleteOrderResponse ¶
func (r DeleteOrderResult) ExtractDeleteOrderResponse() (*DeleteOrderResponse, error)
type Eip ¶
type Eip struct { IpType string `json:"iptype" required:"true"` BandWidth *BandWidth `json:"bandwidth" required:"true"` ExtendParam *EipExtendParam `json:"extendparam,omitempty"` }
type EipExtendParam ¶
type EipExtendParam struct {
ChargingMode string `json:"chargingMode,omitempty"`
}
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(c *golangsdk.ServiceClient, id string) (r GetResult)
Get retrieves a particular Server based on its unique 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 JobEntity ¶
type JobEntity struct { // Specifies the number of subtasks. // When no subtask exists, the value of this parameter is 0. SubJobsTotal int `json:"sub_jobs_total"` // Specifies the execution information of a subtask. // When no subtask exists, the value of this parameter is left blank. SubJobs []SubJob `json:"sub_jobs"` }
type JobResponse ¶
type JobResponse struct {
JobID string `json:"job_id"`
}
type JobResult ¶
func Create ¶
func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
Create requests a server to be provisioned to the user in the current tenant.
func Delete ¶
func Delete(client *golangsdk.ServiceClient, opts DeleteOpts) (r JobResult)
Delete requests a server to be deleted to the user in the current tenant.
func Resize ¶
func Resize(client *golangsdk.ServiceClient, opts ResizeOptsBuilder, serverId string) (r JobResult)
Resize requests a server to be resizeed.
func (JobResult) ExtractJobResponse ¶
func (r JobResult) ExtractJobResponse() (*JobResponse, error)
func (JobResult) ExtractJobStatus ¶
type JobStatus ¶
type JobStatus struct { Status string `json:"status"` Entities JobEntity `json:"entities"` JobID string `json:"job_id"` JobType string `json:"job_type"` BeginTime string `json:"begin_time"` EndTime string `json:"end_time"` ErrorCode string `json:"error_code"` FailReason string `json:"fail_reason"` }
type ListOpts ¶
type ListOpts struct { // Name of the server as a string; can be queried with regular expressions. // Realize that ?name=bob returns both bob and bobb. If you need to match bob // only, you can use a regular expression matching the syntax of the // underlying database server implemented for Compute. Name string `q:"name"` // Flavor is the name of the flavor in URL format. Flavor string `q:"flavor"` // Status is the value of the status of the server so that you can filter on // "ACTIVE" for example. Status string `q:"status"` // Specifies the ECS that is bound to an enterprise project. EnterpriseProjectID string `q:"enterprise_project_id"` // Indicates the filtering result for IPv4 addresses, which are fuzzy matched. // These IP addresses are private IP addresses of the ECS. IP string `q:"ip"` // Specifies the maximum number of ECSs on one page. // Each page contains 25 ECSs by default, and a maximum of 1000 ECSs are returned. Limit int `q:"limit"` // Specifies a page number. The default value is 1. // The value must be greater than or equal to 0. If the value is 0, the first page is displayed. Offset int `q:"offset"` }
ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the server attributes you want to see returned. Marker and Limit are used for pagination.
func (ListOpts) ToServerListQuery ¶
ToServerListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
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"` AgencyName string `json:"agency_name"` }
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 OrderResponse ¶
type OrderResult ¶
func CreatePrePaid ¶
func CreatePrePaid(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r OrderResult)
CreatePrePaid requests a server to be provisioned to the user in the current tenant.
func (OrderResult) ExtractOrderResponse ¶
func (r OrderResult) ExtractOrderResponse() (*OrderResponse, error)
func (OrderResult) ExtractOrderStatus ¶
func (r OrderResult) ExtractOrderStatus() (*OrderStatus, error)
type OrderStatus ¶
type OsSchedulerHints ¶
type ResizeExtendParam ¶
type ResizeExtendParam struct {
AutoPay string `json:"isAutoPay,omitempty"`
}
type ResizeOpts ¶
type ResizeOpts struct { FlavorRef string `json:"flavorRef" required:"true"` Mode string `json:"mode,omitempty"` ExtendParam *ResizeExtendParam `json:"extendparam,omitempty"` }
func (ResizeOpts) ToServerResizeMap ¶
func (opts ResizeOpts) ToServerResizeMap() (map[string]interface{}, error)
ToServerResizeMap assembles a request body based on the contents of a ResizeOpts.
type ResizeOptsBuilder ¶
ResizeOptsBuilder allows extensions to add additional parameters to the Resize request.
type RootVolume ¶
type RootVolume struct { VolumeType string `json:"volumetype" required:"true"` Size int `json:"size,omitempty"` ExtendParam *VolumeExtendParam `json:"extendparam,omitempty"` }
type SchedulerHints ¶
type SchedulerHints struct { Group string `json:"group,omitempty"` FaultDomain string `json:"fault_domain,omitempty"` // Specifies whether the ECS is created on a Dedicated Host (DeH) or in a shared pool. Tenancy string `json:"tenancy,omitempty"` // DedicatedHostID specifies a DeH ID. DedicatedHostID string `json:"dedicated_host_id,omitempty"` }
type SecurityGroup ¶
type SecurityGroup struct {
ID string `json:"id" required:"true"`
}
type SecurityGroups ¶
type ServerExtendParam ¶
type ServerExtendParam struct { ChargingMode string `json:"chargingMode,omitempty"` RegionID string `json:"regionID,omitempty"` PeriodType string `json:"periodType,omitempty"` PeriodNum int `json:"periodNum,omitempty"` IsAutoRenew string `json:"isAutoRenew,omitempty"` IsAutoPay string `json:"isAutoPay,omitempty"` EnterpriseProjectId string `json:"enterprise_project_id,omitempty"` SupportAutoRecovery string `json:"support_auto_recovery,omitempty"` }
type ServerPage ¶
type ServerPage struct {
pagination.LinkedPageBase
}
ServerPage abstracts the raw results of making a List() request against the API.
func (ServerPage) IsEmpty ¶
func (r ServerPage) IsEmpty() (bool, error)
IsEmpty returns true if a page contains no Server results.
func (ServerPage) NextPageURL ¶
func (r ServerPage) NextPageURL() (string, error)
NextPageURL uses the response's embedded link reference to navigate to the next page of results.
type ServerTags ¶
type SubJob ¶
type SubJob struct { // Specifies the task ID. Id string `json:"job_id"` // Task type. Type string `json:"job_type"` //Specifies the task status. // SUCCESS: indicates the task is successfully executed. // RUNNING: indicates that the task is in progress. // FAIL: indicates that the task failed. // INIT: indicates that the task is being initialized. Status string `json:"status"` // Specifies the time when the task started. BeginTime string `json:"begin_time"` // Specifies the time when the task finished. EndTime string `json:"end_time"` // Specifies the returned error code when the task execution fails. ErrorCode string `json:"error_code"` // Specifies the cause of the task execution failure. FailReason string `json:"fail_reason"` // Specifies the object of the task. Entities map[string]interface{} `json:"entities"` }
type VolumeAttached ¶
type VolumeExtendParam ¶
type VolumeExtendParam struct {
SnapshotId string `json:"snapshotId,omitempty"`
}