Documentation ¶
Index ¶
- func ParseDescription(description *string) (*string, *string)
- func RuleEntriesToAwsIpPermissions(entries []*RuleEntry) []*ec2.IpPermission
- type AwsContext
- func (a *AwsContext) DeleteInboundRules(rules []*ec2.IpPermission) error
- func (a *AwsContext) DeleteRuleEntries(entries []*RuleEntry) error
- func (a *AwsContext) GetInboundRules() ([]*ec2.IpPermission, error)
- func (a *AwsContext) GetInboundRulesNotOwnedByID() ([]*ec2.IpPermission, error)
- func (a *AwsContext) GetInboundRulesOwnedByID() ([]*ec2.IpPermission, error)
- func (a *AwsContext) GetOwnedEntries() ([]*RuleEntry, error)
- func (a *AwsContext) Init() error
- func (a *AwsContext) ReplaceOwnedEntries(entries []*RuleEntry) error
- func (a *AwsContext) SetInboundRules(rules []*ec2.IpPermission) error
- func (a *AwsContext) SetOwnerIDFromEnv() error
- func (a *AwsContext) SetSecurityGroupIDFromEnv() error
- type RuleEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseDescription ¶
Given the string found in the Description column of an inbound rule, get the OwnerID and NodeName out of it.
func RuleEntriesToAwsIpPermissions ¶
func RuleEntriesToAwsIpPermissions(entries []*RuleEntry) []*ec2.IpPermission
Convert a list of RuleEntry objects into a list ofec2.IpPermission objects.
Types ¶
type AwsContext ¶
type AwsContext struct { SecurityGroupID string OwnerID string // contains filtered or unexported fields }
A bundle of other structs to serve as a context for this connection.
func (*AwsContext) DeleteInboundRules ¶
func (a *AwsContext) DeleteInboundRules(rules []*ec2.IpPermission) error
func (*AwsContext) DeleteRuleEntries ¶
func (a *AwsContext) DeleteRuleEntries(entries []*RuleEntry) error
func (*AwsContext) GetInboundRules ¶
func (a *AwsContext) GetInboundRules() ([]*ec2.IpPermission, error)
Get all the inbound rules that are part of the current Security Group.
func (*AwsContext) GetInboundRulesNotOwnedByID ¶
func (a *AwsContext) GetInboundRulesNotOwnedByID() ([]*ec2.IpPermission, error)
Get the inbound rules that are under the current Security Group and are not tagged as owned by OwnerID.
func (*AwsContext) GetInboundRulesOwnedByID ¶
func (a *AwsContext) GetInboundRulesOwnedByID() ([]*ec2.IpPermission, error)
Get the inbound rules that are under the current Security Group and tagged as owned by OwnerID.
func (*AwsContext) GetOwnedEntries ¶
func (a *AwsContext) GetOwnedEntries() ([]*RuleEntry, error)
Given the SecurityGroupID in the current context, get the list of firewall entries that are tagged under the current OwnerID.
func (*AwsContext) Init ¶
func (a *AwsContext) Init() error
Initialize the connection to the AWS API.
func (*AwsContext) ReplaceOwnedEntries ¶
func (a *AwsContext) ReplaceOwnedEntries(entries []*RuleEntry) error
Delete all the firewall entries tagged under the current OwnerID and then add a fresh set of rules according to the entries parameter.
func (*AwsContext) SetInboundRules ¶
func (a *AwsContext) SetInboundRules(rules []*ec2.IpPermission) error
func (*AwsContext) SetOwnerIDFromEnv ¶
func (a *AwsContext) SetOwnerIDFromEnv() error
Set the OwnerID from the environment var
func (*AwsContext) SetSecurityGroupIDFromEnv ¶
func (a *AwsContext) SetSecurityGroupIDFromEnv() error
Set the SecurityGroupID from the environment var
type RuleEntry ¶
type RuleEntry struct { NodeName string OwnerID string FromPort int64 ToPort int64 IP string Protocol string }
This is the equivalent of a firewall inbound rule entry in the AWS security group.
func RuleEntryFromDescription ¶
Create a RuleEntry from a Description string. Note that this will only fill up the OwnerID and NodeName fields so the rest will still have to be filled up after.
func (*RuleEntry) GetDescription ¶
Create a "Description" according to the OwnerID and NodeName values.