|
1 | | -An upcoming release of the **AWS SDK for Kotlin** will introduce an optional region provider parameter that determines the AWS region when configuring a client |
| 1 | +An upcoming release of the **AWS SDK for Kotlin** will move several region-related classes into different namespaces and modules as part of an internal refactoring. |
| 2 | +This change was necessary to support adding `regionProvider` client config property, see https://github.com/awslabs/aws-sdk-kotlin/issues/1478 for more details. |
2 | 3 |
|
3 | 4 | # Release date |
4 | 5 |
|
5 | | -This change will be included in the upcoming **v1.5.0** release, |
| 6 | +This change will be included in the upcoming **v1.5.0** release. |
6 | 7 |
|
7 | 8 | # What's changing |
8 | | -Adding an optional `regionProvider` parameter to provide more flexibility in how regions are specified. |
9 | | -This affects the configuration of AWS service clients. |
10 | 9 |
|
11 | | -The SDK will resolve the region in the following priority order: |
12 | | -1. Static region (if specified using `region = "..."`) |
13 | | -2. Custom region provider (if specified using `regionProvider = ...`) |
14 | | -3. Default region provider chain |
| 10 | +The `RegionProvider` and `RegionProviderChain` classes are now available from different modules than before. **This will affect your build if you're using these classes**. |
15 | 11 |
|
16 | | -Example usage: |
17 | | -```kotlin |
18 | | -val myRegionProvider = RegionProviderChain(src1, src2, src3, ...) |
| 12 | +# How to migrate |
19 | 13 |
|
20 | | -val s3 = S3Client.fromEnvironment { |
21 | | - regionProvider = myRegionProvider |
22 | | -} |
23 | | -``` |
24 | | -If a static region is specified, the value of regionProvider will not be used: |
| 14 | +## 1. Update build dependencies |
| 15 | +If your code uses region-related classes, you may need to add a new dependency in your `build.gradle.kts`: |
25 | 16 |
|
26 | 17 | ```kotlin |
27 | | -val myRegionProvider = ... |
28 | | - |
29 | | -val s3 = S3Client.fromEnvironment { |
30 | | - regionProvider = myRegionProvider // Ignored since `region` is also set |
31 | | - region = "moon-east-1" |
32 | | -} |
| 18 | +implementation("aws.smithy.kotlin:smithy-client:<version>") |
33 | 19 | ``` |
34 | 20 |
|
35 | | -# How to migrate |
36 | | -Update your imports to reflect the new file locations: |
| 21 | +## 2. Update import statements |
| 22 | +After updating the dependencies, you'll need to modify your import statements: |
| 23 | + |
| 24 | +Replace these imports: |
37 | 25 |
|
38 | 26 | ```kotlin |
39 | | -//old imports |
40 | 27 | import aws.sdk.kotlin.runtime.region.RegionProvider |
41 | 28 | import aws.sdk.kotlin.runtime.region.RegionProviderChain |
42 | 29 | ``` |
| 30 | +With: |
43 | 31 |
|
44 | 32 | ```kotlin |
45 | | -//new imports |
46 | 33 | import aws.smithy.kotlin.runtime.client.region.RegionProvider |
47 | 34 | import aws.smithy.kotlin.runtime.client.region.RegionProviderChain |
48 | 35 | ``` |
49 | 36 |
|
| 37 | +No changes to your existing implementation code are required beyond updating the dependencies and imports. Your code should continue to function as before once the dependencies and imports are updated. |
| 38 | + |
50 | 39 | # Additional information |
51 | 40 |
|
52 | 41 | For more information about this change, see https://github.com/awslabs/aws-sdk-kotlin/issues/1478. |
|
0 commit comments