ec2

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrCode

func ErrCode(msg string, err error) error

ErrCode converts ec2 errors to apierror errors TODO fill out with EC2 standard error types

Types

type EC2Option

type EC2Option func(*Ec2)

func WithCredentials

func WithCredentials(key, secret, token, region string) EC2Option

func WithDefaultKMSKeyId

func WithDefaultKMSKeyId(keyId string) EC2Option

func WithDefaultSgs

func WithDefaultSgs(sgs []string) EC2Option

func WithDefaultSubnets

func WithDefaultSubnets(subnets []string) EC2Option

func WithOrg

func WithOrg(org string) EC2Option

func WithSession

func WithSession(sess *session.Session) EC2Option

type Ec2

type Ec2 struct {
	Service         ec2iface.EC2API
	DefaultKMSKeyId string
	DefaultSgs      []string
	DefaultSubnets  []string
	// contains filtered or unexported fields
}

Ec2 is a wrapper around the aws EC2 service with some default config info

func New

func New(opts ...EC2Option) *Ec2

New creates a new Ec2

func (*Ec2) AuthorizeSecurityGroup added in v0.6.0

func (e *Ec2) AuthorizeSecurityGroup(ctx context.Context, direction, sg string, permissions []*ec2.IpPermission) error

func (*Ec2) CreateSecurityGroup added in v0.6.0

func (e *Ec2) CreateSecurityGroup(ctx context.Context, input *ec2.CreateSecurityGroupInput) (*ec2.CreateSecurityGroupOutput, error)

func (*Ec2) DeleteSecurityGroup added in v0.3.0

func (e *Ec2) DeleteSecurityGroup(ctx context.Context, id string) error

DeleteSecurityGroup deletes the given security group

func (*Ec2) GetImage

func (e *Ec2) GetImage(ctx context.Context, ids ...string) ([]*ec2.Image, error)

func (*Ec2) GetInstance

func (e *Ec2) GetInstance(ctx context.Context, id string) (*ec2.Instance, error)

GetInstance gets details about an instance by ID

func (*Ec2) GetInstanceVolume

func (e *Ec2) GetInstanceVolume(ctx context.Context, id, volid string) (*ec2.Volume, error)

func (*Ec2) GetSecurityGroup added in v0.2.4

func (e *Ec2) GetSecurityGroup(ctx context.Context, ids ...string) ([]*ec2.SecurityGroup, error)

GetSecurityGroup Get the given security groups by a list of ids

func (*Ec2) GetSnapshot

func (e *Ec2) GetSnapshot(ctx context.Context, ids ...string) ([]*ec2.Snapshot, error)

func (*Ec2) GetVolume

func (e *Ec2) GetVolume(ctx context.Context, ids ...string) ([]*ec2.Volume, error)

func (*Ec2) ListImages

func (e *Ec2) ListImages(ctx context.Context, org, name string) ([]map[string]*string, error)

func (*Ec2) ListInstanceSnapshots

func (e *Ec2) ListInstanceSnapshots(ctx context.Context, id string) ([]string, error)

ListInstanceSnapshots returns the snapshots for all volumes for an instance

func (*Ec2) ListInstanceVolumes

func (e *Ec2) ListInstanceVolumes(ctx context.Context, id string) ([]string, error)

ListInstanceVolumes returns the volumes for an instance

func (*Ec2) ListInstances

func (e *Ec2) ListInstances(ctx context.Context, org string, per int64, next *string) ([]map[string]*string, *string, error)

ListInstances lists the instances that are not terminated and not spot

func (*Ec2) ListSecurityGroups added in v0.2.4

func (e *Ec2) ListSecurityGroups(ctx context.Context, org string) ([]map[string]*string, error)

ListSecurityGroups List all security groups in an aws account

func (*Ec2) ListSnapshots

func (e *Ec2) ListSnapshots(ctx context.Context, org string, per int64, next *string) ([]map[string]*string, *string, error)

func (*Ec2) ListSubnets added in v0.5.0

func (e *Ec2) ListSubnets(ctx context.Context, vpc string) ([]map[string]string, error)

func (*Ec2) ListVPCs added in v0.4.0

func (e *Ec2) ListVPCs(ctx context.Context) ([]map[string]string, error)

func (*Ec2) ListVolumeModifications added in v0.7.0

func (e *Ec2) ListVolumeModifications(ctx context.Context, id string) ([]*ec2.VolumeModification, error)

ListVolumeModifications returns the modifications events for a volume

func (*Ec2) ListVolumeSnapshots added in v0.7.0

func (e *Ec2) ListVolumeSnapshots(ctx context.Context, id string) ([]string, error)

ListVolumeSnapshots returns the snapshots for a volume

func (*Ec2) ListVolumes

func (e *Ec2) ListVolumes(ctx context.Context, org string, per int64, next *string) ([]map[string]*string, *string, error)

func (*Ec2) RevokeSecurityGroup added in v0.6.0

func (e *Ec2) RevokeSecurityGroup(ctx context.Context, direction, sg string, permissions []*ec2.IpPermission) error

func (*Ec2) WaitUntilSecurityGroupExists added in v0.6.0

func (e *Ec2) WaitUntilSecurityGroupExists(ctx context.Context, id string) error

Jump to

Keyboard shortcuts

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