aws

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TagName    = "Name"
	TagCluster = "KubernetesCluster"
	TagRole    = "Role"
)

Tag keys for aws resources:

Variables

View Source
var (
	ErrInvalidKeys        = errors.New("aws: invalid keys")
	ErrNoRegionProvided   = errors.New("aws: region should shouldn't be emplty")
	ErrInstanceIDEmpty    = errors.New("aws: instance id shouldn't be emplty")
	ErrNoInstancesCreated = errors.New("aws: no instances were created")
	ErrInstanceNotFound   = errors.New("aws: instance: not found")
)

AWS client specific errors:

Functions

This section is empty.

Types

type Client

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

Client used for accessing AWS resources.

func New

func New(keyID, secret string, tags map[string]string) (*Client, error)

New returns a configured AWS client.

func (*Client) AvailableInstanceTypes

func (c *Client) AvailableInstanceTypes(ctx context.Context) ([]*EC2TypeInfo, error)

AvailableInstanceTypes returns a list of valid instance types for the region.

func (*Client) CreateInstance

func (c *Client) CreateInstance(ctx context.Context, cfg InstanceConfig) (*ec2.Instance, error)

CreateInstance starts a new instance due to the config.

func (*Client) DeleteInstance

func (c *Client) DeleteInstance(ctx context.Context, region, instanceID string) (*ec2.InstanceStateChange, error)

DeleteInstance terminates an instance with provided id and region.

func (*Client) GetInstance

func (c *Client) GetInstance(ctx context.Context, region, id string) (*ec2.Instance, error)

GetInstance retrieves an instance by instanceID.

func (*Client) ListRegionInstances

func (c *Client) ListRegionInstances(ctx context.Context, region string, tags map[string]string) ([]*ec2.Instance, error)

ListInstances returns a list of instances.

type EC2TypeAttributes

type EC2TypeAttributes struct {
	ServiceCode       string `json:"servicecode"`
	ServiceName       string `json:"servicename"`
	InstanceFamily    string `json:"instanceFamily"`
	InstanceType      string `json:"instanceType"`
	OperatingSystem   string `json:"operatingSystem"`
	Location          string `json:"location"`
	VCPU              string `json:"vcpu"`
	Memory            string `json:"memory"`
	ECU               string `json:"ecu"`
	PhysicalProcessor string `json:"physicalProcessor"`
	Storage           string `json:"storage"`
	CapacityStatus    string `json:"capacitystatus"`
}

type EC2TypeInfo

type EC2TypeInfo struct {
	SKU           string             `json:"sku"`
	ProductFamily string             `json:"productFamily"`
	Attributes    *EC2TypeAttributes `json:"attributes"`
}

type InstanceConfig

type InstanceConfig struct {
	TagName          string
	Type             string
	TagClusterName   string
	TagClusterRole   string
	ID               string
	Region           string
	ImageID          string
	KeyName          string
	HasPublicAddr    bool
	SecurityGroups   []*string
	SubnetID         string
	IAMRole          string
	VolumeType       string
	VolumeSize       int64
	VolumeDeviceName string
	EBSOptimized     *bool
	Tags             map[string]string
	UsedData         string
}

Jump to

Keyboard shortcuts

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