aws

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EksaAwsCredentialsFileKey = "EKSA_AWS_CREDENTIALS_FILE"
	EksaAwsCABundlesFileKey   = "EKSA_AWS_CA_BUNDLES_FILE"
)

Variables

This section is empty.

Functions

func AwsCABundlesFile

func AwsCABundlesFile() (filePath string, err error)

func AwsCredentialsFile

func AwsCredentialsFile() (filePath string, err error)

func EncodeFileFromEnv

func EncodeFileFromEnv(envKey string) (string, error)

func LoadConfig

func LoadConfig(ctx context.Context, opts ...AwsConfigOpt) (aws.Config, error)

LoadConfig reads the optional aws configurations, and populates an AWS Config with the values from the configurations.

func NewEC2Client

func NewEC2Client(config aws.Config) *ec2.Client

func NewSnowballClient added in v0.12.0

func NewSnowballClient(config aws.Config) *snowballdevice.Client

func ParseDeviceIPs

func ParseDeviceIPs(r io.Reader) ([]string, error)

func ParseDeviceIPsFromFile

func ParseDeviceIPsFromFile(filePath string) ([]string, error)

func SnowEndpointResolver

func SnowEndpointResolver(deviceIP string) aws.EndpointResolverWithOptionsFunc

Types

type AwsConfigOpt

type AwsConfigOpt = config.LoadOptionsFunc

func AwsConfigOptSet

func AwsConfigOptSet(opts ...AwsConfigOpt) AwsConfigOpt

func WithCustomCABundleFile

func WithCustomCABundleFile(certsFile string) AwsConfigOpt

WithCustomCABundleFile is a helper function to construct functional options that reads an aws certificates file and sets CustomCABundle on config's LoadOptions.

func WithSnowEndpointAccess

func WithSnowEndpointAccess(deviceIP string, certsFile, credsFile string) AwsConfigOpt

WithSnowEndpointAccess gathers all the config's LoadOptions for snow, which includes snowball ec2 endpoint, snow credentials for a specific profile, and CA bundles for accessing the https endpoint.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides the single API client to make operations call to aws services

func NewClient

func NewClient(ctx context.Context, cfg aws.Config) *Client

func NewClientFromEC2

func NewClientFromEC2(ec2 EC2Client) *Client

NewClientFromEC2 is mainly used for EC2 related unit tests

func NewClientFromSnowball added in v0.12.0

func NewClientFromSnowball(snowballdevice SnowballDeviceClient) *Client

NewClientFromSnowball is mainly used for Snowballdevice related unit tests

func (*Client) EC2ImageExists

func (c *Client) EC2ImageExists(ctx context.Context, imageID string) (bool, error)

EC2ImageExists calls aws sdk ec2.DescribeImages with filter imageID to fetch a specified images (AMIs, AKIs, and ARIs) available. Returns (false, nil) if the image does not exist, (true, nil) if image exists, and (false, err) if there is an non 400 status code error from ec2.DescribeImages.

func (*Client) EC2ImportKeyPair

func (c *Client) EC2ImportKeyPair(ctx context.Context, keyName string, keyMaterial []byte) error

EC2ImportKeyPair calls aws sdk ec2.ImportKeyPair to import a key pair to ec2.

func (*Client) EC2KeyNameExists

func (c *Client) EC2KeyNameExists(ctx context.Context, keyName string) (bool, error)

EC2KeyNameExists calls aws sdk ec2.DescribeKeyPairs with filter keyName to fetch a specified key pair available in aws. Returns (false, nil) if the key pair does not exist, (true, nil) if key pair exists, and (false, err) if there is an error from ec2.DescribeKeyPairs.

func (*Client) IsSnowballDeviceUnlocked added in v0.12.0

func (c *Client) IsSnowballDeviceUnlocked(ctx context.Context) (bool, error)

func (*Client) SnowballDeviceSoftwareVersion added in v0.12.0

func (c *Client) SnowballDeviceSoftwareVersion(ctx context.Context) (string, error)

type Clients

type Clients map[string]*Client

Clients are a map between aws profile and its aws client

func BuildClients added in v0.11.0

func BuildClients(ctx context.Context) (Clients, error)

type EC2Client

type EC2Client interface {
	DescribeImages(ctx context.Context, params *ec2.DescribeImagesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeImagesOutput, error)
	DescribeKeyPairs(ctx context.Context, params *ec2.DescribeKeyPairsInput, optFns ...func(*ec2.Options)) (*ec2.DescribeKeyPairsOutput, error)
	ImportKeyPair(ctx context.Context, params *ec2.ImportKeyPairInput, optFns ...func(*ec2.Options)) (*ec2.ImportKeyPairOutput, error)
}

type ServiceEndpoint

type ServiceEndpoint struct {
	ServiceID     string
	URL           string
	SigningRegion string
}

type SnowballDeviceClient added in v0.12.0

type SnowballDeviceClient interface {
	DescribeDevice(ctx context.Context, params *snowballdevice.DescribeDeviceInput, optFns ...func(*snowballdevice.Options)) (*snowballdevice.DescribeDeviceOutput, error)
	DescribeDeviceSoftware(ctx context.Context, params *snowballdevice.DescribeDeviceSoftwareInput, optFns ...func(*snowballdevice.Options)) (*snowballdevice.DescribeDeviceSoftwareOutput, error)
}

Directories

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

Jump to

Keyboard shortcuts

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