Documentation ¶
Index ¶
- func RegionFromInstanceMetadata() (string, error)
- func SecureInstanceUserData(cloudWatchGroup, hostname string) string
- type ASG
- type AWS
- func New(region string, accessKeyID string, accessKey string, sessionToken string) (*AWS, error)
- func NewDefault(region string) (*AWS, error)
- func NewForEndpoint(endpoint, region, accessKeyID, accessKey, sessionToken, caBundle string, ...) (*AWS, error)
- func NewForEndpointFromFile(filename, endpoint, region, caBundle string, skipSSLVerification bool) (*AWS, error)
- func NewFromFile(filename string, region string) (*AWS, error)
- func (a *AWS) ASGSetProtectHost(protect bool) error
- func (a *AWS) CopyImage(name, ami, sourceRegion string) (string, error)
- func (a *AWS) DeleteLaunchTemplateById(ctx context.Context, ltID *string) error
- func (a *AWS) DeleteSecurityGroupById(ctx context.Context, sgID *string) error
- func (a *AWS) DescribeImagesByName(name string) (*ec2.DescribeImagesOutput, error)
- func (a *AWS) DescribeImagesByTag(tagKey, tagValue string) ([]ec2types.Image, error)
- func (a *AWS) DescribeInstancesByInstanceID(instanceID string) ([]ec2types.Reservation, error)
- func (a *AWS) DescribeInstancesByLaunchTemplateID(launchTemplateID string) ([]ec2types.Reservation, error)
- func (a *AWS) DescribeInstancesBySecurityGroupID(securityGroupID string) ([]ec2types.Reservation, error)
- func (a *AWS) DescribeInstancesByTag(tagKey, tagValue string) ([]ec2types.Reservation, error)
- func (a *AWS) DescribeLaunchTemplatesByPrefix(ctx context.Context, prefix string) ([]ec2types.LaunchTemplate, error)
- func (a *AWS) DescribeSecurityGroupsByPrefix(ctx context.Context, prefix string) ([]ec2types.SecurityGroup, error)
- func (a *AWS) EC2ForTestsOnly() EC2
- func (a *AWS) MarkS3ObjectAsPublic(bucket, objectKey string) error
- func (a *AWS) Regions() ([]string, error)
- func (a *AWS) Register(name, bucket, key string, shareWith []string, rpmArch string, bootMode *string) (*string, error)
- func (a *AWS) RemoveSnapshotAndDeregisterImage(image *ec2types.Image) error
- func (a *AWS) RunSecureInstance(iamProfile, keyName, cloudWatchGroup, hostname string) (*SecureInstance, error)
- func (a *AWS) S3ObjectPresignedURL(bucket, objectKey string) (string, error)
- func (a *AWS) ShareImage(ami string, userIds []string) error
- func (a *AWS) TerminateInstances(instanceIDs []string) error
- func (a *AWS) TerminateSecureInstance(si *SecureInstance) error
- func (a *AWS) Upload(filename, bucket, key string) (*manager.UploadOutput, error)
- type EC2
- type EC2Imds
- type S3
- type S3Manager
- type S3Presign
- type SecureInstance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SecureInstanceUserData ¶
SecureInstanceUserData returns the cloud-init user data for a secure instance.
Types ¶
type ASG ¶
type ASG interface { DescribeAutoScalingInstances(context.Context, *autoscaling.DescribeAutoScalingInstancesInput, ...func(*autoscaling.Options)) (*autoscaling.DescribeAutoScalingInstancesOutput, error) SetInstanceProtection(context.Context, *autoscaling.SetInstanceProtectionInput, ...func(*autoscaling.Options)) (*autoscaling.SetInstanceProtectionOutput, error) }
type AWS ¶
type AWS struct {
// contains filtered or unexported fields
}
func NewDefault ¶
Initialize a new AWS object from defaults. Looks for env variables, shared credential file, and EC2 Instance Roles.
func NewForEndpoint ¶
func NewForEndpoint(endpoint, region, accessKeyID, accessKey, sessionToken, caBundle string, skipSSLVerification bool) (*AWS, error)
Initialize a new AWS object targeting a specific endpoint from individual bits. SessionToken is optional
func NewForEndpointFromFile ¶
func NewForEndpointFromFile(filename, endpoint, region, caBundle string, skipSSLVerification bool) (*AWS, error)
Initializes a new AWS object targeting a specific endpoint with the credentials info found at filename's location. The credential files should match the AWS format, such as: [default] aws_access_key_id = secretString1 aws_secret_access_key = secretString2
If filename is empty the underlying function will look for the "AWS_SHARED_CREDENTIALS_FILE" env variable or will default to $HOME/.aws/credentials.
func NewFromFile ¶
Initializes a new AWS object with the credentials info found at filename's location. The credential files should match the AWS format, such as: [default] aws_access_key_id = secretString1 aws_secret_access_key = secretString2
If filename is empty the underlying function will look for the "AWS_SHARED_CREDENTIALS_FILE" env variable or will default to $HOME/.aws/credentials.
func (*AWS) ASGSetProtectHost ¶
func (*AWS) DeleteLaunchTemplateById ¶
func (*AWS) DeleteSecurityGroupById ¶
func (*AWS) DescribeImagesByName ¶
func (a *AWS) DescribeImagesByName(name string) (*ec2.DescribeImagesOutput, error)
func (*AWS) DescribeImagesByTag ¶
For service maintenance images are discovered by the "Name:composer-api-*" tag filter. Currently all image names in the service are generated, so they're guaranteed to be unique as well. If users are ever allowed to name their images, an extra tag should be added.
func (*AWS) DescribeInstancesByInstanceID ¶
func (a *AWS) DescribeInstancesByInstanceID(instanceID string) ([]ec2types.Reservation, error)
func (*AWS) DescribeInstancesByLaunchTemplateID ¶
func (a *AWS) DescribeInstancesByLaunchTemplateID(launchTemplateID string) ([]ec2types.Reservation, error)
func (*AWS) DescribeInstancesBySecurityGroupID ¶
func (a *AWS) DescribeInstancesBySecurityGroupID(securityGroupID string) ([]ec2types.Reservation, error)
func (*AWS) DescribeInstancesByTag ¶
func (a *AWS) DescribeInstancesByTag(tagKey, tagValue string) ([]ec2types.Reservation, error)
func (*AWS) DescribeLaunchTemplatesByPrefix ¶
func (*AWS) DescribeSecurityGroupsByPrefix ¶
func (*AWS) EC2ForTestsOnly ¶
This is used by the internal/boot test, which access the ec2 apis directly
func (*AWS) MarkS3ObjectAsPublic ¶
func (*AWS) Register ¶
func (a *AWS) Register(name, bucket, key string, shareWith []string, rpmArch string, bootMode *string) (*string, error)
Register is a function that imports a snapshot, waits for the snapshot to fully import, tags the snapshot, cleans up the image in S3, and registers an AMI in AWS. The caller can optionally specify the boot mode of the AMI. If the boot mode is not specified, then the instances launched from this AMI use the default boot mode value of the instance type.
func (*AWS) RemoveSnapshotAndDeregisterImage ¶
func (*AWS) RunSecureInstance ¶
func (a *AWS) RunSecureInstance(iamProfile, keyName, cloudWatchGroup, hostname string) (*SecureInstance, error)
Runs an instance with a security group that only allows traffic to the host. Will replace resources if they already exists.
func (*AWS) S3ObjectPresignedURL ¶
func (*AWS) TerminateInstances ¶
func (*AWS) TerminateSecureInstance ¶
func (a *AWS) TerminateSecureInstance(si *SecureInstance) error
type EC2 ¶
type EC2 interface { DescribeRegions(context.Context, *ec2.DescribeRegionsInput, ...func(*ec2.Options)) (*ec2.DescribeRegionsOutput, error) // Security Groups AuthorizeSecurityGroupIngress(context.Context, *ec2.AuthorizeSecurityGroupIngressInput, ...func(*ec2.Options)) (*ec2.AuthorizeSecurityGroupIngressOutput, error) CreateSecurityGroup(context.Context, *ec2.CreateSecurityGroupInput, ...func(*ec2.Options)) (*ec2.CreateSecurityGroupOutput, error) DeleteSecurityGroup(context.Context, *ec2.DeleteSecurityGroupInput, ...func(*ec2.Options)) (*ec2.DeleteSecurityGroupOutput, error) DescribeSecurityGroups(context.Context, *ec2.DescribeSecurityGroupsInput, ...func(*ec2.Options)) (*ec2.DescribeSecurityGroupsOutput, error) // Subnets CreateSubnet(context.Context, *ec2.CreateSubnetInput, ...func(*ec2.Options)) (*ec2.CreateSubnetOutput, error) DeleteSubnet(context.Context, *ec2.DeleteSubnetInput, ...func(*ec2.Options)) (*ec2.DeleteSubnetOutput, error) DescribeSubnets(context.Context, *ec2.DescribeSubnetsInput, ...func(*ec2.Options)) (*ec2.DescribeSubnetsOutput, error) // LaunchTemplates CreateLaunchTemplate(context.Context, *ec2.CreateLaunchTemplateInput, ...func(*ec2.Options)) (*ec2.CreateLaunchTemplateOutput, error) DeleteLaunchTemplate(context.Context, *ec2.DeleteLaunchTemplateInput, ...func(*ec2.Options)) (*ec2.DeleteLaunchTemplateOutput, error) DescribeLaunchTemplates(context.Context, *ec2.DescribeLaunchTemplatesInput, ...func(*ec2.Options)) (*ec2.DescribeLaunchTemplatesOutput, error) // Instances DescribeInstances(context.Context, *ec2.DescribeInstancesInput, ...func(*ec2.Options)) (*ec2.DescribeInstancesOutput, error) DescribeInstanceStatus(context.Context, *ec2.DescribeInstanceStatusInput, ...func(*ec2.Options)) (*ec2.DescribeInstanceStatusOutput, error) RunInstances(context.Context, *ec2.RunInstancesInput, ...func(*ec2.Options)) (*ec2.RunInstancesOutput, error) TerminateInstances(context.Context, *ec2.TerminateInstancesInput, ...func(*ec2.Options)) (*ec2.TerminateInstancesOutput, error) // Fleets CreateFleet(context.Context, *ec2.CreateFleetInput, ...func(*ec2.Options)) (*ec2.CreateFleetOutput, error) DeleteFleets(context.Context, *ec2.DeleteFleetsInput, ...func(*ec2.Options)) (*ec2.DeleteFleetsOutput, error) // Images CopyImage(context.Context, *ec2.CopyImageInput, ...func(*ec2.Options)) (*ec2.CopyImageOutput, error) RegisterImage(context.Context, *ec2.RegisterImageInput, ...func(*ec2.Options)) (*ec2.RegisterImageOutput, error) DeregisterImage(context.Context, *ec2.DeregisterImageInput, ...func(*ec2.Options)) (*ec2.DeregisterImageOutput, error) DescribeImages(context.Context, *ec2.DescribeImagesInput, ...func(*ec2.Options)) (*ec2.DescribeImagesOutput, error) ModifyImageAttribute(context.Context, *ec2.ModifyImageAttributeInput, ...func(*ec2.Options)) (*ec2.ModifyImageAttributeOutput, error) // Snapshots DeleteSnapshot(context.Context, *ec2.DeleteSnapshotInput, ...func(*ec2.Options)) (*ec2.DeleteSnapshotOutput, error) DescribeImportSnapshotTasks(context.Context, *ec2.DescribeImportSnapshotTasksInput, ...func(*ec2.Options)) (*ec2.DescribeImportSnapshotTasksOutput, error) ImportSnapshot(context.Context, *ec2.ImportSnapshotInput, ...func(*ec2.Options)) (*ec2.ImportSnapshotOutput, error) ModifySnapshotAttribute(context.Context, *ec2.ModifySnapshotAttributeInput, ...func(*ec2.Options)) (*ec2.ModifySnapshotAttributeOutput, error) // Tags CreateTags(context.Context, *ec2.CreateTagsInput, ...func(*ec2.Options)) (*ec2.CreateTagsOutput, error) }
type EC2Imds ¶
type EC2Imds interface {
GetInstanceIdentityDocument(context.Context, *imds.GetInstanceIdentityDocumentInput, ...func(*imds.Options)) (*imds.GetInstanceIdentityDocumentOutput, error)
}
type S3 ¶
type S3 interface { DeleteObject(context.Context, *s3.DeleteObjectInput, ...func(*s3.Options)) (*s3.DeleteObjectOutput, error) PutObjectAcl(context.Context, *s3.PutObjectAclInput, ...func(*s3.Options)) (*s3.PutObjectAclOutput, error) }
type S3Manager ¶
type S3Manager interface {
Upload(context.Context, *s3.PutObjectInput, ...func(*manager.Uploader)) (*manager.UploadOutput, error)
}
type S3Presign ¶
type S3Presign interface {
PresignGetObject(context.Context, *s3.GetObjectInput, ...func(*s3.PresignOptions)) (*v4.PresignedHTTPRequest, error)
}