manager

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandOutput

type CommandOutput struct {
	InstanceID string
	Status     string
	Output     string
	Error      error
}

CommandOutput is the return type transmitted over a channel when fetching output.

type Instance

type Instance struct {
	InstanceID       string    `json:"instanceId"`
	Name             string    `json:"name"`
	State            string    `json:"state"`
	ImageID          string    `json:"imageId"`
	PlatformName     string    `json:"platformName"`
	PlatformVersion  string    `json:"platformVersion"`
	IPAddress        string    `json:"ipAddress"`
	PingStatus       string    `json:"pingStatus"`
	LastPingDateTime time.Time `json:"lastPingDateTime"`
}

Instance describes relevant information about an instance-id as collected from SSM and EC2 endpoints. And does not user pointers for all values.

func NewInstance

func NewInstance(ssmInstance *ssm.InstanceInformation, ec2Instance *ec2.Instance) *Instance

NewInstance creates a new Instance from ssm.InstanceInformation.

func (*Instance) ID added in v0.2.1

func (i *Instance) ID() string

ID returns the InstanceID of an Instance.

func (*Instance) TabString

func (i *Instance) TabString() string

TabString returns all field values separated by "\t|\t" for an instance. Use with tabwriter to output a table of instances.

type Manager

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

Manager handles the clients interfacing with AWS.

func NewManager

func NewManager(sess *session.Session, region string) *Manager

NewManager creates a new Manager from an AWS session and region.

func NewTestManager

func NewTestManager(ssm ssmiface.SSMAPI, s3 s3iface.S3API, ec2 ec2iface.EC2API) *Manager

NewTestManager creates a new manager for testing purposes.

func (*Manager) AbortCommand

func (m *Manager) AbortCommand(instanceIds []string, commandID string) error

AbortCommand command on the given instance ids.

func (*Manager) GetCommandOutput

func (m *Manager) GetCommandOutput(ctx context.Context, instanceIds []string, commandID string, out chan<- *CommandOutput)

GetCommandOutput fetches the results from a command invocation for all specified instanceIds and closes the receiving channel before exiting.

func (*Manager) ListInstances

func (m *Manager) ListInstances(limit int64, tagFilters []*TagFilter) ([]*Instance, error)

ListInstances fetches a list of instances managed by SSM. Paginates until all responses have been collected.

func (*Manager) RunCommand

func (m *Manager) RunCommand(instanceIds []string, command string) (string, error)

RunCommand on the given instance ids.

type MockEC2 added in v0.2.2

type MockEC2 struct {
	ec2iface.EC2API
	Instances map[string]*ec2.Instance
	Error     bool
}

func (*MockEC2) DescribeInstances added in v0.2.2

func (mock *MockEC2) DescribeInstances(input *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)

type MockS3

type MockS3 struct {
	s3iface.S3API
	Error bool
}

func (*MockS3) GetObject

func (mock *MockS3) GetObject(input *s3.GetObjectInput) (*s3.GetObjectOutput, error)

type MockSSM

type MockSSM struct {
	ssmiface.SSMAPI
	Instances      []*ssm.InstanceInformation
	NextToken      string
	CommandStatus  string
	CommandHistory map[string]*struct {
		Command *ssm.Command
		Status  string
	}
	Error bool
	// contains filtered or unexported fields
}

func (*MockSSM) CancelCommand

func (mock *MockSSM) CancelCommand(input *ssm.CancelCommandInput) (*ssm.CancelCommandOutput, error)

func (*MockSSM) DescribeInstanceInformation

func (mock *MockSSM) DescribeInstanceInformation(input *ssm.DescribeInstanceInformationInput) (*ssm.DescribeInstanceInformationOutput, error)

func (*MockSSM) GetCommandInvocation

func (mock *MockSSM) GetCommandInvocation(input *ssm.GetCommandInvocationInput) (*ssm.GetCommandInvocationOutput, error)

func (*MockSSM) SendCommand

func (mock *MockSSM) SendCommand(input *ssm.SendCommandInput) (*ssm.SendCommandOutput, error)

type TagFilter added in v0.2.3

type TagFilter struct {
	Key    string
	Values []string
}

TagFilter represents a key=value pair for AWS EC2 tags.

func (*TagFilter) Filter added in v0.2.3

func (t *TagFilter) Filter() *ec2.Filter

Filter returns the ec2.Filter representation of the TagFilter.

Jump to

Keyboard shortcuts

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