service

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultProfile is the default AWS Profile
	DefaultProfile = "default"
)

Variables

View Source
var (
	// DefaultTags list of tags to look for
	DefaultTags = []string{"name", "env", "environment", "stage", "role", "build", "version"}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Profile *string
	Args    []string
}

Config holds service settings

type Instance

type Instance struct {
	ID        string
	PrivateIP string
	PublicIP  string
	State     string
	AZ        string
	Launched  time.Time
	Type      string
	AMI       string
	Tags      map[string]string
	// contains filtered or unexported fields
}

Instance holds an ec2 instance information

func NewInstance

func NewInstance(i *ec2.Instance) *Instance

NewInstance returns a new Instance from an AWS EC2 Instance

func (*Instance) IsRunningLessThan

func (i *Instance) IsRunningLessThan(mins int) bool

IsRunningLessThan indicates if the instance was started less than X minutes ago

func (*Instance) IsRunningMoreThan

func (i *Instance) IsRunningMoreThan(mins int) bool

IsRunningMoreThan indicates if the instance was started more than X minutes ago

func (*Instance) RunningDescription

func (i *Instance) RunningDescription() string

RunningDescription returns how old the instance is as a string eg. 1 day ago, 10 minutes ago, ...

func (*Instance) TagValues

func (i *Instance) TagValues(names []string) []string

TagValues returns the values for the requested tag names

type InstanceSort

type InstanceSort []*Instance

InstanceSort implements sort.Interface

func (InstanceSort) Len

func (a InstanceSort) Len() int

func (InstanceSort) Less

func (a InstanceSort) Less(i, j int) bool

func (InstanceSort) Swap

func (a InstanceSort) Swap(i, j int)

type Service

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

Service holds internal state

func NewService

func NewService(conf *Config) *Service

NewService returns a new service instance

func (*Service) Run

func (s *Service) Run()

Run starts the application

Jump to

Keyboard shortcuts

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