awscloud

package
v0.83.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

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 New

func New(region string, accessKeyID string, accessKey string, sessionToken string) (*AWS, error)

Initialize a new AWS object from individual bits. SessionToken is optional

func NewDefault

func NewDefault(region string) (*AWS, error)

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

func NewFromFile(filename string, region string) (*AWS, error)

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 (a *AWS) AuthorizeSecurityGroupIngressEC2(groupID *string, address string, from, to int64, proto string) (*ec2.AuthorizeSecurityGroupIngressOutput, error)

func (*AWS) Buckets added in v0.50.0

func (a *AWS) Buckets() ([]string, error)

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) CopyImage

func (a *AWS) CopyImage(name, ami, sourceRegion string) (string, error)

target region is determined by the region configured in the aws session

func (*AWS) CreateSecurityGroupEC2

func (a *AWS) CreateSecurityGroupEC2(name, description string) (*ec2.CreateSecurityGroupOutput, error)

func (*AWS) DeleteEC2Image

func (a *AWS) DeleteEC2Image(imageID, snapshotID *string) error

DeleteEC2Image deletes the specified image and its associated snapshot

func (*AWS) DeleteSecurityGroupEC2

func (a *AWS) DeleteSecurityGroupEC2(groupID *string) (*ec2.DeleteSecurityGroupOutput, error)

func (*AWS) DescribeImagesByTag

func (a *AWS) DescribeImagesByTag(tagKey, tagValue string) ([]*ec2.Image, error)

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 (a *AWS) GetInstanceAddress(instanceID *string) (string, error)

func (*AWS) MarkS3ObjectAsPublic

func (a *AWS) MarkS3ObjectAsPublic(bucket, objectKey string) error

func (*AWS) Regions

func (a *AWS) Regions() ([]string, error)

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 (a *AWS) RemoveSnapshotAndDeregisterImage(image *ec2.Image) error

func (*AWS) RunInstanceEC2

func (a *AWS) RunInstanceEC2(imageID, secGroupID *string, userData, instanceType string) (*ec2.Reservation, error)

func (*AWS) S3ObjectPresignedURL

func (a *AWS) S3ObjectPresignedURL(bucket, objectKey string) (string, error)

func (*AWS) ShareImage

func (a *AWS) ShareImage(ami string, userIds []string) error

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

func (a *AWS) UploadFromReader(r io.Reader, bucket, key string) (*s3manager.UploadOutput, error)

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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL