Documentation
¶
Overview ¶
Package qingcloud ... this file rewrap existing methods to implement the cloudsvr.Handler interface
Package qingcloud ... Most borrowed from:
github.com/yunify/qingcloud-sdk-go/service
Index ¶
- Variables
- type AllocateEIPsOutput
- type AssociateEIPOutput
- type BaseResponse
- type Config
- type CreateNicsOutput
- type DescribeEIPsOutput
- type DescribeInstanceTypesOutput
- type DescribeInstancesOutput
- type DescribeJobsOutput
- type DescribeNicsOutput
- type DescribeZonesInput
- type DescribeZonesOutput
- type DissociateEIPsOutput
- type EIP
- type EIPGroup
- type EIPResource
- type Image
- type Instance
- type InstanceType
- type InstanceVxNet
- type InstanceWrapper
- type Job
- type NIC
- type NICIP
- type ParameterRequiredError
- type ParameterValueNotAllowedError
- type QcAPIError
- type ReleaseEIPsOutput
- type Resource
- type ResourceTagPair
- type ResourceTypeCount
- type Router
- type RunInstancesInput
- type RunInstancesOutput
- type SDK
- func (sdk *SDK) APIEndPoint() string
- func (sdk *SDK) AccessID() string
- func (sdk *SDK) AccessKey() string
- func (sdk *SDK) AssignEip(zone, instanceID, eipID string) error
- func (sdk *SDK) DebugSignature()
- func (sdk *SDK) InspectEcs(zone, instanceID string) (*Instance, error)
- func (sdk *SDK) InspectEip(zone, eipID string) (*EIP, error)
- func (sdk *SDK) InspectJob(zone, jobID string) (*Job, error)
- func (sdk *SDK) InspectNode(id, regionOrZone string) (interface{}, error)
- func (sdk *SDK) ListCloudRegions() ([]*cloudsvr.CloudRegion, error)
- func (sdk *SDK) ListCloudTypes(region string) ([]*cloudsvr.CloudNodeType, error)
- func (sdk *SDK) ListEcses(zone string) ([]*InstanceWrapper, error)
- func (sdk *SDK) ListEips(zone, status string) ([]*EIP, error)
- func (sdk *SDK) ListInstanceTypes(zone string, minCPU, maxCPU, minMem, maxMem int) ([]*InstanceType, error)
- func (sdk *SDK) ListNics(zone string) ([]*NIC, error)
- func (sdk *SDK) ListNodes() ([]*cloudsvr.CloudNode, error)
- func (sdk *SDK) ListZones() ([]*Zone, error)
- func (sdk *SDK) NewEcs(zone string, req *RunInstancesInput) (string, error)
- func (sdk *SDK) NewEip(zone string, bandwidth int) (string, string, error)
- func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error)
- func (sdk *SDK) Ping() error
- func (sdk *SDK) RemoveEcs(zone, instanceID string) error
- func (sdk *SDK) RemoveEip(zone, eipID string) error
- func (sdk *SDK) RemoveNode(node *cloudsvr.CloudNode) error
- func (sdk *SDK) StartEcs(zone, instanceID string) error
- func (sdk *SDK) StopEcs(zone, instanceID string) error
- func (sdk *SDK) Type() string
- func (sdk *SDK) UnAssignEip(zone, eipID string) error
- func (sdk *SDK) Verify() error
- func (sdk *SDK) WaitEcs(zone, instanceID, expectStatus string, maxWait time.Duration) error
- func (sdk *SDK) WaitJob(zone, jobID, expectStatus string, maxWait time.Duration) error
- type SecurityGroup
- type StartInstancesOutput
- type StopInstancesOutput
- type Tag
- type TerminateInstancesOutput
- type Volume
- type VxNet
- type Zone
Constants ¶
This section is empty.
Variables ¶
var ( // OsImage is exported OsImage = "centos73x64" // NodeName is exported NodeName = "inf-agent-qingcloud-node" )
var (
// CloudType is exported
CloudType = "qingcloud"
)
var ( // DefaultAPIEndPoint is exported DefaultAPIEndPoint = "https://api.qingcloud.com/iaas" // note: no trailing / )
Functions ¶
This section is empty.
Types ¶
type AllocateEIPsOutput ¶
type AllocateEIPsOutput struct {
BaseResponse
EIPs []*string `json:"eips"`
}
AllocateEIPsOutput is exported
type AssociateEIPOutput ¶
type AssociateEIPOutput struct {
BaseResponse
JobID *string `json:"job_id"`
}
AssociateEIPOutput is exported
type BaseResponse ¶
type BaseResponse struct {
Message string `json:"message"`
Action string `json:"action"`
RetCode int `json:"ret_code"`
}
BaseResponse is exported
type Config ¶
type Config struct {
EndPoint string `json:"endpoint,omitempty"`
AccessID string `json:"access_id"`
AccessKey string `json:"access_key"`
}
Config is exported
type CreateNicsOutput ¶
type CreateNicsOutput struct {
BaseResponse
Nics []*NICIP `json:"nics"`
}
CreateNicsOutput is exported
type DescribeEIPsOutput ¶
type DescribeEIPsOutput struct {
BaseResponse
EIPSet []*EIP `json:"eip_set"`
TotalCount *int `json:"total_count"`
}
DescribeEIPsOutput is exported
type DescribeInstanceTypesOutput ¶
type DescribeInstanceTypesOutput struct {
BaseResponse
TotalCount *int `json:"total_count"`
InstanceTypeSet []*InstanceType `json:"instance_type_set"`
}
DescribeInstanceTypesOutput is exported
type DescribeInstancesOutput ¶
type DescribeInstancesOutput struct {
BaseResponse
InstanceSet []*Instance `json:"instance_set"`
TotalCount *int `json:"total_count"`
}
DescribeInstancesOutput is exported
type DescribeJobsOutput ¶
type DescribeJobsOutput struct {
BaseResponse
JobSet []*Job `json:"job_set"`
TotalCount *int `json:"total_count"`
}
DescribeJobsOutput is exported
type DescribeNicsOutput ¶
type DescribeNicsOutput struct {
BaseResponse
NICSet []*NIC `json:"nic_set"`
TotalCount *int `json:"total_count"`
}
DescribeNicsOutput is exported
type DescribeZonesInput ¶
DescribeZonesInput is exported
func (*DescribeZonesInput) Validate ¶
func (v *DescribeZonesInput) Validate() error
Validate is exported
type DescribeZonesOutput ¶
type DescribeZonesOutput struct {
BaseResponse
TotalCount *int `json:"total_count"`
ZoneSet []*Zone `json:"zone_set"`
}
DescribeZonesOutput is exported
type DissociateEIPsOutput ¶
type DissociateEIPsOutput struct {
BaseResponse
JobID *string `json:"job_id"`
}
DissociateEIPsOutput is exported
type EIP ¶
type EIP struct {
AlarmStatus *string `json:"alarm_status"`
AssociateMode *int `json:"associate_mode"`
Bandwidth *int `json:"bandwidth"`
// BillingMode's available values: bandwidth, traffic
BillingMode *string `json:"billing_mode"`
CreateTime *time.Time `json:"create_time"`
Description *string `json:"description"`
EIPAddr *string `json:"eip_addr"`
EIPGroup *EIPGroup `json:"eip_group"`
EIPID *string `json:"eip_id"`
EIPName *string `json:"eip_name"`
ICPCodes *string `json:"icp_codes"`
NeedICP *int `json:"need_icp"`
Resource *EIPResource `json:"resource"`
// Status's available values: pending, available, associated, suspended, released, ceased
Status *string `json:"status"`
StatusTime *time.Time `json:"status_time"`
SubCode *int `json:"sub_code"`
Tags []*Tag `json:"tags"`
// TransitionStatus's available values: associating, dissociating, suspending, resuming, releasing
TransitionStatus *string `json:"transition_status"`
}
EIP is exported
type EIPGroup ¶
type EIPGroup struct {
EIPGroupID *string `json:"eip_group_id"`
EIPGroupName *string `json:"eip_group_name"`
}
EIPGroup is exported
type EIPResource ¶
type EIPResource struct {
ResourceID *string `json:"resource_id"`
ResourceName *string `json:"resource_name"`
ResourceType *string `json:"resource_type"`
}
EIPResource is exported
type Image ¶
type Image struct {
AppBillingID *string `json:"app_billing_id"`
Architecture *string `json:"architecture"`
BillingID *string `json:"billing_id"`
CreateTime *time.Time `json:"create_time"`
DefaultPasswd *string `json:"default_passwd"`
DefaultUser *string `json:"default_user"`
Description *string `json:"description"`
FResetpwd *int `json:"f_resetpwd"`
Feature *int `json:"feature"`
Features *int `json:"features"`
Hypervisor *string `json:"hypervisor"`
ImageID *string `json:"image_id"`
ImageName *string `json:"image_name"`
InstanceIDs []*string `json:"instance_ids"`
OSFamily *string `json:"os_family"`
Owner *string `json:"owner"`
// Platform's available values: linux, windows
Platform *string `json:"platform"`
// ProcessorType's available values: 64bit, 32bit
ProcessorType *string `json:"processor_type"`
// Provider's available values: system, self
Provider *string `json:"provider"`
RecommendedType *string `json:"recommended_type"`
RootID *string `json:"root_id"`
Size *int `json:"size"`
// Status's available values: pending, available, deprecated, suspended, deleted, ceased
Status *string `json:"status"`
StatusTime *time.Time `json:"status_time"`
SubCode *int `json:"sub_code"`
// TransitionStatus's available values: creating, suspending, resuming, deleting, recovering
TransitionStatus *string `json:"transition_status"`
UIType *string `json:"ui_type"`
// Visibility's available values: public, private
Visibility *string `json:"visibility"`
}
Image is exported
type Instance ¶
type Instance struct {
AlarmStatus *string `json:"alarm_status"`
CPUTopology *string `json:"cpu_topology"`
CreateTime *time.Time `json:"create_time"`
Description *string `json:"description"`
Device *string `json:"device"`
EIP *EIP `json:"eip"`
GraphicsPasswd *string `json:"graphics_passwd"`
GraphicsProtocol *string `json:"graphics_protocol"`
Image Image `json:"image"`
ImageID *string `json:"image_id"`
InstanceClass *int `json:"instance_class"`
InstanceID *string `json:"instance_id"`
InstanceName *string `json:"instance_name"`
InstanceType *string `json:"instance_type"`
KeyPairIDs []string `json:"keypair_ids"`
MemoryCurrent *int `json:"memory_current"`
PrivateIP *string `json:"private_ip"`
SecurityGroup SecurityGroup `json:"security_group"`
Status *string `json:"status"` // pending, running, stopped, suspended, terminated, ceased
StatusTime time.Time `json:"status_time"`
SubCode *int `json:"sub_code"`
Tags []Tag `json:"tags"`
TransitionStatus *string `json:"transition_status"` // creating, starting, stopping, restarting, suspending, resuming, terminating, recovering, resetting
VCPUsCurrent *int `json:"vcpus_current"`
VolumeIDs []*string `json:"volume_ids"`
Volumes []Volume `json:"volumes"`
VxNets []InstanceVxNet `json:"vxnets"`
}
Instance is exported
type InstanceType ¶
type InstanceType struct {
Description *string `json:"description"`
InstanceTypeID *string `json:"instance_type_id"`
InstanceTypeName *string `json:"instance_type_name"`
MemoryCurrent *int `json:"memory_current"` // by MiB
Status *string `json:"status"` // available, deprecated
VCPUsCurrent *int `json:"vcpus_current"`
ZoneID *string `json:"zone_id"`
}
InstanceType is exported
type InstanceVxNet ¶
type InstanceVxNet struct {
NICID *string `json:"nic_id"`
PrivateIP *string `json:"private_ip"`
Role *int `json:"role"`
VxNetID *string `json:"vxnet_id"`
VxNetName *string `json:"vxnet_name"`
// VxNetType's available values: 0, 1
VxNetType *int `json:"vxnet_type"`
}
InstanceVxNet is exported
type InstanceWrapper ¶
InstanceWrapper is exported
type Job ¶
type Job struct {
CreateTime *time.Time `json:"create_time"`
JobAction *string `json:"job_action"`
JobID *string `json:"job_id"`
Owner *string `json:"owner"`
ResourceIDs *string `json:"resource_ids"`
Status *string `json:"status"` // pending, working, failed, successful, done with failure
StatusTime *time.Time `json:"status_time"`
}
Job is exported
type NIC ¶
type NIC struct {
CreateTime *time.Time `json:"create_time"`
InstanceID *string `json:"instance_id"`
NICID *string `json:"nic_id"`
NICName *string `json:"nic_name"`
Owner *string `json:"owner"`
PrivateIP *string `json:"private_ip"`
Role *int `json:"role"`
RootUserID *string `json:"root_user_id"`
SecurityGroup *string `json:"security_group"`
Sequence *int `json:"sequence"`
Status *string `json:"status"` // avaliable, in-use
StatusTime *time.Time `json:"status_time"`
Tags []*Tag `json:"tags"`
VxNetID *string `json:"vxnet_id"`
}
NIC is exported
type ParameterRequiredError ¶
ParameterRequiredError indicates that the required parameter is missing.
func (ParameterRequiredError) Error ¶
func (e ParameterRequiredError) Error() string
Error returns the description of ParameterRequiredError.
type ParameterValueNotAllowedError ¶
type ParameterValueNotAllowedError struct {
ParameterName string
ParameterValue string
AllowedValues []string
}
ParameterValueNotAllowedError indicates that the parameter value is not allowed.
func (ParameterValueNotAllowedError) Error ¶
func (e ParameterValueNotAllowedError) Error() string
Error returns the description of ParameterValueNotAllowedError.
type QcAPIError ¶
QcAPIError is exported
type ReleaseEIPsOutput ¶
type ReleaseEIPsOutput struct {
BaseResponse
JobID *string `json:"job_id"`
}
ReleaseEIPsOutput is exported
type Resource ¶
type Resource struct {
ResourceID *string `json:"resource_id"`
ResourceName *string `json:"resource_name"`
ResourceType *string `json:"resource_type"`
}
Resource is exported
type ResourceTagPair ¶
type ResourceTagPair struct {
ResourceID *string `json:"resource_id"`
ResourceType *string `json:"resource_type"`
Status *string `json:"status"`
StatusTime *time.Time `json:"status_time"`
TagID *string `json:"tag_id"`
}
ResourceTagPair is exported
type ResourceTypeCount ¶
type ResourceTypeCount struct {
Count *int `json:"count"`
ResourceType *string `json:"resource_type"`
}
ResourceTypeCount is exported
type Router ¶
type Router struct {
CreateTime *time.Time `json:"create_time"`
Description *string `json:"description"`
DYNIPEnd *string `json:"dyn_ip_end"`
DYNIPStart *string `json:"dyn_ip_start"`
EIP *EIP `json:"eip"`
IPNetwork *string `json:"ip_network"`
// IsApplied's available values: 0, 1
IsApplied *int `json:"is_applied"`
ManagerIP *string `json:"manager_ip"`
Mode *int `json:"mode"`
PrivateIP *string `json:"private_ip"`
RouterID *string `json:"router_id"`
RouterName *string `json:"router_name"`
// RouterType's available values: 1
RouterType *int `json:"router_type"`
SecurityGroupID *string `json:"security_group_id"`
// Status's available values: pending, active, poweroffed, suspended, deleted, ceased
Status *string `json:"status"`
StatusTime *time.Time `json:"status_time"`
Tags []*Tag `json:"tags"`
// TransitionStatus's available values: creating, updating, suspending, resuming, poweroffing, poweroning, deleting
TransitionStatus *string `json:"transition_status"`
VxNets []*VxNet `json:"vxnets"`
}
Router is exported
type RunInstancesInput ¶
type RunInstancesInput struct {
Count *int `json:"count"` // must
ImageID *string `json:"image_id"` // must
LoginMode *string `json:"login_mode"` // must: keypair, passwd
InstanceType *string `json:"instance_type"` // optional
CPU *int `json:"cpu"` // must if InstanceType empty: 1, 2, 4, 8, 16
Memory *int `json:"memory"` // must if InstanceType empty: 1024, 2048, 4096, 6144, 8192, 12288, 16384, 24576, 32768
LoginPasswd *string `json:"login_passwd"` // must if LoginMode==passwd
LoginKeyPair *string `json:"login_keypair"` // must if LoginMode==keypair
Hostname *string `json:"hostname"`
InstanceClass *int `json:"instance_class"` // 0, 1
InstanceName *string `json:"instance_name"`
NeedNewSID *int `json:"need_newsid"` // 0, 1
NeedUserdata *int `json:"need_userdata"` // 0, 1
SecurityGroup *string `json:"security_group"`
UIType *string `json:"ui_type"`
UserdataFile *string `json:"userdata_file"`
UserdataPath *string `json:"userdata_path"`
UserdataType *string `json:"userdata_type"` // plain, exec, tar
UserdataValue *string `json:"userdata_value"`
Volumes []*string `json:"volumes"`
VxNets []*string `json:"vxnets"`
}
RunInstancesInput is exported
func (*RunInstancesInput) AddToParameters ¶
func (v *RunInstancesInput) AddToParameters(params *orderparam.Params)
AddToParameters should be called after Validate verify checking
func (*RunInstancesInput) Validate ¶
func (v *RunInstancesInput) Validate() error
Validate is exported
type RunInstancesOutput ¶
type RunInstancesOutput struct {
BaseResponse
Instances []string `json:"instances"`
JobID string `json:"job_id"`
}
RunInstancesOutput is exported
type SDK ¶
type SDK struct {
// contains filtered or unexported fields
}
SDK is an implement of CloudSvr
func (*SDK) DebugSignature ¶
func (sdk *SDK) DebugSignature()
DebugSignature is used for debug qingcloud request signature ...
func (*SDK) InspectEcs ¶
InspectEcs show details of a given ecs instance
func (*SDK) InspectEip ¶
InspectEip is exported
func (*SDK) InspectJob ¶
InspectJob show details of a given async job
func (*SDK) InspectNode ¶
InspectNode show details of one given ecs instance
func (*SDK) ListCloudRegions ¶
func (sdk *SDK) ListCloudRegions() ([]*cloudsvr.CloudRegion, error)
ListCloudRegions implement cloudsvr.Handler
func (*SDK) ListCloudTypes ¶
func (sdk *SDK) ListCloudTypes(region string) ([]*cloudsvr.CloudNodeType, error)
ListCloudTypes implement cloudsvr.Handler
func (*SDK) ListEcses ¶
func (sdk *SDK) ListEcses(zone string) ([]*InstanceWrapper, error)
ListEcses show all of ecs instances under given zone if empty zone parameter, will query all zones
func (*SDK) ListEips ¶
ListEips show all of given status of eips under given zone pending, available, associated, suspended, released, ceased
func (*SDK) ListInstanceTypes ¶
func (sdk *SDK) ListInstanceTypes(zone string, minCPU, maxCPU, minMem, maxMem int) ([]*InstanceType, error)
ListInstanceTypes show all of instance types under given zone support cpu / memory minimal/maximize filter parameters
func (*SDK) ListNodes ¶
ListNodes list all qingcloud ecs instances with InstanceName == NodeName the nodes listed does NOT have any auth fields `User` `Password`
func (*SDK) NewEcs ¶
func (sdk *SDK) NewEcs(zone string, req *RunInstancesInput) (string, error)
NewEcs create a new ecs instance with given settings
func (*SDK) NewNode ¶
func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error)
NewNode create qingcloud ecs instance, try to use prefered attributes firstly
func (*SDK) RemoveEcs ¶
RemoveEcs remove the specified ecs instance note: maybe met temporarily error like followings:
1400:PermissionDenied, resource [i-hdqves5i] lease info not ready yet, please try later
if met, we will retry removal until succeed.
func (*SDK) RemoveEip ¶
RemoveEip remove one given eip under given zone note: maybe met temporarily error like followings:
1400:PermissionDenied, resource [eip-df098ifi] lease info not ready yet, please try later
if met, we will retry removal until succeed.
func (*SDK) RemoveNode ¶
RemoveNode remove qingcloud ecs instance
func (*SDK) UnAssignEip ¶
UnAssignEip unassign one given eip
type SecurityGroup ¶
type SecurityGroup struct {
CreateTime *time.Time `json:"create_time"`
Description *string `json:"description"`
IsApplied *int `json:"is_applied"`
IsDefault *int `json:"is_default"`
Resources []*Resource `json:"resources"`
SecurityGroupID *string `json:"security_group_id"`
SecurityGroupName *string `json:"security_group_name"`
Tags []*Tag `json:"tags"`
}
SecurityGroup is exported
type StartInstancesOutput ¶
type StartInstancesOutput struct {
BaseResponse
JobID *string `json:"job_id"`
}
StartInstancesOutput is exported
type StopInstancesOutput ¶
type StopInstancesOutput struct {
BaseResponse
JobID *string `json:"job_id"`
}
StopInstancesOutput is exported
type Tag ¶
type Tag struct {
Color *string `json:"color"`
CreateTime *time.Time `json:"create_time"`
Description *string `json:"description"`
Owner *string `json:"owner"`
ResourceCount *int `json:"resource_count"`
ResourceTagPairs []*ResourceTagPair `json:"resource_tag_pairs"`
ResourceTypeCount []*ResourceTypeCount `json:"resource_type_count"`
TagID *string `json:"tag_id"`
TagKey *string `json:"tag_key"`
TagName *string `json:"tag_name"`
}
Tag is exported
type TerminateInstancesOutput ¶
type TerminateInstancesOutput struct {
BaseResponse
JobID *string `json:"job_id"`
}
TerminateInstancesOutput is exported
type Volume ¶
type Volume struct {
CreateTime *time.Time `json:"create_time"`
Description *string `json:"description"`
Device *string `json:"device"`
Instance *Instance `json:"instance"`
Instances []*Instance `json:"instances"`
LatestSnapshotTime *time.Time `json:"latest_snapshot_time"`
Owner *string `json:"owner"`
PlaceGroupID *string `json:"place_group_id"`
Size *int `json:"size"`
// Status's available values: pending, available, in-use, suspended, deleted, ceased
Status *string `json:"status"`
StatusTime *time.Time `json:"status_time"`
SubCode *int `json:"sub_code"`
Tags []*Tag `json:"tags"`
// TransitionStatus's available values: creating, attaching, detaching, suspending, resuming, deleting, recovering
TransitionStatus *string `json:"transition_status"`
VolumeID *string `json:"volume_id"`
VolumeName *string `json:"volume_name"`
// VolumeType's available values: 0, 1, 2, 3
VolumeType *int `json:"volume_type"`
}
Volume is exported
type VxNet ¶
type VxNet struct {
AvailableIPCount *int `json:"available_ip_count"`
CreateTime *time.Time `json:"create_time"`
Description *string `json:"description"`
InstanceIDs []*string `json:"instance_ids"`
Owner *string `json:"owner"`
Router *Router `json:"router"`
Tags []*Tag `json:"tags"`
VpcRouterID *string `json:"vpc_router_id"`
VxNetID *string `json:"vxnet_id"`
VxNetName *string `json:"vxnet_name"`
// VxNetType's available values: 0, 1
VxNetType *int `json:"vxnet_type"`
}
VxNet is exported