PageRenderTime 47ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/UPGRADING.md

https://gitlab.com/github-cloud-corp/aws-sdk-php
Markdown | 324 lines | 259 code | 65 blank | 0 comment | 0 complexity | 809ac7bb22d0008973abae51086d8069 MD5 | raw file
  1. Upgrading Guide
  2. ===============
  3. Upgrade from 2.x to 3.x
  4. -----------------------
  5. Version 3 is a new major version of the SDK that represents a significant effort
  6. to improve the capabilities of the SDK, incorporate two years of customer
  7. feedback, upgrade our dependencies, improve performance, and adopt the latest
  8. PHP standards.
  9. The basic usage pattern of the SDK (i.e., `$result = $client->operation($params);`)
  10. has not changed from Version 2 to Version 3, which should result in a fairly
  11. smooth migration.
  12. For details on how to migrate your code from Version 2 to Version 3, read the
  13. [Version 3 Migration Guide](http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/migration.html).
  14. Upgrade from 2.7 to 2.8
  15. -----------------------
  16. ### AWS Lambda
  17. Version 2.8 is backward-compatible with version 2.7, except in the case of the
  18. AWS Lambda service. The Lambda service has changed their API significantly based
  19. on customer feedback during their preview period. The `invokeAsync()` operation
  20. has not changed, but many aspects of the API has.
  21. If you would like to continue using the old 2014-11-11 previewAPI, you can
  22. configure this when you instantiate the `LambdaClient`:
  23. ```php
  24. use Aws\Lambda\LambdaClient;
  25. $client = LambdaClient::factory(array(
  26. 'version' => '2014-11-11',
  27. // ...
  28. ));
  29. ```
  30. ### Preparations for Version 3 of the SDK
  31. In preparation for Version 3 of the AWS SDK for PHP:
  32. * We marked all of the "facade" classes and methods as deprecated, since they
  33. will be removed.
  34. * We added the `getAwsErrorCode()`, `getAwsErrorType()` and `getAwsRequestId()`
  35. methods to the `ServiceResponseException` to be forward-compatible with
  36. Version 3's `AwsException` interface.
  37. * We advise against the use of any `Enum` class, since these will be removed.
  38. Instead, use the literal value to which the enum corresponds.
  39. * We advise against the use of any granular service classes, since these will be
  40. removed. Instead, catch the top-level service exception (e.g.,
  41. `Aws\S3\Exception\S3Exception`) and use the `getAwsErrorCode()` method if you
  42. need to know the granular error code.
  43. Upgrade from 2.6 to 2.7
  44. -----------------------
  45. Version 2.7 is backward-compatible with version 2.6. The version bump was
  46. necessary in order to mark some things in the DynamoDb namespace as deprecated.
  47. See the [CHANGELOG entry for 2.7.0](https://github.com/aws/aws-sdk-php/blob/v3/CHANGELOG.md#270-2014-10-08)
  48. for more details.
  49. Upgrade from 2.5 to 2.6
  50. -----------------------
  51. **IMPORTANT:** Version 2.6 *is* backward-compatible with version 2.5, *unless* you are using the Amazon CloudSearch
  52. client. If you are using CloudSearch, please read the next section carefully.
  53. ### Amazon CloudSearch
  54. Version 2.6 of the AWS SDK for PHP has been updated to use the 2013-01-01 API version of Amazon CloudSearch by default.
  55. The 2013-01-01 API marks a significant upgrade of Amazon CloudSearch, but includes numerous breaking changes to the API.
  56. CloudSearch now supports 33 languages, highlighting, autocomplete suggestions, geospatial search, AWS IAM integration to
  57. control access to domain configuration actions, and user configurable scaling and availability options. These new
  58. features are reflected in the changes to the method and parameters of the CloudSearch client.
  59. For details about the new API and how to update your usage of CloudSearch, please consult the [Configuration API
  60. Reference for Amazon CloudSearch](http://docs.aws.amazon.com/cloudsearch/latest/developerguide/configuration-api.html)
  61. and the guide for [Migrating to the Amazon CloudSearch 2013-01-01 API](http://docs.aws.amazon.com/cloudsearch/latest/developerguide/migrating.html).
  62. If you would like to continue using the older 2011-02-01 API, you can configure this when you instantiate the
  63. `CloudSearchClient`:
  64. ```php
  65. use Aws\CloudSearch\CloudSearchClient;
  66. $client = CloudSearchClient::factory(array(
  67. 'key' => '<aws access key>',
  68. 'secret' => '<aws secret key>',
  69. 'region' => '<region name>',
  70. 'version' => '2011-02-01',
  71. ));
  72. ```
  73. Upgrade from 2.4 to 2.5
  74. -----------------------
  75. ### Amazon EC2
  76. A small, backwards-incompatible change has been made to the Amazon EC2 API. The `LaunchConfiguration.MonitoringEnabled`
  77. parameter of the `RequestSpotInstances` operation has been change to `LaunchConfiguration.Monitoring.Enabled` See [this
  78. commit](https://github.com/aws/aws-sdk-php/commit/36ae0f68d2a6dcc3bc28222f60ecb318449c4092#diff-bad2f6eac12565bb684f2015364c22bd)
  79. for the exact change. You are only affected by this change if you are using this specific parameter. To fix your code to
  80. work with the updated parameter, you will need to change the structure of your request slightly.
  81. ```php
  82. // The OLD way
  83. $result = $ec2->requestSpotInstances(array(
  84. // ...
  85. 'LaunchSpecification' => array(
  86. // ...
  87. 'MonitoringEnabled' => true,
  88. // ...
  89. ),
  90. // ...
  91. ));
  92. // The NEW way
  93. $result = $ec2->requestSpotInstances(array(
  94. // ...
  95. 'LaunchSpecification' => array(
  96. // ...
  97. 'Monitoring' => array(
  98. 'Enabled' => true,
  99. ),
  100. // ...
  101. ),
  102. // ...
  103. ));
  104. ```
  105. ### AWS CloudTrail
  106. AWS CloudTrail has made changes to their API. If you are not using the CloudTrail service, then you will not be
  107. affected by this change.
  108. Here is an excerpt (with minor modifications) directly from the [CloudTrail team's
  109. announcement](https://forums.aws.amazon.com/ann.jspa?annID=2286) regarding this change:
  110. > [...] We have made some minor improvements/fixes to the service API, based on early feedback. The impact of these
  111. > changes to you depends on how you are currently interacting with the CloudTrail service. [...] If you have code that
  112. > calls the APIs below, you will need to make minor changes.
  113. >
  114. > There are two changes:
  115. >
  116. > 1) `CreateTrail` / `UpdateTrail`: These APIs originally took a single parameter, a `Trail` object. [...] We have
  117. > changed this so that you can now simply pass individual parameters directly to these APIs. The same applies to the
  118. > responses of these APIs, namely the APIs return individual fields directly [...]
  119. > 2) `GetTrailStatus`: The actual values of the fields returned and their data types were not all as intended. As such,
  120. > we are deprecating a set of fields, and adding a new set of replacement fields. The following fields are now
  121. > deprecated, and should no longer be used:
  122. >
  123. > * `LatestDeliveryAttemptTime` (String): Time CloudTrail most recently attempted to deliver a file to S3 configured
  124. > bucket.
  125. > * `LatestNotificationAttemptTime` (String): As above, but for publishing a notification to configured SNS topic.
  126. > * `LatestDeliveryAttemptSucceeded` (String): This one had a mismatch between implementation and documentation. As
  127. > documented: whether or not the latest file delivery was successful. As implemented: Time of most recent successful
  128. > file delivery.
  129. > * `LatestNotificationAttemptSucceeded` (String): As above, but for SNS notifications.
  130. > * `TimeLoggingStarted` (String): Time `StartLogging` was most recently called. [...]
  131. > * `TimeLoggingStarted` (String): Time `StopLogging` was most recently called.
  132. >
  133. > The following fields are new, and replace the fields above:
  134. >
  135. > * `LatestDeliveryTime` (Date): Date/Time that CloudTrail most recently delivered a log file.
  136. > * `LatestNotificationTime` (Date): As above, for SNS notifications.
  137. > * `StartLoggingTime` (Date): Same as `TimeLoggingStarted`, but with more consistent naming, and correct data type.
  138. > * `StopLoggingTime` (Date): Same as `TimeLoggingStopped`, but with more consistent naming, and correct data type.
  139. >
  140. > Note that `LatestDeliveryAttemptSucceeded` and `LatestNotificationAttemptSucceeded` have no direct replacement. To
  141. > query whether everything is configured correctly for log file delivery, it is sufficient to query LatestDeliveryError,
  142. > and if non-empty that means that there is a configuration problem preventing CloudTrail from being able to deliver
  143. > logs successfully. Basically either the bucket doesnt exist, or CloudTrail doesnt have sufficient permissions to
  144. > write to the configured path in the bucket. Likewise for `LatestNotificationAttemptSucceeded`.
  145. >
  146. > The deprecated fields will be removed in the future, no earlier than February 15. Both set of fields will coexist on
  147. > the service during this period to give those who are using the deprecated fields time to switch over to the use the
  148. > new fields. However new SDKs and CLIs will remove the deprecated fields sooner than that. Previous SDK and CLI
  149. > versions will continue to work until the deprecated fields are removed from the service.
  150. >
  151. > We apologize for any inconvenience, and appreciate your understanding as we make these adjustments to improve the
  152. > long-term usability of the CloudTrail APIs.
  153. We are marking this as a breaking change now, preemptive of the February 15th cutoff, and we encourage everyone to
  154. update their code now. The changes to how you use `createTrail()` and `updateTrail()` are easy changes:
  155. ```php
  156. // The OLD way
  157. $cloudTrail->createTrail(array(
  158. 'trail' => array(
  159. 'Name' => 'TRAIL_NAME',
  160. 'S3BucketName' => 'BUCKET_NAME',
  161. )
  162. ));
  163. // The NEW way
  164. $cloudTrail->createTrail(array(
  165. 'Name' => 'TRAIL_NAME',
  166. 'S3BucketName' => 'BUCKET_NAME',
  167. ));
  168. ```
  169. ### China (Beijing) Region / Signatures
  170. This release adds support for the new China (Beijing) Region. This region requires that Signature V4 be used for both
  171. Amazon S3 and Amazon EC2 requests. We've added support for Signature V4 in both of these services for clients
  172. configured for this region. While doing this work, we did some refactoring to the signature classes and also removed
  173. support for Signature V3, as it is no longer needed. Unless you are explicitly referencing Signature V3 or explicitly
  174. interacting with signature objects, these changes should not affect you.
  175. Upgrade from 2.3 to 2.4
  176. -----------------------
  177. ### Amazon CloudFront Client
  178. The new 2013-05-12 API version of Amazon CloudFront includes support for custom SSL certificates via the
  179. `ViewerCertificate` parameter, but also introduces breaking changes to the API. Version 2.4 of the SDK now ships with
  180. two versions of the Amazon CloudFront service description, one for the new 2013-05-12 API and one for the next most
  181. recent 2012-05-05 API. The SDK defaults to using the newest API version, so CloudFront users may experience a breaking
  182. change to their projects when upgrading. This can be easily circumvented by switching back to the 2012-05-05 API by
  183. using the `version` option when instantiating the CloudFront client.
  184. ### Guzzle 3.7
  185. Version 2.4 of the AWS SDK for PHP requires at least version 3.7 of Guzzle.
  186. Upgrade from 2.2 to 2.3
  187. -----------------------
  188. ### Amazon DynamoDB Client
  189. The newly released 2012-08-10 API version of the Amazon DynamoDB service includes the new Local Secondary Indexes
  190. feature, but also introduces breaking changes to the API. The most notable change is in the way that you specify keys
  191. when creating tables and retrieving items. Version 2.3 of the SDK now ships with 2 versions of the DynamoDB service
  192. description, one for the new 2012-08-10 API and one for the next most recent 2011-12-05 API. The SDK defaults to using
  193. the newest API version, so DynamoDB users may experience a breaking change to their projects when upgrading. This can be
  194. easily fixed by switching back to the 2011-12-05 API by using the new `version` configuration setting when instantiating
  195. the DynamoDB client.
  196. ```php
  197. use Aws\DynamoDb\DynamoDbClient;
  198. $client = DynamoDbClient::factory(array(
  199. 'key' => '<aws access key>',
  200. 'secret' => '<aws secret key>',
  201. 'region' => '<region name>',
  202. 'version' => '2011-12-05'
  203. ));
  204. ```
  205. If you are using a config file with `Aws\Common\Aws`, then you can modify your file like the following.
  206. ```json
  207. {
  208. "includes": ["_aws"],
  209. "services": {
  210. "default_settings": {
  211. "params": {
  212. "key": "<aws access key>",
  213. "secret": "<aws secret key>",
  214. "region": "<region name>"
  215. }
  216. },
  217. "dynamodb": {
  218. "extends": "dynamodb",
  219. "params": {
  220. "version": "2011-12-05"
  221. }
  222. }
  223. }
  224. }
  225. ```
  226. The [SDK user guide](http://docs.aws.amazon.com/aws-sdk-php/guide/latest/index.html) has a guide and examples for both
  227. versions of the API.
  228. ### Guzzle 3.4.1
  229. Version 2.3 of the AWS SDK for PHP requires at least version 3.4.1 of Guzzle.
  230. Upgrade from 2.1 to 2.2
  231. -----------------------
  232. ### Full Service Coverage
  233. The AWS SDK for PHP now supports the full set of AWS services.
  234. ### Guzzle 3.3
  235. Version 2.2 of the AWS SDK for PHP requires at least version 3.3 of Guzzle.
  236. Upgrade from 2.0 to 2.1
  237. -----------------------
  238. ### General
  239. Service descriptions are now versioned under the Resources/ directory of each client.
  240. ### Waiters
  241. Waiters now require an associative array as input for the underlying operation performed by a waiter. The configuration
  242. system for waiters under 2.0.x utilized strings to determine the parameters used to create an operation. For example,
  243. when waiting for an object to exist with Amazon S3, you would pass a string containing the bucket name concatenated
  244. with the object name using a '/' separator (e.g. 'foo/baz'). In the 2.1 release, these parameters are now more
  245. explicitly tied to the underlying operation utilized by a waiter. For example, to use the ObjectExists waiter of
  246. Amazon S3 pass an associative array of `array('Bucket' => 'foo', 'Key' => 'baz')`. These options match the option names
  247. and rules associated with the HeadObject operation performed by the waiter. The API documentation of each client
  248. describes the waiters associated with the client and what underlying operation is responsible for waiting on the
  249. resource. Waiter specific options like the maximum number of attempts (max_attempts) or interval to wait between
  250. retries (interval) can be specified in this same configuration array by prefixing the keys with `waiter.`.
  251. Waiters can also be invoked using magic methods on the client. These magic methods are listed in each client's docblock
  252. using `@method` tags.
  253. ```php
  254. $s3Client->waitUntilObjectExists(array(
  255. 'Bucket' => 'foo',
  256. 'Key' => 'bar',
  257. 'waiter.max_attempts' => 3
  258. ));
  259. ```