baremetalservers

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: 4 Imported by: 0

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

	Size int `json:"size" required:"true"`
	// contains filtered or unexported fields
}

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

	UserData []byte `json:"-"`

	AdminPass string `json:"admin_password,omitempty"`

	KeyName string `json:"key_name,omitempty"`

	SecurityGroups []SecurityGroup `json:"security_groups"`

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

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

	ExtendParam ServerExtendParam `json:"extendparam,omitempty"`

	Tags []interface{} `json:"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"`
	Extendparam map[string]string `json:"extendparam,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

type DeleteOpts

type DeleteOpts struct {
	Servers        []Server `json:"servers" required:"true"`
	DeletePublicIp bool     `json:"delete_publicip"`
	DeleteVolume   bool     `json:"delete_volume"`
}

func (DeleteOpts) ToServerDeleteMap

func (opts DeleteOpts) ToServerDeleteMap() (map[string]interface{}, error)

ToServerDeleteMap assembles a request body based on the contents of a DeleteOpts.

type Eip

type Eip struct {
	IpType    string    `json:"iptype" required:"true"`
	BandWidth BandWidth `json:"bandwidth" 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(client *golangsdk.ServiceClient, id string, opts ListOptsBuilder) (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 Create

func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)

CreatePrePaid requests a server to be provisioned to the user in the current tenant.

func Delete

func Delete(client *golangsdk.ServiceClient, opts DeleteOpts) (r JobResult)

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

	// 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 BMS' id.
	ID string `q:"id"`

	// Specifies the BMS' tags.
	Tags string `q:"tags"`

	// Expected field to be returned.
	ExpectFields string `q:"expect_fields"`

	// Specifies the BMS that is bound to an enterprise project.
	EnterpriseProjectID string `q:"enterprise_project_id"`

	// Specifies the maximum number of ECSs on one page.
	// Each page contains 25 BMSs by default, and a maximum of 1000 BMSs 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

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

ToServerListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type MetaData

type MetaData struct {
	OpSvcUserId string `json:"op_svc_userid,omitempty"`
	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 (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 SecurityGroup

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

type SecurityGroups

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

type Server

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

type ServerExtendParam

type ServerExtendParam struct {
	ChargingMode        string `json:"chargingMode,omitempty"`
	RegionID            string `json:"regionID,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 UpdateResult

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

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