Documentation ¶
Index ¶
- func GetLocalEc2AZ() (string, error)
- func GetLocalEc2Hostname() (string, error)
- func GetLocalEc2IP() (string, error)
- func GetLocalEc2InstanceID() (string, error)
- func GetLocalEc2Region() (string, error)
- func GetLocalEc2VpcID() (string, error)
- func GetRegionAZs(region string, sess *session.Session) ([]string, error)
- type AWSEc2
- func (s *AWSEc2) AssignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error
- func (s *AWSEc2) AttachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *AWSEc2) CreateVolume(ctx context.Context, opts *server.CreateVolumeOptions) (volID string, err error)
- func (s *AWSEc2) CreateVpc(ctx context.Context) (vpcID string, err error)
- func (s *AWSEc2) DeleteVolume(ctx context.Context, volID string) error
- func (s *AWSEc2) DeleteVpc(ctx context.Context, vpcID string) error
- func (s *AWSEc2) DescribeInstance(ctx context.Context, instanceID string) (*ec2.Instance, error)
- func (s *AWSEc2) DescribeSubnet(ctx context.Context, subnetID string) (*ec2.Subnet, error)
- func (s *AWSEc2) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *AWSEc2) GetControlDBDeviceName() string
- func (s *AWSEc2) GetFirstDeviceName() string
- func (s *AWSEc2) GetInstanceNetworkInterface(ctx context.Context, instanceID string) (netInterface *server.NetworkInterface, err error)
- func (s *AWSEc2) GetInstanceState(ctx context.Context, instanceID string) (state string, err error)
- func (s *AWSEc2) GetNetworkInterfaces(ctx context.Context, cluster string, vpcID string, zone string) (netInterfaces []*server.NetworkInterface, cidrBlock string, err error)
- func (s *AWSEc2) GetNextDeviceName(lastDev string) (devName string, err error)
- func (s *AWSEc2) GetVolumeInfo(ctx context.Context, volID string) (info server.VolumeInfo, err error)
- func (s *AWSEc2) GetVolumeState(ctx context.Context, volID string) (state string, err error)
- func (s *AWSEc2) LaunchOneInstance(ctx context.Context, imageID string, az string, cluster string) (instanceID string, err error)
- func (s *AWSEc2) TerminateInstance(ctx context.Context, instanceID string) error
- func (s *AWSEc2) UnassignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error
- func (s *AWSEc2) WaitInstanceRunning(ctx context.Context, instanceID string) error
- func (s *AWSEc2) WaitVolumeAttached(ctx context.Context, volID string) error
- func (s *AWSEc2) WaitVolumeCreated(ctx context.Context, volID string) error
- func (s *AWSEc2) WaitVolumeDetached(ctx context.Context, volID string) error
- type Ec2Info
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalEc2AZ ¶
GetLocalEc2AZ gets the current ec2 node's availability-zone
func GetLocalEc2Hostname ¶
GetLocalEc2Hostname gets the current ec2 node's hostname
func GetLocalEc2IP ¶
GetLocalEc2IP gets the current ec2 node's local IP
func GetLocalEc2InstanceID ¶
GetLocalEc2InstanceID gets the current ec2 node's instanceID
func GetLocalEc2Region ¶
GetLocalEc2Region gets the current ec2 node's region
func GetLocalEc2VpcID ¶
GetLocalEc2VpcID gets the current ec2 node's vpc id
Types ¶
type AWSEc2 ¶
type AWSEc2 struct {
// contains filtered or unexported fields
}
AWSEc2 handles the ec2 related functions
func (*AWSEc2) AssignStaticIP ¶ added in v0.8.1
func (s *AWSEc2) AssignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error
AssignStaticIP assigns the static ip to the network interface.
func (*AWSEc2) AttachVolume ¶
func (s *AWSEc2) AttachVolume(ctx context.Context, volID string, instanceID string, devName string) error
AttachVolume attaches the volume
func (*AWSEc2) CreateVolume ¶
func (s *AWSEc2) CreateVolume(ctx context.Context, opts *server.CreateVolumeOptions) (volID string, err error)
CreateVolume creates one volume
func (*AWSEc2) DeleteVolume ¶
DeleteVolume deletes the volume
func (*AWSEc2) DescribeInstance ¶ added in v0.8.1
DescribeInstance gets the ec2 instance.
func (*AWSEc2) DescribeSubnet ¶ added in v0.8.1
DescribeSubnet returns the ec2 subnet
func (*AWSEc2) DetachVolume ¶
func (s *AWSEc2) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error
DetachVolume detaches the volume
func (*AWSEc2) GetControlDBDeviceName ¶
GetControlDBDeviceName returns the default controldb device name
func (*AWSEc2) GetFirstDeviceName ¶
GetFirstDeviceName returns the first device name AWS EBS only supports device names, /dev/xvd[b-c][a-z], recommend /dev/xvd[f-p]
func (*AWSEc2) GetInstanceNetworkInterface ¶ added in v0.8.1
func (s *AWSEc2) GetInstanceNetworkInterface(ctx context.Context, instanceID string) (netInterface *server.NetworkInterface, err error)
GetInstanceNetworkInterface gets the network interface of the instance. Assume one instance only has one network interface.
func (*AWSEc2) GetInstanceState ¶
GetInstanceState returns instance state, valid state:
pending | running | shutting-down | terminated | stopping | stopped
func (*AWSEc2) GetNetworkInterfaces ¶ added in v0.8.1
func (s *AWSEc2) GetNetworkInterfaces(ctx context.Context, cluster string, vpcID string, zone string) (netInterfaces []*server.NetworkInterface, cidrBlock string, err error)
GetNetworkInterfaces gets all network interfaces in the cluster, vpc and zone.
func (*AWSEc2) GetNextDeviceName ¶
GetNextDeviceName returns the next device name
func (*AWSEc2) GetVolumeInfo ¶
func (s *AWSEc2) GetVolumeInfo(ctx context.Context, volID string) (info server.VolumeInfo, err error)
GetVolumeInfo returns the volume information
func (*AWSEc2) GetVolumeState ¶
GetVolumeState returns volume state, valid state:
creating | available | in-use | deleting | deleted | error
func (*AWSEc2) LaunchOneInstance ¶
func (s *AWSEc2) LaunchOneInstance(ctx context.Context, imageID string, az string, cluster string) (instanceID string, err error)
LaunchOneInstance launches a new instance at specified az
func (*AWSEc2) TerminateInstance ¶
TerminateInstance terminates one instance
func (*AWSEc2) UnassignStaticIP ¶ added in v0.8.1
func (s *AWSEc2) UnassignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error
UnassignStaticIP unassigns the staticIP from the networkInterface. If the networkInterface does not own the ip, should return success.
func (*AWSEc2) WaitInstanceRunning ¶
WaitInstanceRunning waits till the instance is at running state
func (*AWSEc2) WaitVolumeAttached ¶
WaitVolumeAttached waits till volume is attached, e.g. volume state becomes in-use
func (*AWSEc2) WaitVolumeCreated ¶
WaitVolumeCreated waits till volume is created
type Ec2Info ¶
type Ec2Info struct {
// contains filtered or unexported fields
}
Ec2Info implements server.Info
func NewEc2Info ¶
NewEc2Info creates a Ec2Info instance