Documentation ¶
Index ¶
- Constants
- func NewEC2(awsSession *session.Session)
- func NewEC2Metadata(awsSession *session.Session)
- type EC2
- func (e *EC2) AssociateSGToInstanceIfNeeded(instances []*string, newSG *string) error
- func (e *EC2) CreateNewInstanceSG(sgName *string, sgID *string, vpcID *string) (*string, error)
- func (e *EC2) CreateSecurityGroupFromPorts(vpcID *string, sgName *string, ports []int64, cidrs []*string) (*string, *string, error)
- func (e *EC2) DeleteSecurityGroupByID(sgID *string) error
- func (e *EC2) DescribeSGByPermissionGroup(sg *string) (*string, error)
- func (e *EC2) DescribeSGInboundCidrs(sgID *string) ([]*string, error)
- func (e *EC2) DescribeSGPorts(sgID *string) ([]int64, error)
- func (e *EC2) DescribeSGTags(sgID *string) ([]*ec2.TagDescription, error)
- func (e *EC2) DisassociateSGFromInstanceIfNeeded(instances []*string, managedSG *string) error
- func (e *EC2) GetVPCID() (*string, error)
- func (e *EC2) Status() func() error
- func (e *EC2) UpdateSGIfNeeded(vpcID *string, sgName *string, currentPorts []int64, desiredPorts []int64, ...) (*string, *string, error)
- type EC2MData
Constants ¶
const ( ManagedByKey = "ManagedBy" ManagedByValue = "alb-ingress" )
Variables ¶
This section is empty.
Functions ¶
func NewEC2Metadata ¶
NewEC2Metadata returns an awsutil EC2Metadata service
Types ¶
type EC2 ¶
EC2 is our extension to AWS's ec2.EC2
var EC2svc *EC2
EC2svc is a pointer to the awsutil EC2 service
func (*EC2) AssociateSGToInstanceIfNeeded ¶
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 (*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 ¶
DeleteSecurityGroupByID deletes a security group based on its provided ID
func (*EC2) DescribeSGByPermissionGroup ¶
DescribeSGByPermissionGroup Finds an SG that the passed SG has permission to.
func (*EC2) DescribeSGInboundCidrs ¶
DescribeSGInboundCidrs returns the inbound cidrs associated with a SG.
func (*EC2) DescribeSGPorts ¶
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 ¶
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 ¶
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) 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