awsec2

package
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 12 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalEc2AZ

func GetLocalEc2AZ() (string, error)

GetLocalEc2AZ gets the current ec2 node's availability-zone

func GetLocalEc2Hostname

func GetLocalEc2Hostname() (string, error)

GetLocalEc2Hostname gets the current ec2 node's hostname

func GetLocalEc2IP

func GetLocalEc2IP() (string, error)

GetLocalEc2IP gets the current ec2 node's local IP

func GetLocalEc2InstanceID

func GetLocalEc2InstanceID() (string, error)

GetLocalEc2InstanceID gets the current ec2 node's instanceID

func GetLocalEc2Region

func GetLocalEc2Region() (string, error)

GetLocalEc2Region gets the current ec2 node's region

func GetLocalEc2VpcID

func GetLocalEc2VpcID() (string, error)

GetLocalEc2VpcID gets the current ec2 node's vpc id

func GetRegionAZs

func GetRegionAZs(region string, sess *session.Session) ([]string, error)

GetRegionAZs gets the AvailabilityZones in one region

Types

type AWSEc2

type AWSEc2 struct {
	// contains filtered or unexported fields
}

AWSEc2 handles the ec2 related functions

func NewAWSEc2

func NewAWSEc2(sess *session.Session) *AWSEc2

NewAWSEc2 creates a AWSEc2 instance

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) CreateVpc

func (s *AWSEc2) CreateVpc(ctx context.Context) (vpcID string, err error)

CreateVpc creates one vpc

func (*AWSEc2) DeleteVolume

func (s *AWSEc2) DeleteVolume(ctx context.Context, volID string) error

DeleteVolume deletes the volume

func (*AWSEc2) DeleteVpc

func (s *AWSEc2) DeleteVpc(ctx context.Context, vpcID string) error

DeleteVpc deletes the vpc

func (*AWSEc2) DescribeInstance added in v0.8.1

func (s *AWSEc2) DescribeInstance(ctx context.Context, instanceID string) (*ec2.Instance, error)

DescribeInstance gets the ec2 instance.

func (*AWSEc2) DescribeSubnet added in v0.8.1

func (s *AWSEc2) DescribeSubnet(ctx context.Context, subnetID string) (*ec2.Subnet, error)

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

func (s *AWSEc2) GetControlDBDeviceName() string

GetControlDBDeviceName returns the default controldb device name

func (*AWSEc2) GetFirstDeviceName

func (s *AWSEc2) GetFirstDeviceName() string

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

func (s *AWSEc2) GetInstanceState(ctx context.Context, instanceID string) (state string, err error)

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

func (s *AWSEc2) GetNextDeviceName(lastDev string) (devName string, err error)

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

func (s *AWSEc2) GetVolumeState(ctx context.Context, volID string) (state string, err error)

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

func (s *AWSEc2) TerminateInstance(ctx context.Context, instanceID string) error

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

func (s *AWSEc2) WaitInstanceRunning(ctx context.Context, instanceID string) error

WaitInstanceRunning waits till the instance is at running state

func (*AWSEc2) WaitVolumeAttached

func (s *AWSEc2) WaitVolumeAttached(ctx context.Context, volID string) error

WaitVolumeAttached waits till volume is attached, e.g. volume state becomes in-use

func (*AWSEc2) WaitVolumeCreated

func (s *AWSEc2) WaitVolumeCreated(ctx context.Context, volID string) error

WaitVolumeCreated waits till volume is created

func (*AWSEc2) WaitVolumeDetached

func (s *AWSEc2) WaitVolumeDetached(ctx context.Context, volID string) error

WaitVolumeDetached waits till volume is detached, state will be available

type Ec2Info

type Ec2Info struct {
	// contains filtered or unexported fields
}

Ec2Info implements server.Info

func NewEc2Info

func NewEc2Info(sess *session.Session) (*Ec2Info, error)

NewEc2Info creates a Ec2Info instance

func (*Ec2Info) GetLocalAvailabilityZone

func (s *Ec2Info) GetLocalAvailabilityZone() string

func (*Ec2Info) GetLocalInstanceID

func (s *Ec2Info) GetLocalInstanceID() string

func (*Ec2Info) GetLocalRegion

func (s *Ec2Info) GetLocalRegion() string

func (*Ec2Info) GetLocalRegionAZs

func (s *Ec2Info) GetLocalRegionAZs() []string

func (*Ec2Info) GetLocalVpcID

func (s *Ec2Info) GetLocalVpcID() string

func (*Ec2Info) GetPrivateIP

func (s *Ec2Info) GetPrivateIP() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL