Documentation ¶
Overview ¶
Package aliyun ... this file rewrap existing methods to implement the cloudsvr.Handler interface
Package aliyun ...
Most borrowed from:
github.com/ChangjunZhao/aliyun-api-golang/ecs
Index ¶
- Variables
- type AccountType
- type AllocatePublicIPAddressResponse
- type AuthorizeSecurityGroupRequest
- type AutoSnapshotExecutionStatusType
- type AutoSnapshotPolicyType
- type AvailableDiskCategoriesType
- type AvailableInstanceTypes
- type AvailableResourceCreationType
- type AvailableResources
- type AvailableVolumeCategories
- type ClusterType
- type Config
- type CreateInstanceRequest
- type CreateInstanceResponse
- type CreateSecurityGroupRequest
- type CreateSecurityGroupResponse
- type DescribeInstanceTypesResponse
- type DescribeInstancesResponse
- type DescribeRegionZonesResponse
- type DescribeRegionsResponse
- type DiskDeviceMapping
- type DiskItemType
- type DiskMonitorDataType
- type DiskSetType
- type EcsBaseResponse
- type EcsErrorResponse
- type EipAddressAssociateType
- type EipAddressSetType
- type EipMonitorDataType
- type IPAddressSetType
- type IPRangeSetType
- type ImageType
- type InstanceAttributesType
- type InstanceMonitorDataType
- type InstanceTypeItemType
- type InstanceTypes
- type Instances
- type OperationLocksType
- type RegionType
- type Regions
- type RouteEntrySetType
- type RouteTableSetType
- type SDK
- func (sdk *SDK) APIEndPoint() string
- func (sdk *SDK) AccessID() string
- func (sdk *SDK) AccessKey() string
- func (sdk *SDK) AssignEcsPublicIP(id string) (string, error)
- func (sdk *SDK) AuthorizeSecurityGroup(req *AuthorizeSecurityGroupRequest) error
- func (sdk *SDK) InspectEcs(regionID, instanceID string) (InstanceAttributesType, 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(regionID string) ([]InstanceAttributesType, error)
- func (sdk *SDK) ListInstanceTypes(minCPU, maxCPU, minMem, maxMem int) ([]InstanceTypeItemType, error)
- func (sdk *SDK) ListNodes() ([]*cloudsvr.CloudNode, error)
- func (sdk *SDK) ListRegionZones(regionID string) ([]ZoneType, error)
- func (sdk *SDK) ListRegions() ([]RegionType, error)
- func (sdk *SDK) NewEcs(req *CreateInstanceRequest) (string, error)
- func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error)
- func (sdk *SDK) NewSecurityGroup(req *CreateSecurityGroupRequest) (string, error)
- func (sdk *SDK) Ping() error
- func (sdk *SDK) RemoveEcs(regionID, instanceID string) error
- func (sdk *SDK) RemoveNode(node *cloudsvr.CloudNode) error
- func (sdk *SDK) RemoveSecurityGroup(regionID, securityGroupID string) error
- func (sdk *SDK) StartEcs(id string) error
- func (sdk *SDK) StopEcs(id string) error
- func (sdk *SDK) Type() string
- func (sdk *SDK) Verify() error
- func (sdk *SDK) WaitEcs(regionID, instanceID, expectStatus string, maxWait time.Duration) error
- type SecurityGroupIDSetType
- type ShareGroupType
- type SnapshotType
- type TagType
- type Tags
- type VRouterSetType
- type VSwitchSetType
- type VpcAttributesType
- type VpcSetType
- type ZoneType
- type Zones
Constants ¶
This section is empty.
Variables ¶
var ( // OsImage is exported to make pass golint OsImage = "centos_7_03_64_40G_alibase_20170710.vhd" // NodeName is exported to make pass golint NodeName = "inf-agent-aliyun-node" // NodeLabels is exported to make pass golint NodeLabels = map[string]string{cloudsvr.CLOUDFLAGKEY: CloudType} )
var (
// CloudType is exported
CloudType = "aliyun"
)
var (
// DefaultAPIEndPoint is exported
DefaultAPIEndPoint = "https://ecs.aliyuncs.com/"
)
Functions ¶
This section is empty.
Types ¶
type AllocatePublicIPAddressResponse ¶
type AllocatePublicIPAddressResponse struct { EcsBaseResponse IPAddress string `json:"IpAddress"` }
AllocatePublicIPAddressResponse is exported
type AuthorizeSecurityGroupRequest ¶
type AuthorizeSecurityGroupRequest struct { SecurityGroupID string // must RegionID string // must IPProtocol string // must tcp/udp/icmp/gre/all PortRange string // must 1-100 / -1/-1 Policy string // accept, drop NicType string // internet(default), intranet Priority string // [1-100] SourceCidrIP string // 0.0.0.0/0 (default) SourceGroupID string SourceGroupOwnerAccount string DestCidrIP string DestGroupID string DestGroupOwnerAccount string }
AuthorizeSecurityGroupRequest is exported
func (*AuthorizeSecurityGroupRequest) AddToParameters ¶
func (r *AuthorizeSecurityGroupRequest) AddToParameters(params *orderparam.Params)
AddToParameters is exported
func (*AuthorizeSecurityGroupRequest) Validate ¶
func (r *AuthorizeSecurityGroupRequest) Validate() error
Validate is exported
type AutoSnapshotExecutionStatusType ¶
type AutoSnapshotExecutionStatusType struct { SystemDiskExecutionStatus string DataDiskExecutionStatus string }
AutoSnapshotExecutionStatusType is exported
type AutoSnapshotPolicyType ¶
type AutoSnapshotPolicyType struct { SystemDiskPolicyEnabled string SystemDiskPolicyTimePeriod int SystemDiskPolicyRetentionDays int SystemDiskPolicyRetentionLastWeek string DataDiskPolicyEnabled string DataDiskPolicyTimePeriod int DataDiskPolicyRetentionDays int DataDiskPolicyRetentionLastWeek string }
AutoSnapshotPolicyType is exported
type AvailableDiskCategoriesType ¶
type AvailableDiskCategoriesType struct {
DiskCategories []string `json:"DiskCategories"` // cloud, ephemeral, ephemeral_ssd
}
AvailableDiskCategoriesType is exported
type AvailableInstanceTypes ¶
type AvailableInstanceTypes struct {
InstanceTypes []string `json:"InstanceTypes"`
}
AvailableInstanceTypes is exported
type AvailableResourceCreationType ¶
type AvailableResourceCreationType struct {
ResourceTypes []string `json:"ResourceTypes"` // Instance, Disk, VSwitch
}
AvailableResourceCreationType is exported
type AvailableResources ¶
type AvailableResources struct { // contains all of supported DiskCategory / NetworkCategory / InstanceType / SystemDiskCategory // but the returned data is not exactly, so we do NOT actually using this ResourcesInfo []interface{} `json:"ResourcesInfo"` }
AvailableResources is exported
type AvailableVolumeCategories ¶
type AvailableVolumeCategories struct {
VolumeCategories []string `json:"VolumeCategories"`
}
AvailableVolumeCategories is exported
type ClusterType ¶
type ClusterType struct {
ClusterID string `json:"ClusterId"`
}
ClusterType 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 CreateInstanceRequest ¶
type CreateInstanceRequest struct { RegionID string // must ZoneID string ImageID string // must InstanceType string // must: https://help.aliyun.com/document_detail/25378.html?spm=5176.doc25499.2.10.dzAw7Z SecurityGroupID string // must Password string // not required, if setup, must call Api via https InstanceName string Description string InternetChargeType string InternetMaxBandwidthIn string InternetMaxBandwidthOut string HostName string IoOptimized string SystemDiskCategory string SystemDiskDiskName string SystemDiskDescription string VSwitchID string PrivateIPAddress string InstanceChargeType string // PrePaid, PostPaid(default, require RMB 100+) Period int // required if InstanceChargeType == PrePaid Labels map[string]string // max 5 }
CreateInstanceRequest is exported See More: https://help.aliyun.com/document_detail/25499.html?spm=5176.doc25506.6.798.eeuP5g
func (*CreateInstanceRequest) AddToParameters ¶
func (r *CreateInstanceRequest) AddToParameters(params *orderparam.Params)
AddToParameters should be called after Validate verify checking
func (*CreateInstanceRequest) Validate ¶
func (r *CreateInstanceRequest) Validate() error
Validate is exported
type CreateInstanceResponse ¶
type CreateInstanceResponse struct { EcsBaseResponse InstanceID string `json:"InstanceId"` }
CreateInstanceResponse is exported
type CreateSecurityGroupRequest ¶
type CreateSecurityGroupRequest struct { RegionID string // must SecurityGroupName string Description string VpcID string }
CreateSecurityGroupRequest is exported See More: https://help.aliyun.com/document_detail/25553.html?spm=5176.doc25499.6.857.CzabIR
func (*CreateSecurityGroupRequest) AddToParameters ¶
func (r *CreateSecurityGroupRequest) AddToParameters(params *orderparam.Params)
AddToParameters should be called after Validate verify checking
func (*CreateSecurityGroupRequest) Validate ¶
func (r *CreateSecurityGroupRequest) Validate() error
Validate is exported
type CreateSecurityGroupResponse ¶
type CreateSecurityGroupResponse struct { EcsBaseResponse SecurityGroupID string `json:"SecurityGroupId"` }
CreateSecurityGroupResponse is exported
type DescribeInstanceTypesResponse ¶
type DescribeInstanceTypesResponse struct { EcsBaseResponse InstanceTypes InstanceTypes `json:"InstanceTypes"` }
DescribeInstanceTypesResponse is exported
type DescribeInstancesResponse ¶
type DescribeInstancesResponse struct { EcsBaseResponse TotalCount int `json:"TotalCount"` PageNumber int `json:"PageNumber"` PageSize int `json:"PageSize"` Instances Instances `json:"Instances"` }
DescribeInstancesResponse is exported
type DescribeRegionZonesResponse ¶
type DescribeRegionZonesResponse struct { EcsBaseResponse Zones Zones `json:"Zones"` }
DescribeRegionZonesResponse is exported
NOTE: no use because the returned data is not exactly
type DescribeRegionsResponse ¶
type DescribeRegionsResponse struct { EcsBaseResponse Response Regions `json:"Regions"` }
DescribeRegionsResponse is exported
type DiskDeviceMapping ¶
DiskDeviceMapping is exported
type DiskItemType ¶
type DiskItemType struct { DiskID string RegionID string ZoneID string DiskName string Description string Type string Category string Size int ImageID string SourceSnapshotID string ProductCode string Portable string Status string OperationLocks OperationLocksType InstanceID string Device string DeleteWithInstance string DeleteAutoSnapshot string EnableAutoSnapshot string CreationTime string AttachedTime string DetachedTime string }
DiskItemType is exported
type DiskMonitorDataType ¶
type DiskMonitorDataType struct { DiskID string IOPSRead int IOPSWrite int IOPSTotal int BPSRead int BPSWrite int BPSTotal int TimeStamp string }
DiskMonitorDataType is exported
type EcsBaseResponse ¶
type EcsBaseResponse struct {
RequestID string `json:"RequestId"`
}
EcsBaseResponse is exported
type EcsErrorResponse ¶
type EcsErrorResponse struct { EcsBaseResponse HostID string `json:"HostId"` Code string `json:"Code"` Message string `json:"Message"` }
EcsErrorResponse is exported
type EipAddressAssociateType ¶
type EipAddressAssociateType struct { AllocationID string `json:"AllocationId"` IPAddress string `json:"IpAddress"` Bandwidth int `json:"Bandwidth"` InternetChargeType string `json:"InternetChargeType"` }
EipAddressAssociateType is exported
type EipAddressSetType ¶
type EipAddressSetType struct { RegionID string IPAddress string AllocationID string Status string InstanceID string Bandwidth int InternetChargeType string OperationLocks OperationLocksType AllocationTime string }
EipAddressSetType is exported
type EipMonitorDataType ¶
type EipMonitorDataType struct { EipRX int EipTX int EipFlow int EipBandwidth int EipPackets int TimeStamp string }
EipMonitorDataType is exported
type IPAddressSetType ¶
type IPAddressSetType struct {
IPAddress []string `json:"IpAddress"`
}
IPAddressSetType is exported
type IPRangeSetType ¶
IPRangeSetType is exported
type ImageType ¶
type ImageType struct { ImageID string ImageVersion string Architecture string ImageName string Description string Size int ImageOwnerAlias string OSName string DiskDeviceMappings DiskDeviceMapping ProductCode string IsSubscribed string Progress string Status string CreationTime string }
ImageType is exported
type InstanceAttributesType ¶
type InstanceAttributesType struct { InstanceID string `json:"InstanceId"` InstanceName string `json:"InstanceName"` Description string `json:"Description"` ImageID string `json:"ImageId"` RegionID string `json:"RegionId"` ZoneID string `json:"ZoneId"` InstanceType string `json:"InstanceType"` HostName string `json:"HostName"` Status string `json:"Status"` SecurityGroupIDs SecurityGroupIDSetType `json:"SecurityGroupIds"` InnerIPAddress IPAddressSetType `json:"InnerIpAddress"` PublicIPAddress IPAddressSetType `json:"PublicIpAddress"` InternetMaxBandwidthIn int `json:"InternetMaxBandwidthIn"` InternetMaxBandwidthOut int `json:"InternetMaxBandwidthOut"` InternetChargeType string `json:"InternetChargeType"` CreationTime string `json:"CreationTime"` VpcAttributes VpcAttributesType `json:"VpcAttributes"` EipAddress EipAddressAssociateType `json:"EipAddress"` InstanceNetworkType string `json:"InstanceNetworkType"` OperationLocks OperationLocksType `json:"OperationLocks"` Tags Tags `json:"Tags"` // extended }
InstanceAttributesType is exported
type InstanceMonitorDataType ¶
type InstanceMonitorDataType struct { InstanceID string CPU int IntranetRX int IntranetTX int IntranetBandwidth int InternetRX int InternetTX int InternetBandwidth int IOPSRead int IOPSWrite int BPSRead int BPSWrite int TimeStamp string }
InstanceMonitorDataType is exported
type InstanceTypeItemType ¶
type InstanceTypeItemType struct { InstanceTypeID string `json:"InstanceTypeId"` CPUCoreCount int `json:"CpuCoreCount"` MemorySize float64 `json:"MemorySize"` GPUSpec string `json:"GPUSpec"` GPUAmount int `json:"GPUAmount"` InstanceTypeFamily string `json:"InstanceTypeFamily"` LocalStorageCategory string `json:"LocalStorageCategory"` }
InstanceTypeItemType is exported
type InstanceTypes ¶
type InstanceTypes struct {
InstanceType []InstanceTypeItemType `json:"InstanceType"`
}
InstanceTypes is exported
type Instances ¶
type Instances struct {
Instance []InstanceAttributesType `json:"Instance"`
}
Instances is exported
type OperationLocksType ¶
type OperationLocksType struct {
LockReason []string `json:"LockReason"` // financial, security
}
OperationLocksType is exported
type RegionType ¶
RegionType is exported
type RouteEntrySetType ¶
type RouteEntrySetType struct { RouteTableID string DestinationCidrBlock string Type string NextHopID string Status string }
RouteEntrySetType is exported
type RouteTableSetType ¶
type RouteTableSetType struct { VRouterID string RouteTableID string RouteEntrys []RouteEntrySetType RouteTableType string CreationTime string }
RouteTableSetType is exported
type SDK ¶
type SDK struct {
// contains filtered or unexported fields
}
SDK is an implement of CloudSvr
func (*SDK) AssignEcsPublicIP ¶
AssignEcsPublicIP assign a public ip to specified ecs instance note that Ecs must be `Running` or `Stopped` status
func (*SDK) AuthorizeSecurityGroup ¶
func (sdk *SDK) AuthorizeSecurityGroup(req *AuthorizeSecurityGroupRequest) error
AuthorizeSecurityGroup create an authorization rule within specified security group
func (*SDK) InspectEcs ¶
func (sdk *SDK) InspectEcs(regionID, instanceID string) (InstanceAttributesType, error)
InspectEcs show details of a given ecs instance
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(regionID string) ([]InstanceAttributesType, error)
ListEcses show all of ecs instances for a specified region (regionID parameter set) or all of regions (regionID parameter empty)
func (*SDK) ListInstanceTypes ¶
func (sdk *SDK) ListInstanceTypes(minCPU, maxCPU, minMem, maxMem int) ([]InstanceTypeItemType, error)
ListInstanceTypes show all of instance types aliyun supported support cpu / memory minimal/maximize filter parameters
func (*SDK) ListNodes ¶
ListNodes list all aliyun ecs instances with labels key: CLOUDFLAGKEY the nodes listed does NOT have any auth fields `User` `Password` note: aliyun's api is much slower, use concurrency to speed up
func (*SDK) ListRegionZones ¶
ListRegionZones show all of zones under a specified region. but the returned zone availble resources can't be used because the data is not exactly note: Deprecated
func (*SDK) ListRegions ¶
func (sdk *SDK) ListRegions() ([]RegionType, error)
ListRegions show all of regions aliyun supported
func (*SDK) NewEcs ¶
func (sdk *SDK) NewEcs(req *CreateInstanceRequest) (string, error)
NewEcs create a new ecs instance with given settings note that Ecs is `Stopped` status after this call
func (*SDK) NewNode ¶
func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error)
NewNode create aliyun ecs instance, try to use prefered attributes firstly
func (*SDK) NewSecurityGroup ¶
func (sdk *SDK) NewSecurityGroup(req *CreateSecurityGroupRequest) (string, error)
NewSecurityGroup create a new security group with empty authorizations
func (*SDK) RemoveNode ¶
RemoveNode remove aliyun ecs instance, ignore IncorrectInstanceStatus error and retry until succeed or timeout 1. stop ecs 2. wait ecs stopped 3. remove ecs (ignore ...)
func (*SDK) RemoveSecurityGroup ¶
RemoveSecurityGroup remove specified recurity group under given region
func (*SDK) StartEcs ¶
StartEcs start the specified ecs instance note that Ecs must be `Stopped` status, after this call, Ecs entering `Starting` status
func (*SDK) StopEcs ¶
StopEcs stop the specified ecs instance note that Ecs must be `Running` status, after this call, Ecs entering `Stopping` status
type SecurityGroupIDSetType ¶
type SecurityGroupIDSetType struct {
SecurityGroupID []string `json:"SecurityGroupId"`
}
SecurityGroupIDSetType is exported
type SnapshotType ¶
type SnapshotType struct { SnapshotID string `json:"SnapshotId"` SnapshotName string `json:"SnapshotName"` Description string `json:"Description"` Progress string `json:"Progress"` SourceDiskID string `json:"SourceDiskId"` SourceDiskSize int `json:"SourceDiskSize"` SourceDiskType string `json:"SourceDiskType"` ProductCode string `json:"ProductCode"` CreationTime string `json:"CreationTime"` }
SnapshotType is exported
type VRouterSetType ¶
type VRouterSetType struct { VRouterID string RegionID string VpcID string RouteTableIDs string VRouterName string Description string CreationTime string }
VRouterSetType is exported
type VSwitchSetType ¶
type VSwitchSetType struct { VSwitchID string VpcID string Status string CidrBlock string ZoneID string AvailableIPAddressCount int Description string VSwitchName string CreationTime string }
VSwitchSetType is exported
type VpcAttributesType ¶
type VpcAttributesType struct { VpcID string `json:"VpcId"` VSwitchID string `json:"VSwitchId"` PrivateIPAddress IPAddressSetType `json:"PrivateIpAddress"` NatIPAddress string `json:"NatIpAddress"` }
VpcAttributesType is exported
type VpcSetType ¶
type VpcSetType struct { VpcID string RegionID string Status string VpcName string VSwitchIDs string CidrBlock string VRouterID string Description string CreationTime string }
VpcSetType is exported
type ZoneType ¶
type ZoneType struct { ZoneID string `json:"ZoneId"` LocalName string `json:"LocalName"` AvailableResources AvailableResources `json:"AvailableResources"` AvailableInstanceTypes AvailableInstanceTypes `json:"AvailableInstanceTypes"` AvailableResourceCreation AvailableResourceCreationType `json:"AvailableResourceCreation"` AvailableDiskCategories AvailableDiskCategoriesType `json:"AvailableDiskCategories"` AvailableVolumeCategories AvailableVolumeCategories `json:"AvailableVolumeCategories"` }
ZoneType is exported