manager

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 19 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
	OutputUrl  string
	Error      error
}

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

type DocumentDescription added in v1.0.0

type DocumentDescription struct {
	Name            string `json:"name"`
	Description     string `json:"description"`
	Owner           string `json:"owner"`
	DocumentVersion string `json:"documentVersion"`
	DocumentFormat  string `json:"documentFormat"`
	DocumentType    string `json:"documentType"`
	SchemaVersion   string `json:"schemaVersion"`
	TargetType      string `json:"targetType"`
	Parameters      []*DocumentParameter
}

DocumentDescription describes relevant information about a SSM Document

func NewDocumentDescription added in v1.0.0

func NewDocumentDescription(ssmDocument *ssm.DocumentDescription) *DocumentDescription

NewDocumentDescription creates a new Document from ssm.DocumentIdentifier.

func (*DocumentDescription) ParametersTabString added in v1.0.0

func (d *DocumentDescription) ParametersTabString() string

ParametersTabString returns all parameter values separated by "\t|\t" for an document. Use with tabwriter to output a table of parameters.

func (*DocumentDescription) TabString added in v1.0.0

func (d *DocumentDescription) TabString() string

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

type DocumentIdentifier added in v1.0.0

type DocumentIdentifier struct {
	Name            string `json:"name"`
	Owner           string `json:"owner"`
	DocumentVersion string `json:"documentVersion"`
	DocumentFormat  string `json:"documentFormat"`
	DocumentType    string `json:"documentType"`
	SchemaVersion   string `json:"schemaVersion"`
	TargetType      string `json:"targetType"`
}

DocumentIdentifier describes relevant information about a SSM Document

func NewDocumentIdentifier added in v1.0.0

func NewDocumentIdentifier(ssmDocument *ssm.DocumentIdentifier) *DocumentIdentifier

NewDocumentIdentifier creates a new Document from ssm.DocumentIdentifier.

func (*DocumentIdentifier) TabString added in v1.0.0

func (d *DocumentIdentifier) TabString() string

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

type DocumentParameter added in v1.0.0

type DocumentParameter struct {
	Name         string
	Description  string
	DefaultValue string
	Type         string
}

DocumentParameter describes relevant information about a SSM Document Parameter

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, opts Opts) *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) DescribeDocument added in v1.0.0

func (m *Manager) DescribeDocument(name string) (*DocumentDescription, error)

DescribeDocument lists information for a specific document managed by SSM.

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) ListDocuments added in v1.0.0

func (m *Manager) ListDocuments(limit int64, documentFilters []*ssm.DocumentFilter) ([]*DocumentIdentifier, error)

ListDocuments fetches a list of documents managed by SSM. Paginates until all responses have been collected.

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, name string, parameters map[string]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
	Documents           []*ssm.DocumentIdentifier
	DocumentDescription *ssm.DocumentDescription
	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) DescribeDocument added in v1.0.0

func (mock *MockSSM) DescribeDocument(input *ssm.DescribeDocumentInput) (*ssm.DescribeDocumentOutput, 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) ListDocuments added in v1.0.0

func (mock *MockSSM) ListDocuments(input *ssm.ListDocumentsInput) (*ssm.ListDocumentsOutput, error)

func (*MockSSM) SendCommand

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

type Opts added in v0.4.0

type Opts struct {
	ExtendOutput   bool
	S3Bucket       string
	S3KeyPrefix    string
	CommandComment string
}

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