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) AttachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *AWSEc2) CreateVolume(ctx context.Context, az string, volSizeGB int64) (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) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *AWSEc2) GetControlDBDeviceName() string
- func (s *AWSEc2) GetFirstDeviceName() string
- func (s *AWSEc2) GetInstanceState(ctx context.Context, instanceID string) (state 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, az string) (instanceID string, err error)
- func (s *AWSEc2) TerminateInstance(ctx context.Context, instanceID 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) 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, az string, volSizeGB int64) (volID string, err error)
CreateVolume creates one volume
func (*AWSEc2) DeleteVolume ¶
DeleteVolume deletes the volume
func (*AWSEc2) DetachVolume ¶
func (s *AWSEc2) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error
DetachVolume detaches the volume return error:
- IncorrectState if volume is at like available state
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) GetInstanceState ¶
GetInstanceState returns instance state, valid state:
pending | running | shutting-down | terminated | stopping | stopped
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 ¶
LaunchOneInstance launches a new instance at specified az
func (*AWSEc2) TerminateInstance ¶
TerminateInstance terminates one instance
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