/vendors/aws-sdk/services/ec2.class.php
PHP | 3813 lines | 1107 code | 300 blank | 2406 comment | 168 complexity | 32edd84b329ffa27a9dc688554fe2534 MD5 | raw file
Possible License(s): BSD-3-Clause
Large files files are truncated, but you can click here to view the full file
- <?php
- /*
- * Copyright 2010 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
- /**
- * File: AmazonEC2
- * Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity
- * in the cloud. It is designed to make web-scale computing easier for developers.
- *
- * Amazon EC2's simple web service interface allows you to obtain and configure capacity with minimal
- * friction. It provides you with complete control of your computing resources and lets you run on
- * Amazon's proven computing environment. Amazon EC2 reduces the time required to obtain and boot new
- * server instances to minutes, allowing you to quickly scale capacity, both up and down, as your
- * computing requirements change. Amazon EC2 changes the economics of computing by allowing you to pay
- * only for capacity that you actually use. Amazon EC2 provides developers the tools to build failure
- * resilient applications and isolate themselves from common failure scenarios.
- *
- * Visit [http://aws.amazon.com/ec2/](http://aws.amazon.com/ec2/) for more information.
- *
- * Version:
- * Fri Dec 03 16:23:55 PST 2010
- *
- * License and Copyright:
- * See the included NOTICE.md file for complete information.
- *
- * See Also:
- * [Amazon Elastic Compute Cloud](http://aws.amazon.com/ec2/)
- * [Amazon Elastic Compute Cloud documentation](http://aws.amazon.com/documentation/ec2/)
- */
- /*%******************************************************************************************%*/
- // EXCEPTIONS
- /**
- * Exception: EC2_Exception
- * Default EC2 Exception.
- */
- class EC2_Exception extends Exception {}
- /*%******************************************************************************************%*/
- // MAIN CLASS
- /**
- * Class: AmazonEC2
- * Container for all service-related methods.
- */
- class AmazonEC2 extends CFRuntime
- {
- /*%******************************************************************************************%*/
- // CLASS CONSTANTS
- /**
- * Constant: DEFAULT_URL
- * Specify the default queue URL.
- */
- const DEFAULT_URL = 'ec2.amazonaws.com';
- /**
- * Constant: REGION_US_E1
- * Specify the queue URL for the US-East (Northern Virginia) Region.
- */
- const REGION_US_E1 = 'us-east-1';
- /**
- * Constant: REGION_US_W1
- * Specify the queue URL for the US-West (Northern California) Region.
- */
- const REGION_US_W1 = 'us-west-1';
- /**
- * Constant: REGION_EU_W1
- * Specify the queue URL for the EU (Ireland) Region.
- */
- const REGION_EU_W1 = 'eu-west-1';
- /**
- * Constant: REGION_APAC_SE1
- * Specify the queue URL for the Asia Pacific (Singapore) Region.
- */
- const REGION_APAC_SE1 = 'ap-southeast-1';
- /**
- * Constant: STATE_PENDING
- * The "pending" state code of an EC2 instance. Useful for conditionals.
- */
- const STATE_PENDING = 0;
- /**
- * Constant: STATE_RUNNING
- * The "running" state code of an EC2 instance. Useful for conditionals.
- */
- const STATE_RUNNING = 16;
- /**
- * Constant: STATE_SHUTTING_DOWN
- * The "shutting-down" state code of an EC2 instance. Useful for conditionals.
- */
- const STATE_SHUTTING_DOWN = 32;
- /**
- * Constant: STATE_TERMINATED
- * The "terminated" state code of an EC2 instance. Useful for conditionals.
- */
- const STATE_TERMINATED = 48;
- /**
- * Constant: STATE_STOPPING
- * The "stopping" state code of an EC2 instance. Useful for conditionals.
- */
- const STATE_STOPPING = 64;
- /**
- * Constant: STATE_STOPPED
- * The "stopped" state code of an EC2 instance. Useful for conditionals.
- */
- const STATE_STOPPED = 80;
- /*%******************************************************************************************%*/
- // SETTERS
- /**
- * Method: set_region()
- * This allows you to explicitly sets the region for the service to use.
- *
- * Access:
- * public
- *
- * Parameters:
- * $region - _string_ (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_EU_W1>, or <REGION_APAC_SE1>.
- *
- * Returns:
- * `$this`
- */
- public function set_region($region)
- {
- $this->set_hostname('http://ec2.'. $region .'.amazonaws.com');
- return $this;
- }
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
- /**
- * Method: __construct()
- * Constructs a new instance of <AmazonEC2>.
- *
- * Access:
- * public
- *
- * Parameters:
- * $key - _string_ (Optional) Your Amazon API Key. If blank, it will look for the <AWS_KEY> constant.
- * $secret_key - _string_ (Optional) Your Amazon API Secret Key. If blank, it will look for the <AWS_SECRET_KEY> constant.
- *
- * Returns:
- * _boolean_ false if no valid values are set, otherwise true.
- */
- public function __construct($key = null, $secret_key = null)
- {
- $this->api_version = '2010-08-31';
- $this->hostname = self::DEFAULT_URL;
- if (!$key && !defined('AWS_KEY'))
- {
- throw new EC2_Exception('No account key was passed into the constructor, nor was it set in the AWS_KEY constant.');
- }
- if (!$secret_key && !defined('AWS_SECRET_KEY'))
- {
- throw new EC2_Exception('No account secret was passed into the constructor, nor was it set in the AWS_SECRET_KEY constant.');
- }
- return parent::__construct($key, $secret_key);
- }
- /*%******************************************************************************************%*/
- // SERVICE METHODS
- /**
- * Method: reboot_instances()
- * The RebootInstances operation 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 the user. Requests to reboot terminated instances
- * are ignored.
- *
- * Access:
- * public
- *
- * Parameters:
- * $instance_id - _string_|_array_ (Required) The list of instances to terminate. Pass a string for a single value, or an indexed array for multiple values.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function reboot_instances($instance_id, $opt = null)
- {
- if (!$opt) $opt = array();
- // Required parameter
- $opt = array_merge($opt, CFComplexType::map(array(
- 'InstanceId' => (is_array($instance_id) ? $instance_id : array($instance_id))
- )));
- return $this->authenticate('RebootInstances', $opt, $this->hostname);
- }
- /**
- * Method: describe_placement_groups()
- * Returns information about one or more PlacementGroup instances in a user's account.
- *
- * Access:
- * public
- *
- * Parameters:
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * GroupName - _string_|_array_ (Optional) The name of the `PlacementGroup`. Pass a string for a single value, or an indexed array for multiple values.
- * Filter - _ComplexList_ (Optional) A ComplexList is an indexed array of ComplexTypes. Each ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `Filter` subtype (documented next), or by passing an associative array with the following `Filter`-prefixed entries as keys. In the descriptions below, `x`, `y` and `z` should be integers starting at `1`. See below for a list and a usage example.
- * Filter.x.Name - _string_ (Optional) Specifies the name of the filter.
- * Filter.x.Value.y - _string_ (Optional) Contains one or more values for the filter.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function describe_placement_groups($opt = null)
- {
- if (!$opt) $opt = array();
- // Optional parameter
- if (isset($opt['GroupName']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'GroupName' => (is_array($opt['GroupName']) ? $opt['GroupName'] : array($opt['GroupName']))
- )));
- unset($opt['GroupName']);
- }
- // Optional parameter
- if (isset($opt['Filter']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'Filter' => $opt['Filter']
- )));
- unset($opt['Filter']);
- }
- return $this->authenticate('DescribePlacementGroups', $opt, $this->hostname);
- }
- /**
- * Method: run_instances()
- * The RunInstances operation launches a specified number of instances.
- *
- * If Amazon EC2 cannot launch the minimum number AMIs you request, no instances launch. If there is
- * insufficient capacity to launch the maximum number of AMIs you request, Amazon EC2 launches as many
- * as possible to satisfy the requested maximum values.
- *
- * Every instance is launched in a security group. If you do not specify a security group at launch,
- * the instances start in your default security group. For more information on creating security
- * groups, see CreateSecurityGroup.
- *
- * An optional instance type can be specified. For information about instance types, see Instance
- * Types.
- *
- * You can provide an optional key pair ID for each image in the launch request (for more information,
- * see CreateKeyPair). All instances that are created from images that use this key pair will have
- * access to the associated public key at boot. You can use this key to provide secure access to an
- * instance of an image on a per-instance basis. Amazon EC2 public images use this feature to provide
- * secure access without passwords.
- *
- * Launching public images without a key pair ID will leave them inaccessible.
- *
- * The public key material is made available to the instance at boot time by placing it in the
- * openssh_id.pub file on a logical device that is exposed to the instance as /dev/sda2 (the ephemeral
- * store). The format of this file is suitable for use as an entry within ~/.ssh/authorized_keys (the
- * OpenSSH format). This can be done at boot (e.g., as part of rc.local) allowing for secure access
- * without passwords.
- *
- * Optional user data can be provided in the launch request. All instances that collectively comprise
- * the launch request have access to this data For more information, see Instance Metadata.
- *
- * If any of the AMIs have a product code attached for which the user has not subscribed, the
- * RunInstances call will fail.
- *
- * We strongly recommend using the 2.6.18 Xen stock kernel with the c1.medium and c1.xlarge instances.
- * Although the default Amazon EC2 kernels will work, the new kernels provide greater stability and
- * performance for these instance types. For more information about kernels, see Kernels, RAM Disks,
- * and Block Device Mappings.
- *
- * Access:
- * public
- *
- * Parameters:
- * $image_id - _string_ (Required) Unique ID of a machine image, returned by a call to DescribeImages.
- * $min_count - _integer_ (Required) Minimum number of instances to launch. If the value is more than Amazon EC2 can launch, no instances are launched at all.
- * $max_count - _integer_ (Required) Maximum number of instances to launch. If the value is more than Amazon EC2 can launch, the largest possible number above minCount will be launched instead. Between 1 and the maximum number allowed for your account (default: 20).
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * KeyName - _string_ (Optional) The name of the key pair.
- * SecurityGroup - _string_|_array_ (Optional) The names of the security groups into which the instances will be launched. Pass a string for a single value, or an indexed array for multiple values.
- * UserData - _string_ (Optional) Specifies additional information to make available to the instance(s).
- * InstanceType - _string_ (Optional) Specifies the instance type for the launched instances. [Allowed values: `t1.micro`, `m1.small`, `m1.large`, `m1.xlarge`, `m2.xlarge`, `m2.2xlarge`, `m2.4xlarge`, `c1.medium`, `c1.xlarge`, `cc1.4xlarge`, `cg1.4xlarge`]
- * Placement - _ComplexType_ (Optional) Specifies the placement constraints (Availability Zones) for launching the instances. A ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `Placement` subtype (documented next), or by passing an associative array with the following `Placement`-prefixed entries as keys. See below for a list and a usage example.
- * Placement.AvailabilityZone - _string_ (Optional) The availability zone in which an Amazon EC2 instance runs.
- * Placement.GroupName - _string_ (Optional) The name of a PlacementGroup.
- * KernelId - _string_ (Optional) The ID of the kernel with which to launch the instance.
- * RamdiskId - _string_ (Optional) The ID of the RAM disk with which to launch the instance. Some kernels require additional drivers at launch. Check the kernel requirements for information on whether you need to specify a RAM disk. To find kernel requirements, go to the Resource Center and search for the kernel ID.
- * BlockDeviceMapping - _ComplexList_ (Optional) A ComplexList is an indexed array of ComplexTypes. Each ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `BlockDeviceMapping` subtype (documented next), or by passing an associative array with the following `BlockDeviceMapping`-prefixed entries as keys. In the descriptions below, `x`, `y` and `z` should be integers starting at `1`. See below for a list and a usage example.
- * BlockDeviceMapping.x.VirtualName - _string_ (Optional) Specifies the virtual device name.
- * BlockDeviceMapping.x.DeviceName - _string_ (Optional) Specifies the device name (e.g., /dev/sdh).
- * BlockDeviceMapping.x.Ebs.SnapshotId - _string_ (Optional) The ID of the snapshot from which the volume will be created.
- * BlockDeviceMapping.x.Ebs.VolumeSize - _integer_ (Optional) The size of the volume, in gigabytes.
- * BlockDeviceMapping.x.Ebs.DeleteOnTermination - _boolean_ (Optional) Specifies whether the Amazon EBS volume is deleted on instance termination.
- * BlockDeviceMapping.x.NoDevice - _string_ (Optional) Specifies the device name to suppress during instance launch.
- * Monitoring.Enabled - _boolean_ (Optional) Enables monitoring for the instance.
- * SubnetId - _string_ (Optional) Specifies the subnet ID within which to launch the instance(s) for Amazon Virtual Private Cloud.
- * DisableApiTermination - _boolean_ (Optional) Specifies whether the instance can be terminated using the APIs. You must modify this attribute before you can terminate any "locked" instances from the APIs.
- * InstanceInitiatedShutdownBehavior - _string_ (Optional) Specifies whether the instance's Amazon EBS volumes are stopped or terminated when the instance is shut down.
- * License - _ComplexType_ (Optional) Specifies active licenses in use and attached to an Amazon EC2 instance. A ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `License` subtype (documented next), or by passing an associative array with the following `License`-prefixed entries as keys. See below for a list and a usage example.
- * License.Pool - _string_ (Optional) The license pool from which to take a license when starting Amazon EC2 instances in the associated `RunInstances` request.
- * PrivateIpAddress - _string_ (Optional) If you're using Amazon Virtual Private Cloud, you can optionally use this parameter to assign the instance a specific available IP address from the subnet.
- * ClientToken - _string_ (Optional) Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, go to How to Ensure Idempotency in the Amazon Elastic Compute Cloud User Guide.
- * AdditionalInfo - _string_ (Optional) For internal use only.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function run_instances($image_id, $min_count, $max_count, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['ImageId'] = $image_id;
- $opt['MinCount'] = $min_count;
- $opt['MaxCount'] = $max_count;
- // Optional parameter
- if (isset($opt['SecurityGroup']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'SecurityGroup' => (is_array($opt['SecurityGroup']) ? $opt['SecurityGroup'] : array($opt['SecurityGroup']))
- )));
- unset($opt['SecurityGroup']);
- }
- // Optional parameter
- if (isset($opt['Placement']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'Placement' => $opt['Placement']
- )));
- unset($opt['Placement']);
- }
- // Optional parameter
- if (isset($opt['BlockDeviceMapping']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'BlockDeviceMapping' => $opt['BlockDeviceMapping']
- )));
- unset($opt['BlockDeviceMapping']);
- }
- // Optional parameter
- if (isset($opt['License']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'License' => $opt['License']
- )));
- unset($opt['License']);
- }
- return $this->authenticate('RunInstances', $opt, $this->hostname);
- }
- /**
- * Method: describe_reserved_instances()
- * The DescribeReservedInstances operation describes Reserved Instances that were purchased for use
- * with your account.
- *
- * Access:
- * public
- *
- * Parameters:
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * ReservedInstancesId - _string_|_array_ (Optional) The optional list of Reserved Instance IDs to describe. Pass a string for a single value, or an indexed array for multiple values.
- * Filter - _ComplexList_ (Optional) A list of filters used to match properties for ReservedInstances. For a complete reference to the available filter keys for this operation, see the Amazon EC2 API reference. A ComplexList is an indexed array of ComplexTypes. Each ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `Filter` subtype (documented next), or by passing an associative array with the following `Filter`-prefixed entries as keys. In the descriptions below, `x`, `y` and `z` should be integers starting at `1`. See below for a list and a usage example.
- * Filter.x.Name - _string_ (Optional) Specifies the name of the filter.
- * Filter.x.Value.y - _string_ (Optional) Contains one or more values for the filter.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function describe_reserved_instances($opt = null)
- {
- if (!$opt) $opt = array();
- // Optional parameter
- if (isset($opt['ReservedInstancesId']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'ReservedInstancesId' => (is_array($opt['ReservedInstancesId']) ? $opt['ReservedInstancesId'] : array($opt['ReservedInstancesId']))
- )));
- unset($opt['ReservedInstancesId']);
- }
- // Optional parameter
- if (isset($opt['Filter']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'Filter' => $opt['Filter']
- )));
- unset($opt['Filter']);
- }
- return $this->authenticate('DescribeReservedInstances', $opt, $this->hostname);
- }
- /**
- * Method: describe_subnets()
- * Gives you information about your subnets. You can filter the results to return information only
- * about subnets that match criteria you specify. For example, you could ask to get information about a
- * particular subnet (or all) only if the subnet's state is available. You can specify multiple filters
- * (e.g., the subnet is in a particular VPC, and the subnet's state is available). The result includes
- * information for a particular subnet only if the subnet matches all your filters. If there's no
- * match, no special message is returned; the response is simply empty. The following table shows the
- * available filters.
- *
- * Access:
- * public
- *
- * Parameters:
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * SubnetId - _string_|_array_ (Optional) A set of one or more subnet IDs. Pass a string for a single value, or an indexed array for multiple values.
- * Filter - _ComplexList_ (Optional) A ComplexList is an indexed array of ComplexTypes. Each ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `Filter` subtype (documented next), or by passing an associative array with the following `Filter`-prefixed entries as keys. In the descriptions below, `x`, `y` and `z` should be integers starting at `1`. See below for a list and a usage example.
- * Filter.x.Name - _string_ (Optional) Specifies the name of the filter.
- * Filter.x.Value.y - _string_ (Optional) Contains one or more values for the filter.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function describe_subnets($opt = null)
- {
- if (!$opt) $opt = array();
- // Optional parameter
- if (isset($opt['SubnetId']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'SubnetId' => (is_array($opt['SubnetId']) ? $opt['SubnetId'] : array($opt['SubnetId']))
- )));
- unset($opt['SubnetId']);
- }
- // Optional parameter
- if (isset($opt['Filter']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'Filter' => $opt['Filter']
- )));
- unset($opt['Filter']);
- }
- return $this->authenticate('DescribeSubnets', $opt, $this->hostname);
- }
- /**
- * Method: describe_availability_zones()
- * The DescribeAvailabilityZones operation describes availability zones that are currently available to
- * the account and their states.
- *
- * Availability zones are not the same across accounts. The availability zone us-east-1a for account A
- * is not necessarily the same as us-east-1a for account B. Zone assignments are mapped independently
- * for each account.
- *
- * Access:
- * public
- *
- * Parameters:
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * ZoneName - _string_|_array_ (Optional) A list of the availability zone names to describe. Pass a string for a single value, or an indexed array for multiple values.
- * Filter - _ComplexList_ (Optional) A list of filters used to match properties for AvailabilityZones. For a complete reference to the available filter keys for this operation, see the Amazon EC2 API reference. A ComplexList is an indexed array of ComplexTypes. Each ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `Filter` subtype (documented next), or by passing an associative array with the following `Filter`-prefixed entries as keys. In the descriptions below, `x`, `y` and `z` should be integers starting at `1`. See below for a list and a usage example.
- * Filter.x.Name - _string_ (Optional) Specifies the name of the filter.
- * Filter.x.Value.y - _string_ (Optional) Contains one or more values for the filter.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function describe_availability_zones($opt = null)
- {
- if (!$opt) $opt = array();
- // Optional parameter
- if (isset($opt['ZoneName']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'ZoneName' => (is_array($opt['ZoneName']) ? $opt['ZoneName'] : array($opt['ZoneName']))
- )));
- unset($opt['ZoneName']);
- }
- // Optional parameter
- if (isset($opt['Filter']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'Filter' => $opt['Filter']
- )));
- unset($opt['Filter']);
- }
- return $this->authenticate('DescribeAvailabilityZones', $opt, $this->hostname);
- }
- /**
- * Method: detach_volume()
- * Detach a previously attached volume from a running instance.
- *
- * Access:
- * public
- *
- * Parameters:
- * $volume_id - _string_ (Required) The ID of the volume to detach.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * InstanceId - _string_ (Optional) The ID of the instance from which to detach the the specified volume.
- * Device - _string_ (Optional) The device name to which the volume is attached on the specified instance.
- * Force - _boolean_ (Optional) Forces detachment if the previous detachment attempt did not occur cleanly (logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance will not have an opportunity to flush file system caches nor file system meta data. If you use this option, you must perform file system check and repair procedures.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function detach_volume($volume_id, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['VolumeId'] = $volume_id;
- return $this->authenticate('DetachVolume', $opt, $this->hostname);
- }
- /**
- * Method: delete_key_pair()
- * The DeleteKeyPair operation deletes a key pair.
- *
- * Access:
- * public
- *
- * Parameters:
- * $key_name - _string_ (Required) The name of the Amazon EC2 key pair to delete.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function delete_key_pair($key_name, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['KeyName'] = $key_name;
- return $this->authenticate('DeleteKeyPair', $opt, $this->hostname);
- }
- /**
- * Method: describe_instances()
- * The DescribeInstances operation returns information about instances that you own.
- *
- * If you specify one or more instance IDs, Amazon EC2 returns information for those instances. If you
- * do not specify instance IDs, Amazon EC2 returns information for all relevant instances. If you
- * specify an invalid instance ID, a fault is returned. If you specify an instance that you do not own,
- * it will not be included in the returned results.
- *
- * Recently terminated instances might appear in the returned results. This interval is usually less
- * than one hour.
- *
- * Access:
- * public
- *
- * Parameters:
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * InstanceId - _string_|_array_ (Optional) An optional list of the instances to describe. Pass a string for a single value, or an indexed array for multiple values.
- * Filter - _ComplexList_ (Optional) A list of filters used to match properties for Instances. For a complete reference to the available filter keys for this operation, see the Amazon EC2 API reference. A ComplexList is an indexed array of ComplexTypes. Each ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `Filter` subtype (documented next), or by passing an associative array with the following `Filter`-prefixed entries as keys. In the descriptions below, `x`, `y` and `z` should be integers starting at `1`. See below for a list and a usage example.
- * Filter.x.Name - _string_ (Optional) Specifies the name of the filter.
- * Filter.x.Value.y - _string_ (Optional) Contains one or more values for the filter.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function describe_instances($opt = null)
- {
- if (!$opt) $opt = array();
- // Optional parameter
- if (isset($opt['InstanceId']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'InstanceId' => (is_array($opt['InstanceId']) ? $opt['InstanceId'] : array($opt['InstanceId']))
- )));
- unset($opt['InstanceId']);
- }
- // Optional parameter
- if (isset($opt['Filter']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'Filter' => $opt['Filter']
- )));
- unset($opt['Filter']);
- }
- return $this->authenticate('DescribeInstances', $opt, $this->hostname);
- }
- /**
- * Method: describe_images()
- * The DescribeImages operation returns information about AMIs, AKIs, and ARIs available to the user.
- * Information returned includes image type, product codes, architecture, and kernel and RAM disk IDs.
- * Images available to the user include public images available for any user to launch, private images
- * owned by the user making the request, and private images owned by other users for which the user has
- * explicit launch permissions.
- *
- * Launch permissions fall into three categories:
- *
- * - Public: The owner of the AMI granted launch permissions for the AMI to the all group. All users
- * have launch permissions for these AMIs.
- *
- * - Explicit: The owner of the AMI granted launch permissions to a specific user.
- *
- * - Implicit: A user has implicit launch permissions for all AMIs he or she owns.
- *
- * The list of AMIs returned can be modified by specifying AMI IDs, AMI owners, or users with launch
- * permissions. If no options are specified, Amazon EC2 returns all AMIs for which the user has launch
- * permissions.
- *
- * If you specify one or more AMI IDs, only AMIs that have the specified IDs are returned. If you
- * specify an invalid AMI ID, a fault is returned. If you specify an AMI ID for which you do not have
- * access, it will not be included in the returned results.
- *
- * If you specify one or more AMI owners, only AMIs from the specified owners and for which you have
- * access are returned. The results can include the account IDs of the specified owners, amazon for
- * AMIs owned by Amazon or self for AMIs that you own.
- *
- * If you specify a list of executable users, only users that have launch permissions for the AMIs are
- * returned. You can specify account IDs (if you own the AMI(s)), self for AMIs for which you own or
- * have explicit permissions, or all for public AMIs.
- *
- * Deregistered images are included in the returned results for an unspecified interval after
- * deregistration.
- *
- * Access:
- * public
- *
- * Parameters:
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * ImageId - _string_|_array_ (Optional) An optional list of the AMI IDs to describe. If not specified, all AMIs will be described. Pass a string for a single value, or an indexed array for multiple values.
- * Owner - _string_|_array_ (Optional) The optional list of owners for the described AMIs. The IDs amazon, self, and explicit can be used to include AMIs owned by Amazon, AMIs owned by the user, and AMIs for which the user has explicit launch permissions, respectively. Pass a string for a single value, or an indexed array for multiple values.
- * ExecutableBy - _string_|_array_ (Optional) The optional list of users with explicit launch permissions for the described AMIs. The user ID can be a user's account ID, 'self' to return AMIs for which the sender of the request has explicit launch permissions, or 'all' to return AMIs with public launch permissions. Pass a string for a single value, or an indexed array for multiple values.
- * Filter - _ComplexList_ (Optional) A list of filters used to match properties for Images. For a complete reference to the available filter keys for this operation, see the Amazon EC2 API reference. A ComplexList is an indexed array of ComplexTypes. Each ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `Filter` subtype (documented next), or by passing an associative array with the following `Filter`-prefixed entries as keys. In the descriptions below, `x`, `y` and `z` should be integers starting at `1`. See below for a list and a usage example.
- * Filter.x.Name - _string_ (Optional) Specifies the name of the filter.
- * Filter.x.Value.y - _string_ (Optional) Contains one or more values for the filter.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function describe_images($opt = null)
- {
- if (!$opt) $opt = array();
- // Optional parameter
- if (isset($opt['ImageId']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'ImageId' => (is_array($opt['ImageId']) ? $opt['ImageId'] : array($opt['ImageId']))
- )));
- unset($opt['ImageId']);
- }
- // Optional parameter
- if (isset($opt['Owner']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'Owner' => (is_array($opt['Owner']) ? $opt['Owner'] : array($opt['Owner']))
- )));
- unset($opt['Owner']);
- }
- // Optional parameter
- if (isset($opt['ExecutableBy']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'ExecutableBy' => (is_array($opt['ExecutableBy']) ? $opt['ExecutableBy'] : array($opt['ExecutableBy']))
- )));
- unset($opt['ExecutableBy']);
- }
- // Optional parameter
- if (isset($opt['Filter']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'Filter' => $opt['Filter']
- )));
- unset($opt['Filter']);
- }
- return $this->authenticate('DescribeImages', $opt, $this->hostname);
- }
- /**
- * Method: start_instances()
- * Starts an instance that uses an Amazon EBS volume as its root device. Instances that use Amazon EBS
- * volumes as their root devices can be quickly stopped and started. When an instance is stopped, the
- * compute resources are released and you are not billed for hourly instance usage. However, your root
- * partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon
- * EBS volume usage. You can restart your instance at any time.
- *
- * Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an
- * instance does not preserve data stored in RAM.
- *
- * Performing this operation on an instance that uses an instance store as its root device returns an
- * error.
- *
- * Access:
- * public
- *
- * Parameters:
- * $instance_id - _string_|_array_ (Required) The list of Amazon EC2 instances to start. Pass a string for a single value, or an indexed array for multiple values.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function start_instances($instance_id, $opt = null)
- {
- if (!$opt) $opt = array();
- // Required parameter
- $opt = array_merge($opt, CFComplexType::map(array(
- 'InstanceId' => (is_array($instance_id) ? $instance_id : array($instance_id))
- )));
- return $this->authenticate('StartInstances', $opt, $this->hostname);
- }
- /**
- * Method: unmonitor_instances()
- * Disables monitoring for a running instance.
- *
- * Access:
- * public
- *
- * Parameters:
- * $instance_id - _string_|_array_ (Required) The list of Amazon EC2 instances on which to disable monitoring. Pass a string for a single value, or an indexed array for multiple values.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function unmonitor_instances($instance_id, $opt = null)
- {
- if (!$opt) $opt = array();
- // Required parameter
- $opt = array_merge($opt, CFComplexType::map(array(
- 'InstanceId' => (is_array($instance_id) ? $instance_id : array($instance_id))
- )));
- return $this->authenticate('UnmonitorInstances', $opt, $this->hostname);
- }
- /**
- * Method: attach_vpn_gateway()
- * Attaches a VPN gateway to a VPC. This is the last step required to get your VPC fully connected to
- * your data center before launching instances in it. For more information, go to Process for Using
- * Amazon VPC in the Amazon Virtual Private Cloud Developer Guide.
- *
- * Access:
- * public
- *
- * Parameters:
- * $vpn_gateway_id - _string_ (Required) The ID of the VPN gateway to attach to the VPC.
- * $vpc_id - _string_ (Required) The ID of the VPC to attach to the VPN gateway.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function attach_vpn_gateway($vpn_gateway_id, $vpc_id, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['VpnGatewayId'] = $vpn_gateway_id;
- $opt['VpcId'] = $vpc_id;
- return $this->authenticate('AttachVpnGateway', $opt, $this->hostname);
- }
- /**
- * Method: modify_instance_attribute()
- * Modifies an attribute of an instance.
- *
- * Access:
- * public
- *
- * Parameters:
- * $instance_id - _string_ (Required) The ID of the instance whose attribute is being modified.
- * $attribute - _string_ (Required) The name of the attribute being modified. Available attribute names: instanceType, kernel, ramdisk, userData, disableApiTermination, instanceInitiatedShutdownBehavior, rootDevice, blockDeviceMapping
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * Value - _string_ (Optional) The new value of the instance attribute being modified. Only valid when kernel, ramdisk, userData disableApiTermination, or instanceInitiateShutdownBehavior is specified as the attribute being modified.
- * BlockDeviceMapping - _ComplexList_ (Optional) The new block device mappings for the instance whose attributes are being modified. Only valid when blockDeviceMapping is specified as the attribute being modified. A ComplexList is an indexed array of ComplexTypes. Each ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individual `BlockDeviceMapping` subtype (documented next), or by passing an associative array with the following `BlockDeviceMapping`-prefixed entries as keys. In the descriptions below, `x`, `y` and `z` should be integers starting at `1`. See below for a list and a usage example.
- * BlockDeviceMapping.x.DeviceName - _string_ (Optional) The device name (e.g., /dev/sdh) at which the block device is exposed on the instance.
- * BlockDeviceMapping.x.Ebs.VolumeId - _string_ (Optional) The ID of the EBS volume that should be mounted as a block device on an Amazon EC2 instance.
- * BlockDeviceMapping.x.Ebs.DeleteOnTermination - _boolean_ (Optional) Specifies whether the Amazon EBS volume is deleted on instance termination.
- * BlockDeviceMapping.x.VirtualName - _string_ (Optional) The virtual device name.
- * BlockDeviceMapping.x.NoDevice - _string_ (Optional) When set to the empty string, specifies that the device name in this object should not be mapped to any real device.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function modify_instance_attribute($instance_id, $attribute, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['InstanceId'] = $instance_id;
- $opt['Attribute'] = $attribute;
- // Optional parameter
- if (isset($opt['BlockDeviceMapping']))
- {
- $opt = array_merge($opt, CFComplexType::map(array(
- 'BlockDeviceMapping' => $opt['BlockDeviceMapping']
- )));
- unset($opt['BlockDeviceMapping']);
- }
- return $this->authenticate('ModifyInstanceAttribute', $opt, $this->hostname);
- }
- /**
- * Method: delete_dhcp_options()
- * Deletes a set of DHCP options that you specify. Amazon VPC returns an error if the set of options
- * you specify is currently associated with a VPC. You can disassociate the set of options by
- * associating either a new set of options or the default options with the VPC.
- *
- * Access:
- * public
- *
- * Parameters:
- * $dhcp_options_id - _string_ (Required) The ID of the DHCP options set to delete.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function delete_dhcp_options($dhcp_options_id, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['DhcpOptionsId'] = $dhcp_options_id;
- return $this->authenticate('DeleteDhcpOptions', $opt, $this->hostname);
- }
- /**
- * Method: delete_security_group()
- * The DeleteSecurityGroup operation deletes a security group.
- *
- * If you attempt to delete a security group that contains instances, a fault is returned.
- *
- * If you attempt to delete a security group that is referenced by another security group, a fault is
- * returned. For example, if security group B has a rule that allows access from security group A,
- * security group A cannot be deleted until the allow rule is removed.
- *
- * Access:
- * public
- *
- * Parameters:
- * $group_name - _string_ (Required) The name of the Amazon EC2 security group to delete.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function delete_security_group($group_name, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['GroupName'] = $group_name;
- return $this->authenticate('DeleteSecurityGroup', $opt, $this->hostname);
- }
- /**
- * Method: create_image()
- * Creates an Amazon EBS-backed AMI from a "running" or "stopped" instance. AMIs that use an Amazon EBS
- * root device boot faster than AMIs that use instance stores. They can be up to 1 TiB in size, use
- * storage that persists on instance failure, and can be stopped and started.
- *
- * Access:
- * public
- *
- * Parameters:
- * $instance_id - _string_ (Required) The ID of the instance from which to create the new image.
- * $name - _string_ (Required) The name for the new AMI being created.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * Description - _string_ (Optional) The description for the new AMI being created.
- * NoReboot - _boolean_ (Optional) By default this property is set to `false`, which means Amazon EC2 attempts to cleanly shut down the instance before image creation and reboots the instance afterwards. When set to true, Amazon EC2 will not shut down the instance before creating the image. When this option is used, file system integrity on the created image cannot be guaranteed.
- * returnCurlHandle - _boolean_ (Optional) A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.
- *
- * Returns:
- * _CFResponse_ A <CFResponse> object containing a parsed HTTP response.
- */
- public function create_image($instance_id, $name, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['InstanceId'] = $instance_id;
- $opt['Name'] = $name;
- return $this->authenticate('CreateImage', $opt, $this->hostname);
- }
- /**
- * Method: authorize_security_group_ingress()
- * The AuthorizeSecurityGroupIngress operation adds permissions to a security group.
- *
- * Permissions are specified by the IP protocol (TCP, UDP or ICMP), the source of the request (by IP
- * range or an Amazon EC2 user-group pair), the source and destination port ranges (for TCP and UDP),
- * and the ICMP codes and types (for ICMP). When authorizing ICMP, -1 can be used as a wildcard in the
- * type and code fields.
- *
- * Permission changes are propagated to instances within the security group as quickly as possible.
- * However, depending on the number of instances, a small delay might occur.
- *
- * Access:
- * public
- *
- * Parameters:
- * $group_name - _string_ (Required) Name of the group to modify. The name must be valid and belong to the account.
- * $opt - _array_ (Optional) An associative array of parameters that can have the keys listed in the following section.
- *
- * Keys for the $opt parameter:
- * SourceSecurityGroupName - _string_ (Optional) Deprecated - use the list of IP permissions to specify this information instead. Name of the security group. Cannot be used when specifying a CIDR IP address.
- * SourceSecurityGroupOwnerId - _string_ (Optional) Deprecated - use the list of IP permissions to specify this information instead. AWS user ID of an account. Cannot be used when specifying a CIDR IP address.
- * IpProtocol - _string_ (Optional) Deprecated - use the list of IP permissions to specify this information instead. IP protocol.
- * FromPort - _integer_ (Optional) Deprecated - use the list of IP permissions to specify this information instead. Start of port range for the TCP and UDP protocols, or an ICMP type number. An ICMP type number of -1 indicates a wildcard (i.e., any ICMP type number).
- * ToPort - _integer_ (Optional) Deprecated - use the list of IP permissions to specify this information instead. End of port range for the TCP and UDP protocols, or an ICMP code. An ICMP code of -1 indicates a wildcard (i.e., any ICMP code).
- * CidrIp - _string_ (Optional) Deprecated - use the list of IP permissions to specify this information instead. CIDR range.
- * IpPermissions - _ComplexList_ (Optional) List of IP permissions to authorize on the specified security group. Specifying permissions through IP permissions is the preferred way of authorizing permissions since it offers more flexibility and control. A ComplexList is an indexed array of ComplexTypes. Each ComplexType is a set of key-value pairs. These pairs can be set one of two ways: by setting each individ…
Large files files are truncated, but you can click here to view the full file