Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremeamia committed Nov 14, 2012
1 parent 19774df commit 4b50b81
Show file tree
Hide file tree
Showing 12 changed files with 328 additions and 77 deletions.
21 changes: 21 additions & 0 deletions _docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# Changelog: 1.5.17

Launched Tuesday, November 13, 2012.

## Bug fixes and enhancements
* **New:** Support for the new Asia Pacific (Sydney) Region has been added. Region endpoint constants have been added to several clients.

## Services
### AmazonDynamoDB
* **New:** Support for ConsistentRead option on the BatchWriteItem operation has been added to the SDK.
* **New:** Support for CRC32 checksums has been added to the SDK. Requests are automatically retried on the if there is a checksum mismatch on the response.

### AmazonElasticBeanstalk
* **New:** Support for the TerminateEnvByForce option on the DeleteApplication operation has been added to the SDK.

### AmazonS3
* **New:** Support for website page redirects has been added to the SDK.
* **New:** Support for archiving data to Amazon Glacier has been added to the SDK.

----

# Changelog: 1.5.16.1 "Rhapsody"
The pre-cursor to Mac OS X, built from technology acquired from NeXT. <http://en.wikipedia.org/wiki/Rhapsody_(operating_system)>

Expand Down
1 change: 1 addition & 0 deletions _docs/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The following people have provided ideas, support and bug fixes:
* [Dan Stillman](https://github.com/dstillman) (bug fixes)
* [Daniel Holmes](https://github.com/danielholmes) (bug fixes)
* [David Chan](http://www.chandeeland.org) (bug fixes)
* [derekclapham](https://github.com/derekclapham) (bug fixes)
* [Eric Caron](http://www.ericcaron.com) (bug fixes)
* [Jason Ardell](http://ardell.posterous.com/) (bug fixes)
* [Jeremy Archuleta](http://code.google.com/u/jeremy.archuleta/) (bug fixes)
Expand Down
1 change: 1 addition & 0 deletions extensions/s3browserupload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class S3BrowserUpload extends AmazonS3
* <li><code>success_action_status</code> - <code>integer</code> - Optional - The status code for Amazon S3 to return upon successful upload.</li>
* <li><code>x-amz-server-side-encryption</code> - <code>string</code> - Optional - The server-side encryption mechanism to use. [Allowed values: <code>AES256</code>].</li>
* <li><code>x-amz-storage-class</code> - <code>string</code> - Optional - The storage setting to apply to the object. [Allowed values: <code>AmazonS3::STORAGE_STANDARD</code>, <code>AmazonS3::STORAGE_REDUCED</code>]. The default value is <code>AmazonS3::STORAGE_STANDARD</code>.</li>
* <li><code>x-amz-website-redirect-location</code> - <code>string</code> - Optional - The URI to send an HTTP 301 redirect to when accessing this object. Value must be prefixed either <code>/</code>, <code>http://</code> or <code>https://</code>.</li>
* <li><code>x-amz-meta-*</code> - <code>mixed</code> - Optional - Any custom meta tag that should be set to the object.</li>
* </ul>
* @return array An array of fields that can be converted into markup.
Expand Down
16 changes: 8 additions & 8 deletions package.xml

Large diffs are not rendered by default.

59 changes: 38 additions & 21 deletions sdk.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ function __aws_sdk_ua_callback()
// INTERMEDIARY CONSTANTS

define('CFRUNTIME_NAME', 'aws-sdk-php');
define('CFRUNTIME_VERSION', '1.5.16.1');
define('CFRUNTIME_BUILD', '20121112104359');
define('CFRUNTIME_VERSION', '1.5.17');
define('CFRUNTIME_BUILD', '20121113183000');
define('CFRUNTIME_USERAGENT', CFRUNTIME_NAME . '/' . CFRUNTIME_VERSION . ' PHP/' . PHP_VERSION . ' ' . str_replace(' ', '_', php_uname('s')) . '/' . str_replace(' ', '_', php_uname('r')) . ' Arch/' . php_uname('m') . ' SAPI/' . php_sapi_name() . ' Integer/' . PHP_INT_MAX . ' Build/' . CFRUNTIME_BUILD . __aws_sdk_ua_callback());


Expand Down Expand Up @@ -1047,10 +1047,12 @@ public function authenticate($operation, $payload)

$data = new $this->response_class($headers, ($this->parse_the_response === true) ? $this->parse_callback($request->get_response_body()) : $request->get_response_body(), $request->get_response_code());

$response_body = (string) $request->get_response_body();

// Was it Amazon's fault the request failed? Retry the request until we reach $max_retries.
if (
(integer) $request->get_response_code() === 500 || // Internal Error (presumably transient)
(integer) $request->get_response_code() === 503) // Service Unavailable (presumably transient)
(integer) $request->get_response_code() === 500 || // Internal Error (presumably transient)
(integer) $request->get_response_code() === 503) // Service Unavailable (presumably transient)
{
if ($this->redirects <= $this->max_retries)
{
Expand All @@ -1062,26 +1064,41 @@ public function authenticate($operation, $payload)
}
}

// DynamoDB has custom logic
elseif (
(integer) $request->get_response_code() === 400 &&
stripos((string) $request->get_response_body(), 'com.amazonaws.dynamodb.') !== false && (
stripos((string) $request->get_response_body(), 'ProvisionedThroughputExceededException') !== false
)
)
// DynamoDB has additional, custom logic for retrying requests
else
{
if ($this->redirects === 0)
// If the request to DynamoDB was throttled, we need to retry
$need_to_retry_dynamodb_request = (
(integer) $request->get_response_code() === 400 &&
stripos($response_body, 'com.amazonaws.dynamodb.') !== false &&
stripos($response_body, 'ProvisionedThroughputExceededException') !== false
);

// If the CRC32 of the response does not match the expected value, we need to retry
$response_headers = $request->get_response_header();
if (!$need_to_retry_dynamodb_request && isset($response_headers['x-amz-crc32']))
{
$this->redirects++;
$data = $this->authenticate($operation, $original_payload);
$crc32_expected = $response_headers['x-amz-crc32'];
$crc32_actual = hexdec(hash('crc32b', $response_body));
$need_to_retry_dynamodb_request = ($crc32_expected != $crc32_actual);
}
elseif ($this->redirects <= max($this->max_retries, 10))

// Perform retry if necessary using a more aggressive exponential backoff
if ($need_to_retry_dynamodb_request)
{
// Exponential backoff
$delay = (integer) (pow(2, ($this->redirects - 1)) * 50000);
usleep($delay);
$this->redirects++;
$data = $this->authenticate($operation, $original_payload);
if ($this->redirects === 0)
{
$this->redirects++;
$data = $this->authenticate($operation, $original_payload);
}
elseif ($this->redirects <= max($this->max_retries, 10))
{
// Exponential backoff
$delay = (integer) (pow(2, ($this->redirects - 1)) * 50000);
usleep($delay);
$this->redirects++;
$data = $this->authenticate($operation, $original_payload);
}
}
}

Expand Down Expand Up @@ -1467,7 +1484,7 @@ public static function autoloader($class)
elseif ($class === 'Signer')
{
if (!interface_exists('Signable', false) &&
file_exists($require_this = $path . 'authentication' . DIRECTORY_SEPARATOR . 'signable.interface.php'))
file_exists($require_this = $path . 'authentication' . DIRECTORY_SEPARATOR . 'signable.interface.php'))
{
require_once $require_this;
}
Expand Down
15 changes: 13 additions & 2 deletions services/dynamodb.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Amazon DynamoDB removes traditional scalability limitations on data storage while maintaining
* low latency and predictable performance.
*
* @version 2012.09.18
* @version 2012.11.12
* @license See the included NOTICE.md file for complete information.
* @copyright See the included NOTICE.md file for complete information.
* @link http://aws.amazon.com/dynamodb/ Amazon DynamoDB
Expand Down Expand Up @@ -82,6 +82,16 @@ class AmazonDynamoDB extends CFRuntime
*/
const REGION_SINGAPORE = self::REGION_APAC_SE1;

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_APAC_SE2 = 'dynamodb.ap-southeast-2.amazonaws.com';

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_SYDNEY = self::REGION_APAC_SE2;

/**
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
*/
Expand Down Expand Up @@ -304,7 +314,7 @@ public function __construct(array $options = array())
/**
* This allows you to explicitly sets the region for the service to use.
*
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_NE1>.
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_SE2>, <REGION_APAC_NE1>.
* @return $this A reference to the current instance.
*/
public function set_region($region)
Expand Down Expand Up @@ -577,6 +587,7 @@ public function binary_set($values)
* </ul></li>
* </ul></li>
* <li><code>AttributesToGet</code> - <code>string|array</code> - Optional - List of <code>Attribute</code> names. If attribute names are not specified then all attributes will be returned. If some attributes are not found, they will not appear in the result. Pass a string for a single value, or an indexed array for multiple values.</li>
* <li><code>ConsistentRead</code> - <code>boolean</code> - Optional - If set to <code>true</code>, then a consistent read is issued. Otherwise eventually-consistent is used.</li>
* </ul></li>
* </ul></li>
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
Expand Down
14 changes: 12 additions & 2 deletions services/ec2.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
* Visit <a href="http://aws.amazon.com/ec2/">http://aws.amazon.com/ec2/</a> for more information.
*
* @version 2012.09.18
* @version 2012.11.12
* @license See the included NOTICE.md file for complete information.
* @copyright See the included NOTICE.md file for complete information.
* @link http://aws.amazon.com/ec2/ Amazon EC2
Expand Down Expand Up @@ -90,6 +90,16 @@ class AmazonEC2 extends CFRuntime
*/
const REGION_SINGAPORE = self::REGION_APAC_SE1;

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_APAC_SE2 = 'ec2.ap-southeast-2.amazonaws.com';

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_SYDNEY = self::REGION_APAC_SE2;

/**
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
*/
Expand Down Expand Up @@ -191,7 +201,7 @@ public function __construct(array $options = array())
/**
* This allows you to explicitly sets the region for the service to use.
*
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_NE1>, <REGION_US_GOV1>, <REGION_SA_E1>.
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_SE2>, <REGION_APAC_NE1>, <REGION_US_GOV1>, <REGION_SA_E1>.
* @return $this A reference to the current instance.
*/
public function set_region($region)
Expand Down
56 changes: 38 additions & 18 deletions services/elasticbeanstalk.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@
*
* <strong>Endpoints</strong>
*
* AWS Elastic Beanstalk supports the following region-specific endpoint:
*
* <ul>
* <li>https://elasticbeanstalk.us-east-1.amazonaws.com</li>
* </ul>
* For a list of region-specific endpoints that AWS Elastic Beanstalk supports, go to <a href=
* "http://docs.amazonwebservices.com/general/latest/gr/rande.html#elasticbeanstalk_region">Regions
* and Endpoints</a> in the <em>Amazon Web Services Glossary</em>.
*
* @version 2012.06.21
* @version 2012.11.12
* @license See the included NOTICE.md file for complete information.
* @copyright See the included NOTICE.md file for complete information.
* @link http://aws.amazon.com/elasticbeanstalk/ AWS ElasticBeanstalk
Expand All @@ -55,16 +53,6 @@ class AmazonElasticBeanstalk extends CFRuntime
*/
const REGION_VIRGINIA = self::REGION_US_E1;

/**
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
*/
const REGION_APAC_NE1 = 'elasticbeanstalk.ap-northeast-1.amazonaws.com';

/**
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
*/
const REGION_TOKYO = self::REGION_APAC_NE1;

/**
* Specify the queue URL for the United States West (Northern California) Region.
*/
Expand Down Expand Up @@ -95,6 +83,36 @@ class AmazonElasticBeanstalk extends CFRuntime
*/
const REGION_IRELAND = self::REGION_EU_W1;

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_APAC_SE1 = 'elasticbeanstalk.ap-southeast-1.amazonaws.com';

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_SINGAPORE = self::REGION_APAC_SE1;

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_APAC_SE2 = 'elasticbeanstalk.ap-southeast-2.amazonaws.com';

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_SYDNEY = self::REGION_APAC_SE2;

/**
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
*/
const REGION_APAC_NE1 = 'elasticbeanstalk.ap-northeast-1.amazonaws.com';

/**
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
*/
const REGION_TOKYO = self::REGION_APAC_NE1;

/**
* Default service endpoint.
*/
Expand Down Expand Up @@ -132,7 +150,7 @@ public function __construct(array $options = array())
/**
* This allows you to explicitly sets the region for the service to use.
*
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_APAC_NE1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>.
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_SE2>, <REGION_APAC_NE1>.
* @return $this A reference to the current instance.
*/
public function set_region($region)
Expand Down Expand Up @@ -365,14 +383,16 @@ public function create_storage_location($opt = null)
}

/**
* Deletes the specified application along with all associated versions and configurations.
* Deletes the specified application along with all associated versions and configurations. The
* application versions will not be deleted from your Amazon S3 bucket.
*
* <p class="note">
* You cannot delete an application that has a running environment.
* </p>
*
* @param string $application_name (Required) The name of the application to delete.
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
* <li><code>TerminateEnvByForce</code> - <code>boolean</code> - Optional - When set to true, running environments will be terminated before deleting the application.</li>
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
* <li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
Expand Down
14 changes: 12 additions & 2 deletions services/elb.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* application loads between two or more EC2 instances. Elastic Load Balancing enables
* availability through redundancy and supports traffic growth of your application.
*
* @version 2012.06.25
* @version 2012.11.12
* @license See the included NOTICE.md file for complete information.
* @copyright See the included NOTICE.md file for complete information.
* @link http://aws.amazon.com/elasticloadbalancing/ Elastic Load Balancing
Expand Down Expand Up @@ -81,6 +81,16 @@ class AmazonELB extends CFRuntime
*/
const REGION_SINGAPORE = self::REGION_APAC_SE1;

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_APAC_SE2 = 'elasticloadbalancing.ap-southeast-2.amazonaws.com';

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_SYDNEY = self::REGION_APAC_SE2;

/**
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
*/
Expand Down Expand Up @@ -138,7 +148,7 @@ public function __construct(array $options = array())
/**
* This allows you to explicitly sets the region for the service to use.
*
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_NE1>, <REGION_SA_E1>.
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_SE2>, <REGION_APAC_NE1>, <REGION_SA_E1>.
* @return $this A reference to the current instance.
*/
public function set_region($region)
Expand Down
14 changes: 12 additions & 2 deletions services/emr.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* tasks such as web indexing, data mining, log file analysis, machine learning, scientific
* simulation, and data warehousing.
*
* @version 2012.01.16
* @version 2012.11.12
* @license See the included NOTICE.md file for complete information.
* @copyright See the included NOTICE.md file for complete information.
* @link http://aws.amazon.com/elasticmapreduce/ Amazon Elastic MapReduce
Expand Down Expand Up @@ -84,6 +84,16 @@ class AmazonEMR extends CFRuntime
*/
const REGION_SINGAPORE = self::REGION_APAC_SE1;

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_APAC_SE2 = 'elasticmapreduce.ap-southeast-2.amazonaws.com';

/**
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
*/
const REGION_SYDNEY = self::REGION_APAC_SE2;

/**
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
*/
Expand Down Expand Up @@ -141,7 +151,7 @@ public function __construct(array $options = array())
/**
* This allows you to explicitly sets the region for the service to use.
*
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_NE1>, <REGION_SA_E1>.
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_SE2>, <REGION_APAC_NE1>, <REGION_SA_E1>.
* @return $this A reference to the current instance.
*/
public function set_region($region)
Expand Down
Loading

0 comments on commit 4b50b81

Please sign in to comment.