Documentation ¶
Index ¶
- Constants
- func AwsCABundlesFile() (filePath string, err error)
- func AwsCredentialsFile() (filePath string, err error)
- func EncodeFileFromEnv(envKey string) (string, error)
- func LoadConfig(ctx context.Context, opts ...AwsConfigOpt) (aws.Config, error)
- func NewEC2Client(config aws.Config) *ec2.Client
- func NewIMDSClient(config aws.Config) *imds.Client
- func NewSnowballClient(config aws.Config) *snowballdevice.Client
- func ParseDeviceIPs(r io.Reader) ([]string, error)
- func ParseDeviceIPsFromFile(filePath string) ([]string, error)
- func SnowEndpointResolver(deviceIP string) aws.EndpointResolverWithOptionsFunc
- type AwsConfigOpt
- type Client
- func (c *Client) BuildIMDS(ctx context.Context) error
- func (c *Client) EC2ImageExists(ctx context.Context, imageID string) (bool, error)
- func (c *Client) EC2ImportKeyPair(ctx context.Context, keyName string, keyMaterial []byte) error
- func (c *Client) EC2InstanceIP(ctx context.Context) (string, error)
- func (c *Client) EC2InstanceTypes(ctx context.Context) ([]EC2InstanceType, error)
- func (c *Client) EC2KeyNameExists(ctx context.Context, keyName string) (bool, error)
- func (c *Client) IsSnowballDeviceUnlocked(ctx context.Context) (bool, error)
- func (c *Client) SnowballDeviceSoftwareVersion(ctx context.Context) (string, error)
- type ClientOpt
- type Clients
- type EC2Client
- type EC2InstanceType
- type IMDSClient
- type ServiceEndpoint
- type SnowballDeviceClient
Constants ¶
const ( EksaAwsCredentialsFileKey = "EKSA_AWS_CREDENTIALS_FILE" EksaAwsCABundlesFileKey = "EKSA_AWS_CA_BUNDLES_FILE" )
Variables ¶
This section is empty.
Functions ¶
func AwsCABundlesFile ¶
func AwsCredentialsFile ¶
func EncodeFileFromEnv ¶
func LoadConfig ¶
LoadConfig reads the optional aws configurations, and populates an AWS Config with the values from the configurations.
func NewEC2Client ¶
NewEC2Client builds a new ec2 client.
func NewIMDSClient ¶ added in v0.14.2
NewIMDSClient builds a new imds client.
func NewSnowballClient ¶ added in v0.12.0
func NewSnowballClient(config aws.Config) *snowballdevice.Client
func ParseDeviceIPsFromFile ¶
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 NewClientFromConfig ¶ added in v0.14.2
NewClientFromConfig builds an aws client with ec2 and snowballdevice apis from aws config.
func (*Client) BuildIMDS ¶ added in v0.14.2
BuildIMDS builds or overrides the imds client in the Client with default aws config.
func (*Client) EC2ImageExists ¶
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 ¶
EC2ImportKeyPair calls aws sdk ec2.ImportKeyPair to import a key pair to ec2.
func (*Client) EC2InstanceIP ¶ added in v0.14.2
EC2InstanceIP calls aws sdk imds.GetMetadata with public-ipv4 path to fetch the instance ip from metadata service.
func (*Client) EC2InstanceTypes ¶ added in v0.14.2
func (c *Client) EC2InstanceTypes(ctx context.Context) ([]EC2InstanceType, error)
EC2InstanceTypes calls aws sdk ec2.DescribeInstanceTypes to get a list of supported instance type for a device.
func (*Client) EC2KeyNameExists ¶
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
type ClientOpt ¶ added in v0.14.2
type ClientOpt func(*Client)
ClientOpt updates an aws.Client.
func WithIMDS ¶ added in v0.14.2
func WithIMDS(imds IMDSClient) ClientOpt
WithIMDS returns a ClientOpt that sets the imds client.
func WithSnowballDevice ¶ added in v0.14.2
func WithSnowballDevice(snowballdevice SnowballDeviceClient) ClientOpt
WithSnowballDevice returns a ClientOpt that sets the snowballdevice client.
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) DescribeInstanceTypes(ctx context.Context, params *ec2.DescribeInstanceTypesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeInstanceTypesOutput, error) ImportKeyPair(ctx context.Context, params *ec2.ImportKeyPairInput, optFns ...func(*ec2.Options)) (*ec2.ImportKeyPairOutput, error) }
EC2Client is an ec2 client that wraps around the aws sdk ec2 client.
type EC2InstanceType ¶ added in v0.14.2
EC2InstanceType has the information of an ec2 instance type.
type IMDSClient ¶ added in v0.14.2
type IMDSClient interface {
GetMetadata(ctx context.Context, params *imds.GetMetadataInput, optFns ...func(*imds.Options)) (*imds.GetMetadataOutput, error)
}
IMDSClient is an imds client that wraps around the aws sdk imds client.
type ServiceEndpoint ¶
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) }