Documentation ¶
Index ¶
- Constants
- type API
- func (a *API) AddKey(name, key string) error
- func (a *API) CopyBucket(srcBucket, prefix, destBucket, policy string) error
- func (a *API) CopyImage(sourceImageID string, regions []string, cb func(string, ImageData)) error
- func (a *API) CopyObject(srcBucket, srcPath, destBucket, destPath, policy string) error
- func (a *API) CreateHVMImage(snapshotID string, diskSizeGiB uint, name string, description string, ...) (string, error)
- func (a *API) CreateImportRole(bucket string) error
- func (a *API) CreateInstances(name, keyname, userdata string, count uint64, minDiskSize int64, ...) ([]*ec2.Instance, error)
- func (a *API) CreateSnapshot(imageName, sourceURL string, format EC2ImageFormat) (*Snapshot, error)
- func (a *API) CreateTags(resources []string, tags map[string]string) error
- func (a *API) DeleteKey(name string) error
- func (a *API) DeleteObject(bucket, path string) error
- func (a *API) DownloadFile(srcBucket, srcPath string) (*os.File, error)
- func (a *API) FindImage(name string) (string, error)
- func (a *API) FindSnapshot(imageName string) (*Snapshot, error)
- func (a *API) GC(gracePeriod time.Duration) error
- func (a *API) GetConsoleOutput(instanceID string) (string, error)
- func (a *API) GetZonesForInstanceType(instanceType string) ([]string, error)
- func (a *API) GrantLaunchPermission(imageID string, userIDs []string) error
- func (a *API) GrantVolumePermission(snapshotID string, userIDs []string) error
- func (a *API) InitializeBucket(bucket string) error
- func (a *API) ListRegions(kind RegionKind) ([]string, error)
- func (a *API) PreflightCheck() error
- func (a *API) PublishImage(imageID string) error
- func (a *API) PutObjectAcl(bucket, path, policy string) error
- func (a *API) RemoveImage(name, s3BucketName, s3ObjectPath string) error
- func (a *API) TerminateInstances(ids []string) error
- func (a *API) UpdateBucketObjectsACL(srcBucket, prefix, policy string) error
- func (a *API) UploadObject(r io.Reader, bucket, path string, force bool) error
- func (a *API) UploadObjectExt(r io.Reader, bucket, path string, force bool, policy string, ...) error
- type EC2ImageFormat
- type ImageData
- type Options
- type RegionKind
- type Snapshot
Constants ¶
const ContainerLinuxDiskSizeGiB = 8
The default size of Container Linux disks on AWS, in GiB. See discussion in https://github.com/coreos/mantle/pull/944
const (
// ContentTypeJSON is canonical content-type for JSON objects
ContentTypeJSON = "application/json"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new AWS API wrapper. It uses credentials from any of the standard credentials sources, including the environment and the profile configured in ~/.aws. No validation is done that credentials exist and before using the API a preflight check is recommended via api.PreflightCheck Note that this method may modify Options to update the AMI ID
func (*API) CopyBucket ¶
Copies all objects in srcBucket to destBucket with a given canned ACL policy
func (*API) CopyObject ¶
Copy an Object to a new location with a given canned ACL policy
func (*API) CreateHVMImage ¶
func (*API) CreateImportRole ¶
func (*API) CreateInstances ¶
func (a *API) CreateInstances(name, keyname, userdata string, count uint64, minDiskSize int64, useInstanceProfile bool) ([]*ec2.Instance, error)
CreateInstances creates EC2 instances with a given name tag, optional ssh key name, user data. The image ID, instance type, and security group set in the API will be used. CreateInstances will block until all instances are running and have an IP address.
func (*API) CreateSnapshot ¶
func (a *API) CreateSnapshot(imageName, sourceURL string, format EC2ImageFormat) (*Snapshot, error)
CreateSnapshot creates an AWS Snapshot
func (*API) DeleteObject ¶
func (*API) DownloadFile ¶
Downloads a file from S3 to a temporary file. This file must be closed by the caller.
func (*API) FindSnapshot ¶
Look up a Snapshot by name. Return nil if not found.
func (*API) GC ¶
GC removes AWS resources that are at least gracePeriod old. It attempts to only operate on resources that were created by a mantle tool.
func (*API) GetConsoleOutput ¶
GetConsoleOutput returns the console output. Returns "", nil if no logs are available.
func (*API) GetZonesForInstanceType ¶
GetZonesForInstanceType returns all available zones that offer the given instance type. This is useful because not all availability zones offer all instances types.
func (*API) GrantLaunchPermission ¶
func (*API) GrantVolumePermission ¶
GrantVolumePermission grants permission to access an EC2 snapshot volume (referenced by its snapshot ID) to a list of AWS users (referenced by their 12-digit numerical user IDs).
func (*API) InitializeBucket ¶
func (*API) ListRegions ¶
func (a *API) ListRegions(kind RegionKind) ([]string, error)
ListRegions lists the enabled regions in the AWS partition specified implicitly by the CredentialsFile, Profile, and Region options.
func (*API) PreflightCheck ¶
PreflightCheck validates that the aws configuration provided has valid credentials
func (*API) PublishImage ¶
Grant everyone launch permission on the specified image and create-volume permission on its underlying snapshot.
func (*API) PutObjectAcl ¶
This will modify the ACL on Objects to one of the canned ACL policies
func (*API) RemoveImage ¶
Remove all uploaded data associated with an AMI.
func (*API) TerminateInstances ¶
TerminateInstances schedules EC2 instances to be terminated.
func (*API) UpdateBucketObjectsACL ¶
TODO: bikeshed this name modifies the ACL of all objects of a given prefix in srcBucket to a given canned ACL policy
func (*API) UploadObject ¶
UploadObject uploads an object to S3
type EC2ImageFormat ¶
type EC2ImageFormat string
const ( EC2ImageFormatRaw EC2ImageFormat = ec2.DiskImageFormatRaw EC2ImageFormatVmdk EC2ImageFormat = ec2.DiskImageFormatVmdk )
func (*EC2ImageFormat) Set ¶
func (e *EC2ImageFormat) Set(s string) error
func (*EC2ImageFormat) String ¶
func (e *EC2ImageFormat) String() string
func (*EC2ImageFormat) Type ¶
func (e *EC2ImageFormat) Type() string
type Options ¶
type Options struct { *platform.Options // The AWS region regional api calls should use Region string // The path to the shared credentials file, if not ~/.aws/credentials CredentialsFile string // The profile to use when resolving credentials, if applicable Profile string // AccessKeyID is the optional access key to use. It will override all other sources AccessKeyID string // SecretKey is the optional secret key to use. It will override all other sources SecretKey string // AMI is the AWS AMI to launch EC2 instances with. // If it is one of the special strings alpha|beta|stable, it will be resolved // to an actual ID. AMI string InstanceType string SecurityGroup string IAMInstanceProfile string }
type RegionKind ¶
type RegionKind int
const ( RegionEnabled RegionKind = iota RegionDisabled RegionAny )