Documentation ¶
Overview ¶
Package awscommons contains routines for interacting with AWS. Meant to provide high level interfaces used throughout various Gruntwork CLIs. NOTE: The routines in this package are adapted for aws-sdk-go-v2, not V1.
Index ¶
- Constants
- func DetachInstances(opts *Options, asgName string, idList []string) error
- func GetAllEnabledRegions(opts *Options) ([]string, error)
- func GetAsgByName(opts *Options, asgName string) (*autoscalingTypes.AutoScalingGroup, error)
- func GetSecretsManagerMetadata(opts *Options, secretID string) (*secretsmanager.DescribeSecretOutput, error)
- func GetSecretsManagerSecretString(opts *Options, arn string) (string, error)
- func NewAutoScalingClient(opts *Options) (*autoscaling.Client, error)
- func NewDefaultConfig(opts *Options) (aws.Config, error)
- func NewEC2Client(opts *Options) (*ec2.Client, error)
- func NewS3Client(opts *Options) (*s3.Client, error)
- func NewSecretsManagerClient(opts *Options) (*secretsmanager.Client, error)
- func ScaleUp(opts *Options, asgName string, originalInstanceIds []string, ...) ([]string, error)
- func SecretsManagerEntryExists(opts *Options, arn string) (bool, error)
- func SetAsgMaxSize(client *autoscaling.Client, opts *Options, asgName string, maxSize int32) error
- func UploadObjectString(opts *Options, bucket, key, contents string) error
- type CouldNotMeetASGCapacityError
- type LookupError
- type MultipleLookupErrors
- type Options
Constants ¶
const (
DefaultRegion = "us-east-1"
)
Variables ¶
This section is empty.
Functions ¶
func DetachInstances ¶ added in v0.13.4
DetachInstances requests AWS to detach the instances, removing them from the ASG. It will also request to auto decrement the desired capacity.
func GetAllEnabledRegions ¶ added in v0.10.2
GetAllEnabledRegions will return the list of AWS regions (e.g., us-east-1) that are enabled and available to use in the account.
func GetAsgByName ¶ added in v0.13.4
func GetAsgByName(opts *Options, asgName string) (*autoscalingTypes.AutoScalingGroup, error)
GetAsgByName finds the Auto Scaling Group matching the given name. Returns an error if it cannot find a match.
func GetSecretsManagerMetadata ¶
func GetSecretsManagerMetadata(opts *Options, secretID string) (*secretsmanager.DescribeSecretOutput, error)
GetSecretsManagerMetadata returns the metadata of the Secrets Manager entry with the given ID.
func GetSecretsManagerSecretString ¶
GetSecretsManagerSecretString will return the secret value stored at the given Secrets Manager ARN.
func NewAutoScalingClient ¶ added in v0.13.4
func NewAutoScalingClient(opts *Options) (*autoscaling.Client, error)
NewAutoscalingClient returns a new AWS SDK client for interacting with AWS Autoscaling.
func NewDefaultConfig ¶
NewDefaultConfig will retrieve a new authenticated AWS config using SDK default credentials. This config can be used to setup new AWS service clients.
func NewEC2Client ¶ added in v0.10.2
NewEC2Client will return a new AWS SDK client for interacting with AWS EC2.
func NewS3Client ¶ added in v0.10.0
NewS3Client will return a new AWS SDK client for interacting with AWS S3.
func NewSecretsManagerClient ¶
func NewSecretsManagerClient(opts *Options) (*secretsmanager.Client, error)
NewSecretsManagerClient will return a new AWS SDK client for interacting with AWS Secrets Manager.
func ScaleUp ¶ added in v0.13.4
func ScaleUp( opts *Options, asgName string, originalInstanceIds []string, desiredCapacity int32, maxRetries int, sleepBetweenRetries time.Duration, ) ([]string, error)
ScaleUp sets the desired capacity, waits until all the instances are available, and returns the new instance IDs.
func SecretsManagerEntryExists ¶
SecretsManagerEntryExists returns whether or not the SecretsManager Entry with the given ARN exists. This will return an error if it exists, but is not accessible due to permission issues, or if there is an authentication issue.
func SetAsgMaxSize ¶ added in v0.13.4
SetAsgMaxSize sets the max size on the auto scaling group. Note that updating the max size does not typically change the cluster size.
func UploadObjectString ¶ added in v0.10.0
UploadObjectString will upload the provided string to the given S3 bucket as an object under the specified key.
Types ¶
type CouldNotMeetASGCapacityError ¶ added in v0.13.4
type CouldNotMeetASGCapacityError struct {
// contains filtered or unexported fields
}
CouldNotMeetASGCapacityError represents an error related to waiting for ASG to reach desired capacity.
func NewCouldNotMeetASGCapacityError ¶ added in v0.13.4
func NewCouldNotMeetASGCapacityError(asgName string, message string) CouldNotMeetASGCapacityError
func (CouldNotMeetASGCapacityError) Error ¶ added in v0.13.4
func (err CouldNotMeetASGCapacityError) Error() string
type LookupError ¶ added in v0.13.4
type LookupError struct {
// contains filtered or unexported fields
}
LookupError represents an error related to looking up data on an object.
func NewLookupError ¶ added in v0.13.4
func NewLookupError(objectType string, objectId string, objectProperty string) LookupError
NewLookupError constructs a new LookupError object that can be used to return an error related to a look up error.
func (LookupError) Error ¶ added in v0.13.4
func (err LookupError) Error() string
type MultipleLookupErrors ¶ added in v0.13.4
type MultipleLookupErrors struct {
// contains filtered or unexported fields
}
MultipleLookupErrors represents multiple errors found while looking up a resource
func NewMultipleLookupErrors ¶ added in v0.13.4
func NewMultipleLookupErrors() MultipleLookupErrors
func (MultipleLookupErrors) AddError ¶ added in v0.13.4
func (err MultipleLookupErrors) AddError(newErr error)
func (MultipleLookupErrors) Error ¶ added in v0.13.4
func (err MultipleLookupErrors) Error() string
func (MultipleLookupErrors) IsEmpty ¶ added in v0.13.4
func (err MultipleLookupErrors) IsEmpty() bool
type Options ¶
Options represents all the parameters necessary for setting up authentication credentials with AWS.
func NewOptions ¶
NewOptions will create a new aws.Options struct that provides reasonable defaults for unspecified values.