aws

package
v0.0.0-...-1eea727 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InstanceStart is the action to start an instance
	InstanceStart string = "start"
	// InstanceStop is the action to stop an instance
	InstanceStop string = "stop"
	// InstanceStatus is the action to query status of instance
	InstanceStatus string = "status"
	// InstanceHibernate is the action to hibernate an instance
	InstanceHibernate string = "hibernate"
	// DryRunOperation is the error code for dry run operation
	DryRunOperation string = "DryRunOperation"
)

Variables

This section is empty.

Functions

func GetDeployedInstances

func GetDeployedInstances(c chan RegionSummary, region string, tags map[string]string, action string, instanceIDs []string)

GetDeployedInstances retrieves the status of all deployed instances in a given region

func GetInstanceRegion

func GetInstanceRegion(accSum AccountSummary, id string) (string, error)

GetInstanceRegion returns the region of an instance given an account summary

func GetRegions

func GetRegions() (regions []string)

GetRegions is a function to retrieve all active regions in an account

func IDs

func IDs(instances []Instance) []string

Helper function to extract instance IDs from a slice of instances

func ModifyInstanceType

func ModifyInstanceType(region string, instanceType string, instanceID string) (err error)

ModifyInstanceType modifies an AWS Instance type

func StartStopInstance

func StartStopInstance(region string, action string, instanceIDs []string) ([]types.InstanceStateChange, error)

StartStopInstance starts or stops an AWS Instance

func TerminateInstances

func TerminateInstances(region string, instances []string) (err error)

func WriteTable

func WriteTable(data []Instance)

Types

type AccountSummary

type AccountSummary []RegionSummary

AccountSummary is a structure holding a slice of regions summaries across an entire account

func (AccountSummary) Print

func (u AccountSummary) Print()

Print prints the summary of instances in an account in tabular format

func (AccountSummary) Prompt

func (u AccountSummary) Prompt(action string) AccountSummary

Prompts user for confirmation

type Instance

type Instance struct {
	Name             string
	ID               string
	Status           types.InstanceStateName
	Type             types.InstanceType
	Lifecycle        string
	Environment      string
	IP               string
	SpotInstanceType types.SpotInstanceType
	Region           string
	AZ               string
	Hibernation      bool
}

Instance is a struct to hold instance characteristics

type RegionSummary

type RegionSummary struct {
	Region    string
	Instances []Instance
}

RegionSummary is a structure holding deployed instances in a given region

func (RegionSummary) Print

func (u RegionSummary) Print()

Print prints the summary of instances in a given region in tabular format

Jump to

Keyboard shortcuts

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