aws

package
v0.0.0-...-cbe1db9 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 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) ([]ec2v2types.Instance, error)
	ListNonRunningInstances(infraID string) ([]ec2v2types.Instance, error)
	PollInstanceStopEventsFor(instances []ec2v2types.Instance, retryTimes int) ([]cloudtrailv2types.Event, error)
	GetAWSCredentials() awsv2.Credentials
	GetSecurityGroupID(infraID string) (string, error)
	GetSubnetID(infraID string) ([]string, error)
	IsSubnetPrivate(subnet string) (bool, error)
	GetRouteTableForSubnet(subnetID string) (ec2v2types.RouteTable, error)
}

type CloudTrailAPI

type CloudTrailAPI interface {
	LookupEvents(ctx context.Context, in *cloudtrailv2.LookupEventsInput, optFns ...func(*cloudtrailv2.Options)) (*cloudtrailv2.LookupEventsOutput, error)
}

type EC2API

type EC2API interface {
	DescribeInstances(ctx context.Context, in *ec2v2.DescribeInstancesInput, optFns ...func(*ec2v2.Options)) (*ec2v2.DescribeInstancesOutput, error)
	DescribeSecurityGroups(ctx context.Context, in *ec2v2.DescribeSecurityGroupsInput, optFns ...func(*ec2v2.Options)) (*ec2v2.DescribeSecurityGroupsOutput, error)
	DescribeSubnets(ctx context.Context, in *ec2v2.DescribeSubnetsInput, optFns ...func(*ec2v2.Options)) (*ec2v2.DescribeSubnetsOutput, error)
	DescribeRouteTables(ctx context.Context, in *ec2v2.DescribeRouteTablesInput, optFns ...func(*ec2v2.Options)) (*ec2v2.DescribeRouteTablesOutput, error)
}

type SdkClient

type SdkClient struct {
	Credentials      awsv2.Credentials
	Region           string
	CloudtrailClient CloudTrailAPI
	Ec2Client        EC2API
	StsClient        StsAPI
}

func NewClient

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

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() awsv2.Credentials

GetAWSCredentials gets the AWS credentials

func (*SdkClient) GetRouteTableForSubnet

func (c *SdkClient) GetRouteTableForSubnet(subnetID string) (ec2v2types.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, error)

IsSubnetPrivate checks if the provided subnet is private

func (*SdkClient) ListAllInstanceStopEventsV2

func (c *SdkClient) ListAllInstanceStopEventsV2() ([]cloudtrailv2types.Event, error)

ListAllInstanceStopEvents lists StopInstances events from CloudTrail

func (*SdkClient) ListAllTerminatedInstancesV2

func (c *SdkClient) ListAllTerminatedInstancesV2() ([]cloudtrailv2types.Event, error)

ListAllTerminatedInstances lists TerminatedInstances events from CloudTrail

func (*SdkClient) ListNonRunningInstances

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

ListNonRunningInstances lists all non-running instances that belong to a cluster

func (*SdkClient) ListRunningInstances

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

ListRunningInstances lists all running or starting instances that belong to a cluster

func (*SdkClient) PollInstanceStopEventsFor

func (c *SdkClient) PollInstanceStopEventsFor(instances []ec2v2types.Instance, retryTimes int) ([]cloudtrailv2types.Event, error)

type StsAPI

type StsAPI interface {
	AssumeRole(ctx context.Context, in *stsv2.AssumeRoleInput, optFns ...func(*stsv2.Options)) (*stsv2.AssumeRoleOutput, error)
}

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