Skip to content

Commit 6a8500c

Browse files
authored
Bring service configuration sample up-to-date (#6833)
Finished modernizing
1 parent be90fca commit 6a8500c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

swift/example_code/swift-sdk/config/Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.8
1+
// swift-tools-version: 5.6
22
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
// SPDX-License-Identifier: Apache-2.0
44
// The swift-tools-version declares the minimum version of Swift required to build this package.
@@ -16,7 +16,7 @@ let package = Package(
1616
// Dependencies declare other packages that this package depends on.
1717
.package(
1818
url: "https://github.com/awslabs/aws-sdk-swift",
19-
from: "0.36.0"
19+
from: "0.75.0"
2020
),
2121
],
2222
targets: [

swift/example_code/swift-sdk/config/Sources/ConfigExample.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
// SDK for Swift. The same principle applies to all services.
66

77
import Foundation
8-
import ClientRuntime
8+
import AWSClientRuntime
99
import AWSS3
10+
import SmithyRetries
11+
import SmithyRetriesAPI
1012

1113
@main
1214
struct ConfigExample {
1315
static func main() async {
1416
// snippet-start:[config.swift.use-custom-configuration]
1517
// Create an Amazon S3 client configuration object that specifies the
16-
// region as "us-east-1", the adaptive retry mode, and the maximum
17-
// number of retries as 5.
18+
// region as "us-east-1", an exponential backoff strategy, the
19+
// adaptive retry mode, and the maximum number of retries as 5.
1820

1921
let config: S3Client.S3ClientConfiguration
2022

@@ -23,8 +25,9 @@ struct ConfigExample {
2325
config = try await S3Client.S3ClientConfiguration(
2426
region: "us-east-1",
2527
retryStrategyOptions: RetryStrategyOptions(
28+
backoffStrategy: SmithyRetries.ExponentialBackoffStrategy(),
2629
maxRetriesBase: 5,
27-
rateLimitingMode: .adaptive
30+
rateLimitingMode: RetryStrategyOptions.RateLimitingMode.adaptive
2831
)
2932
)
3033
// snippet-end:[config.swift.create-configuration]

0 commit comments

Comments
 (0)