Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: aws/aws-sdk-php
base: master
...
head fork: WhiteSpace-Strippers/aws-sdk-php
compare: master
  • 1 commit
  • 376 files changed
  • 0 commit comments
  • 1 contributor
Showing with 29,358 additions and 29,358 deletions.
  1. +2 −2 CHANGELOG.md
  2. +18 −18 LICENSE.md
  3. +160 −160 README.md
  4. +188 −188 build.xml
  5. +5 −5 build/phar-stub.php
  6. +3 −3 build/vanity/bootstrap.php
  7. +9 −9 build/vanity/config.yml
  8. +28 −28 composer.json
  9. +29 −29 phpunit.functional.xml.dist
  10. +47 −47 phpunit.xml.dist
  11. +193 −193 src/Aws/CloudFront/CloudFrontClient.php
  12. +28 −28 src/Aws/CloudFront/CloudFrontSignature.php
  13. +2 −2 src/Aws/CloudFront/Enum/OriginProtocolPolicy.php
  14. +2 −2 src/Aws/CloudFront/Enum/ViewerProtocolPolicy.php
  15. +3,820 −3,820 src/Aws/CloudFront/Resources/client.php
  16. +14 −14 src/Aws/CloudFront/Waiter/DistributionDeployed.php
  17. +32 −32 src/Aws/CloudFront/Waiter/InvalidationCompleted.php
  18. +14 −14 src/Aws/CloudFront/Waiter/StreamingDistributionDeployed.php
  19. +67 −67 src/Aws/Common/Aws.php
  20. +197 −197 src/Aws/Common/Client/AbstractClient.php
  21. +36 −36 src/Aws/Common/Client/AbstractMissingFunctionOptionResolver.php
  22. +36 −36 src/Aws/Common/Client/AwsClientInterface.php
  23. +66 −66 src/Aws/Common/Client/BackoffOptionResolver.php
  24. +414 −414 src/Aws/Common/Client/ClientBuilder.php
  25. +46 −46 src/Aws/Common/Client/CredentialsOptionResolver.php
  26. +51 −51 src/Aws/Common/Client/DefaultClient.php
  27. +10 −10 src/Aws/Common/Client/OptionResolverInterface.php
  28. +40 −40 src/Aws/Common/Client/SignatureOptionResolver.php
  29. +59 −59 src/Aws/Common/Client/UploadBodyListener.php
  30. +28 −28 src/Aws/Common/Client/UserAgentListener.php
  31. +44 −44 src/Aws/Common/Command/AwsQueryVisitor.php
  32. +26 −26 src/Aws/Common/Command/JsonCommand.php
  33. +16 −16 src/Aws/Common/Command/QueryCommand.php
  34. +112 −112 src/Aws/Common/Credentials/AbstractCredentialsDecorator.php
  35. +34 −34 src/Aws/Common/Credentials/AbstractRefreshableCredentials.php
  36. +44 −44 src/Aws/Common/Credentials/CacheableCredentials.php
  37. +199 −199 src/Aws/Common/Credentials/Credentials.php
  38. +62 −62 src/Aws/Common/Credentials/CredentialsInterface.php
  39. +49 −49 src/Aws/Common/Credentials/RefreshableInstanceProfileCredentials.php
  40. +27 −27 src/Aws/Common/Enum.php
  41. +125 −125 src/Aws/Common/Enum/ClientOptions.php
  42. +5 −5 src/Aws/Common/Enum/DateFormat.php
  43. +20 −20 src/Aws/Common/Enum/Region.php
  44. +21 −21 src/Aws/Common/Enum/Size.php
  45. +14 −14 src/Aws/Common/Enum/Time.php
  46. +29 −29 src/Aws/Common/Enum/UaString.php
  47. +6 −6 src/Aws/Common/Exception/AwsExceptionInterface.php
  48. +8 −8 src/Aws/Common/Exception/ExceptionFactoryInterface.php
  49. +29 −29 src/Aws/Common/Exception/ExceptionListener.php
  50. +22 −22 src/Aws/Common/Exception/InstanceProfileCredentialsException.php
  51. +26 −26 src/Aws/Common/Exception/MultipartUploadException.php
  52. +61 −61 src/Aws/Common/Exception/NamespaceExceptionFactory.php
  53. +28 −28 src/Aws/Common/Exception/Parser/AbstractJsonExceptionParser.php
  54. +64 −64 src/Aws/Common/Exception/Parser/DefaultXmlExceptionParser.php
  55. +14 −14 src/Aws/Common/Exception/Parser/ExceptionParserInterface.php
  56. +10 −10 src/Aws/Common/Exception/Parser/JsonQueryExceptionParser.php
  57. +9 −9 src/Aws/Common/Exception/Parser/JsonRestExceptionParser.php
  58. +124 −124 src/Aws/Common/Exception/ServiceResponseException.php
  59. +52 −52 src/Aws/Common/Hash/ChunkHash.php
  60. +25 −25 src/Aws/Common/Hash/ChunkHashInterface.php
  61. +42 −42 src/Aws/Common/Hash/HashUtils.php
  62. +166 −166 src/Aws/Common/Hash/TreeHash.php
  63. +50 −50 src/Aws/Common/HostNameUtils.php
  64. +33 −33 src/Aws/Common/InstanceMetadata/InstanceMetadataClient.php
  65. +15 −15 src/Aws/Common/InstanceMetadata/Waiter/ServiceAvailable.php
  66. +120 −120 src/Aws/Common/Iterator/AwsResourceIterator.php
  67. +84 −84 src/Aws/Common/Iterator/AwsResourceIteratorFactory.php
  68. +207 −207 src/Aws/Common/Model/MultipartUpload/AbstractTransfer.php
  69. +124 −124 src/Aws/Common/Model/MultipartUpload/AbstractTransferState.php
  70. +121 −121 src/Aws/Common/Model/MultipartUpload/AbstractUploadBuilder.php
  71. +56 −56 src/Aws/Common/Model/MultipartUpload/AbstractUploadId.php
  72. +66 −66 src/Aws/Common/Model/MultipartUpload/AbstractUploadPart.php
  73. +26 −26 src/Aws/Common/Model/MultipartUpload/TransferInterface.php
  74. +59 −59 src/Aws/Common/Model/MultipartUpload/TransferStateInterface.php
  75. +14 −14 src/Aws/Common/Model/MultipartUpload/UploadIdInterface.php
  76. +20 −20 src/Aws/Common/Model/MultipartUpload/UploadPartInterface.php
  77. +49 −49 src/Aws/Common/Region/CachingEndpointProvider.php
  78. +120 −120 src/Aws/Common/Region/Endpoint.php
  79. +28 −28 src/Aws/Common/Region/EndpointProviderInterface.php
  80. +29 −29 src/Aws/Common/Region/Region.php
  81. +46 −46 src/Aws/Common/Region/Service.php
  82. +103 −103 src/Aws/Common/Region/XmlEndpointProvider.php
  83. +41 −41 src/Aws/Common/Resources/aws-config.php
  84. +1,363 −1,363 src/Aws/Common/Resources/endpoints.xml
  85. +120 −120 src/Aws/Common/Resources/sdk1-config.php
  86. +56 −56 src/Aws/Common/Signature/AbstractSignature.php
  87. +16 −16 src/Aws/Common/Signature/EndpointSignatureInterface.php
  88. +9 −9 src/Aws/Common/Signature/SignatureInterface.php
  89. +37 −37 src/Aws/Common/Signature/SignatureListener.php
  90. +65 −65 src/Aws/Common/Signature/SignatureV2.php
  91. +57 −57 src/Aws/Common/Signature/SignatureV3.php
  92. +22 −22 src/Aws/Common/Signature/SignatureV3Https.php
  93. +219 −219 src/Aws/Common/Signature/SignatureV4.php
  94. +49 −49 src/Aws/Common/Waiter/AbstractResourceWaiter.php
  95. +102 −102 src/Aws/Common/Waiter/AbstractWaiter.php
  96. +35 −35 src/Aws/Common/Waiter/CallableWaiter.php
  97. +16 −16 src/Aws/Common/Waiter/ResourceWaiterInterface.php
  98. +49 −49 src/Aws/Common/Waiter/WaiterClassFactory.php
  99. +8 −8 src/Aws/Common/Waiter/WaiterFactoryInterface.php
  100. +38 −38 src/Aws/Common/Waiter/WaiterInterface.php
  101. +77 −77 src/Aws/DataPipeline/DataPipelineClient.php
  102. +3 −3 src/Aws/DataPipeline/Enum/WorkStatus.php
  103. +1,523 −1,523 src/Aws/DataPipeline/Resources/client.php
  104. +33 −33 src/Aws/DynamoDb/Crc32ErrorChecker.php
  105. +155 −155 src/Aws/DynamoDb/DynamoDbClient.php
  106. +3 −3 src/Aws/DynamoDb/Enum/AttributeAction.php
  107. +13 −13 src/Aws/DynamoDb/Enum/ComparisonOperator.php
  108. +5 −5 src/Aws/DynamoDb/Enum/ReturnValue.php
  109. +3 −3 src/Aws/DynamoDb/Enum/ScalarAttributeType.php
  110. +4 −4 src/Aws/DynamoDb/Enum/TableStatus.php
  111. +12 −12 src/Aws/DynamoDb/Enum/Type.php
  112. +1 −1  src/Aws/DynamoDb/Exception/ServiceUnavailableException.php
  113. +45 −45 src/Aws/DynamoDb/Exception/UnprocessedWriteRequestsException.php
  114. +15 −15 src/Aws/DynamoDb/Iterator/BatchGetItemIterator.php
  115. +21 −21 src/Aws/DynamoDb/Iterator/ScanIterator.php
  116. +214 −214 src/Aws/DynamoDb/Model/Attribute.php
  117. +11 −11 src/Aws/DynamoDb/Model/BatchRequest/AbstractWriteRequest.php
  118. +59 −59 src/Aws/DynamoDb/Model/BatchRequest/DeleteRequest.php
  119. +62 −62 src/Aws/DynamoDb/Model/BatchRequest/PutRequest.php
  120. +22 −22 src/Aws/DynamoDb/Model/BatchRequest/UnprocessedRequest.php
  121. +71 −71 src/Aws/DynamoDb/Model/BatchRequest/WriteRequestBatch.php
  122. +170 −170 src/Aws/DynamoDb/Model/BatchRequest/WriteRequestBatchTransfer.php
  123. +6 −6 src/Aws/DynamoDb/Model/BatchRequest/WriteRequestInterface.php
  124. +207 −207 src/Aws/DynamoDb/Model/Item.php
  125. +3,403 −3,403 src/Aws/DynamoDb/Resources/client.php
  126. +80 −80 src/Aws/DynamoDb/Session/LockingStrategy/AbstractLockingStrategy.php
  127. +49 −49 src/Aws/DynamoDb/Session/LockingStrategy/LockingStrategyFactory.php
  128. +9 −9 src/Aws/DynamoDb/Session/LockingStrategy/LockingStrategyFactoryInterface.php
  129. +26 −26 src/Aws/DynamoDb/Session/LockingStrategy/LockingStrategyInterface.php
  130. +37 −37 src/Aws/DynamoDb/Session/LockingStrategy/NullLockingStrategy.php
  131. +78 −78 src/Aws/DynamoDb/Session/LockingStrategy/PessimisticLockingStrategy.php
  132. +380 −380 src/Aws/DynamoDb/Session/SessionHandler.php
  133. +52 −52 src/Aws/DynamoDb/Session/SessionHandlerConfig.php
  134. +36 −36 src/Aws/DynamoDb/ThrottlingErrorChecker.php
  135. +23 −23 src/Aws/DynamoDb/Waiter/TableExists.php
  136. +18 −18 src/Aws/DynamoDb/Waiter/TableNotExists.php
  137. +2 −2 src/Aws/Glacier/Enum/Action.php
  138. +3 −3 src/Aws/Glacier/Enum/StatusCode.php
  139. +92 −92 src/Aws/Glacier/GlacierClient.php
  140. +32 −32 src/Aws/Glacier/GlacierUploadListener.php
  141. +63 −63 src/Aws/Glacier/Model/MultipartUpload/AbstractTransfer.php
  142. +42 −42 src/Aws/Glacier/Model/MultipartUpload/ParallelTransfer.php
  143. +23 −23 src/Aws/Glacier/Model/MultipartUpload/SerialTransfer.php
  144. +43 −43 src/Aws/Glacier/Model/MultipartUpload/TransferState.php
  145. +186 −186 src/Aws/Glacier/Model/MultipartUpload/UploadBuilder.php
  146. +8 −8 src/Aws/Glacier/Model/MultipartUpload/UploadId.php
  147. +73 −73 src/Aws/Glacier/Model/MultipartUpload/UploadPart.php
  148. +110 −110 src/Aws/Glacier/Model/MultipartUpload/UploadPartContext.php
  149. +240 −240 src/Aws/Glacier/Model/MultipartUpload/UploadPartGenerator.php
  150. +1,490 −1,490 src/Aws/Glacier/Resources/client.php
  151. +18 −18 src/Aws/Glacier/Waiter/VaultExists.php
  152. +18 −18 src/Aws/Glacier/Waiter/VaultNotExists.php
  153. +2 −2 src/Aws/Route53/Enum/Action.php
  154. +10 −10 src/Aws/Route53/Enum/RecordType.php
  155. +2 −2 src/Aws/Route53/Enum/Status.php
  156. +1 −1  src/Aws/Route53/Exception/HostedZoneNotEmptyException.php
  157. +888 −888 src/Aws/Route53/Resources/client.php
  158. +102 −102 src/Aws/Route53/Route53Client.php
  159. +42 −42 src/Aws/S3/AcpListener.php
  160. +53 −53 src/Aws/S3/BucketStyleListener.php
  161. +7 −7 src/Aws/S3/Enum/CannedAcl.php
  162. +3 −3 src/Aws/S3/Enum/GranteeType.php
  163. +3 −3 src/Aws/S3/Enum/Group.php
  164. +5 −5 src/Aws/S3/Enum/Permission.php
  165. +3 −3 src/Aws/S3/Enum/Storage.php
  166. +22 −22 src/Aws/S3/Exception/DeleteMultipleObjectsException.php
  167. +26 −26 src/Aws/S3/Exception/Parser/S3ExceptionParser.php
  168. +15 −15 src/Aws/S3/Iterator/ListBucketsIterator.php
  169. +13 −13 src/Aws/S3/Iterator/ListMultipartUploadsIterator.php
  170. +15 −15 src/Aws/S3/Iterator/ListObjectVersionsIterator.php
  171. +35 −35 src/Aws/S3/Iterator/ListObjectsIterator.php
  172. +214 −214 src/Aws/S3/Model/Acp.php
  173. +108 −108 src/Aws/S3/Model/AcpBuilder.php
  174. +157 −157 src/Aws/S3/Model/ClearBucket.php
  175. +48 −48 src/Aws/S3/Model/DeleteObjectsBatch.php
  176. +100 −100 src/Aws/S3/Model/DeleteObjectsTransfer.php
  177. +99 −99 src/Aws/S3/Model/Grant.php
  178. +213 −213 src/Aws/S3/Model/Grantee.php
  179. +64 −64 src/Aws/S3/Model/MultipartUpload/AbstractTransfer.php
  180. +94 −94 src/Aws/S3/Model/MultipartUpload/ParallelTransfer.php
  181. +48 −48 src/Aws/S3/Model/MultipartUpload/SerialTransfer.php
  182. +11 −11 src/Aws/S3/Model/MultipartUpload/TransferState.php
  183. +232 −232 src/Aws/S3/Model/MultipartUpload/UploadBuilder.php
  184. +8 −8 src/Aws/S3/Model/MultipartUpload/UploadId.php
  185. +42 −42 src/Aws/S3/Model/MultipartUpload/UploadPart.php
  186. +209 −209 src/Aws/S3/Model/PostObject.php
  187. +4,543 −4,543 src/Aws/S3/Resources/client.php
  188. +303 −303 src/Aws/S3/S3Client.php
  189. +171 −171 src/Aws/S3/S3Signature.php
  190. +18 −18 src/Aws/S3/S3SignatureInterface.php
  191. +10 −10 src/Aws/S3/Waiter/BucketExists.php
  192. +10 −10 src/Aws/S3/Waiter/BucketNotExists.php
  193. +25 −25 src/Aws/S3/Waiter/ObjectExists.php
  194. +298 −298 src/Aws/Sts/Resources/client.php
  195. +65 −65 src/Aws/Sts/StsClient.php
  196. +18 −18 test_services.json.dist
  197. +100 −100 tests/Aws/Tests/CloudFront/CloudFrontClientTest.php
  198. +24 −24 tests/Aws/Tests/CloudFront/CloudFrontSignatureTest.php
  199. +188 −188 tests/Aws/Tests/CloudFront/Integration/BasicOperationsTest.php
  200. +30 −30 tests/Aws/Tests/CloudFront/Integration/IteratorsTest.php
  201. +21 −21 tests/Aws/Tests/CloudFront/Waiter/DistributionDeployedTest.php
  202. +30 −30 tests/Aws/Tests/CloudFront/Waiter/InvalidationCompletedTest.php
  203. +21 −21 tests/Aws/Tests/CloudFront/Waiter/StreamingDistributionDeployedTest.php
  204. +20 −20 tests/Aws/Tests/Common/AwsTest.php
  205. +176 −176 tests/Aws/Tests/Common/Client/AbstractClientTest.php
  206. +22 −22 tests/Aws/Tests/Common/Client/AbstractMissingFunctionOptionResolverTest.php
  207. +69 −69 tests/Aws/Tests/Common/Client/BackoffOptionResolverTest.php
  208. +104 −104 tests/Aws/Tests/Common/Client/ClientBuilderTest.php
Sorry, we could not display the entire diff because too many files (376) changed.
4 CHANGELOG.md
View
@@ -14,14 +14,14 @@ CHANGELOG
------------------
* Fixed an issue with the Amazon S3 client where non-DNS compatible buckets that was previously causing a signature
- mismatch error
+ mismatch error
* Fixed an issue with the service description for the Amazon S3 `UploadPart` operation so that it works correctly
* Fixed an issue with the Amazon S3 service description dealing with `response-*` query parameters of `GetObject`
* Fixed an issue with the Amazon S3 client where object keys prefixed by the bucket name were being treated incorrectly
* Fixed an issue with `Aws\S3\Model\MultipartUpload\ParallelTransfer` class
* Added support for the `AssumeRole` operation for AWS STS
* Added a the `UploadBodyListener` which allows upload operations in Amazon S3 and Amazon Glacier to accept file handles
- in the `Body` parameter and file paths in the `SourceFile` parameter
+ in the `Body` parameter and file paths in the `SourceFile` parameter
* Added Content-Type guessing for uploads
* Added new region endpoints, including sa-east-1 and us-gov-west-1 for Amazon DynamoDB
* Added methods to `Aws\S3\Model\MultipartUpload\UploadBuilder` class to make setting ACL and Content-Type easier
36 LICENSE.md
View
@@ -73,24 +73,24 @@ License for that Work shall terminate as of the date such litigation is filed.
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You meet the following conditions:
- 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
-
- 2. You must cause any modified files to carry prominent notices stating that You changed the files; and
-
- 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent,
- trademark, and attribution notices from the Source form of the Work, excluding those notices that do
- not pertain to any part of the Derivative Works; and
-
- 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that
- You distribute must include a readable copy of the attribution notices contained within such NOTICE
- file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed as part of the Derivative Works; within
- the Source form or documentation, if provided along with the Derivative Works; or, within a display
- generated by the Derivative Works, if and wherever such third-party notices normally appear. The
- contents of the NOTICE file are for informational purposes only and do not modify the License. You may
- add Your own attribution notices within Derivative Works that You distribute, alongside or as an
- addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be
- construed as modifying the License.
+ 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+ 2. You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+ 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent,
+ trademark, and attribution notices from the Source form of the Work, excluding those notices that do
+ not pertain to any part of the Derivative Works; and
+
+ 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that
+ You distribute must include a readable copy of the attribution notices contained within such NOTICE
+ file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed as part of the Derivative Works; within
+ the Source form or documentation, if provided along with the Derivative Works; or, within a display
+ generated by the Derivative Works, if and wherever such third-party notices normally appear. The
+ contents of the NOTICE file are for informational purposes only and do not modify the License. You may
+ add Your own attribution notices within Derivative Works that You distribute, alongside or as an
+ addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be
+ construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license
terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative
320 README.md
View
@@ -16,20 +16,20 @@ phar file](http://pear.amazonwebservices.com/get/aws.phar).
1. **[New Features](#new-features)**
1. **[Before Using the SDK](#before-using-the-sdk)**
- * [Signing Up for AWS](#signing-up-for-aws)
- * [To sign up for AWS](#to-sign-up-for-aws)
- * [To view your AWS credentials](#to-view-your-aws-credentials)
- * [Getting your AWS credentials](#getting-your-aws-credentials)
- * [Minimum requirements](#minimum-requirements)
+ * [Signing Up for AWS](#signing-up-for-aws)
+ * [To sign up for AWS](#to-sign-up-for-aws)
+ * [To view your AWS credentials](#to-view-your-aws-credentials)
+ * [Getting your AWS credentials](#getting-your-aws-credentials)
+ * [Minimum requirements](#minimum-requirements)
1. **[Installing the SDK](#installing-the-sdk)**
- * [Installing via Composer](#installing-via-composer)
- * [Installing via Phar](#installing-via-phar)
- * [Installing via PEAR](#installing-via-pear)
+ * [Installing via Composer](#installing-via-composer)
+ * [Installing via Phar](#installing-via-phar)
+ * [Installing via PEAR](#installing-via-pear)
1. **[Using the SDK](#using-the-sdk)**
- * [Quick Start](#quick-start)
- * [Using the Service Builder](#using-the-service-builder)
- * [Configuration](#configuration)
- * [Using a Custom Configuration File](#using-a-custom-configuration-file)
+ * [Quick Start](#quick-start)
+ * [Using the Service Builder](#using-the-service-builder)
+ * [Configuration](#configuration)
+ * [Using a Custom Configuration File](#using-a-custom-configuration-file)
1. **[More Examples](#more-examples)**
1. **[Contributing to the SDK](#contributing-to-the-sdk)**
@@ -40,7 +40,7 @@ phar file](http://pear.amazonwebservices.com/get/aws.phar).
- Built on [Guzzle](http://guzzlephp.org) and utilizes the Guzzle feature set
- Persistent connection management for both serial and parallel requests
- Event hooks (via [Symfony2 EventDispatcher](http://symfony.com/doc/2.0/components/event_dispatcher/introduction.html))
- for event-driven, custom behavior
+ for event-driven, custom behavior
- Request and response entity bodies are stored in `php://temp` streams to reduce memory usage
- Transient networking and cURL failures are automatically retried using truncated exponential backoff
- Plug-ins for over-the-wire logging and response caching
@@ -56,7 +56,7 @@ phar file](http://pear.amazonwebservices.com/get/aws.phar).
- [Phing](http://phing.info) `build.xml` for installing dev tools, driving testing, and producing `.phar` files
- Fast Amazon DynamoDB batch PutItem and DeleteItem system
- Multipart upload system for Amazon Simple Storage Service (Amazon S3) and Amazon Glacier that can be paused and
- resumed.
+ resumed.
- Redesigned DynamoDB Session Handler
- Improved multi-region support
@@ -85,7 +85,7 @@ charges and account activity and download usage reports.
1. Under **Your Account**, click **Security Credentials**.
1. In the spaces provided, type your user name and password, and then click **Sign in using our secure server**.
1. Under **Access Credentials**, on the **Access Keys** tab, your access key ID is displayed. To view your secret key,
- under **Secret Access Key**, click **Show**.
+ under **Secret Access Key**, click **Show**.
Your secret key must remain a secret that is known only by you and AWS. Keep it confidential in order to protect your
account. Store it securely in a safe place, and never email it. Do not share it outside your organization, even if an
@@ -100,9 +100,9 @@ To get your AWS Access Key ID and Secret Access Key
- Go to http://aws.amazon.com/.
- Click **Account** and then click **Security Credentials**. The Security Credentials page displays (you might be
- prompted to log in).
+ prompted to log in).
- Scroll down to Access Credentials and make sure the **Access Keys** tab is selected. The AWS Access Key ID appears in
- the Access Key column.
+ the Access Key column.
- To view the Secret Access Key, click **Show**.
**Important: your Secret Access Key is a secret**, which only you and AWS should know. It is important to keep it
@@ -117,16 +117,16 @@ few minimum system requirements to start using the AWS SDK for PHP 2. The extens
with PHP 5.3 by default in most environments.
- Minimum requirements
- - PHP 5.3.2+ compiled with the cURL extension
- - A recent version of cURL 7.16.2+ compiled with OpenSSL and zlib
+ - PHP 5.3.2+ compiled with the cURL extension
+ - A recent version of cURL 7.16.2+ compiled with OpenSSL and zlib
- To use Amazon CloudFront private distributions, you must have the [OpenSSL PHP extension](http://us2.php.net/openssl)
- (which is not the same as any low-level OpenSSL libraries you may have installed on your system) to sign private
- CloudFront URLs.
+ (which is not the same as any low-level OpenSSL libraries you may have installed on your system) to sign private
+ CloudFront URLs.
- To improve the overall performance of your PHP environment, as well as to enable in-memory caching, it is **highly
- recommended** that you install an [opcode cache](https://secure.wikimedia.org/wikipedia/en/wiki/PHP_accelerator) such
- as [APC](http://php.net/apc), [XCache](http://xcache.lighttpd.net), or another extension that can be used by
- [Doctrine\Common\Cache](https://github.com/doctrine/common/tree/master/lib/Doctrine/Common/Cache>). For APC, it is
- recommended that you set the `apc.shm_size` INI setting to be `64MB` or higher.
+ recommended** that you install an [opcode cache](https://secure.wikimedia.org/wikipedia/en/wiki/PHP_accelerator) such
+ as [APC](http://php.net/apc), [XCache](http://xcache.lighttpd.net), or another extension that can be used by
+ [Doctrine\Common\Cache](https://github.com/doctrine/common/tree/master/lib/Doctrine/Common/Cache>). For APC, it is
+ recommended that you set the `apc.shm_size` INI setting to be `64MB` or higher.
## Installing the SDK
@@ -138,31 +138,31 @@ your project. In order to use the AWS SDK for PHP 2 through Composer, you must d
1. Add `"aws/aws-sdk-php"` as a dependency in your project's `composer.json` file.
- ```json
- {
- "require": {
- "aws/aws-sdk-php": "2.*"
- }
- }
- ```
+ ```json
+ {
+ "require": {
+ "aws/aws-sdk-php": "2.*"
+ }
+ }
+ ```
- Consider tightening your dependencies to a known version when deploying mission critical applications (e.g.,
- `2.0.*`).
+ Consider tightening your dependencies to a known version when deploying mission critical applications (e.g.,
+ `2.0.*`).
1. Download and install Composer.
- curl -s "http://getcomposer.org/installer" | php
+ curl -s "http://getcomposer.org/installer" | php
1. Install your dependencies.
- php composer.phar install
+ php composer.phar install
1. Require Composer's autoloader.
- Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries
- that it downloads. To use it, just add the following line to your code's bootstrap process.
+ Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries
+ that it downloads. To use it, just add the following line to your code's bootstrap process.
- require '/path/to/sdk/vendor/autoload.php';
+ require '/path/to/sdk/vendor/autoload.php';
You can find out more on how to install Composer, configure autoloading, and other best-practices for defining
dependencies at [getcomposer.org](http://getcomposer.org).
@@ -174,21 +174,21 @@ containing all of the classes and dependencies you need to run the SDK. Addition
registers a class autoloader for the AWS SDK for PHP and all of its dependencies when included. Bundled with the phar
file are the following required and suggested libraries:
-- [Guzzle](https://github.com/guzzle/guzzle) for HTTP requests
-- [Symfony2 EventDispatcher](http://symfony.com/doc/master/components/event_dispatcher/introduction.html) for events
-- [Monolog](https://github.com/seldaek/monolog) for logging
-- [Doctrine](https://github.com/doctrine/common) for caching
+- [Guzzle](https://github.com/guzzle/guzzle) for HTTP requests
+- [Symfony2 EventDispatcher](http://symfony.com/doc/master/components/event_dispatcher/introduction.html) for events
+- [Monolog](https://github.com/seldaek/monolog) for logging
+- [Doctrine](https://github.com/doctrine/common) for caching
You can download the packaged Phar at http://pear.amazonwebservices.com/get/aws.phar. Simply include it in your scripts
to get started:
- require 'aws.phar';
+ require 'aws.phar';
**Note:** If you are using PHP with the Suhosin patch (especially common on Ubuntu and Debian distributions), you will
need to enable the use of phars in the `suhosin.ini`. Without this, including a phar file in your code will cause it to
silently fail. You should modify the `suhosin.ini` file by adding the line:
- suhosin.executor.include.whitelist = phar
+ suhosin.executor.include.whitelist = phar
### Installing via PEAR
@@ -202,11 +202,11 @@ any PHP project. PEAR packages are not specific to your project, but rather to t
From the command-line, you can install the SDK with PEAR as follows. _**Note:** You may need to use `sudo` for the
following command._
- pear -D auto_discover=1 install pear.amazonwebservices.com/sdk
+ pear -D auto_discover=1 install pear.amazonwebservices.com/sdk
Once the SDK has been installed via PEAR, you can load the phar into your project with:
- require 'AWSSDKforPHP/aws.phar';
+ require 'AWSSDKforPHP/aws.phar';
## Using the SDK
@@ -226,26 +226,26 @@ use Aws\Common\Enum\Region;
// Instantiate the DynamoDB client with your AWS credentials
$client = DynamoDbClient::factory(array(
- 'key' => 'your-aws-access-key-id',
- 'secret' => 'your-aws-secret-access-key',
- 'region' => Region::US_WEST_2
+ 'key' => 'your-aws-access-key-id',
+ 'secret' => 'your-aws-secret-access-key',
+ 'region' => Region::US_WEST_2
));
$table = 'posts';
// Create a "posts" table
$result = $client->createTable(array(
- 'TableName' => $table,
- 'KeySchema' => array(
- 'HashKeyElement' => array(
- 'AttributeName' => 'slug',
- 'AttributeType' => 'S'
- )
- ),
- 'ProvisionedThroughput' => array(
- 'ReadCapacityUnits' => 10,
- 'WriteCapacityUnits' => 5
- )
+ 'TableName' => $table,
+ 'KeySchema' => array(
+ 'HashKeyElement' => array(
+ 'AttributeName' => 'slug',
+ 'AttributeType' => 'S'
+ )
+ ),
+ 'ProvisionedThroughput' => array(
+ 'ReadCapacityUnits' => 10,
+ 'WriteCapacityUnits' => 5
+ )
));
// Wait until the table is created and active
@@ -286,9 +286,9 @@ several commands in parallel. It also supports a chainable syntax.
<?php
$result = $client->getCommand('ListTables')
- ->set('Limit', 5)
- ->set('ExclusiveStartTableName', 'some-table-name')
- ->getResult();
+ ->set('Limit', 5)
+ ->set('ExclusiveStartTableName', 'some-table-name')
+ ->getResult();
```
### Using the Service Builder
@@ -320,9 +320,9 @@ use Aws\DynamoDb\Exception\DynamoDbException;
// Create a service building using shared credentials for each service
$aws = Aws::factory(array(
- 'key' => 'your-aws-access-key-id',
- 'secret' => 'your-aws-secret-access-key',
- 'region' => Region::US_WEST_2
+ 'key' => 'your-aws-access-key-id',
+ 'secret' => 'your-aws-secret-access-key',
+ 'region' => Region::US_WEST_2
));
// Retrieve the DynamoDB client by its short name from the service builder
@@ -330,17 +330,17 @@ $client = $aws->get('dynamodb');
// Get an item from the "posts"
try {
- $result = $client->getItem(array(
- 'TableName' => 'posts',
- 'Key' => $client->formatAttributes(array(
- 'HashKeyElement' => 'using-dynamodb-with-the-php-sdk'
- )),
- 'ConsistentRead' => true
- ));
-
- print_r($result['Item']);
+ $result = $client->getItem(array(
+ 'TableName' => 'posts',
+ 'Key' => $client->formatAttributes(array(
+ 'HashKeyElement' => 'using-dynamodb-with-the-php-sdk'
+ )),
+ 'ConsistentRead' => true
+ ));
+
+ print_r($result['Item']);
} catch (DynamoDbException $e) {
- echo 'The item could not be retrieved.';
+ echo 'The item could not be retrieved.';
}
```
@@ -358,19 +358,19 @@ Excerpt from `src/Aws/Common/Resources/aws-config.php`:
```php
<?php
return array(
- 'services' => array(
- 'default_settings' => array(
- 'params' => array()
- ),
- 'dynamodb' => array(
- 'extends' => 'default_settings',
- 'class' => 'Aws\DynamoDb\DynamoDbClient'
- ),
- 's3' => array(
- 'extends' => 'default_settings',
- 'class' => 'Aws\S3\S3Client'
- )
- )
+ 'services' => array(
+ 'default_settings' => array(
+ 'params' => array()
+ ),
+ 'dynamodb' => array(
+ 'extends' => 'default_settings',
+ 'class' => 'Aws\DynamoDb\DynamoDbClient'
+ ),
+ 's3' => array(
+ 'extends' => 'default_settings',
+ 'class' => 'Aws\S3\S3Client'
+ )
+ )
);
```
@@ -394,16 +394,16 @@ service:
```php
<?php
return array(
- 'includes' => array('_aws'),
- 'services' => array(
- 'default_settings' => array(
- 'params' => array(
- 'key' => 'your-aws-access-key-id',
- 'secret' => 'your-aws-secret-access-key',
- 'region' => 'us-west-2'
- )
- )
- )
+ 'includes' => array('_aws'),
+ 'services' => array(
+ 'default_settings' => array(
+ 'params' => array(
+ 'key' => 'your-aws-access-key-id',
+ 'secret' => 'your-aws-secret-access-key',
+ 'region' => 'us-west-2'
+ )
+ )
+ )
);
```
@@ -424,25 +424,25 @@ You can create custom named services if you need to use multiple accounts with t
```php
<?php
return array(
- 'includes' => array('_aws'),
- 'services' => array(
- 'foo.dynamodb' => array(
- 'extends' => 'dynamodb',
- 'params' => array(
- 'key' => 'your-aws-access-key-id-for-foo',
- 'secret' => 'your-aws-secret-access-key-for-foo',
- 'region' => 'us-west-2'
- )
- ),
- 'bar.dynamodb' => array(
- 'extends' => 'dynamodb',
- 'params' => array(
- 'key' => 'your-aws-access-key-id-for-bar',
- 'secret' => 'your-aws-secret-access-key-for-bar',
- 'region' => 'us-west-2'
- )
- )
- )
+ 'includes' => array('_aws'),
+ 'services' => array(
+ 'foo.dynamodb' => array(
+ 'extends' => 'dynamodb',
+ 'params' => array(
+ 'key' => 'your-aws-access-key-id-for-foo',
+ 'secret' => 'your-aws-secret-access-key-for-foo',
+ 'region' => 'us-west-2'
+ )
+ ),
+ 'bar.dynamodb' => array(
+ 'extends' => 'dynamodb',
+ 'params' => array(
+ 'key' => 'your-aws-access-key-id-for-bar',
+ 'secret' => 'your-aws-secret-access-key-for-bar',
+ 'region' => 'us-west-2'
+ )
+ )
+ )
);
```
@@ -450,16 +450,16 @@ If you prefer JSON syntax, you can define your configuration in JSON format inst
```json
{
- "includes": ["_aws"],
- "services": {
- "default_settings": {
- "params": {
- "key": "your-aws-access-key-id",
- "secret": "your-aws-secret-access-key",
- "region": "us-west-2"
- }
- }
- }
+ "includes": ["_aws"],
+ "services": {
+ "default_settings": {
+ "params": {
+ "key": "your-aws-access-key-id",
+ "secret": "your-aws-secret-access-key",
+ "region": "us-west-2"
+ }
+ }
+ }
}
```
@@ -481,14 +481,14 @@ $s3 = Aws::factory('/path/to/config.php')->get('s3');
// Upload a publicly accessible file. File size, file type, and md5 hash are automatically calculated by the SDK
try {
- $s3->putObject(array(
- 'Bucket' => 'my-bucket',
- 'Key' => 'my-object',
- 'Body' => fopen('/path/to/file', 'r'),
- 'ACL' => CannedAcl::PUBLIC_READ
- ));
+ $s3->putObject(array(
+ 'Bucket' => 'my-bucket',
+ 'Key' => 'my-object',
+ 'Body' => fopen('/path/to/file', 'r'),
+ 'ACL' => CannedAcl::PUBLIC_READ
+ ));
} catch (S3Exception $e) {
- echo "The file was not uploaded.\n";
+ echo "The file was not uploaded.\n";
}
```
@@ -505,9 +505,9 @@ use Aws\Common\Aws;
$s3 = Aws::factory('/path/to/config.php')->get('s3');
foreach ($s3->getIterator('ListBuckets') as $bucket) {
- foreach ($s3->getIterator('ListObjects', array('Bucket' => $bucket['Name'])) as $object) {
- echo $bucket['Name'] . '/' . $object['Key'] . PHP_EOL;
- }
+ foreach ($s3->getIterator('ListObjects', array('Bucket' => $bucket['Name'])) as $object) {
+ echo $bucket['Name'] . '/' . $object['Key'] . PHP_EOL;
+ }
}
```
@@ -528,20 +528,20 @@ $s3 = Aws::factory('/path/to/config.php')->get('s3');
// Prepare the upload parameters
$uploader = UploadBuilder::newInstance()
- ->setClient($s3)
- ->setSource('/path/to/large/file.mov')
- ->setBucket('my-bucket')
- ->setKey('my-object-key')
- ->setMinPartSize(10 * Size::MB)
- ->build();
+ ->setClient($s3)
+ ->setSource('/path/to/large/file.mov')
+ ->setBucket('my-bucket')
+ ->setKey('my-object-key')
+ ->setMinPartSize(10 * Size::MB)
+ ->build();
// Perform the upload. Abort the upload if something goes wrong
try {
- $uploader->upload();
- echo "Upload complete.\n";
+ $uploader->upload();
+ echo "Upload complete.\n";
} catch (MultipartUploadException $e) {
- $uploader->abort();
- echo "Upload failed.\n";
+ $uploader->abort();
+ echo "Upload failed.\n";
}
```
@@ -554,19 +554,19 @@ version 2 of the SDK, we've tried to make our development even more open than be
GitHub. Here are a few things to keep in mind for your contributions:
1. The SDK is released under the [Apache license](http://aws.amazon.com/apache2.0/). Any code you submit will be
- released under that license. For substantial contributions, we may ask you to sign a [Contributor License Agreement
- (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement).
+ released under that license. For substantial contributions, we may ask you to sign a [Contributor License Agreement
+ (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement).
2. We follow the [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md),
- [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), and
- [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) recommendations
- from the [PHP Framework Interop Group](http://php-fig.org). Please submit code that follows these standards. The
- [PHP CS Fixer](http://cs.sensiolabs.org/) tool can be helpful for formatting your code.
+ [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), and
+ [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) recommendations
+ from the [PHP Framework Interop Group](http://php-fig.org). Please submit code that follows these standards. The
+ [PHP CS Fixer](http://cs.sensiolabs.org/) tool can be helpful for formatting your code.
3. We maintain a high percentage of code coverage in our unit tests. If you make changes to the code, please add,
- update, and/or remove unit (and integration) tests as appropriate.
+ update, and/or remove unit (and integration) tests as appropriate.
4. We do not accept pull requests that change `client.php` files (i.e., `src/Aws/*/Resources/client.php`). We generate
- these files based on our internal knowledge of the AWS services.
+ these files based on our internal knowledge of the AWS services.
5. If your code does not conform to the PSR standards or does not include adequate tests, we may ask you to update your
- pull requests before we accept them. We also reserve the right to deny any pull requests that do not align with our
- standards or goals.
+ pull requests before we accept them. We also reserve the right to deny any pull requests that do not align with our
+ standards or goals.
6. If you would like to implement support for an AWS service that is not yet available in the SDK, please talk to us
- beforehand to avoid any duplication of effort.
+ beforehand to avoid any duplication of effort.
376 build.xml
View
@@ -1,193 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="aws-sdk-for-php" default="test">
- <property name="dir.output" value="${project.basedir}/build/artifacts" />
- <property name="coverage" value="false" />
- <property name="mock" value="false" />
- <property name="min" value="false" />
- <property name="sdk_url" value="http://aws.amazon.com/sdkforphp2" />
-
- <fileset id="src_files" dir="${project.basedir}/src" includes="**/*.php" />
-
- <target name="test" description="Run unit tests" depends="test-init">
- <exec passthru="true" command="vendor/bin/phpunit" />
- </target>
-
- <target name="integration" description="Run integration tests">
- <if>
- <available file="phpunit.functional.xml" />
- <then>
- <if>
- <equals arg1="${mock}" arg2="true" />
- <then>
- <echo>php -d mock=true `which phpunit` -c phpunit.functional.xml</echo>
- <exec passthru="true" command="php -d mock=true `which phpunit` -c phpunit.functional.xml" />
- </then>
- <else>
- <exec passthru="true" command="phpunit -c phpunit.functional.xml" />
- </else>
- </if>
- </then>
- <else>
- <fail>You must copy phpunit.functional.dist to phpunit.functional.xml and modify the appropriate property settings</fail>
- </else>
- </if>
- </target>
-
- <target name="phar" description="Create a phar with an autoloader">
- <phingcall target="test-init" />
- <pharpackage destfile="build/aws.phar" stub="build/phar-stub.php" basedir=".">
- <fileset dir=".">
- <!-- Add AWS classes -->
- <include name="src/**/*.php" />
- <include name="src/**/*.json" />
- <include name="src/**/*.xml" />
- <!-- Include the Symfony2 class loader component -->
- <include name="vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php" />
- <!-- Install Guzzle and its dependencies -->
- <include name="vendor/guzzle/guzzle/src/**/*.php" />
- <include name="vendor/guzzle/guzzle/**/*.pem" />
- <include name="vendor/symfony/event-dispatcher/**/*.php" />
- <include name="vendor/doctrine/common/lib/Doctrine/Common/Cache/*.php" />
- <include name="vendor/monolog/monolog/src/**/*.php" />
- </fileset>
- <metadata>
- <element name="link" value="${sdk_url}" />
- </metadata>
- </pharpackage>
- <exec command="php -d aws_phar=aws.phar `which phpunit`" passthru="true" />
- </target>
-
- <target name="composer-init" description="Downloads a local copy of composer.phar if necessary">
- <if>
- <available file="composer.phar" />
- <then>
- <echo>Composer is installed</echo>
- </then>
- <else>
- <echo message="Installing composer" />
- <exec command="curl -s http://getcomposer.org/installer | php" passthru="true" />
- <exec command="php composer.phar install --dev" passthru="true" />
- </else>
- </if>
- </target>
-
- <target name="test-init" description="Initialize test dependencies" depends="composer-init">
- <copy file="phpunit.xml.dist" tofile="phpunit.xml" overwrite="false" />
- <copy file="phpunit.functional.xml.dist" tofile="phpunit.functional.xml" overwrite="false" />
- <copy file="test_services.json.dist" tofile="test_services.json" overwrite="false" />
- </target>
-
- <target name="clean" description="Deletes build artifacts">
- <delete dir="${dir.output}"/>
- </target>
-
- <target name="prepare" depends="clean,test-init">
- <mkdir dir="${dir.output}"/>
- <mkdir dir="${dir.output}/logs" />
- </target>
-
- <target name="clean-dependencies" description="Deletes all dependencies downloaded by Composer">
- <delete dir="${project.basedir}/vendor"/>
- <delete file="composer.lock" />
- </target>
-
- <target name="update-dependencies" depends="composer-init" description="Updates Composer dependencies">
- <exec command="php composer.phar update --dev" passthru="true" />
- </target>
-
- <target name="coverage">
- <mkdir dir="${dir.output}/logs" />
- <exec passthru="true" command="phpunit --coverage-html=${dir.output}/coverage --coverage-clover=${dir.output}/logs/clover.xml" />
- </target>
-
- <target name="view-coverage">
- <exec passthru="true" command="open ${dir.output}/coverage/index.html" />
- </target>
-
- <target name="phpdepend">
- <delete dir="${dir.output}/pdepend" includeemptydirs="true" verbose="true" failonerror="true" />
- <mkdir dir="${dir.output}/pdepend" />
- <phpdepend>
- <fileset refid="src_files" />
- <analyzer type="coderank-mode" value="method"/>
- <logger type="jdepend-chart" outfile="${dir.output}/pdepend/jdepend-chart.svg" />
- <logger type="overview-pyramid" outfile="${dir.output}/pdepend/overview-pyramid.svg" />
- <logger type="jdepend-chart" outfile="${dir.output}/pdepend/jdepend-chart.png" />
- <logger type="overview-pyramid" outfile="${dir.output}/pdepend/overview-pyramid.png" />
- <logger type="jdepend-xml" outfile="${dir.output}/pdepend/jdepend.xml" />
- <logger type="phpunit-xml" outfile="${dir.output}/pdepend/phpunit.xml" />
- <logger type="summary-xml" outfile="${dir.output}/pdepend/summary.xml" />
- </phpdepend>
- </target>
-
- <target name="phpcs">
- <delete dir="${dir.output}/phpcs" includeemptydirs="true" verbose="true" failonerror="true" />
- <mkdir dir="${dir.output}/phpcs" />
- <!-- <phpcodesniffer></phpcodesniffer> -->
- </target>
-
- <target name="phpmd">
- <delete dir="${dir.output}/phpmd" includeemptydirs="true" verbose="true" failonerror="true" />
- <mkdir dir="${dir.output}/phpmd" />
- <phpmd>
- <fileset refid="src_files" />
- <formatter type="html" outfile="${dir.output}/phpmd/phpmd.html"/>
- <formatter type="xml" outfile="${dir.output}/phpmd/phpmd.xml"/>
- </phpmd>
- </target>
-
- <target name="phpcpd">
- <delete dir="${dir.output}/phpcpd" includeemptydirs="true" verbose="true" failonerror="true" />
- <mkdir dir="${dir.output}/phpcpd" />
- <phpcpd>
- <fileset refid="src_files" />
- <formatter type="pmd" outfile="${dir.output}/phpcpd/pmd.xml" />
- <formatter type="default" outfile="${dir.output}/phpcpd/default.xml" />
- </phpcpd>
- </target>
-
- <target name="phploc">
- <exec command="phploc --log-csv ${dir.output}/logs/phploc.csv ." dir="${project.basedir}/src" passthru="true" />
- </target>
-
- <target name="phplint">
- <phplint>
- <fileset refid="src_files" />
- </phplint>
- </target>
-
- <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
- <exec executable="phpcb">
- <arg value="--log" />
- <arg path="${dir.output}/logs" />
- <arg value="--source" />
- <arg path="${project.basedir}/src" />
- <arg value="--output" />
- <arg path="${dir.output}/code-browser" />
- </exec>
- </target>
-
- <target name="install-build-deps">
- <exec command="pear install --alldeps pear.phpunit.de/PHPUnit" passthru="true" />
- <exec command="pear install --alldeps phpunit/PHP_CodeBrowser" passthru="true" />
- <exec command="pear install --alldeps phpunit/phploc" passthru="true" />
- <exec command="pear install --alldeps pear.pdepend.org/PHP_Depend-beta" passthru="true" />
- <exec command="pear install --alldeps pear.phpmd.org/PHP_PMD" passthru="true" />
- <exec command="pear install --alldeps pear.phpunit.de/phpcpd" passthru="true" />
- <exec command="pear install --alldeps PHP_CodeSniffer" passthru="true" />
- <exec command="pear install --alldeps pear.phing.info/phing" passthru="true" />
- </target>
-
- <target name="all" depends="clean, prepare, test-init, build, report"/>
- <target name="build" depends="phplint, prepare, test-init, test, phar"/>
- <target name="report" depends="coverage, phploc, phpcs, phpmd, phpcpd, phpdepend, phpcb"/>
-
- <target name="update-regions" description="Downloads a new copy of the AWS regions and endpoints file used by the SDK">
- <echo message="Downloading a new copy of http://aws-sdk-configurations.amazonwebservices.com/endpoints.xml to src/Aws/Common/Resources/endpoints.xml" />
- <delete file="src/Aws/Common/Resources/endpoints.xml" />
- <exec command="curl -s -S -o endpoints.xml http://aws-sdk-configurations.amazonwebservices.com/endpoints.xml" dir="src/Aws/Common/Resources" passthru="true"/>
- <exec command="dos2unix endpoints.xml" dir="src/Aws/Common/Resources" passthru="true"/>
- </target>
+ <property name="dir.output" value="${project.basedir}/build/artifacts" />
+ <property name="coverage" value="false" />
+ <property name="mock" value="false" />
+ <property name="min" value="false" />
+ <property name="sdk_url" value="http://aws.amazon.com/sdkforphp2" />
+
+ <fileset id="src_files" dir="${project.basedir}/src" includes="**/*.php" />
+
+ <target name="test" description="Run unit tests" depends="test-init">
+ <exec passthru="true" command="vendor/bin/phpunit" />
+ </target>
+
+ <target name="integration" description="Run integration tests">
+ <if>
+ <available file="phpunit.functional.xml" />
+ <then>
+ <if>
+ <equals arg1="${mock}" arg2="true" />
+ <then>
+ <echo>php -d mock=true `which phpunit` -c phpunit.functional.xml</echo>
+ <exec passthru="true" command="php -d mock=true `which phpunit` -c phpunit.functional.xml" />
+ </then>
+ <else>
+ <exec passthru="true" command="phpunit -c phpunit.functional.xml" />
+ </else>
+ </if>
+ </then>
+ <else>
+ <fail>You must copy phpunit.functional.dist to phpunit.functional.xml and modify the appropriate property settings</fail>
+ </else>
+ </if>
+ </target>
+
+ <target name="phar" description="Create a phar with an autoloader">
+ <phingcall target="test-init" />
+ <pharpackage destfile="build/aws.phar" stub="build/phar-stub.php" basedir=".">
+ <fileset dir=".">
+ <!-- Add AWS classes -->
+ <include name="src/**/*.php" />
+ <include name="src/**/*.json" />
+ <include name="src/**/*.xml" />
+ <!-- Include the Symfony2 class loader component -->
+ <include name="vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php" />
+ <!-- Install Guzzle and its dependencies -->
+ <include name="vendor/guzzle/guzzle/src/**/*.php" />
+ <include name="vendor/guzzle/guzzle/**/*.pem" />
+ <include name="vendor/symfony/event-dispatcher/**/*.php" />
+ <include name="vendor/doctrine/common/lib/Doctrine/Common/Cache/*.php" />
+ <include name="vendor/monolog/monolog/src/**/*.php" />
+ </fileset>
+ <metadata>
+ <element name="link" value="${sdk_url}" />
+ </metadata>
+ </pharpackage>
+ <exec command="php -d aws_phar=aws.phar `which phpunit`" passthru="true" />
+ </target>
+
+ <target name="composer-init" description="Downloads a local copy of composer.phar if necessary">
+ <if>
+ <available file="composer.phar" />
+ <then>
+ <echo>Composer is installed</echo>
+ </then>
+ <else>
+ <echo message="Installing composer" />
+ <exec command="curl -s http://getcomposer.org/installer | php" passthru="true" />
+ <exec command="php composer.phar install --dev" passthru="true" />
+ </else>
+ </if>
+ </target>
+
+ <target name="test-init" description="Initialize test dependencies" depends="composer-init">
+ <copy file="phpunit.xml.dist" tofile="phpunit.xml" overwrite="false" />
+ <copy file="phpunit.functional.xml.dist" tofile="phpunit.functional.xml" overwrite="false" />
+ <copy file="test_services.json.dist" tofile="test_services.json" overwrite="false" />
+ </target>
+
+ <target name="clean" description="Deletes build artifacts">
+ <delete dir="${dir.output}"/>
+ </target>
+
+ <target name="prepare" depends="clean,test-init">
+ <mkdir dir="${dir.output}"/>
+ <mkdir dir="${dir.output}/logs" />
+ </target>
+
+ <target name="clean-dependencies" description="Deletes all dependencies downloaded by Composer">
+ <delete dir="${project.basedir}/vendor"/>
+ <delete file="composer.lock" />
+ </target>
+
+ <target name="update-dependencies" depends="composer-init" description="Updates Composer dependencies">
+ <exec command="php composer.phar update --dev" passthru="true" />
+ </target>
+
+ <target name="coverage">
+ <mkdir dir="${dir.output}/logs" />
+ <exec passthru="true" command="phpunit --coverage-html=${dir.output}/coverage --coverage-clover=${dir.output}/logs/clover.xml" />
+ </target>
+
+ <target name="view-coverage">
+ <exec passthru="true" command="open ${dir.output}/coverage/index.html" />
+ </target>
+
+ <target name="phpdepend">
+ <delete dir="${dir.output}/pdepend" includeemptydirs="true" verbose="true" failonerror="true" />
+ <mkdir dir="${dir.output}/pdepend" />
+ <phpdepend>
+ <fileset refid="src_files" />
+ <analyzer type="coderank-mode" value="method"/>
+ <logger type="jdepend-chart" outfile="${dir.output}/pdepend/jdepend-chart.svg" />
+ <logger type="overview-pyramid" outfile="${dir.output}/pdepend/overview-pyramid.svg" />
+ <logger type="jdepend-chart" outfile="${dir.output}/pdepend/jdepend-chart.png" />
+ <logger type="overview-pyramid" outfile="${dir.output}/pdepend/overview-pyramid.png" />
+ <logger type="jdepend-xml" outfile="${dir.output}/pdepend/jdepend.xml" />
+ <logger type="phpunit-xml" outfile="${dir.output}/pdepend/phpunit.xml" />
+ <logger type="summary-xml" outfile="${dir.output}/pdepend/summary.xml" />
+ </phpdepend>
+ </target>
+
+ <target name="phpcs">
+ <delete dir="${dir.output}/phpcs" includeemptydirs="true" verbose="true" failonerror="true" />
+ <mkdir dir="${dir.output}/phpcs" />
+ <!-- <phpcodesniffer></phpcodesniffer> -->
+ </target>
+
+ <target name="phpmd">
+ <delete dir="${dir.output}/phpmd" includeemptydirs="true" verbose="true" failonerror="true" />
+ <mkdir dir="${dir.output}/phpmd" />
+ <phpmd>
+ <fileset refid="src_files" />
+ <formatter type="html" outfile="${dir.output}/phpmd/phpmd.html"/>
+ <formatter type="xml" outfile="${dir.output}/phpmd/phpmd.xml"/>
+ </phpmd>
+ </target>
+
+ <target name="phpcpd">
+ <delete dir="${dir.output}/phpcpd" includeemptydirs="true" verbose="true" failonerror="true" />
+ <mkdir dir="${dir.output}/phpcpd" />
+ <phpcpd>
+ <fileset refid="src_files" />
+ <formatter type="pmd" outfile="${dir.output}/phpcpd/pmd.xml" />
+ <formatter type="default" outfile="${dir.output}/phpcpd/default.xml" />
+ </phpcpd>
+ </target>
+
+ <target name="phploc">
+ <exec command="phploc --log-csv ${dir.output}/logs/phploc.csv ." dir="${project.basedir}/src" passthru="true" />
+ </target>
+
+ <target name="phplint">
+ <phplint>
+ <fileset refid="src_files" />
+ </phplint>
+ </target>
+
+ <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
+ <exec executable="phpcb">
+ <arg value="--log" />
+ <arg path="${dir.output}/logs" />
+ <arg value="--source" />
+ <arg path="${project.basedir}/src" />
+ <arg value="--output" />
+ <arg path="${dir.output}/code-browser" />
+ </exec>
+ </target>
+
+ <target name="install-build-deps">
+ <exec command="pear install --alldeps pear.phpunit.de/PHPUnit" passthru="true" />
+ <exec command="pear install --alldeps phpunit/PHP_CodeBrowser" passthru="true" />
+ <exec command="pear install --alldeps phpunit/phploc" passthru="true" />
+ <exec command="pear install --alldeps pear.pdepend.org/PHP_Depend-beta" passthru="true" />
+ <exec command="pear install --alldeps pear.phpmd.org/PHP_PMD" passthru="true" />
+ <exec command="pear install --alldeps pear.phpunit.de/phpcpd" passthru="true" />
+ <exec command="pear install --alldeps PHP_CodeSniffer" passthru="true" />
+ <exec command="pear install --alldeps pear.phing.info/phing" passthru="true" />
+ </target>
+
+ <target name="all" depends="clean, prepare, test-init, build, report"/>
+ <target name="build" depends="phplint, prepare, test-init, test, phar"/>
+ <target name="report" depends="coverage, phploc, phpcs, phpmd, phpcpd, phpdepend, phpcb"/>
+
+ <target name="update-regions" description="Downloads a new copy of the AWS regions and endpoints file used by the SDK">
+ <echo message="Downloading a new copy of http://aws-sdk-configurations.amazonwebservices.com/endpoints.xml to src/Aws/Common/Resources/endpoints.xml" />
+ <delete file="src/Aws/Common/Resources/endpoints.xml" />
+ <exec command="curl -s -S -o endpoints.xml http://aws-sdk-configurations.amazonwebservices.com/endpoints.xml" dir="src/Aws/Common/Resources" passthru="true"/>
+ <exec command="dos2unix endpoints.xml" dir="src/Aws/Common/Resources" passthru="true"/>
+ </target>
</project>
10 build/phar-stub.php
View
@@ -22,11 +22,11 @@
$classLoader = new Symfony\Component\ClassLoader\UniversalClassLoader();
$classLoader->registerNamespaces(array(
- 'Aws' => 'phar://aws.phar/src',
- 'Guzzle' => 'phar://aws.phar/vendor/guzzle/guzzle/src',
- 'Symfony\\Component\\EventDispatcher' => 'phar://aws.phar/vendor/symfony/event-dispatcher',
- 'Doctrine' => 'phar://aws.phar/vendor/doctrine/common/lib',
- 'Monolog' => 'phar://aws.phar/vendor/monolog/monolog/src'
+ 'Aws' => 'phar://aws.phar/src',
+ 'Guzzle' => 'phar://aws.phar/vendor/guzzle/guzzle/src',
+ 'Symfony\\Component\\EventDispatcher' => 'phar://aws.phar/vendor/symfony/event-dispatcher',
+ 'Doctrine' => 'phar://aws.phar/vendor/doctrine/common/lib',
+ 'Monolog' => 'phar://aws.phar/vendor/monolog/monolog/src'
));
$classLoader->register();
6 build/vanity/bootstrap.php
View
@@ -3,7 +3,7 @@
// Assist PSR-0 autoloading
if (!file_exists(dirname(dirname(__DIR__)) . '/vendor/composer/autoload_namespaces.php')) {
- $formatters = Utilities::formatters();
- echo $formatters->warning->apply(' You must run Composer\'s `install` task before generating documentation. ') . PHP_EOL . PHP_EOL;
- exit(1);
+ $formatters = Utilities::formatters();
+ echo $formatters->warning->apply(' You must run Composer\'s `install` task before generating documentation. ') . PHP_EOL . PHP_EOL;
+ exit(1);
}
18 build/vanity/config.yml
View
@@ -1,12 +1,12 @@
# Vanity configuration
vanity:
- name: AWS SDK for PHP
+ name: AWS SDK for PHP
api:
- stage: dev
- exclude:
- classes: /\n/
- warn:
- dependencies: true
- inconsistencies: true
- todo: true
- ungrouped: true
+ stage: dev
+ exclude:
+ classes: /\n/
+ warn:
+ dependencies: true
+ inconsistencies: true
+ todo: true
+ ungrouped: true
56 composer.json
View
@@ -1,30 +1,30 @@
{
- "name": "aws/aws-sdk-php",
- "homepage": "http://aws.amazon.com/sdkforphp2",
- "description":"AWS SDK for PHP",
- "keywords":["aws","amazon","sdk","s3","ec2","dynamodb"],
- "type":"library",
- "license":"Apache-2.0",
- "authors":[
- {
- "name":"Amazon Web Services",
- "homepage":"http://aws.amazon.com"
- }
- ],
- "require": {
- "php": ">=5.3.2",
- "guzzle/guzzle": "3.0.*"
- },
- "require-dev": {
- "symfony/class-loader": "2.*",
- "doctrine/common": "2.3.*",
- "monolog/monolog": "1.2.*",
- "ext-apc": "*",
- "phpunit/phpunit": "3.7.*"
- },
- "autoload": {
- "psr-0": {
- "Aws": "src/"
- }
- }
+ "name": "aws/aws-sdk-php",
+ "homepage": "http://aws.amazon.com/sdkforphp2",
+ "description":"AWS SDK for PHP",
+ "keywords":["aws","amazon","sdk","s3","ec2","dynamodb"],
+ "type":"library",
+ "license":"Apache-2.0",
+ "authors":[
+ {
+ "name":"Amazon Web Services",
+ "homepage":"http://aws.amazon.com"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.2",
+ "guzzle/guzzle": "3.0.*"
+ },
+ "require-dev": {
+ "symfony/class-loader": "2.*",
+ "doctrine/common": "2.3.*",
+ "monolog/monolog": "1.2.*",
+ "ext-apc": "*",
+ "phpunit/phpunit": "3.7.*"
+ },
+ "autoload": {
+ "psr-0": {
+ "Aws": "src/"
+ }
+ }
}
58 phpunit.functional.xml.dist
View
@@ -1,37 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./tests/bootstrap.php"
- colors="true"
- processIsolation="false"
- stopOnFailure="false"
- syntaxCheck="false"
- convertErrorsToExceptions="true"
- convertNoticesToExceptions="true"
- convertWarningsToExceptions="true"
- testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader">
+ colors="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader">
- <php>
- <!-- If you want to run the integration tests, you will need to provide
- the path to a service configuration file. You WILL be charged
- for your usage if you choose to run the integration tests. -->
- <server name="CONFIG" value="test_services.json" />
+ <php>
+ <!-- If you want to run the integration tests, you will need to provide
+ the path to a service configuration file. You WILL be charged
+ for your usage if you choose to run the integration tests. -->
+ <server name="CONFIG" value="test_services.json" />
- <!-- The PREFIX is added to any globally shared namespaced
- resources that are created during integration tests -->
- <server name="PREFIX" value="hostname" />
- </php>
+ <!-- The PREFIX is added to any globally shared namespaced
+ resources that are created during integration tests -->
+ <server name="PREFIX" value="hostname" />
+ </php>
- <testsuites>
- <testsuite name="Aws">
- <directory>./tests/Aws/Tests</directory>
- </testsuite>
- </testsuites>
+ <testsuites>
+ <testsuite name="Aws">
+ <directory>./tests/Aws/Tests</directory>
+ </testsuite>
+ </testsuites>
- <!-- Only execute integration and performance tests -->
- <groups>
- <include>
- <group>integration</group>
- <group>performance</group>
- </include>
- </groups>
+ <!-- Only execute integration and performance tests -->
+ <groups>
+ <include>
+ <group>integration</group>
+ <group>performance</group>
+ </include>
+ </groups>
</phpunit>
94 phpunit.xml.dist
View
@@ -1,55 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./tests/bootstrap.php"
- colors="true"
- processIsolation="false"
- stopOnFailure="false"
- syntaxCheck="false"
- convertErrorsToExceptions="true"
- convertNoticesToExceptions="true"
- convertWarningsToExceptions="true"
- testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader">
+ colors="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader">
- <testsuites>
- <testsuite name="Aws">
- <directory>tests/Aws/Tests</directory>
- </testsuite>
- </testsuites>
+ <testsuites>
+ <testsuite name="Aws">
+ <directory>tests/Aws/Tests</directory>
+ </testsuite>
+ </testsuites>
- <!-- Exclude the integration tests in regular unit tests -->
- <groups>
- <exclude>
- <group>integration</group>
- <group>performance</group>
- </exclude>
- </groups>
+ <!-- Exclude the integration tests in regular unit tests -->
+ <groups>
+ <exclude>
+ <group>integration</group>
+ <group>performance</group>
+ </exclude>
+ </groups>
- <logging>
- <log type="junit" target="build/artifacts/logs/junit.xml" logIncompleteSkipped="false" />
- </logging>
+ <logging>
+ <log type="junit" target="build/artifacts/logs/junit.xml" logIncompleteSkipped="false" />
+ </logging>
- <filter>
- <whitelist>
- <directory suffix=".php">./src/Aws</directory>
- <exclude>
- <directory suffix="Interface.php">./src/Aws</directory>
- <directory>./src/Aws/**/Enum</directory>
- <directory>./src/Aws/**/Resources</directory>
- <directory>./src/Aws/Common/Exception/DomainException.php</directory>
- <directory>./src/Aws/Common/Exception/InvalidArgumentException.php</directory>
- <directory>./src/Aws/Common/Exception/LogicException.php</directory>
- <directory>./src/Aws/Common/Exception/OverflowException.php</directory>
- <directory>./src/Aws/Common/Exception/OutOfBoundsException.php</directory>
- <directory>./src/Aws/Common/Exception/RuntimeException.php</directory>
- <directory>./src/Aws/Common/Exception/UnexpectedValueException.php</directory>
- <directory suffix="Exception.php">./src/Aws/CloudFront/Exception</directory>
- <directory suffix="Exception.php">./src/Aws/DataPipeline/Exception</directory>
- <directory suffix="Exception.php">./src/Aws/DynamoDb/Exception</directory>
- <directory suffix="Exception.php">./src/Aws/Glacier/Exception</directory>
- <directory suffix="Exception.php">./src/Aws/Route53/Exception</directory>
- <directory suffix="Exception.php">./src/Aws/S3/Exception</directory>
- <directory suffix="Exception.php">./src/Aws/Sts/Exception</directory>
- </exclude>
- </whitelist>
- </filter>
+ <filter>
+ <whitelist>
+ <directory suffix=".php">./src/Aws</directory>
+ <exclude>
+ <directory suffix="Interface.php">./src/Aws</directory>
+ <directory>./src/Aws/**/Enum</directory>
+ <directory>./src/Aws/**/Resources</directory>
+ <directory>./src/Aws/Common/Exception/DomainException.php</directory>
+ <directory>./src/Aws/Common/Exception/InvalidArgumentException.php</directory>
+ <directory>./src/Aws/Common/Exception/LogicException.php</directory>
+ <directory>./src/Aws/Common/Exception/OverflowException.php</directory>
+ <directory>./src/Aws/Common/Exception/OutOfBoundsException.php</directory>
+ <directory>./src/Aws/Common/Exception/RuntimeException.php</directory>
+ <directory>./src/Aws/Common/Exception/UnexpectedValueException.php</directory>
+ <directory suffix="Exception.php">./src/Aws/CloudFront/Exception</directory>
+ <directory suffix="Exception.php">./src/Aws/DataPipeline/Exception</directory>
+ <directory suffix="Exception.php">./src/Aws/DynamoDb/Exception</directory>
+ <directory suffix="Exception.php">./src/Aws/Glacier/Exception</directory>
+ <directory suffix="Exception.php">./src/Aws/Route53/Exception</directory>
+ <directory suffix="Exception.php">./src/Aws/S3/Exception</directory>
+ <directory suffix="Exception.php">./src/Aws/Sts/Exception</directory>
+ </exclude>
+ </whitelist>
+ </filter>
</phpunit>
386 src/Aws/CloudFront/CloudFrontClient.php
View
@@ -54,197 +54,197 @@
*/
class CloudFrontClient extends AbstractClient
{
- /**
- * @inheritdoc
- */
- protected $directory = __DIR__;
-
- /**
- * Factory method to create a new Amazon CloudFront client using an array of configuration options:
- *
- * Credential options (`key`, `secret`, and optional `token` OR `credentials` is required)
- *
- * - key: AWS Access Key ID
- * - secret: AWS secret access key
- * - credentials: You can optionally provide a custom `Aws\Common\Credentials\CredentialsInterface` object
- * - token: Custom AWS security token to use with request authentication
- * - token.ttd: UNIX timestamp for when the custom credentials expire
- * - credentials.cache: Used to cache credentials when using providers that require HTTP requests. Set the true
- * to use the default APC cache or provide a `Guzzle\Cache\CacheAdapterInterface` object.
- * - credentials.cache.key: Optional custom cache key to use with the credentials
- * - credentials.client: Pass this option to specify a custom `Guzzle\Http\ClientInterface` to use if your
- * credentials require a HTTP request (e.g. RefreshableInstanceProfileCredentials)
- *
- * Region and Endpoint options
- *
- * - base_url: Instead of using a `region` and `scheme`, you can specify a custom base URL for the client
- * - endpoint_provider: Optional `Aws\Common\Region\EndpointProviderInterface` used to provide region endpoints
- *
- * Generic client options
- *
- * - ssl.certificate_authority: Set to true to use the bundled CA cert (default), system to use the certificate
- * bundled with your system, or pass the full path to an SSL certificate bundle. This option should be used when
- * you encounter curl error code 60.
- * - curl.options: Array of cURL options to apply to every request.
- * See http://www.php.net/manual/en/function.curl-setopt.php for a list of available options
- * - client.backoff.logger: `Guzzle\Log\LogAdapterInterface` object used to log backoff retries. Use
- * 'debug' to emit PHP warnings when a retry is issued.
- * - client.backoff.logger.template: Optional template to use for exponential backoff log messages. See
- * `Guzzle\Plugin\Backoff\BackoffLogger` for formatting information.
- *
- * @param array|Collection $config Client configuration data
- *
- * @return self
- */
- public static function factory($config = array())
- {
- // Instantiate the CloudFront client
- $client = ClientBuilder::factory(__NAMESPACE__)
- ->setConfig($config)
- ->setConfigDefaults(array(
- Options::SERVICE => 'cloudfront',
- Options::SCHEME => 'https',
- Options::REGION => Region::US_EAST_1
- ))
- ->setSignature(new CloudFrontSignature())
- ->setExceptionParser(new DefaultXmlExceptionParser())
- ->setIteratorsConfig(array(
- 'token_param' => 'Marker',
- 'token_key' => 'NextMarker',
- 'more_key' => 'IsTruncated',
- 'result_key' => 'Items',
- 'operations' => array(
- 'ListCloudFrontOriginAccessIdentities',
- 'ListDistributions',
- 'ListInvalidations',
- 'ListStreamingDistributions'
- )
- ))
- ->build();
-
- return $client;
- }
-
- /**
- * Create a signed URL
- *
- * This method accepts an array of configuration options:
- * - url: (string) URL of the resource being signed (can include query string and wildcards). For example:
- * rtmp://s5c39gqb8ow64r.cloudfront.net/videos/mp3_name.mp3
- * http://d111111abcdef8.cloudfront.net/images/horizon.jpg?size=large&license=yes
- * - policy: (string) JSON policy. Use this option when creating a signed URL for a custom policy.
- * - expires: (int) UTC Unix timestamp used when signing with a canned policy. Not required when passing a
- * custom 'policy' option.
- *
- * @param array $options Array of configuration options used when signing
- *
- * @return string The file URL with authentication parameters.
- * @throws InvalidArgumentException if key_pair_id and private_key have not been configured on the client
- */
- public function getSignedUrl(array $options)
- {
- if (!$this->getConfig('key_pair_id') || !$this->getConfig('private_key')) {
- throw new InvalidArgumentException(
- 'An Amazon CloudFront keypair ID (key_pair_id) and an RSA private key (private_key) is required'
- );
- }
-
- // Initialize the configuration data and ensure that the url was specified
- $options = Collection::fromConfig($options, null, array('url'));
- // Determine the scheme of the policy
- $urlSections = explode('://', $options['url']);
- // Ensure that the URL contained a scheme and parts after the scheme
- if (count($urlSections) < 2) {
- throw new InvalidArgumentException('Invalid URL: ' . $options['url']);
- }
-
- // Get the real scheme by removing wildcards from the scheme
- $scheme = str_replace('*', '', $urlSections[0]);
- $policy = $options['policy'] ?: $this->createCannedPolicy($scheme, $options['url'], $options['expires']);
- // Strip whitespace from the policy
- $policy = str_replace(' ', '', $policy);
-
- $url = Url::factory($scheme . '://' . $urlSections[1]);
- if ($options['policy']) {
- // Custom policies require that the encoded policy be specified in the URL
- $url->getQuery()->set('Policy', strtr(base64_encode($policy), '+=/', '-_~'));
- } else {
- // Canned policies require that the Expires parameter be set in the URL
- $url->getQuery()->set('Expires', $options['expires']);
- }
-
- // Sign the policy using the CloudFront private key
- $signedPolicy = $this->rsaSha1Sign($policy, $this->getConfig('private_key'));
- // Remove whitespace, base64 encode the policy, and replace special characters
- $signedPolicy = strtr(base64_encode(str_replace(' ', '', $signedPolicy)), '+=/', '-_~');
-
- $url->getQuery()
- ->useUrlEncoding(false)
- ->set('Signature', $signedPolicy)
- ->set('Key-Pair-Id', $this->getConfig('key_pair_id'));
-
- if ($scheme != 'rtmp') {
- // HTTP and HTTPS signed URLs include the full URL
- return (string) $url;
- } else {
- // Use a relative URL when creating Flash player URLs
- $url->setScheme(null)->setHost(null);
- // Encode query string variables for flash players
- $url = str_replace(array('?', '=', '&'), array('%3F', '%3D', '%26'), (string) $url);
-
- return substr($url, 1);
- }
- }
-
- /**
- * Sign a policy string using OpenSSL RSA SHA1
- *
- * @param string $policy Policy to sign
- * @param string $privateKeyFilename File containing the OpenSSL private key
- *
- * @return string
- */
- protected function rsaSha1Sign($policy, $privateKeyFilename)
- {
- $signature = '';
- openssl_sign($policy, $signature, file_get_contents($privateKeyFilename));
-
- return $signature;
- }
-
- /**
- * Create a canned policy for a particular URL and expiration
- *
- * @param string $scheme Parsed scheme without wildcards
- * @param string $url URL that is being signed
- * @param int $expires Time in which the signature expires