Documentation ¶
Index ¶
- Constants
- func AssertS3BucketExists(t *testing.T, region string, name string)
- func AssertS3BucketExistsE(t *testing.T, region string, name string) error
- func CreateAwsCredentials(accessKeyId string, secretAccessKey string) *credentials.Credentials
- func CreateAwsCredentialsWithSessionToken(accessKeyId, secretAccessKey, sessionToken string) *credentials.Credentials
- func CreateAwsSessionWithCreds(region string, accessKeyId string, secretAccessKey string) (*session.Session, error)
- func CreateAwsSessionWithMfa(region string, stsClient *sts.STS, mfaDevice *iam.VirtualMFADevice) (*session.Session, error)
- func CreateMfaDevice(t *testing.T, iamClient *iam.IAM, deviceName string) *iam.VirtualMFADevice
- func CreateMfaDeviceE(t *testing.T, iamClient *iam.IAM, deviceName string) (*iam.VirtualMFADevice, error)
- func CreateRandomQueue(t *testing.T, awsRegion string, prefix string) string
- func CreateRandomQueueE(t *testing.T, awsRegion string, prefix string) (string, error)
- func CreateS3Bucket(t *testing.T, region string, name string)
- func CreateS3BucketE(t *testing.T, region string, name string) error
- func CreateSnsTopic(t *testing.T, region string, snsTopicName string) string
- func CreateSnsTopicE(t *testing.T, region string, snsTopicName string) (string, error)
- func DeleteAmi(t *testing.T, region string, imageId string)
- func DeleteAmiE(t *testing.T, region string, imageId string) error
- func DeleteEC2KeyPair(t *testing.T, keyPair *Ec2Keypair)
- func DeleteEC2KeyPairE(t *testing.T, keyPair *Ec2Keypair) error
- func DeleteMessageFromQueue(t *testing.T, awsRegion string, queueUrl string, receipt string)
- func DeleteMessageFromQueueE(t *testing.T, awsRegion string, queueUrl string, receipt string) error
- func DeleteQueue(t *testing.T, awsRegion string, queueUrl string)
- func DeleteQueueE(t *testing.T, awsRegion string, queueUrl string) error
- func DeleteS3Bucket(t *testing.T, region string, name string)
- func DeleteS3BucketE(t *testing.T, region string, name string) error
- func DeleteSNSTopic(t *testing.T, region string, snsTopicArn string)
- func DeleteSNSTopicE(t *testing.T, region string, snsTopicArn string) error
- func EnableMfaDevice(t *testing.T, iamClient *iam.IAM, mfaDevice *iam.VirtualMFADevice)
- func EnableMfaDeviceE(t *testing.T, iamClient *iam.IAM, mfaDevice *iam.VirtualMFADevice) error
- func FindS3BucketWithTag(t *testing.T, awsRegion string, key string, value string) string
- func FindS3BucketWithTagE(t *testing.T, awsRegion string, key string, value string) (string, error)
- func FindVpcName(vpc *ec2.Vpc) string
- func GetAccountId(t *testing.T) string
- func GetAccountIdE(t *testing.T) (string, error)
- func GetAcmCertificateArn(awsRegion string, certDomainName string) (string, error)
- func GetAllAwsRegions(t *testing.T) []string
- func GetAllAwsRegionsE(t *testing.T) ([]string, error)
- func GetAmazonLinuxAmi(t *testing.T, region string) string
- func GetAmazonLinuxAmiE(t *testing.T, region string) (string, error)
- func GetAvailabilityZones(t *testing.T, region string) []string
- func GetAvailabilityZonesE(t *testing.T, region string) ([]string, error)
- func GetCentos7Ami(t *testing.T, region string) string
- func GetCentos7AmiE(t *testing.T, region string) (string, error)
- func GetCloudWatchLogEntries(t *testing.T, awsRegion string, logStreamName string, logGroupName string) []string
- func GetCloudWatchLogEntriesE(t *testing.T, awsRegion string, logStreamName string, logGroupName string) ([]string, error)
- func GetCmkArn(t *testing.T, region string, cmkId string) string
- func GetCmkArnE(t *testing.T, region string, cmkId string) (string, error)
- func GetEc2InstanceIdsByTag(t *testing.T, region string, tagName string, tagValue string) []string
- func GetEc2InstanceIdsByTagE(t *testing.T, region string, tagName string, tagValue string) ([]string, error)
- func GetEcsOptimizedAmazonLinuxAmi(t *testing.T, region string) string
- func GetEcsOptimizedAmazonLinuxAmiE(t *testing.T, region string) (string, error)
- func GetFirstTwoOctets(cidrBlock string) string
- func GetIamCurrentUserArn(t *testing.T) string
- func GetIamCurrentUserArnE(t *testing.T) (string, error)
- func GetIamCurrentUserName(t *testing.T) string
- func GetIamCurrentUserNameE(t *testing.T) (string, error)
- func GetMostRecentAmiId(t *testing.T, region string, ownerId string, filters map[string][]string) string
- func GetMostRecentAmiIdE(t *testing.T, region string, ownerId string, filters map[string][]string) (string, error)
- func GetRandomPrivateCidrBlock(routingPrefix int) string
- func GetRandomRegion(t *testing.T, approvedRegions []string, forbiddenRegions []string) string
- func GetRandomRegionE(t *testing.T, approvedRegions []string, forbiddenRegions []string) (string, error)
- func GetS3ObjectContents(t *testing.T, awsRegion string, bucket string, key string) string
- func GetS3ObjectContentsE(t *testing.T, awsRegion string, bucket string, key string) (string, error)
- func GetSyslogForInstance(t *testing.T, instanceId string, awsRegion string) string
- func GetSyslogForInstanceE(t *testing.T, instanceId string, region string) (string, error)
- func GetSyslogForInstancesInAsg(t *testing.T, asgName string, awsRegion string) map[string]string
- func GetSyslogForInstancesInAsgE(t *testing.T, asgName string, awsRegion string) (map[string]string, error)
- func GetTagsForEc2Instance(t *testing.T, region string, instanceId string) map[string]string
- func GetTagsForEc2InstanceE(t *testing.T, region string, instanceId string) (map[string]string, error)
- func GetTimeBasedOneTimePassword(mfaDevice *iam.VirtualMFADevice) (string, error)
- func GetUbuntu1404Ami(t *testing.T, region string) string
- func GetUbuntu1404AmiE(t *testing.T, region string) (string, error)
- func GetUbuntu1604Ami(t *testing.T, region string) string
- func GetUbuntu1604AmiE(t *testing.T, region string) (string, error)
- func NewAcmClient(awsRegion string) (*acm.ACM, error)
- func NewAuthenticatedSession(region string) (*session.Session, error)
- func NewCloudWatchLogsClient(region string) (*cloudwatchlogs.CloudWatchLogs, error)
- func NewEc2Client(region string) (*ec2.EC2, error)
- func NewIamClient(region string) (*iam.IAM, error)
- func NewKmsClient(region string) (*kms.KMS, error)
- func NewS3Client(region string) (*s3.S3, error)
- func NewSnsClient(region string) (*sns.SNS, error)
- func NewSqsClient(region string) (*sqs.SQS, error)
- func ReadPasswordPolicyMinPasswordLength(iamClient *iam.IAM) (int, error)
- func SendMessageToQueue(t *testing.T, awsRegion string, queueUrl string, message string)
- func SendMessageToQueueE(t *testing.T, awsRegion string, queueUrl string, message string) error
- func TerminateInstance(t *testing.T, region string, instanceId string)
- func TerminateInstanceE(t *testing.T, region string, instanceId string) error
- type CredentialsError
- type Ec2Keypair
- func CreateAndImportEC2KeyPair(t *testing.T, region string, name string) *Ec2Keypair
- func CreateAndImportEC2KeyPairE(t *testing.T, region string, name string) (*Ec2Keypair, error)
- func ImportEC2KeyPair(t *testing.T, region string, name string, keyPair *ssh.KeyPair) *Ec2Keypair
- func ImportEC2KeyPairE(t *testing.T, region string, name string, keyPair *ssh.KeyPair) (*Ec2Keypair, error)
- type NoImagesFound
- type QueueMessageResponse
- type ReceiveMessageTimeout
- type Subnet
- type Vpc
Constants ¶
const AmazonAccountId = "amazon"
const CanonicalAccountId = "099720109477"
const CentOsAccountId = "679593333241"
Variables ¶
This section is empty.
Functions ¶
func AssertS3BucketExists ¶
Check if the given S3 bucket exists in the given region and fail the test if it does not
func AssertS3BucketExistsE ¶
Check if the given S3 bucket exists in the given region and return an error if it does not
func CreateAwsCredentials ¶
func CreateAwsCredentials(accessKeyId string, secretAccessKey string) *credentials.Credentials
Create an AWS Credentials configuration with specific AWS credentials.
func CreateAwsCredentialsWithSessionToken ¶
func CreateAwsCredentialsWithSessionToken(accessKeyId, secretAccessKey, sessionToken string) *credentials.Credentials
Create an AWS Credentials configuration with temporary AWS credentials by including a session token (used for authenticating with MFA)
func CreateAwsSessionWithCreds ¶
func CreateAwsSessionWithCreds(region string, accessKeyId string, secretAccessKey string) (*session.Session, error)
Create a new AWS session using explicit credentials. This is useful if you want to create an IAM User dynamically and create an AWS session authenticated as the new IAM User.
func CreateAwsSessionWithMfa ¶
func CreateAwsSessionWithMfa(region string, stsClient *sts.STS, mfaDevice *iam.VirtualMFADevice) (*session.Session, error)
Create a new AWS session authenticated using an MFA token retrieved using the given STS client and MFA Device
func CreateMfaDevice ¶
Create an MFA device using the given IAM client
func CreateMfaDeviceE ¶
func CreateMfaDeviceE(t *testing.T, iamClient *iam.IAM, deviceName string) (*iam.VirtualMFADevice, error)
Create an MFA device using the given IAM client
func CreateRandomQueue ¶
Create a new SQS queue with a random name that starts with the given prefix and return the queue URL
func CreateRandomQueueE ¶
Create a new SQS queue with a random name that starts with the given prefix and return the queue URL
func CreateS3Bucket ¶
Create an S3 bucket in the given region with the given name. Note that S3 bucket names must be globally unique.
func CreateS3BucketE ¶
Create an S3 bucket in the given region with the given name. Note that S3 bucket names must be globally unique.
func CreateSnsTopic ¶
Create an SNS Topic and return the ARN
func CreateSnsTopicE ¶
Create an SNS Topic and return the ARN
func DeleteAmiE ¶
Delete the given AMI in the given region
func DeleteEC2KeyPair ¶
func DeleteEC2KeyPair(t *testing.T, keyPair *Ec2Keypair)
Delete an EC2 Keypair
func DeleteEC2KeyPairE ¶
func DeleteEC2KeyPairE(t *testing.T, keyPair *Ec2Keypair) error
Delete an EC2 Keypair
func DeleteMessageFromQueue ¶
Delete the message with the given receipt from the SQS queue with the given URL
func DeleteMessageFromQueueE ¶
Delete the message with the given receipt from the SQS queue with the given URL
func DeleteQueue ¶
Delete the SQS queue with the given URL
func DeleteQueueE ¶
Delete the SQS queue with the given URL
func DeleteS3Bucket ¶
Destroy the S3 bucket in the given region with the given name.
func DeleteS3BucketE ¶
Destroy the S3 bucket in the given region with the given name.
func DeleteSNSTopic ¶
Delete an SNS Topic
func DeleteSNSTopicE ¶
Delete an SNS Topic
func EnableMfaDevice ¶
Enable a newly created MFA Device by supplying the first two one-time passwords, so that it can be used for future logins by the given IAM User
func EnableMfaDeviceE ¶
Enable a newly created MFA Device by supplying the first two one-time passwords, so that it can be used for future logins by the given IAM User
func FindS3BucketWithTag ¶
Find the name of the S3 bucket in the given region with the given tag key=value
func FindS3BucketWithTagE ¶
Find the name of the S3 bucket in the given region with the given tag key=value
func FindVpcName ¶
Extract the VPC name from its tags (if any). Fall back to "Default" if it's the default VPC or empty string otherwise.
func GetAccountId ¶
Get the Account ID for the currently logged in IAM User.
func GetAccountIdE ¶
Get the Account ID for the currently logged in IAM User.
func GetAcmCertificateArn ¶
Get the ACM certificate for the given domain name in the given region
func GetAllAwsRegions ¶
Get the list of AWS regions available in this account
func GetAllAwsRegionsE ¶
Get the list of AWS regions available in this account
func GetAmazonLinuxAmi ¶
Return an Amazon Linux AMI HVM, SSD Volume Type public AMI for the given region.
func GetAmazonLinuxAmiE ¶
Return an Amazon Linux AMI HVM, SSD Volume Type public AMI for the given region.
func GetAvailabilityZones ¶
Get the Availability Zones for a given AWS region. Note that for certain regions (e.g. us-east-1), different AWS accounts have access to different availability zones.
func GetAvailabilityZonesE ¶
Get the Availability Zones for a given AWS region. Note that for certain regions (e.g. us-east-1), different AWS accounts have access to different availability zones.
func GetCentos7Ami ¶
Return a CentOS 7 public AMI from the given region. WARNING: you may have to accept the terms & conditions of this AMI in AWS MarketPlace for your AWS Account before you can successfully launch the AMI.
func GetCentos7AmiE ¶
Return a CentOS 7 public AMI from the given region. WARNING: you may have to accept the terms & conditions of this AMI in AWS MarketPlace for your AWS Account before you can successfully launch the AMI.
func GetCloudWatchLogEntries ¶
func GetCloudWatchLogEntries(t *testing.T, awsRegion string, logStreamName string, logGroupName string) []string
Return the CloudWatch log messages in the given region for the given log stream and log group
func GetCloudWatchLogEntriesE ¶
func GetCloudWatchLogEntriesE(t *testing.T, awsRegion string, logStreamName string, logGroupName string) ([]string, error)
Return the CloudWatch log messages in the given region for the given log stream and log group
func GetCmkArn ¶
Get the ARN of a KMS Customer Master Key (CMK) in the given region with the given ID. The ID can be an alias, such as "alias/my-cmk".
func GetCmkArnE ¶
Get the ARN of a KMS Customer Master Key (CMK) in the given region with the given ID. The ID can be an alias, such as "alias/my-cmk".
func GetEc2InstanceIdsByTag ¶
Return all the IDs of EC2 instances in the given region with the given tag
func GetEc2InstanceIdsByTagE ¶
func GetEc2InstanceIdsByTagE(t *testing.T, region string, tagName string, tagValue string) ([]string, error)
Return all the IDs of EC2 instances in the given region with the given tag
func GetEcsOptimizedAmazonLinuxAmi ¶
Return an Amazon ECS-Optimized Amazon Linux AMI for the given region. This AMI is useful for running an ECS cluster.
func GetEcsOptimizedAmazonLinuxAmiE ¶
Return an Amazon ECS-Optimized Amazon Linux AMI for the given region. This AMI is useful for running an ECS cluster.
func GetFirstTwoOctets ¶
func GetIamCurrentUserArn ¶
Get the ARN for the current IAM user
func GetIamCurrentUserArnE ¶
Get the ARN for the current IAM user
func GetIamCurrentUserName ¶
Get the username fo the current IAM user
func GetIamCurrentUserNameE ¶
Get the username fo the current IAM user
func GetMostRecentAmiId ¶
func GetMostRecentAmiId(t *testing.T, region string, ownerId string, filters map[string][]string) string
Get the ID of the most recent AMI in the given region that has the given owner and matches the given filters. Each filter should correspond to the name and values of a filter supported by DescribeImagesInput: https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#DescribeImagesInput
func GetMostRecentAmiIdE ¶
func GetMostRecentAmiIdE(t *testing.T, region string, ownerId string, filters map[string][]string) (string, error)
Get the ID of the most recent AMI in the given region that has the given owner and matches the given filters. Each filter should correspond to the name and values of a filter supported by DescribeImagesInput: https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#DescribeImagesInput
func GetRandomPrivateCidrBlock ¶
Get a random CIDR block from the range of acceptable private IP addresses per RFC 1918 (https://tools.ietf.org/html/rfc1918#section-3) The routingPrefix refers to the "/28" in 1.2.3.4/28. Note that, as written, this function will return a subset of all valid ranges. Since we will probably use this function mostly for generating random CIDR ranges for VPCs and Subnets, having comprehensive set coverage is not essential.
func GetRandomRegion ¶
Get a randomly chosen AWS region. If approvedRegions is not empty, this will be a region from the approvedRegions list; otherwise, this method will fetch the latest list of regions from the AWS APIs and pick one of those. If forbiddenRegions is not empty, this method will make sure the returned region is not in the forbiddenRegions list.
func GetRandomRegionE ¶
func GetRandomRegionE(t *testing.T, approvedRegions []string, forbiddenRegions []string) (string, error)
Get a randomly chosen AWS region. If approvedRegions is not empty, this will be a region from the approvedRegions list; otherwise, this method will fetch the latest list of regions from the AWS APIs and pick one of those. If forbiddenRegions is not empty, this method will make sure the returned region is not in the forbiddenRegions list.
func GetS3ObjectContents ¶
Fetch the contents of the object in the given bucket with the given key and return it as a string
func GetS3ObjectContentsE ¶
func GetS3ObjectContentsE(t *testing.T, awsRegion string, bucket string, key string) (string, error)
Fetch the contents of the object in the given bucket with the given key and return it as a string
func GetSyslogForInstance ¶
Get the syslog for the Instance with the given ID in the given region. This should be available ~1 minute after an Instance boots and is very useful for debugging boot-time issues, such as an error in User Data.
func GetSyslogForInstanceE ¶
Get the syslog for the Instance with the given ID in the given region. This should be available ~1 minute after an Instance boots and is very useful for debugging boot-time issues, such as an error in User Data.
func GetSyslogForInstancesInAsg ¶
Get the syslog for each of the Instances in the given ASG in the given region. These logs should be available ~1 minute after the Instance boots and are very useful for debugging boot-time issues, such as an error in User Data. Returns a map of Instance Id -> Syslog for that Instance.
func GetSyslogForInstancesInAsgE ¶
func GetSyslogForInstancesInAsgE(t *testing.T, asgName string, awsRegion string) (map[string]string, error)
Get the syslog for each of the Instances in the given ASG in the given region. These logs should be available ~1 minute after the Instance boots and are very useful for debugging boot-time issues, such as an error in User Data. Returns a map of Instance Id -> Syslog for that Instance.
func GetTagsForEc2Instance ¶
Return all the tags for the given EC2 Instance
func GetTagsForEc2InstanceE ¶
func GetTagsForEc2InstanceE(t *testing.T, region string, instanceId string) (map[string]string, error)
Return all the tags for the given EC2 Instance
func GetTimeBasedOneTimePassword ¶
func GetTimeBasedOneTimePassword(mfaDevice *iam.VirtualMFADevice) (string, error)
Get a One-Time Password from the given mfaDevice. Per the RFC 6238 standard, this value will be different every 30 seconds.
func GetUbuntu1404Ami ¶
Get the ID of the most recent Ubuntu 14.04 HVM x86_64 EBS GP2 AMI in the given region
func GetUbuntu1404AmiE ¶
Get the ID of the most recent Ubuntu 14.04 HVM x86_64 EBS GP2 AMI in the given region
func GetUbuntu1604Ami ¶
Get the ID of the most recent Ubuntu 16.04 HVM x86_64 EBS GP2 AMI in the given region
func GetUbuntu1604AmiE ¶
Get the ID of the most recent Ubuntu 16.04 HVM x86_64 EBS GP2 AMI in the given region
func NewAuthenticatedSession ¶
Get an AWS Session, checking that the user has credentials properly configured in their environment
func NewCloudWatchLogsClient ¶
func NewCloudWatchLogsClient(region string) (*cloudwatchlogs.CloudWatchLogs, error)
Create a new CloudWatch Logs client
func SendMessageToQueue ¶
Send the given message to the SQS queue with the given URL
func SendMessageToQueueE ¶
Send the given message to the SQS queue with the given URL
func TerminateInstance ¶
Terminate the EC2 instance with the given ID in the given region
Types ¶
type CredentialsError ¶
type CredentialsError struct {
UnderlyingErr error
}
func (CredentialsError) Error ¶
func (err CredentialsError) Error() string
type Ec2Keypair ¶
type Ec2Keypair struct { *ssh.KeyPair Name string // The name assigned in AWS to the EC2 Key Pair Region string // The AWS region where the EC2 Key Pair lives }
func CreateAndImportEC2KeyPair ¶
func CreateAndImportEC2KeyPair(t *testing.T, region string, name string) *Ec2Keypair
Generate a public/private KeyPair and import it into EC2 in the given region under the given name.
func CreateAndImportEC2KeyPairE ¶
Generate a public/private KeyPair and import it into EC2 in the given region under the given name.
func ImportEC2KeyPair ¶
Create a Key Pair in EC2 by importing an existing public key
func ImportEC2KeyPairE ¶
func ImportEC2KeyPairE(t *testing.T, region string, name string, keyPair *ssh.KeyPair) (*Ec2Keypair, error)
Create a Key Pair in EC2 by importing an existing public key
type NoImagesFound ¶
func (NoImagesFound) Error ¶
func (err NoImagesFound) Error() string
type QueueMessageResponse ¶
func WaitForQueueMessage ¶
func WaitForQueueMessage(t *testing.T, awsRegion string, queueUrl string, timeout int) QueueMessageResponse
Waits to receive a message from on the queueUrl. Since the API only allows us to wait a max 20 seconds for a new message to arrive, we must loop TIMEOUT/20 number of times to be able to wait for a total of TIMEOUT seconds
type ReceiveMessageTimeout ¶
func (ReceiveMessageTimeout) Error ¶
func (err ReceiveMessageTimeout) Error() string
type Subnet ¶
type Subnet struct { Id string // The ID of the Subnet AvailabilityZone string // The Availability Zone the subnet is in }
func GetSubnetsForVpc ¶
Get the subnets in the specified VPC