ecs

package
v0.0.0-...-b47c6c8 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ECSDefaultEndpoint = "https://10.175.38.51"
	ECSVersion         = "v1"
	ECSName            = "cloudservers"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AbnormalResp

type AbnormalResp struct {
	Error ErrBody `json:"error"`
}

type Client

type Client struct {
	common.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(accessKeyId, accessKeySecret string) *Client

func (*Client) CheckInstanceStatus

func (client *Client) CheckInstanceStatus(region string, args *JobPara) (jobResp *JobRespDesc, err error)

func (*Client) CreateInstance

func (client *Client) CreateInstance(region, projectId string, args *CreateInstanceArgs) (retVal interface{}, err error)

func (*Client) CreateKeyPair

func (client *Client) CreateKeyPair(region, projectId string, arg *KeyPairAttr) (kp *KeyPairResponse, err error)

func (*Client) DeleteInstance

func (client *Client) DeleteInstance(region, projectId string, arg *DeleteInstanceArg) (retVal interface{}, err error)

func (*Client) DeleteKeyPair

func (client *Client) DeleteKeyPair(region, projectId, kpName string) error

func (*Client) Do

func (client *Client) Do(version, region, method, uri string, args interface{}) (respbytes []byte, err error)

func (*Client) GetInstanceState

func (client *Client) GetInstanceState(region, projectId, instanceId string) (sr *StateResp, err error)

func (*Client) ListFlavors

func (client *Client) ListFlavors(region, projectId string) (flvList *FlavorResponse, err error)

func (*Client) QueryInterfaces

func (client *Client) QueryInterfaces(region, projectId, instanceId string) (ifList *InterfaceResponse, err error)

func (*Client) RestartInstance

func (client *Client) RestartInstance(region, projectId, instanceId string, arg *InstanceRestartAttr) error

func (*Client) StartInstance

func (client *Client) StartInstance(region, projectId, instanceId string, arg *InstanceStartAttr) error

func (*Client) StopInstance

func (client *Client) StopInstance(region, projectId, instanceId string, arg *InstanceStopAttr) error

type CmdType

type CmdType struct {
	Type string `json:"type"`
}

type CreateInstanceArgs

type CreateInstanceArgs struct {
	ServerAttr CreateInstanceAttribute `json:"server"`
}

type CreateInstanceAttribute

type CreateInstanceAttribute struct {
	ImageId       string      `json:"imageRef"`
	FlavorId      string      `json:"flavorRef"`
	InstanceName  string      `json:"name"`
	VpcId         string      `json:"vpcid"`
	AvailableZone string      `json:"availability_zone"`
	Nic           []NicDesc   `json:"nics"`
	RootVol       RootVolDesc `json:"root_volume"`
	SecGrps       []SecGrp    `json:"security_groups"`
	AdminPass     string      `json:"adminPass"`
	KeyName       string      `json:"key_name"`
}

type CreateInstanceResponse

type CreateInstanceResponse struct {
}

type DeleteInstanceArg

type DeleteInstanceArg struct {
	Servers  []Svr `json:"servers"`
	DelPubIp bool  `json:"delete_publicip"`
	DelVol   bool  `json:"delete_volume"`
}

type EmbServer

type EmbServer struct {
	Status string `json:"status"`
}

type Entity

type Entity struct {
	SubJobsTotal uint32   `json:"sub_jobs_total"`
	SubJobs      []SubJob `json:"sub_jobs"`
}

type ErrBody

type ErrBody struct {
	Message string `json:"message"`
	Code    string `json:"code"`
}

type FixIP

type FixIP struct {
	SubnetId string `json:"subnet_id"`
	IpAddr   string `json:"ip_address"`
}

type FlavorList

type FlavorList struct {
	Id            string      `json:"id"`
	Name          string      `json:"name"`
	Vcpus         string      `json:"vcpus"`
	Ram           uint32      `sjon:"ram"`
	Disk          string      `json:"disk"`
	Swap          string      `json:"swap"`
	Flavor_OS_Ext uint32      `json:"OS-FLV-EXT-DATA:ephemeral"`
	Flavor_OS_Dis bool        `json:"OS-FLV-DISABLED:disabled"`
	RxTx_Factor   float32     `json:"rxtx_factor"`
	RxTx_Quota    string      `json:"rxtx_quota"`
	RxTx_Cap      string      `json:"rxtx_cap"`
	Flavor_OS_Acc bool        `json:"os-flavor-access:is_public"`
	Links         []LinkDesc  `json:"links"`
	Os_Ext_Specs  OS_Ext_Spec `json:"os_extra_specs"`
}

type FlavorResponse

type FlavorResponse struct {
	Flavors []FlavorList `json:"flavors"`
}

type InstanceRestartAttr

type InstanceRestartAttr struct {
	RebootCmd CmdType `json:"reboot"`
}

type InstanceStartAttr

type InstanceStartAttr struct {
	StartCmd string `json:"os-start"`
}

type InstanceStopAttr

type InstanceStopAttr struct {
	StopCmd string `json:"os-stop"`
}

type Interface

type Interface struct {
	PortState string  `json:"port_state"`
	FixIPs    []FixIP `json:"fixed_ips"`
	NetId     string  `json:"net_id"`
	PortId    string  `json:"port_id"`
	MacAddr   string  `json:"mac_addr"`
}

type InterfaceResponse

type InterfaceResponse struct {
	InterfaceList []Interface `json:"interfaceAttachments"`
}

type JobPara

type JobPara struct {
	ProjectId string
	JobId     string
}

type JobRespDesc

type JobRespDesc struct {
	Status       string `json:"status"`
	ServerEntity Entity `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"`
	Message      string `json:"message"`
	Code         string `json:"code"`
}

type KeyPair

type KeyPair struct {
	Name   string `json:"name"`
	PubKey string `json:"public_key"`
}

type KeyPairAttr

type KeyPairAttr struct {
	KP KeyPair `json:"keypair"`
}

type KeyPairDesc

type KeyPairDesc struct {
	FP         string `json:"fingerprint"`
	Name       string `json:"name"`
	PublicKey  string `json:"public_key"`
	PrivateKey string `json:"private_key"`
	UserId     string `json:"user_id"`
}

type KeyPairResponse

type KeyPairResponse struct {
	KPr KeyPairDesc `json:"keypair"`
}

type LinkDesc

type LinkDesc struct {
	Rel  string `json:"rel"`
	Href string `json:"href"`
	Type string `json:"type"`
}

type NicDesc

type NicDesc struct {
	SubnetId string `json:"subnet_id"`
	IpAddr   string `json:"ip_address"`
}

type NormalResp

type NormalResp struct {
	Job_Id string `json:"job_id"`
}

type OS_Ext_Spec

type OS_Ext_Spec struct {
	PerfType  string `json:"ecs:performancetype"`
	AvailZone string `json:"ecs:availablezone"`
}

type RootVolDesc

type RootVolDesc struct {
	VolType string `json:"volumetype"`
	Size    uint32 `json:"size"`
}

type SecGrp

type SecGrp struct {
	Id string `json:"id"`
}

type Server

type Server struct {
	Id string `json:"server_id"`
}

{"status":"SUCCESS","entities":{"sub_jobs_total":1,"sub_jobs":[{"status":"SUCCESS","entities":{"server_id":"d89f8ca7-e54b-4d00-b539-d2621707f1a3"},"job_id":"4010b39b5404b277015404b72e8a0090","job_type":"createSingleServer","begin_time":"2016-04-11T09:46:34.505Z","end_time":"2016-04-11T09:50:16.819Z","error_code":null,"fail_reason":null}]},"job_id":"4010b39b5404b277015404b71f150084","job_type":"createServer","begin_time":"2016-04-11T09:46:30.547Z","end_time":"2016-04-11T09:50:34.756Z","error_code":null,"fail_reason":null}

type StateResp

type StateResp struct {
	Server EmbServer `json:"server"`
}

type SubJob

type SubJob struct {
	Status     string `json:"status"`
	Entities   Server `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"`
	Message    string `json:"message"`
	Code       string `json:"code"`
}

type Svr

type Svr struct {
	Id string `json:"id"`
}

Jump to

Keyboard shortcuts

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