awsclient

package
v0.0.0-...-ac501e4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDescription

func ParseDescription(description *string) (*string, *string)

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

func RuleEntryFromDescription(description *string) *RuleEntry

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

func (r *RuleEntry) GetDescription() string

Create a "Description" according to the OwnerID and NodeName values.

func (RuleEntry) String

func (r RuleEntry) String() string

Jump to

Keyboard shortcuts

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