Documentation ¶
Index ¶
- Variables
- func WaitUntilImportSnapshotTaskCompleted(c *ec2.EC2, input *ec2.DescribeImportSnapshotTasksInput) error
- func WaitUntilImportSnapshotTaskCompletedWithContext(c *ec2.EC2, ctx aws.Context, input *ec2.DescribeImportSnapshotTasksInput, ...) error
- 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) AuthorizeSecurityGroupIngressEC2(groupID *string, address string, from, to int64, proto string) (*ec2.AuthorizeSecurityGroupIngressOutput, error)
- func (a *AWS) Buckets() ([]string, error)
- func (a *AWS) CheckBucketPermission(bucketName string, permission S3Permission) (bool, error)
- func (a *AWS) CopyImage(name, ami, sourceRegion string) (string, error)
- func (a *AWS) CreateSecurityGroupEC2(name, description string) (*ec2.CreateSecurityGroupOutput, error)
- func (a *AWS) DeleteEC2Image(imageID, snapshotID *string) error
- func (a *AWS) DeleteSecurityGroupEC2(groupID *string) (*ec2.DeleteSecurityGroupOutput, error)
- func (a *AWS) DescribeImagesByTag(tagKey, tagValue string) ([]*ec2.Image, error)
- func (a *AWS) GetInstanceAddress(instanceID *string) (string, error)
- 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, *string, error)
- func (a *AWS) RemoveSnapshotAndDeregisterImage(image *ec2.Image) error
- func (a *AWS) RunInstanceEC2(imageID, secGroupID *string, userData, instanceType string) (*ec2.Reservation, error)
- func (a *AWS) S3ObjectPresignedURL(bucket, objectKey string) (string, error)
- func (a *AWS) ShareImage(ami string, userIds []string) error
- func (a *AWS) TerminateInstanceEC2(instanceID *string) (*ec2.TerminateInstancesOutput, error)
- func (a *AWS) Upload(filename, bucket, key string) (*s3manager.UploadOutput, error)
- func (a *AWS) UploadFromReader(r io.Reader, bucket, key string) (*s3manager.UploadOutput, error)
- type S3Permission
Constants ¶
This section is empty.
Variables ¶
var PermissionsMatrix = map[S3Permission][]S3Permission{ S3PermissionRead: {S3PermissionRead, S3PermissionWrite, S3PermissionFullControl}, S3PermissionWrite: {S3PermissionWrite, S3PermissionFullControl}, S3PermissionFullControl: {S3PermissionFullControl}, S3PermissionReadAcp: {S3PermissionReadAcp, S3PermissionWriteAcp}, S3PermissionWriteAcp: {S3PermissionWriteAcp}, }
PermissionsMatrix Maps a requested permission to all permissions that are sufficient for the requested one
Functions ¶
func WaitUntilImportSnapshotTaskCompleted ¶
func WaitUntilImportSnapshotTaskCompleted(c *ec2.EC2, input *ec2.DescribeImportSnapshotTasksInput) error
WaitUntilImportSnapshotCompleted uses the Amazon EC2 API operation DescribeImportSnapshots to wait for a condition to be met before returning. If the condition is not met within the max attempt window, an error will be returned.
func WaitUntilImportSnapshotTaskCompletedWithContext ¶
func WaitUntilImportSnapshotTaskCompletedWithContext(c *ec2.EC2, ctx aws.Context, input *ec2.DescribeImportSnapshotTasksInput, opts ...request.WaiterOption) error
WaitUntilImportSnapshotCompletedWithContext is an extended version of WaitUntilImportSnapshotCompleted. With the support for passing in a context and options to configure the Waiter and the underlying request options.
The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.
NOTE(mhayden): The MaxAttempts is set to zero here so that we will keep checking the status of the image import until it succeeds or fails. This process can take anywhere from 5 to 60+ minutes depending on how quickly AWS can import the snapshot.
Types ¶
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) AuthorizeSecurityGroupIngressEC2 ¶
func (*AWS) CheckBucketPermission ¶ added in v0.50.0
func (a *AWS) CheckBucketPermission(bucketName string, permission S3Permission) (bool, error)
CheckBucketPermission check if the current account (of a.s3) has the `permission` on the given bucket
func (*AWS) CreateSecurityGroupEC2 ¶
func (a *AWS) CreateSecurityGroupEC2(name, description string) (*ec2.CreateSecurityGroupOutput, error)
func (*AWS) DeleteEC2Image ¶
DeleteEC2Image deletes the specified image and its associated snapshot
func (*AWS) DeleteSecurityGroupEC2 ¶
func (a *AWS) DeleteSecurityGroupEC2(groupID *string) (*ec2.DeleteSecurityGroupOutput, 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) GetInstanceAddress ¶
func (*AWS) MarkS3ObjectAsPublic ¶
func (*AWS) Register ¶
func (a *AWS) Register(name, bucket, key string, shareWith []string, rpmArch string, bootMode *string) (*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. Returns the image ID and the snapshot ID.
func (*AWS) RemoveSnapshotAndDeregisterImage ¶
func (*AWS) RunInstanceEC2 ¶
func (*AWS) S3ObjectPresignedURL ¶
func (*AWS) TerminateInstanceEC2 ¶
func (a *AWS) TerminateInstanceEC2(instanceID *string) (*ec2.TerminateInstancesOutput, error)
func (*AWS) Upload ¶
func (a *AWS) Upload(filename, bucket, key string) (*s3manager.UploadOutput, error)
func (*AWS) UploadFromReader ¶ added in v0.33.0
type S3Permission ¶ added in v0.50.0
type S3Permission string
S3Permission Implementing an "enum type" for aws-sdk-go permission constants
const ( S3PermissionRead S3Permission = s3.PermissionRead S3PermissionWrite S3Permission = s3.PermissionWrite S3PermissionFullControl S3Permission = s3.PermissionFullControl S3PermissionReadAcp S3Permission = s3.PermissionReadAcp S3PermissionWriteAcp S3Permission = s3.PermissionWriteAcp )