Documentation ¶
Overview ¶
Package aws contains functions related to aws sdk
Index ¶
- type Client
- type SdkClient
- func (c *SdkClient) AssumeRole(roleARN, region string) (*SdkClient, error)
- func (c *SdkClient) GetAWSCredentials() credentials.Value
- func (c *SdkClient) GetRouteTableForSubnet(subnetID string) (*ec2.RouteTable, error)
- func (c *SdkClient) GetSecurityGroupID(infraID string) (string, error)
- func (c *SdkClient) GetSubnetID(infraID string) ([]string, error)
- func (c *SdkClient) IsSubnetPrivate(subnet string) bool
- func (c *SdkClient) ListAllInstanceStopEvents() ([]*cloudtrail.Event, error)
- func (c *SdkClient) ListAllTerminatedInstances() ([]*cloudtrail.Event, error)
- func (c *SdkClient) ListInstances(infraID string) ([]*ec2.Instance, error)
- func (c *SdkClient) ListNonRunningInstances(infraID string) ([]*ec2.Instance, error)
- func (c *SdkClient) ListRunningInstances(infraID string) ([]*ec2.Instance, error)
- func (c *SdkClient) PollInstanceStopEventsFor(instances []*ec2.Instance, retryTimes int) ([]*cloudtrail.Event, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { ListRunningInstances(infraID string) ([]*ec2.Instance, error) ListNonRunningInstances(infraID string) ([]*ec2.Instance, error) PollInstanceStopEventsFor(instances []*ec2.Instance, retryTimes int) ([]*cloudtrail.Event, error) GetAWSCredentials() credentials.Value GetSecurityGroupID(infraID string) (string, error) GetSubnetID(infraID string) ([]string, error) IsSubnetPrivate(subnet string) bool AssumeRole(roleARN, region string) (*SdkClient, error) GetRouteTableForSubnet(subnetID string) (*ec2.RouteTable, error) }
Client is the interface exposing Aws related functions
type SdkClient ¶
type SdkClient struct { Region string StsClient stsiface.STSAPI Ec2Client ec2iface.EC2API CloudTrailClient cloudtrailiface.CloudTrailAPI Credentials credentials.Value }
SdkClient is a representation of the AWS Client
func NewClient ¶
NewClient creates a new client and is used when we already know the secrets and region, without any need to do any lookup.
func NewClientFromFileCredentials ¶
NewClientFromFileCredentials creates a new client by reading credentials from a file
func (*SdkClient) AssumeRole ¶
AssumeRole returns you a new client in the account specified in the roleARN
func (*SdkClient) GetAWSCredentials ¶
func (c *SdkClient) GetAWSCredentials() credentials.Value
GetAWSCredentials gets the AWS credentials
func (*SdkClient) GetRouteTableForSubnet ¶
func (c *SdkClient) GetRouteTableForSubnet(subnetID string) (*ec2.RouteTable, error)
GetRouteTableForSubnet returns the subnets routeTable
func (*SdkClient) GetSecurityGroupID ¶
GetSecurityGroupID will return the security group id needed for the network verifier
func (*SdkClient) GetSubnetID ¶
GetSubnetID will return the private subnets needed for the network verifier
func (*SdkClient) IsSubnetPrivate ¶
IsSubnetPrivate checks if the provided subnet is private
func (*SdkClient) ListAllInstanceStopEvents ¶
func (c *SdkClient) ListAllInstanceStopEvents() ([]*cloudtrail.Event, error)
ListAllInstanceStopEvents lists StopInstances events from CloudTrail
func (*SdkClient) ListAllTerminatedInstances ¶
func (c *SdkClient) ListAllTerminatedInstances() ([]*cloudtrail.Event, error)
ListAllTerminatedInstances lists TerminatedInstances events from CloudTrail
func (*SdkClient) ListInstances ¶
ListInstances lists all stopped instances that belong to a cluster
func (*SdkClient) ListNonRunningInstances ¶
ListNonRunningInstances lists all non running instances that belong to a cluster
func (*SdkClient) ListRunningInstances ¶
ListRunningInstances lists all running or starting instances that belong to a cluster
func (*SdkClient) PollInstanceStopEventsFor ¶
func (c *SdkClient) PollInstanceStopEventsFor(instances []*ec2.Instance, retryTimes int) ([]*cloudtrail.Event, error)
PollInstanceStopEventsFor will poll the ListAllInstanceStopEvents, and retry on various cases the returned events are unique per instance and are the most up to date that exist