Documentation
¶
Index ¶
- Variables
- func NewUploader(region, bucketName, imageName string, opts *UploaderOptions) (cloud.Uploader, error)
- type AWS
- func New(region string, accessKeyID string, accessKey string, sessionToken string) (*AWS, error)
- func NewDefault(region string, profile 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, address string, from, to int32, proto string) (*ec2.AuthorizeSecurityGroupIngressOutput, error)
- func (a *AWS) Buckets() ([]string, error)
- func (a *AWS) CheckBucketPermission(bucketName string, permission s3types.Permission) (bool, error)
- func (a *AWS) CreateSecurityGroupEC2(name, description string) (*ec2.CreateSecurityGroupOutput, error)
- func (a *AWS) DeleteEC2Image(imageID string) error
- func (a *AWS) DeleteObject(bucket, key string) error
- func (a *AWS) DeleteSecurityGroupEC2(groupID string) (*ec2.DeleteSecurityGroupOutput, 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, tags []AWSTag, shareWith []string, ...) (string, string, error)
- func (a *AWS) RunInstanceEC2(imageID, secGroupID, userData, instanceType string) (*ec2types.Reservation, error)
- func (a *AWS) S3ObjectPresignedURL(bucket, objectKey string) (string, error)
- func (a *AWS) ShareImage(ami string, snapshotIDs, userIDs []string) error
- func (a *AWS) TerminateInstancesEC2(instanceIDs []string, timeout time.Duration) (*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 AWSTag
- type UploaderOptions
Constants ¶
This section is empty.
Variables ¶
var S3PermissionsMatrix = map[s3types.Permission][]s3types.Permission{ s3types.PermissionRead: {s3types.PermissionRead, s3types.PermissionWrite, s3types.PermissionFullControl}, s3types.PermissionWrite: {s3types.PermissionWrite, s3types.PermissionFullControl}, s3types.PermissionFullControl: {s3types.PermissionFullControl}, s3types.PermissionReadAcp: {s3types.PermissionReadAcp, s3types.PermissionWriteAcp}, s3types.PermissionWriteAcp: {s3types.PermissionWriteAcp}, }
S3PermissionsMatrix Maps a requested permission to all permissions that are sufficient for the requested one
Functions ¶
func NewUploader ¶ added in v0.40.2
func NewUploader(region, bucketName, imageName string, opts *UploaderOptions) (cloud.Uploader, error)
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.40.2
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 all of its associated snapshots
func (*AWS) DeleteObject ¶ added in v0.40.2
func (*AWS) DeleteSecurityGroupEC2 ¶
func (a *AWS) DeleteSecurityGroupEC2(groupID string) (*ec2.DeleteSecurityGroupOutput, error)
func (*AWS) GetInstanceAddress ¶
func (*AWS) MarkS3ObjectAsPublic ¶
func (*AWS) Register ¶
func (a *AWS) Register(name, bucket, key string, tags []AWSTag, shareWith []string, architecture arch.Arch, bootMode *platform.BootMode, importRole *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.
func (*AWS) RunInstanceEC2 ¶
func (a *AWS) RunInstanceEC2(imageID, secGroupID, userData, instanceType string) (*ec2types.Reservation, error)
func (*AWS) S3ObjectPresignedURL ¶
func (*AWS) ShareImage ¶
ShareImage shares the AMI and its associated snapshots with the specified user IDs. If no snapshot IDs are provided, it will find the snapshot IDs associated with the AMI.
func (*AWS) TerminateInstancesEC2 ¶ added in v0.174.0
func (a *AWS) TerminateInstancesEC2(instanceIDs []string, timeout time.Duration) (*ec2.TerminateInstancesOutput, error)
TerminateInstancesEC2 terminates the specified EC2 instances and waits for them to be terminated if timeout is greater than 0.
func (*AWS) Upload ¶
func (a *AWS) Upload(filename, bucket, key string) (*s3manager.UploadOutput, error)