ec2

package
v3.0.0-...-24fc1ec Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: LGPL-3.0 Imports: 14 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountAttribute

type AccountAttribute struct {
	Name   string   `xml:"attributeName"`
	Values []string `xml:"attributeValueSet>item>attributeValue"`
}

AccountAttribute holds information about an account attribute.

See http://goo.gl/hBc28j for more details.

type AccountAttributesResp

type AccountAttributesResp struct {
	RequestId  string             `xml:"requestId"`
	Attributes []AccountAttribute `xml:"accountAttributeSet>item"`
}

AccountAttributesResp is the response to an AccountAttributes request.

See http://goo.gl/hBc28j for more details.

type AttachNetworkInterfaceResp

type AttachNetworkInterfaceResp struct {
	RequestId    string `xml:"requestId"`
	AttachmentId string `xml:"attachmentId"`
}

AttachNetworkInterfaceResp is the response to an AttachNetworkInterface request.

See http://goo.gl/rEbSii for more details.

type AvailabilityZone

type AvailabilityZone struct {
	Name   string `xml:"zoneName"`
	Region string `xml:"regionName"`
}

AvailabilityZone represents an EC2 availability zone.

type AvailabilityZoneInfo

type AvailabilityZoneInfo struct {
	AvailabilityZone
	State      string   `xml:"zoneState"`
	MessageSet []string `xml:"messageSet>item"`
}

AvailabilityZoneInfo encapsulates details for an availability zone in EC2.

type AvailabilityZonesResp

type AvailabilityZonesResp struct {
	RequestId string                 `xml:"requestId"`
	Zones     []AvailabilityZoneInfo `xml:"availabilityZoneInfo>item"`
}

AvailabilityZonesResp represents a response to a DescribeAvailabilityZones request in EC2.

type BlockDeviceMapping

type BlockDeviceMapping struct {
	DeviceName          string `xml:"deviceName"`
	VirtualName         string `xml:"virtualName"`
	SnapshotId          string `xml:"ebs>snapshotId"`
	VolumeType          string `xml:"ebs>volumeType"`
	VolumeSize          int64  `xml:"ebs>volumeSize"` // Size is given in GB
	DeleteOnTermination bool   `xml:"ebs>deleteOnTermination"`

	// The number of I/O operations per second (IOPS) that the volume supports.
	IOPS int64 `xml:"ebs>iops"`
}

BlockDeviceMapping represents the association of a block device with an image.

See http://goo.gl/wnDBf for more details.

type CreateNetworkInterface

type CreateNetworkInterface struct {
	SubnetId                string
	PrivateIPs              []PrivateIP
	SecondaryPrivateIPCount int
	Description             string
	SecurityGroupIds        []string
}

CreateNetworkInterface encapsulates options for the CreateNetworkInterface call.

SubnetId is the only required field.

One or more private IP addresses can be specified by using the PrivateIPs slice. Only one provided PrivateIP may be set as primary.

If PrivateIPs is empty, EC2 selects a primary private IP from the subnet range.

When SecondaryPrivateIPCount is non-zero, EC2 allocates that number of IP addresses from within the subnet range. The number of IP addresses you can assign to a network interface varies by instance type.

type CreateNetworkInterfaceResp

type CreateNetworkInterfaceResp struct {
	RequestId        string           `xml:"requestId"`
	NetworkInterface NetworkInterface `xml:"networkInterface"`
}

CreateNetworkInterfaceResp is the response to a CreateNetworkInterface request.

See http://goo.gl/ze3VhA for more details.

type CreateSecurityGroupResp

type CreateSecurityGroupResp struct {
	SecurityGroup
	RequestId string `xml:"requestId"`
}

CreateSecurityGroupResp represents a response to a CreateSecurityGroup request.

type CreateSnapshotResp

type CreateSnapshotResp struct {
	RequestId string `xml:"requestId"`
	Snapshot
}

Response to a CreateSnapshot request.

See http://goo.gl/ttcda for more details.

type CreateSubnetResp

type CreateSubnetResp struct {
	RequestId string `xml:"requestId"`
	Subnet    Subnet `xml:"subnet"`
}

CreateSubnetResp is the response to a CreateSubnet request.

See http://goo.gl/wLPhfI for more details.

type CreateVPCResp

type CreateVPCResp struct {
	RequestId string `xml:"requestId"`
	VPC       VPC    `xml:"vpc"`
}

CreateVPCResp is the response to a CreateVPC request.

See http://goo.gl/nkwjvN for more details.

type CreateVolume

type CreateVolume struct {
	AvailZone  string
	SnapshotId string
	VolumeType string
	VolumeSize int // Size is given in GB
	Encrypted  bool

	// The number of I/O operations per second (IOPS) that the volume supports.
	IOPS int64
}

The CreateVolume type encapsulates options for the respective request in EC2.

See http://goo.gl/uXCf9F for more details.

type CreateVolumeResp

type CreateVolumeResp struct {
	RequestId string `xml:"requestId"`
	Volume
}

CreateVolumeResp is the response to a CreateVolume request.

See http://goo.gl/uXCf9F for more details.

type EC2

type EC2 struct {
	aws.Auth
	aws.Region
	Sign aws.Signer
	// contains filtered or unexported fields
}

The EC2 type encapsulates operations with a specific EC2 region.

func New

func New(auth aws.Auth, region aws.Region, signer aws.Signer) *EC2

New creates a new EC2.

func (*EC2) AccountAttributes

func (ec2 *EC2) AccountAttributes(attrNames ...string) (*AccountAttributesResp, error)

AccountAttributes returns the values of one or more account attributes.

See http://goo.gl/hBc28j for more details.

func (*EC2) AssignPrivateIPAddresses

func (ec2 *EC2) AssignPrivateIPAddresses(interfaceId string, ipAddresses []string, secondaryIPCount int, allowReassignment bool) (resp *SimpleResp, err error)

AssignPrivateIPAddresses assigns secondary IP addresses to the network interface interfaceId.

If secondaryIPCount is non-zero, ipAddresses must be nil, and the specified number of secondary IP addresses will be allocated within the subnet's CIDR block range.

allowReassignment specifies whether to allow reassignment of addresses currently assigned to a different network interface.

See http://goo.gl/MoeH0L more details.

func (*EC2) AttachNetworkInterface

func (ec2 *EC2) AttachNetworkInterface(interfaceId, instanceId string, deviceIndex int) (resp *AttachNetworkInterfaceResp, err error)

AttachNetworkInterface attaches a network interface to an instance.

See http://goo.gl/rEbSii for more details.

func (*EC2) AttachVolume

func (ec2 *EC2) AttachVolume(volumeId, instanceId, device string) (resp *VolumeAttachmentResp, err error)

See http://goo.gl/oESpiF for more details.

func (*EC2) AuthorizeSecurityGroup

func (ec2 *EC2) AuthorizeSecurityGroup(group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error)

AuthorizeSecurityGroup creates an allowance for clients matching the provided rules to access instances within the given security group.

See http://goo.gl/u2sDJ for more details.

func (*EC2) AvailabilityZones

func (ec2 *EC2) AvailabilityZones(filter *Filter) (resp *AvailabilityZonesResp, err error)

AvailabilityZones returns details about availability zones in EC2. The filter parameter is optional, and if provided will limit the availability zones returned to those matching the given filtering rules.

See http://goo.gl/ylxT4R for more details.

func (*EC2) CreateNetworkInterface

func (ec2 *EC2) CreateNetworkInterface(opts CreateNetworkInterface) (resp *CreateNetworkInterfaceResp, err error)

CreateNetworkInterface creates a network interface in the specified subnet.

See http://goo.gl/ze3VhA for more details.

func (*EC2) CreateSecurityGroup

func (ec2 *EC2) CreateSecurityGroup(vpcId, name, description string) (resp *CreateSecurityGroupResp, err error)

CreateSecurityGroup creates a security group with the provided name and description. The vpcId argument can be empty to create a EC2-Classic group, instead of EC2-VPC one.

See http://goo.gl/Eo7Yl for more details.

func (*EC2) CreateSnapshot

func (ec2 *EC2) CreateSnapshot(volumeId, description string) (resp *CreateSnapshotResp, err error)

CreateSnapshot creates a volume snapshot and stores it in S3.

See http://goo.gl/ttcda for more details.

func (*EC2) CreateSubnet

func (ec2 *EC2) CreateSubnet(vpcId, cidrBlock, availZone string) (resp *CreateSubnetResp, err error)

CreateSubnet creates a subnet in an existing VPC.

The vpcId and cidrBlock parameters specify the VPC id and CIDR block respectively - these cannot be changed after creation. The subnet's CIDR block can be the same as the VPC's CIDR block (assuming a single subnet is wanted), or a subset of the VPC's CIDR block. If more than one subnet is created in a VPC, their CIDR blocks must not overlap. The smallest subnet (and VPC) that can be created uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses).

availZone may be empty, an availability zone is automatically selected.

See http://goo.gl/wLPhfI for more details.

func (*EC2) CreateTags

func (ec2 *EC2) CreateTags(instIds []string, tags []Tag) (resp *SimpleResp, err error)

CreateTags adds or overwrites one or more tags for the specified instance ids.

See http://goo.gl/Vmkqc for more details

func (*EC2) CreateVPC

func (ec2 *EC2) CreateVPC(CIDRBlock, instanceTenancy string) (resp *CreateVPCResp, err error)

CreateVPC creates a VPC with the specified CIDR block.

The smallest VPC that can be created uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses).

The instanceTenancy value holds the tenancy options for instances launched into the VPC - either "default" or "dedicated".

See http://goo.gl/nkwjvN for more details.

func (*EC2) CreateVolume

func (ec2 *EC2) CreateVolume(volume CreateVolume) (resp *CreateVolumeResp, err error)

CreateVolume creates a subnet in an existing VPC.

See http://goo.gl/uXCf9F for more details.

func (*EC2) DeleteNetworkInterface

func (ec2 *EC2) DeleteNetworkInterface(id string) (resp *SimpleResp, err error)

DeleteNetworkInterface deletes the specified network interface, which must have been previously detached.

See http://goo.gl/MC1yOj for more details.

func (*EC2) DeleteSecurityGroup

func (ec2 *EC2) DeleteSecurityGroup(group SecurityGroup) (resp *SimpleResp, err error)

DeleteSecurityGroup removes the given security group in EC2.

See http://goo.gl/QJJDO for more details.

func (*EC2) DeleteSnapshots

func (ec2 *EC2) DeleteSnapshots(ids []string) (resp *SimpleResp, err error)

DeleteSnapshots deletes the volume snapshots with the given ids.

Note: If you make periodic snapshots of a volume, the snapshots are incremental so that only the blocks on the device that have changed since your last snapshot are incrementally saved in the new snapshot. Even though snapshots are saved incrementally, the snapshot deletion process is designed so that you need to retain only the most recent snapshot in order to restore the volume.

See http://goo.gl/vwU1y for more details.

func (*EC2) DeleteSubnet

func (ec2 *EC2) DeleteSubnet(id string) (resp *SimpleResp, err error)

DeleteSubnet deletes the specified subnet. All running instances in the subnet must have been terminated.

See http://goo.gl/KmhcBM for more details.

func (*EC2) DeleteVPC

func (ec2 *EC2) DeleteVPC(id string) (resp *SimpleResp, err error)

DeleteVPC deletes the VPC with the specified id. All gateways and resources that are associated with the VPC must have been previously deleted, including instances running in the VPC, and non-default security groups and route tables associated with the VPC.

See http://goo.gl/bcxtbf for more details.

func (*EC2) DeleteVolume

func (ec2 *EC2) DeleteVolume(id string) (resp *SimpleResp, err error)

See http://goo.gl/AM46X0 for more details.

func (*EC2) DetachNetworkInterface

func (ec2 *EC2) DetachNetworkInterface(attachmentId string, force bool) (resp *SimpleResp, err error)

DetachNetworkInterface detaches a network interface from an instance.

See http://goo.gl/0Xc1px for more details.

func (*EC2) DetachVolume

func (ec2 *EC2) DetachVolume(volumeId, instanceId, device string, force bool) (resp *VolumeAttachmentResp, err error)

See http://goo.gl/22mwZP for more details.

func (*EC2) Images

func (ec2 *EC2) Images(ids []string, filter *Filter) (resp *ImagesResp, err error)

Images returns details about available images. The ids and filter parameters, if provided, will limit the images returned. For example, to get all the private images associated with this account set the boolean filter "is-private" to true.

Note: calling this function with nil ids and filter parameters will result in a very large number of images being returned.

See http://goo.gl/SRBhW for more details.

func (*EC2) Instances

func (ec2 *EC2) Instances(instIds []string, filter *Filter) (resp *InstancesResp, err error)

Instances returns details about instances in EC2. Both parameters are optional, and if provided will limit the instances returned to those matching the given instance ids or filtering rules.

See http://goo.gl/4No7c for more details.

func (*EC2) InternetGateways

func (ec2 *EC2) InternetGateways(ids []string, filter *Filter) (resp *InternetGatewaysResp, err error)

InternetGateways describes one or more Internet Gateways (IGWs). Both parameters are optional, and if specified will limit the returned IGWs to the matching ids or filtering rules.

See http://goo.gl/syjv2p for more details.

func (*EC2) ModifyInstanceAttribute

func (ec2 *EC2) ModifyInstanceAttribute(req *ModifyInstanceAttribute, filter *Filter) (resp *SimpleResp, err error)

ModifyInstanceAttribute modifies a single attribute of an instance in EC2.

See http://goo.gl/cTxLa7 for more details.

func (*EC2) ModifySubnetAttribute

func (ec2 *EC2) ModifySubnetAttribute(id, attrName, attrValue string) (resp *SimpleResp, err error)

ModifySubnetAttribute modifies an attribute of an existing subnet. The only supported attribute is the "MapPublicIpOnLaunch" flag, which is true by default for default subnets (of the default VPC) and false for non-default subnets. When set to "true", the flag causes new instances launched into the subnet, and having a single network interface with device index 0, to receive an automatic public IP address mapped to the instance's primary private IP address.

See http://goo.gl/jNNAJe for more details.

func (*EC2) NetworkInterfaces

func (ec2 *EC2) NetworkInterfaces(ids []string, filter *Filter) (resp *NetworkInterfacesResp, err error)

NetworkInterfaces returns a list of network interfaces.

If the ids or filter parameters are provided, only matching interfaces are returned.

See http://goo.gl/2LcXtM for more details.

func (*EC2) RebootInstances

func (ec2 *EC2) RebootInstances(ids ...string) (resp *SimpleResp, err error)

RebootInstance requests a reboot of one or more instances. This operation is asynchronous; it only queues a request to reboot the specified instance(s). The operation will succeed if the instances are valid and belong to you.

Requests to reboot terminated instances are ignored.

See http://goo.gl/baoUf for more details.

func (*EC2) RevokeSecurityGroup

func (ec2 *EC2) RevokeSecurityGroup(group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error)

RevokeSecurityGroup revokes permissions from a group.

See http://goo.gl/ZgdxA for more details.

func (*EC2) RouteTables

func (ec2 *EC2) RouteTables(ids []string, filter *Filter) (resp *RouteTablesResp, err error)

RouteTables describes one or more route tables. Both parameters are optional, and if specified will limit the returned tables to the matching ids or filtering rules.

See http://goo.gl/1JZIfO for more details.

func (*EC2) RunInstances

func (ec2 *EC2) RunInstances(options *RunInstances) (resp *RunInstancesResp, err error)

RunInstances starts new instances in EC2. If options.MinCount and options.MaxCount are both zero, a single instance will be started; otherwise if options.MaxCount is zero, options.MinCount will be used instead.

See http://goo.gl/Mcm3b for more details.

func (*EC2) SecurityGroups

func (ec2 *EC2) SecurityGroups(groups []SecurityGroup, filter *Filter) (resp *SecurityGroupsResp, err error)

SecurityGroups returns details about security groups in EC2. Both parameters are optional, and if provided will limit the security groups returned to those matching the given groups or filtering rules.

See http://goo.gl/k12Uy for more details.

func (*EC2) Snapshots

func (ec2 *EC2) Snapshots(ids []string, filter *Filter) (resp *SnapshotsResp, err error)

Snapshots returns details about volume snapshots available to the user. The ids and filter parameters, if provided, limit the snapshots returned.

See http://goo.gl/ogJL4 for more details.

func (*EC2) StartInstances

func (ec2 *EC2) StartInstances(ids ...string) (resp *StartInstanceResp, err error)

StartInstances starts an Amazon EBS-backed AMI that you've previously stopped.

See http://goo.gl/awKeF for more details.

func (*EC2) StopInstances

func (ec2 *EC2) StopInstances(ids ...string) (resp *StopInstanceResp, err error)

StopInstances requests stopping one or more Amazon EBS-backed instances.

See http://goo.gl/436dJ for more details.

func (*EC2) Subnets

func (ec2 *EC2) Subnets(ids []string, filter *Filter) (resp *SubnetsResp, err error)

Subnets returns one or more subnets. Both parameters are optional, and if specified will limit the returned subnets to the matching ids or filtering rules.

See http://goo.gl/NTKQVI for more details.

func (*EC2) TerminateInstances

func (ec2 *EC2) TerminateInstances(instIds []string) (resp *TerminateInstancesResp, err error)

TerminateInstances requests the termination of instances when the given ids.

See http://goo.gl/3BKHj for more details.

func (*EC2) UnassignPrivateIPAddresses

func (ec2 *EC2) UnassignPrivateIPAddresses(interfaceId string, ipAddresses []string) (resp *SimpleResp, err error)

UnassignPrivateIPAddresses unassigns one or more secondary private IP addresses from a network interface.

See http://goo.gl/RjGZdB for more details.

func (*EC2) VPCs

func (ec2 *EC2) VPCs(ids []string, filter *Filter) (resp *VPCsResp, err error)

VPCs describes one or more VPCs. Both parameters are optional, and if specified will limit the returned VPCs to the matching ids or filtering rules.

See http://goo.gl/Y5kHqG for more details.

func (*EC2) Volumes

func (ec2 *EC2) Volumes(ids []string, filter *Filter) (resp *VolumesResp, err error)

Volumes returns one or more volumes. Both parameters are optional, and if specified will limit the returned volumes to the matching ids or filtering rules.

See http://goo.gl/cZCJM4 for more details.

type Error

type Error struct {
	// HTTP status code (200, 403, ...)
	StatusCode int
	// EC2 error code ("UnsupportedOperation", ...)
	Code string
	// The human-oriented error message
	Message   string
	RequestId string `xml:"RequestID"`
}

Error encapsulates an error returned by EC2.

See http://goo.gl/VZGuC for more details.

func (*Error) Error

func (err *Error) Error() string

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter builds filtering parameters to be used in an EC2 query which supports filtering. For example:

filter := NewFilter()
filter.Add("architecture", "i386")
filter.Add("launch-index", "0")
resp, err := ec2.Instances(nil, filter)

func NewFilter

func NewFilter() *Filter

NewFilter creates a new Filter.

func (*Filter) Add

func (f *Filter) Add(name string, value ...string)

Add appends a filtering parameter with the given name and value(s).

type IPAssociation

type IPAssociation struct {
	PublicIP      string `xml:"publicIp"`
	PublicDNSName string `xml:"publicDnsName"`
	IPOwnerId     string `xml:"ipOwnerId"`
}

IPAssociation describes association information for an Elastic IP address. See http://goo.gl/YCDdMe for more details

type IPPerm

type IPPerm struct {
	Protocol      string              `xml:"ipProtocol"`
	FromPort      int                 `xml:"fromPort"`
	ToPort        int                 `xml:"toPort"`
	SourceIPs     []string            `xml:"ipRanges>item>cidrIp"`
	SourceIPV6IPs []string            `xml:"ipv6Ranges>item>cidrIpv6"`
	SourceGroups  []UserSecurityGroup `xml:"groups>item"`
}

IPPerm represents an allowance within an EC2 security group.

See http://goo.gl/4oTxv for more details.

type Image

type Image struct {
	Id                 string               `xml:"imageId"`
	Name               string               `xml:"name"`
	Description        string               `xml:"description"`
	Type               string               `xml:"imageType"`
	State              string               `xml:"imageState"`
	Location           string               `xml:"imageLocation"`
	Public             bool                 `xml:"isPublic"`
	Architecture       string               `xml:"architecture"`
	Platform           string               `xml:"platform"`
	ProductCodes       []string             `xml:"productCode>item>productCode"`
	KernelId           string               `xml:"kernelId"`
	RamdiskId          string               `xml:"ramdiskId"`
	StateReason        string               `xml:"stateReason"`
	OwnerId            string               `xml:"imageOwnerId"`
	OwnerAlias         string               `xml:"imageOwnerAlias"`
	RootDeviceType     string               `xml:"rootDeviceType"`
	RootDeviceName     string               `xml:"rootDeviceName"`
	VirtualizationType string               `xml:"virtualizationType"`
	Hypervisor         string               `xml:"hypervisor"`
	SRIOVNetSupport    bool                 `xml:"sriovNetSupport,omitempty"`
	BlockDevices       []BlockDeviceMapping `xml:"blockDeviceMapping>item"`
}

Image represents details about an image.

See http://goo.gl/iSqJG for more details.

type ImagesResp

type ImagesResp struct {
	RequestId string  `xml:"requestId"`
	Images    []Image `xml:"imagesSet>item"`
}

Response to a DescribeImages request.

See http://goo.gl/hLnyg for more details.

type Instance

type Instance struct {
	InstanceId          string                       `xml:"instanceId"`
	InstanceType        string                       `xml:"instanceType"`
	ImageId             string                       `xml:"imageId"`
	IAMInstanceProfile  string                       `xml:"iamInstanceProfile>id"`
	PrivateDNSName      string                       `xml:"privateDnsName"`
	DNSName             string                       `xml:"dnsName"`
	IPAddress           string                       `xml:"ipAddress"`
	PrivateIPAddress    string                       `xml:"privateIpAddress"`
	SubnetId            string                       `xml:"subnetId"`
	VPCId               string                       `xml:"vpcId"`
	SourceDestCheck     bool                         `xml:"sourceDestCheck"`
	KeyName             string                       `xml:"keyName"`
	AMILaunchIndex      int                          `xml:"amiLaunchIndex"`
	Hypervisor          string                       `xml:"hypervisor"`
	VirtType            string                       `xml:"virtualizationType"`
	Monitoring          string                       `xml:"monitoring>state"`
	AvailZone           string                       `xml:"placement>availabilityZone"`
	AssociatePublicIP   bool                         `xml:"associatePublicIpAddress,omitempty"`
	PlacementGroupName  string                       `xml:"placement>groupName"`
	EBSOptimized        bool                         `xml:"ebsOptimized,omitempty"`
	SRIOVNetSupport     bool                         `xml:"sriovNetSupport,omitempty"`
	State               InstanceState                `xml:"instanceState"`
	Tags                []Tag                        `xml:"tagSet>item"`
	SecurityGroups      []SecurityGroup              `xml:"groupSet>item"`
	NetworkInterfaces   []NetworkInterface           `xml:"networkInterfaceSet>item"`
	BlockDeviceMappings []InstanceBlockDeviceMapping `xml:"blockDeviceMapping>item"`
	RootDeviceType      string                       `xml:"rootDeviceType"`
	RootDeviceName      string                       `xml:"rootDeviceName"`
}

Instance encapsulates a running instance in EC2.

See http://goo.gl/OCH8a for more details.

type InstanceBlockDeviceMapping

type InstanceBlockDeviceMapping struct {
	DeviceName          string `xml:"deviceName"`
	AttachTime          string `xml:"ebs>attachTime"`
	DeleteOnTermination bool   `xml:"ebs>deleteOnTermination"`
	Status              string `xml:"ebs>status"`
	VolumeId            string `xml:"ebs>volumeId"`
}

InstanceBlockDeviceMapping describes a block device mapping.

See http://goo.gl/Ua0BIw for more details.

type InstanceState

type InstanceState struct {
	Code int    `xml:"code"` // Watch out, bits 15-8 have unpublished meaning.
	Name string `xml:"name"`
}

InstanceState encapsulates the state of an instance in EC2.

See http://goo.gl/y3ZBq for more details.

type InstanceStateChange

type InstanceStateChange struct {
	InstanceId    string        `xml:"instanceId"`
	CurrentState  InstanceState `xml:"currentState"`
	PreviousState InstanceState `xml:"previousState"`
}

InstanceStateChange informs of the previous and current states for an instance when a state change is requested.

type InstancesResp

type InstancesResp struct {
	RequestId    string        `xml:"requestId"`
	Reservations []Reservation `xml:"reservationSet>item"`
}

Response to a DescribeInstances request.

See http://goo.gl/mLbmw for more details.

type InternetGateway

type InternetGateway struct {
	// Id is the id of the Internet Gateway (IGW).
	Id string `xml:"internetGatewayId"`

	// VPCId is the id of the VPC this IGW is attached to.
	// An IGW can be attached to only one VPC at a time.
	// Source: http://goo.gl/6ycqAx (Amazon VPC Limits).
	VPCId string `xml:"attachmentSet>item>vpcId"`

	// AttachmentState is the current state of the attachment.
	// Valid values: attaching | attached | detaching | detached
	AttachmentState string `xml:"attachmentSet>item>state"`

	// Tags holds any tags associated with the IGW.
	Tags []Tag `xml:"tagSet>item"`
}

InternetGateway describes a VPC Internet Gateway.

See http://goo.gl/OC1hcA for more details.

type InternetGatewaysResp

type InternetGatewaysResp struct {
	RequestId        string            `xml:"requestId"`
	InternetGateways []InternetGateway `xml:"internetGatewaySet>item"`
}

InternetGatewaysResp is the response to a InternetGateways request.

See http://goo.gl/syjv2p for more details.

type ModifyInstanceAttribute

type ModifyInstanceAttribute struct {
	InstanceId          string
	SourceDestCheck     *bool
	BlockDeviceMappings []InstanceBlockDeviceMapping
}

The ModifyInstanceAttribute type encapsulates options for the respective request in EC2.

See http://goo.gl/cTxLa7 for more details.

type NetworkInterface

type NetworkInterface struct {
	Id               string                     `xml:"networkInterfaceId"`
	SubnetId         string                     `xml:"subnetId"`
	VPCId            string                     `xml:"vpcId"`
	AvailZone        string                     `xml:"availabilityZone"`
	Description      string                     `xml:"description"`
	OwnerId          string                     `xml:"ownerId"`
	RequesterId      string                     `xml:"requesterId"`
	RequesterManaged bool                       `xml:"requesterManaged"`
	Status           string                     `xml:"status"`
	MACAddress       string                     `xml:"macAddress"`
	PrivateIPAddress string                     `xml:"privateIpAddress"`
	PrivateDNSName   string                     `xml:"privateDnsName"`
	SourceDestCheck  bool                       `xml:"sourceDestCheck"`
	Groups           []SecurityGroup            `xml:"groupSet>item"`
	Attachment       NetworkInterfaceAttachment `xml:"attachment"`
	Tags             []Tag                      `xml:"tagSet>item"`
	PrivateIPs       []PrivateIP                `xml:"privateIpAddressesSet>item"`
}

NetworkInterface describes a network interface for VPC.

See http://goo.gl/G63OQL for more details.

type NetworkInterfaceAttachment

type NetworkInterfaceAttachment struct {
	Id                  string `xml:"attachmentId"`
	InstanceId          string `xml:"instanceId"`
	InstanceOwnerId     string `xml:"instanceOwnerId"`
	DeviceIndex         int    `xml:"deviceIndex"`
	Status              string `xml:"status"`
	AttachTime          string `xml:"attachTime"`
	DeleteOnTermination bool   `xml:"deleteOnTermination"`
}

NetworkInterfaceAttachment describes a network interface attachment.

See http://goo.gl/KtiKuV for more details.

type NetworkInterfacesResp

type NetworkInterfacesResp struct {
	RequestId  string             `xml:"requestId"`
	Interfaces []NetworkInterface `xml:"networkInterfaceSet>item"`
}

NetworkInterfacesResp is the response to a NetworkInterfaces request.

See http://goo.gl/2LcXtM for more details.

type PrivateIP

type PrivateIP struct {
	Address     string        `xml:"privateIpAddress"`
	DNSName     string        `xml:"privateDnsName"`
	IsPrimary   bool          `xml:"primary"`
	Association IPAssociation `xml:"association"`
}

PrivateIP describes a private IP address of a network interface.

See http://goo.gl/jtuQEJ for more details.

type Reservation

type Reservation struct {
	ReservationId  string          `xml:"reservationId"`
	OwnerId        string          `xml:"ownerId"`
	RequesterId    string          `xml:"requesterId"`
	SecurityGroups []SecurityGroup `xml:"groupSet>item"`
	Instances      []Instance      `xml:"instancesSet>item"`
}

Reservation represents details about a reservation in EC2.

See http://goo.gl/0ItPT for more details.

type Route

type Route struct {
	// DestinationCIDRBlock is used for destination matching.
	DestinationCIDRBlock string `xml:"destinationCidrBlock"`

	// DestinationPrefixListId is the prefix of the AWS service.
	DestinationPrefixListId string `xml:"destinationPrefixListId"`

	// GatewayId is the id of an Internet Gateway attached to the VPC.
	GatewayId string `xml:"gatewayId"`

	// InstanceId is the id of a NAT instance in the VPC.
	InstanceId string `xml:"instanceId"`

	// InstanceOwnerId is the AWS account id of the NAT instance
	// owner.
	InstanceOwnerId string `xml:"instanceOwnerId"`

	// InterfaceId is the id of the used Network Interface.
	InterfaceId string `xml:"networkInterfaceId"`

	// Origin describes how the route was created.
	// Values: CreateRouteTable | CreateRoute | EnableVgwRoutePropagation
	Origin string `xml:"origin"`

	// State is the state of the route. The blackhole state indicates
	// the route target isn't available (e.g. IGW isn't attached or
	// NAT instance not found).
	State string `xml:"state"`

	// VPCPeeringConnectionId is the id of the VPC peering connection.
	VPCPeeringConnectionId string `xml:"vpcPeeringConnectionId"`
}

Route describes a single route in a route table.

See http://goo.gl/GlW6ii for more details.

type RouteTable

type RouteTable struct {
	// Id is the id of the Internet Gateway (IGW).
	Id string `xml:"routeTableId"`

	// VPCId is the id of the VPC this route table is attached to.
	VPCId string `xml:"vpcId"`

	// Associations holds associations between the route table and one
	// or more subnets.
	Associations []RouteTableAssociation `xml:"associationSet>item"`

	// Routes holds all route table routes.
	Routes []Route `xml:"routeSet>item"`

	// Tags holds any tags associated with the IGW.
	Tags []Tag `xml:"tagSet>item"`

	// PropagatingVGWIds holds a list of ids of propagating virtual
	// private gateways.
	PropagatingVGWIds []string `xml:"propagatingVgws>gatewayId"`
}

RouteTable describes a VPC route table.

See http://goo.gl/h0bwYw for more details.

type RouteTableAssociation

type RouteTableAssociation struct {
	// Id is the route table association id.
	Id string `xml:"routeTableAssociationId"`

	// TableId is the route table id for this association.
	TableId string `xml:"routeTableId"`

	// SubnetId is the subnet id (only when explicitly associated).
	SubnetId string `xml:"subnetId"`

	// IsMain indicates whether this is the main route table.
	IsMain bool `xml:"main"`
}

RouteTableAssociation describes an association between a route table and a subnet.

See http://goo.gl/ZgrG5j for more details.

type RouteTablesResp

type RouteTablesResp struct {
	RequestId string       `xml:"requestId"`
	Tables    []RouteTable `xml:"routeTableSet>item"`
}

RouteTablesResp is the response to a RouteTables request.

See http://goo.gl/1JZIfO for more details.

type RunInstances

type RunInstances struct {
	ImageId               string
	MinCount              int
	MaxCount              int
	KeyName               string
	InstanceType          string
	SecurityGroups        []SecurityGroup
	KernelId              string
	RamdiskId             string
	UserData              []byte
	AvailZone             string
	PlacementGroupName    string
	Monitoring            bool
	SubnetId              string
	DisableAPITermination bool
	ShutdownBehavior      string
	PrivateIPAddress      string
	IAMInstanceProfile    string
	BlockDeviceMappings   []BlockDeviceMapping
	NetworkInterfaces     []RunNetworkInterface
	EBSOptimized          bool
}

The RunInstances type encapsulates options for the respective request in EC2.

See http://goo.gl/Mcm3b for more details.

type RunInstancesResp

type RunInstancesResp struct {
	RequestId      string          `xml:"requestId"`
	ReservationId  string          `xml:"reservationId"`
	OwnerId        string          `xml:"ownerId"`
	SecurityGroups []SecurityGroup `xml:"groupSet>item"`
	Instances      []Instance      `xml:"instancesSet>item"`
}

Response to a RunInstances request.

See http://goo.gl/Mcm3b for more details.

type RunNetworkInterface

type RunNetworkInterface struct {
	Id                      string
	DeviceIndex             int
	SubnetId                string
	Description             string
	PrivateIPs              []PrivateIP
	SecurityGroupIds        []string
	DeleteOnTermination     bool
	SecondaryPrivateIPCount int
}

RunNetworkInterface encapsulates options for a single network interface, specified when calling RunInstances.

If Id is set, it must match an existing VPC network interface, and in this case only a single instance can be launched. If Id is not set, a new network interface will be created for each instance.

The following fields are required when creating a new network interface (i.e. Id is empty): DeviceIndex, SubnetId, Description (only used if set), SecurityGroupIds.

PrivateIPs can be used to add one or more private IP addresses to a network interface. Only one of the IP addresses can be set as primary. If none are given, EC2 selects a primary IP for each created interface from the subnet pool.

When SecondaryPrivateIPCount is non-zero, EC2 allocates that number of IP addresses from within the subnet range and sets them as secondary IPs. The number of IP addresses that can be assigned to a network interface varies by instance type.

type SecurityGroup

type SecurityGroup struct {
	Id   string `xml:"groupId"`
	Name string `xml:"groupName"`
}

SecurityGroup represents an EC2 security group. If SecurityGroup is used as a parameter, then one of Id or Name may be empty. If both are set, then Id is used.

func SecurityGroupIds

func SecurityGroupIds(ids ...string) []SecurityGroup

SecurityGroupNames is a convenience function that returns a slice of security groups with the given ids.

func SecurityGroupNames

func SecurityGroupNames(names ...string) []SecurityGroup

SecurityGroupNames is a convenience function that returns a slice of security groups with the given names.

type SecurityGroupInfo

type SecurityGroupInfo struct {
	SecurityGroup
	VPCId       string   `xml:"vpcId"`
	OwnerId     string   `xml:"ownerId"`
	Description string   `xml:"groupDescription"`
	IPPerms     []IPPerm `xml:"ipPermissions>item"`
}

SecurityGroup encapsulates details for a security group in EC2.

See http://goo.gl/CIdyP for more details.

type SecurityGroupsResp

type SecurityGroupsResp struct {
	RequestId string              `xml:"requestId"`
	Groups    []SecurityGroupInfo `xml:"securityGroupInfo>item"`
}

SecurityGroupsResp represents a response to a DescribeSecurityGroups request in EC2.

See http://goo.gl/k12Uy for more details.

type SimpleResp

type SimpleResp struct {
	XMLName   xml.Name
	RequestId string `xml:"requestId"`
	Return    bool   `xml:"return"`
}

SimpleResp represents a response to an EC2 request which on success will return no other information besides a request id.

type Snapshot

type Snapshot struct {
	Id          string `xml:"snapshotId"`
	VolumeId    string `xml:"volumeId"`
	VolumeSize  string `xml:"volumeSize"`
	Status      string `xml:"status"`
	StartTime   string `xml:"startTime"`
	Description string `xml:"description"`
	Progress    string `xml:"progress"`
	OwnerId     string `xml:"ownerId"`
	OwnerAlias  string `xml:"ownerAlias"`
	Tags        []Tag  `xml:"tagSet>item"`
}

Snapshot represents details about a volume snapshot.

See http://goo.gl/nkovs for more details.

type SnapshotsResp

type SnapshotsResp struct {
	RequestId string     `xml:"requestId"`
	Snapshots []Snapshot `xml:"snapshotSet>item"`
}

Response to a DescribeSnapshots request.

See http://goo.gl/nClDT for more details.

type StartInstanceResp

type StartInstanceResp struct {
	RequestId    string                `xml:"requestId"`
	StateChanges []InstanceStateChange `xml:"instancesSet>item"`
}

Response to a StartInstances request.

See http://goo.gl/awKeF for more details.

type StopInstanceResp

type StopInstanceResp struct {
	RequestId    string                `xml:"requestId"`
	StateChanges []InstanceStateChange `xml:"instancesSet>item"`
}

Response to a StopInstances request.

See http://goo.gl/436dJ for more details.

type Subnet

type Subnet struct {
	Id                  string `xml:"subnetId"`
	State               string `xml:"state"`
	VPCId               string `xml:"vpcId"`
	CIDRBlock           string `xml:"cidrBlock"`
	AvailableIPCount    int    `xml:"availableIpAddressCount"`
	AvailZone           string `xml:"availabilityZone"`
	DefaultForAZ        bool   `xml:"defaultForAz"`
	MapPublicIPOnLaunch bool   `xml:"mapPublicIpOnLaunch"`
	Tags                []Tag  `xml:"tagSet>item"`
}

Subnet describes an Amazon VPC subnet.

See http://goo.gl/CdkvO2 for more details.

type SubnetsResp

type SubnetsResp struct {
	RequestId string   `xml:"requestId"`
	Subnets   []Subnet `xml:"subnetSet>item"`
}

SubnetsResp is the response to a Subnets request.

See http://goo.gl/NTKQVI for more details.

type Tag

type Tag struct {
	Key   string `xml:"key"`
	Value string `xml:"value"`
}

Tag represents key-value metadata used to classify and organize EC2 instances.

See http://goo.gl/bncl3 for more details

type TerminateInstancesResp

type TerminateInstancesResp struct {
	RequestId    string                `xml:"requestId"`
	StateChanges []InstanceStateChange `xml:"instancesSet>item"`
}

Response to a TerminateInstances request.

See http://goo.gl/3BKHj for more details.

type UserSecurityGroup

type UserSecurityGroup struct {
	Id      string `xml:"groupId"`
	Name    string `xml:"groupName,omitempty"`
	OwnerId string `xml:"userId"`
}

UserSecurityGroup holds a security group and the owner of that group.

type VPC

type VPC struct {
	Id              string `xml:"vpcId"`
	State           string `xml:"state"`
	CIDRBlock       string `xml:"cidrBlock"`
	DHCPOptionsId   string `xml:"dhcpOptionsId"`
	Tags            []Tag  `xml:"tagSet>item"`
	InstanceTenancy string `xml:"instanceTenancy"`
	IsDefault       bool   `xml:"isDefault"`
}

VPC describes a Virtual Private Cloud (VPC).

See http://goo.gl/Uy6ZLL for more details.

type VPCsResp

type VPCsResp struct {
	RequestId string `xml:"requestId"`
	VPCs      []VPC  `xml:"vpcSet>item"`
}

VPCsResp is the response to a VPCs request.

See http://goo.gl/Y5kHqG for more details.

type Volume

type Volume struct {
	Id          string             `xml:"volumeId"`
	Size        int                `xml:"size"`
	SnapshotId  string             `xml:"snapshotId"`
	Status      string             `xml:"status"`
	IOPS        int64              `xml:"iops"`
	AvailZone   string             `xml:"availabilityZone"`
	CreateTime  string             `xml:"createTime"`
	VolumeType  string             `xml:"volumeType"`
	Encrypted   bool               `xml:"encrypted"`
	Tags        []Tag              `xml:"tagSet>item"`
	Attachments []VolumeAttachment `xml:"attachmentSet>item"`
}

Volume describes an Amazon Volume.

See http://goo.gl/3jssTQ for more details.

type VolumeAttachment

type VolumeAttachment struct {
	VolumeId            string `xml:"volumeId"`
	Device              string `xml:"device"`
	InstanceId          string `xml:"instanceId"`
	Status              string `xml:"status"`
	DeleteOnTermination bool   `xml:"deleteOnTermination"`
}

VolumeAttachment describes an Amazon Volume Attachment.

See http://goo.gl/DLkRxx for more details.

type VolumeAttachmentResp

type VolumeAttachmentResp struct {
	RequestId  string `xml:"requestId"`
	VolumeId   string `xml:"volumeId"`
	Device     string `xml:"device"`
	InstanceId string `xml:"instanceId"`
	Status     string `xml:"status"`
	AttachTime string `xml:"attachTime"`
}

VolumeAttachmentResp is the response to a VolumeAttachment request (attach/delete).

See http://goo.gl/oESpiF for more details.

type VolumesResp

type VolumesResp struct {
	RequestId string   `xml:"requestId"`
	Volumes   []Volume `xml:"volumeSet>item"`
}

VolumesResp is the response to a Volumes request.

See http://goo.gl/NTKQVI for more details.

Directories

Path Synopsis
The ec2test package implements a fake EC2 provider with the capability of inducing errors on any given operation, and retrospectively determining what operations have been carried out.
The ec2test package implements a fake EC2 provider with the capability of inducing errors on any given operation, and retrospectively determining what operations have been carried out.

Jump to

Keyboard shortcuts

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