aws

package
v0.0.0-...-d6eb901 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client holds the AWS SDK objects for call AWS API

func NewClient

func NewClient(accessKey, secretKey, region, iamRole, iamSession string) (*Client, error)

NewClient returns a new aws.client

func (*Client) CompleteLifecycleAction

func (c *Client) CompleteLifecycleAction(autoscalingGroupName, instanceID *string) error

CompleteLifecycleAction completes a lifecycle event for an instance pending to be deleted

func (*Client) DescribeAGByName

func (c *Client) DescribeAGByName(autoscalingGroupPrefix string) ([]*autoscaling.Group, error)

DescribeAGByName returns all autoscaling groups that matches a certain prefix

func (*Client) DescribeInstanceByID

func (c *Client) DescribeInstanceByID(instanceID string) (*ec2.Instance, error)

DescribeInstanceByID returns the instance that matches an instanceID

func (*Client) DescribeInstancesByTag

func (c *Client) DescribeInstancesByTag(tagKey string) ([]*ec2.Instance, error)

DescribeInstancesByTag return all instances with a certain tag set

func (*Client) HasLifeCycleHook

func (c *Client) HasLifeCycleHook(autoscalingGroupName *string) (bool, error)

HasLifeCycleHook checks if deathnode lifecyclehook is enabled for an autoscalingGroup

func (*Client) PutLifeCycleHook

func (c *Client) PutLifeCycleHook(autoscalingGroupName *string, heartbeatTimeout *int64) error

PutLifeCycleHook adds an INSTANCE_TERMINATING lifecycle hook to an autoscalingGroup

func (*Client) RemoveASGInstanceProtection

func (c *Client) RemoveASGInstanceProtection(autoscalingGroupName *string, instanceIds []*string) error

RemoveASGInstanceProtection remove ProtectFromScaleIn flag from some instances from an autoscalingGroup

func (*Client) SetASGInstanceProtection

func (c *Client) SetASGInstanceProtection(autoscalingGroupName *string, instanceIds []*string) error

SetASGInstanceProtection set an autoscalingGroup and all it's instances with ProtectFromScaleIn flag

func (*Client) SetInstanceTag

func (c *Client) SetInstanceTag(key, value, instanceID string) error

SetInstanceTag set a tag with <key,value> to an AWS instance

type ClientInterface

type ClientInterface interface {
	DescribeInstanceByID(instanceID string) (*ec2.Instance, error)
	DescribeInstancesByTag(tagKey string) ([]*ec2.Instance, error)
	DescribeAGByName(autoscalingGroupName string) ([]*autoscaling.Group, error)
	RemoveASGInstanceProtection(autoscalingGroupName *string, instanceIDs []*string) error
	SetASGInstanceProtection(autoscalingGroupName *string, instanceIDs []*string) error
	SetInstanceTag(key, value, instanceID string) error
	HasLifeCycleHook(autoscalingGroupName *string) (bool, error)
	PutLifeCycleHook(autoscalingGroupName *string, heartbeatTimeout *int64) error
	CompleteLifecycleAction(autoscalingGroupName, instanceID *string) error
}

ClientInterface implements a client with all required operations against AWS API

type ConnectionMock

type ConnectionMock struct {
	Records  map[string]*[]string
	Requests map[string][][]string
}

ConnectionMock is a aws mock client for testing purposes

func (*ConnectionMock) CompleteLifecycleAction

func (c *ConnectionMock) CompleteLifecycleAction(autoscalingGroupName, instanceID *string) error

CompleteLifecycleAction is a mock call for testing purposes

func (*ConnectionMock) DescribeAGByName

func (c *ConnectionMock) DescribeAGByName(autoscalingGroupName string) ([]*autoscaling.Group, error)

DescribeAGByName is a mock call for testing purposes

func (*ConnectionMock) DescribeInstanceByID

func (c *ConnectionMock) DescribeInstanceByID(instanceID string) (*ec2.Instance, error)

DescribeInstanceByID is a mock call for testing purposes

func (*ConnectionMock) DescribeInstancesByTag

func (c *ConnectionMock) DescribeInstancesByTag(tagKey string) ([]*ec2.Instance, error)

DescribeInstancesByTag is a mock call for testing purposes

func (*ConnectionMock) HasLifeCycleHook

func (c *ConnectionMock) HasLifeCycleHook(autoscalingGroupName *string) (bool, error)

HasLifeCycleHook is a mock call for testing purposes

func (*ConnectionMock) PutLifeCycleHook

func (c *ConnectionMock) PutLifeCycleHook(autoscalingGroupName *string, heartbeatTimeout *int64) error

PutLifeCycleHook is a mock call for testing purposes

func (*ConnectionMock) RemoveASGInstanceProtection

func (c *ConnectionMock) RemoveASGInstanceProtection(autoscalingGroupName *string, instanceIDs []*string) error

RemoveASGInstanceProtection is a mock call for testing purposes

func (*ConnectionMock) SetASGInstanceProtection

func (c *ConnectionMock) SetASGInstanceProtection(autoscalingGroupName *string, instanceIDs []*string) error

SetASGInstanceProtection is a mock call for testing purposes

func (*ConnectionMock) SetInstanceTag

func (c *ConnectionMock) SetInstanceTag(key, value, instanceID string) error

SetInstanceTag is a mock call for testing purposes

Jump to

Keyboard shortcuts

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