aws

package
v0.0.0-...-96756cd Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2018 License: MIT Imports: 14 Imported by: 5

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

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

DescribeAGsByPrefix 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) RecordLifecycleActionHeartbeat

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

RecordLifecycleActionHeartbeat resets the timeout period for a lifecycle hook event

func (*Client) RemoveASGInstanceProtection

func (c *Client) RemoveASGInstanceProtection(autoscalingGroupName, instanceID *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)
	DescribeAGsByPrefix(autoscalingGroupName string) ([]*autoscaling.Group, error)
	RemoveASGInstanceProtection(autoscalingGroupName, instanceID *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
	RecordLifecycleActionHeartbeat(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) DescribeAGsByPrefix

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

DescribeAGsByPrefix 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) FlushMock

func (c *ConnectionMock) FlushMock()

FlushMock will flush all requests recorded on the mock side

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

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

RecordLifecycleActionHeartbeat is a mock call for testing purposes

func (*ConnectionMock) RemoveASGInstanceProtection

func (c *ConnectionMock) RemoveASGInstanceProtection(autoscalingGroupName, instanceID *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