Documentation ¶
Overview ¶
Package aws ... this file rewrap existing methods to implement the cloudsvr.Handler interface
Index ¶
- Variables
- type Config
- type ImageSorter
- type InstanceTypeSpec
- type Region
- type SDK
- func (sdk *SDK) APIEndPoint() string
- func (sdk *SDK) AccessID() string
- func (sdk *SDK) AccessKey() string
- func (sdk *SDK) CreateSSHKey(region, suffix string) (string, string, error)
- func (sdk *SDK) CreateSecurityGroup(region, suffix string) (string, error)
- func (sdk *SDK) InspectEcs(region, ecsID string) (*ec2.Instance, 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(region string, lbs map[string]string) ([]*ec2.Instance, error)
- func (sdk *SDK) ListInstanceTypes(minCPU, maxCPU, minMem, maxMem int) (map[string]*InstanceTypeSpec, error)
- func (sdk *SDK) ListNodes() ([]*cloudsvr.CloudNode, error)
- func (sdk *SDK) ListRegions() ([]*ec2.Region, error)
- func (sdk *SDK) ListZones(region string) ([]*ec2.AvailabilityZone, error)
- func (sdk *SDK) NewEcs(region string, req *ec2.RunInstancesInput) (string, error)
- func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error)
- func (sdk *SDK) PickupCentos7AMI(region string) (string, error)
- func (sdk *SDK) PickupZone(region string) string
- func (sdk *SDK) Ping() error
- func (sdk *SDK) RemoveEcs(region, ecsID string) error
- func (sdk *SDK) RemoveNode(node *cloudsvr.CloudNode) error
- func (sdk *SDK) RemoveSSHKey(region, name string) error
- func (sdk *SDK) RemoveSecurityGroup(region, sgid string) error
- func (sdk *SDK) SwitchRegion(region string) *ec2.EC2
- func (sdk *SDK) Type() string
- func (sdk *SDK) Verify() error
- func (sdk *SDK) WaitEcs(region, ecsID, expectStatus string, maxWait time.Duration) error
Constants ¶
This section is empty.
Variables ¶
var ( // NodeName is exported to make pass golint NodeName = "inf-agent-aws-node" // NodeLabels is exported to make pass golint NodeLabels = map[string]string{cloudsvr.CLOUDFLAGKEY: CloudType} // SSHKeyNamePrefix is exported SSHKeyNamePrefix = "inf-agent-aws-sshkey" // SecurityGrouopNamePrefix is exported SecurityGrouopNamePrefix = "inf-agent-aws-servicegroup" )
var (
// CloudType is exported
CloudType = "aws"
)
var ( // DefaultAPIEndPoint is exported // nouse actually, Amazon VPC directs your request to the us-east-1 DefaultAPIEndPoint = "https://ec2.amazonaws.com" )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { EndPoint string `json:"endpoint,omitempty"` AccessID string `json:"access_id"` AccessKey string `json:"access_key"` }
Config is exported
type ImageSorter ¶
ImageSorter sort the ec2.Image by CreationDate
func (ImageSorter) Len ¶
func (s ImageSorter) Len() int
func (ImageSorter) Less ¶
func (s ImageSorter) Less(i, j int) bool
func (ImageSorter) Swap ¶
func (s ImageSorter) Swap(i, j int)
type InstanceTypeSpec ¶
InstanceTypeSpec is exported
type SDK ¶
type SDK struct {
// contains filtered or unexported fields
}
SDK is an implement of CloudSvr
func (*SDK) CreateSSHKey ¶
CreateSSHKey import a new ssh key on given aws region
func (*SDK) CreateSecurityGroup ¶
CreateSecurityGroup is exported
func (*SDK) InspectEcs ¶
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 ¶
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) (map[string]*InstanceTypeSpec, error)
ListInstanceTypes show all of instance types aws supported support cpu / memory minimal/maximize filter parameters
func (*SDK) ListNodes ¶
ListNodes list all aws ecs instances with labels key: CLOUDFLAGKEY the nodes listed does NOT have any auth fields `User` `Password`
func (*SDK) ListRegions ¶
ListRegions show all of regions aws supported
func (*SDK) ListZones ¶
func (sdk *SDK) ListZones(region string) ([]*ec2.AvailabilityZone, error)
ListZones list available zones under one given region
func (*SDK) NewNode ¶
func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error)
NewNode create aws ecs instance, try to use prefered attributes firstly Note: count of (each type of) instances are limited per-region / per-user See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-resource-limits.html
func (*SDK) PickupCentos7AMI ¶
PickupCentos7AMI pick up the first avaliable centos7 AMI under a specified region
func (*SDK) PickupZone ¶
PickupZone pick up the first avaliable zone under a specified region
func (*SDK) RemoveNode ¶
RemoveNode remove aws ecs instance
func (*SDK) RemoveSSHKey ¶
RemoveSSHKey remove a given ssh key on given aws region
func (*SDK) RemoveSecurityGroup ¶
RemoveSecurityGroup is exported
func (*SDK) SwitchRegion ¶
SwitchRegion switch to new region and return a new ec2.EC2 client
func (*SDK) Verify ¶
Verify verifies configs about aliyun endpoint & access id & access key See: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html