aws

package
v0.0.0-...-96040f1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package aws contains functions related to aws sdk

Index

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

func NewClient(accessID, accessSecret, token, region string) (*SdkClient, error)

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

func NewClientFromFileCredentials(dir string, region string) (*SdkClient, error)

NewClientFromFileCredentials creates a new client by reading credentials from a file

func (*SdkClient) AssumeRole

func (c *SdkClient) AssumeRole(roleARN, region string) (*SdkClient, error)

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

func (c *SdkClient) GetSecurityGroupID(infraID string) (string, error)

GetSecurityGroupID will return the security group id needed for the network verifier

func (*SdkClient) GetSubnetID

func (c *SdkClient) GetSubnetID(infraID string) ([]string, error)

GetSubnetID will return the private subnets needed for the network verifier

func (*SdkClient) IsSubnetPrivate

func (c *SdkClient) IsSubnetPrivate(subnet string) bool

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

func (c *SdkClient) ListInstances(infraID string) ([]*ec2.Instance, error)

ListInstances lists all stopped instances that belong to a cluster

func (*SdkClient) ListNonRunningInstances

func (c *SdkClient) ListNonRunningInstances(infraID string) ([]*ec2.Instance, error)

ListNonRunningInstances lists all non running instances that belong to a cluster

func (*SdkClient) ListRunningInstances

func (c *SdkClient) ListRunningInstances(infraID string) ([]*ec2.Instance, error)

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

Directories

Path Synopsis
Package awsmock is a generated GoMock package.
Package awsmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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