ec2

package
v0.0.0-...-0420b53 Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManagedByKey   = "ManagedBy"
	ManagedByValue = "alb-ingress"
)

Variables

This section is empty.

Functions

func NewEC2

func NewEC2(awsSession *session.Session)

NewEC2 returns an awsutil EC2 service

func NewEC2Metadata

func NewEC2Metadata(awsSession *session.Session)

NewEC2Metadata returns an awsutil EC2Metadata service

Types

type EC2

type EC2 struct {
	ec2iface.EC2API
	// contains filtered or unexported fields
}

EC2 is our extension to AWS's ec2.EC2

var EC2svc *EC2

EC2svc is a pointer to the awsutil EC2 service

func (*EC2) AssociateSGToInstanceIfNeeded

func (e *EC2) AssociateSGToInstanceIfNeeded(instances []*string, newSG *string) error

AssociateSGToInstanceIfNeeded loops through a list of instances to see if newSG exists for them. It not, it is appended to the instances(s).

func (*EC2) CreateNewInstanceSG

func (e *EC2) CreateNewInstanceSG(sgName *string, sgID *string, vpcID *string) (*string, error)

func (*EC2) CreateSecurityGroupFromPorts

func (e *EC2) CreateSecurityGroupFromPorts(vpcID *string, sgName *string, ports []int64, cidrs []*string) (*string, *string, error)

CreateSecurityGroupFromPorts generates a new security group in AWS based on a list of ports. If successful, it returns the security group ID.

func (*EC2) DeleteSecurityGroupByID

func (e *EC2) DeleteSecurityGroupByID(sgID *string) error

DeleteSecurityGroupByID deletes a security group based on its provided ID

func (*EC2) DescribeSGByPermissionGroup

func (e *EC2) DescribeSGByPermissionGroup(sg *string) (*string, error)

DescribeSGByPermissionGroup Finds an SG that the passed SG has permission to.

func (*EC2) DescribeSGInboundCidrs

func (e *EC2) DescribeSGInboundCidrs(sgID *string) ([]*string, error)

DescribeSGInboundCidrs returns the inbound cidrs associated with a SG.

func (*EC2) DescribeSGPorts

func (e *EC2) DescribeSGPorts(sgID *string) ([]int64, error)

DescribeSGPorts returns the ports associated with a SG.

func (*EC2) DescribeSGTags

func (e *EC2) DescribeSGTags(sgID *string) ([]*ec2.TagDescription, error)

DescribeSGTags returns tags for an sg when the sg-id is provided.

func (*EC2) DisassociateSGFromInstanceIfNeeded

func (e *EC2) DisassociateSGFromInstanceIfNeeded(instances []*string, managedSG *string) error

DisassociateSGFromInstanceIfNeeded loops through a list of instances to see if a managedSG exists. If it does, it attempts to remove the managedSG from the list.

func (*EC2) GetVPCID

func (e *EC2) GetVPCID() (*string, error)

GetVPCID returns the VPC of the instance the controller is currently running on. This is achieved by getting the identity document of the EC2 instance and using the DescribeInstances call to determine its VPC ID.

func (*EC2) Status

func (e *EC2) Status() func() error

Status validates EC2 connectivity

func (*EC2) UpdateSGIfNeeded

func (e *EC2) UpdateSGIfNeeded(vpcID *string, sgName *string, currentPorts []int64, desiredPorts []int64, currentCidrs []*string, desiredCidrs []*string) (*string, *string, error)

UpdateSGIfNeeded attempts to resolve a security group based on its description. If one is found, it'll run an update that is effectivley a no-op when the groups are identical. Finally it'll attempt to find the associated instance SG and return that as the second string.

type EC2MData

type EC2MData struct {
	*ec2metadata.EC2Metadata
}

EC2MData is our extension to AWS's ec2metadata.EC2Metadata cache is not required for this struct as we only use it to lookup instance metadata when the cache for the EC2 struct is expired.

var EC2Metadatasvc *EC2MData

EC2Metadatasvc is a pointer to the awsutil EC2metadata service

Jump to

Keyboard shortcuts

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