baremetalservers

package
v0.0.0-...-d823fe1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

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 WaitForJobSuccess

func WaitForJobSuccess(client *golangsdk.ServiceClient, secs int, jobID string) error

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 BandWidth

type BandWidth struct {
	Name       string `json:"name,omitempty"`
	ShareType  string `json:"sharetype" required:"true"`
	Id         string `json:"id,omitempty"`
	Size       int    `json:"size" required:"true"`
	ChargeMode string `json:"chargemode,omitempty"`
}

type CloudServer

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

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

type CreateOpts

type CreateOpts struct {
	ImageRef string `json:"imageRef" required:"true"`

	FlavorRef string `json:"flavorRef" required:"true"`

	Name string `json:"name" required:"true"`

	MetaData MetaData `json:"metadata" required:"true"`

	UserData []byte `json:"-"`

	AdminPass string `json:"adminPass,omitempty"`

	KeyName string `json:"key_name,omitempty"`

	SecurityGroups []SecurityGroup `json:"security_groups,omitempty"`

	Nics []Nic `json:"nics" required:"true"`

	AvailabilityZone string `json:"availability_zone" required:"true"`

	VpcId string `json:"vpcid" required:"true"`

	PublicIp *PublicIp `json:"publicip,omitempty"`

	Count int `json:"count,omitempty"`

	RootVolume *RootVolume `json:"root_volume,omitempty"`

	DataVolumes []DataVolume `json:"data_volumes,omitempty"`

	ExtendParam ServerExtendParam `json:"extendparam" required:"true"`

	SchedulerHints *SchedulerHints `json:"os:scheduler_hints,omitempty"`

	ServerTags []tags.ResourceTag `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

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

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"`
	Shareable   bool   `json:"shareable,omitempty"`
	ClusterID   string `json:"cluster_id,omitempty"`
	ClusterType string `json:"cluster_type,omitempty"`
}

type Eip

type Eip struct {
	IpType      string         `json:"iptype" required:"true"`
	BandWidth   BandWidth      `json:"bandwidth" required:"true"`
	ExtendParam EipExtendParam `json:"extendparam" required:"true"`
}

type EipExtendParam

type EipExtendParam struct {
	ChargingMode string `json:"chargingMode" required:"true"`
}

type Fault

type Fault struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
	Details string `json:"details"`
	Created string `json:"created"`
}

type Flavor

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

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"`
	Name string `json:"name"`
	Type string `json:"__os_type"`
}

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

type JobResult struct {
	golangsdk.Result
}

func (JobResult) ExtractJobResponse

func (r JobResult) ExtractJobResponse() (*JobResponse, error)

func (JobResult) ExtractJobStatus

func (r JobResult) ExtractJobStatus() (*JobStatus, error)

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 MetaData

type MetaData struct {
	OpSvcUserId string `json:"op_svc_userid" required:"true"`
	BYOL        string `json:"BYOL,omitempty"`
	AdminPass   string `json:"admin_pass,omitempty"`
	AgencyName  string `json:"agency_name,omitempty"`
}

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"`
	ImageID          string `json:"metering.image_id"`
	Imagetype        string `json:"metering.imagetype"`
	PortList         string `json:"baremetalPortIDList"`
	Resourcespeccode string `json:"metering.resourcespeccode"`
	ResourceType     string `json:"metering.resourcetype"`
	ImageName        string `json:"image_name"`
	OpSvcUserId      string `json:"op_svc_userid"`
	OsType           string `json:"os_type"`
	BmsSupportEvs    string `json:"__bms_support_evs"`
	OsBit            string `json:"os_bit"`
}

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

type Nic

type Nic struct {
	SubnetId  string `json:"subnet_id" required:"true"`
	IpAddress string `json:"ip_address,omitempty"`
}

type OrderResponse

type OrderResponse struct {
	OrderID string `json:"order_id"`
	JobID   string `json:"job_id"`
}

type OrderResult

type OrderResult struct {
	golangsdk.Result
}

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)

type OsSchedulerHints

type OsSchedulerHints struct {
	DecBaremetal []string `json:"dec_baremetal"`
}

type PublicIp

type PublicIp struct {
	Id  string `json:"id,omitempty"`
	Eip *Eip   `json:"eip,omitempty"`
}

type RootVolume

type RootVolume struct {
	VolumeType  string `json:"volumetype,omitempty"`
	Size        int    `json:"size,omitempty"`
	ClusterID   string `json:"cluster_id,omitempty"`
	ClusterType string `json:"cluster_type,omitempty"`
}

type SchedulerHints

type SchedulerHints struct {
	DecBaremetal string `json:"dec_baremetal,omitempty"`
}

type SecurityGroup

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

type SecurityGroups

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

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

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]string `json:"entities"`
}

type SysTags

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

type UpdateOpts

type UpdateOpts struct {
	Name string `json:"name,omitempty"`
}

func (UpdateOpts) ToServerUpdateMap

func (opts UpdateOpts) ToServerUpdateMap() (map[string]interface{}, error)

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToServerUpdateMap() (map[string]interface{}, error)
}

type UpdateResult

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

func Update

func Update(client *golangsdk.ServiceClient, id string, ops UpdateOptsBuilder) (r UpdateResult)

func (UpdateResult) Extract

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

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