Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class UnauthenticatedAPITests: XCTestCase {
cognitoIdentityClient = try CognitoIdentityClient(region: region)

// CognitoIdentity client for calling unauthenticated API against an identity pool.
let config = try await CognitoIdentityClient.CognitoIdentityClientConfiguration(region: region)
var config = try await CognitoIdentityClient.CognitoIdentityClientConfiguration(region: region)
config.addInterceptorProvider(GetHeadersBeforeTransmitProvider())
cognitoIdentityUnauthenticatedCheckClient = CognitoIdentityClient(config: config)

Expand Down Expand Up @@ -73,7 +73,7 @@ class GetHeadersBeforeTransmit<InputType, OutputType>: Interceptor {
XCTAssertTrue(!context.getRequest().headers.exists(name: "Authorization"))
}
}
class GetHeadersBeforeTransmitProvider: HttpInterceptorProvider {
final class GetHeadersBeforeTransmitProvider: HttpInterceptorProvider, @unchecked Sendable {
func create<InputType, OutputType>() -> any Interceptor<InputType, OutputType, HTTPRequest, HTTPResponse> {
return GetHeadersBeforeTransmit()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ final class QueryCompatibleTest: XCTestCase {

// Mock HTTP Client Implementation

private class MockHTTPClient: HTTPClient {
private class MockHTTPClient: HTTPClient, @unchecked Sendable {
private let handler: (HTTPRequest) async throws -> HTTPResponse

init(handler: @escaping (HTTPRequest) -> HTTPResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProcessAWSCredentialIdentityResolverTests: XCTestCase {
)

// Setup S3ClientConfiguration to use ProcessAWSCredentialIdentityResolver
let testConfig = try await S3Client.S3ClientConfiguration()
var testConfig = try await S3Client.S3ClientConfiguration()
testConfig.awsCredentialIdentityResolver = processAWSCredentialIdentityResolver

// Initialize our S3 client with the specified configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import AWSClientRuntime
import AwsCommonRuntimeKit
import ClientRuntime

public class MockHttpClientEngine: HTTPClient {
public class MockHttpClientEngine: HTTPClient, @unchecked Sendable {
private let errorResponsePayload: String

// Public initializer
Expand Down Expand Up @@ -76,7 +76,7 @@ class S3ErrorIn200Test: XCTestCase {

/// S3Client throws expected InternalError error in response (200) with <Error> tag
func test_foundInternalErrorExpectedError() async throws {
let config = try await S3Client.S3ClientConfiguration(region: "us-west-2")
var config = try await S3Client.S3ClientConfiguration(region: "us-west-2")
config.httpClientEngine = MockHttpClientEngine(response: errorInternalErrorResponsePayload)
let client = S3Client(config: config)

Expand All @@ -95,7 +95,7 @@ class S3ErrorIn200Test: XCTestCase {

/// S3Client throws expected SlowDown error in response (200) with <Error> tag
func test_foundSlowDownExpectedError() async throws {
let config = try await S3Client.S3ClientConfiguration(region: "us-west-2")
var config = try await S3Client.S3ClientConfiguration(region: "us-west-2")
config.httpClientEngine = MockHttpClientEngine(response: errorSlowDownResponsePayload)
let client = S3Client(config: config)

Expand All @@ -114,7 +114,7 @@ class S3ErrorIn200Test: XCTestCase {

/// S3Client does not throw error when <Error> is not at the root
func test_noErrorExpected() async throws {
let config = try await S3Client.S3ClientConfiguration(region: "us-west-2")
var config = try await S3Client.S3ClientConfiguration(region: "us-west-2")
config.httpClientEngine = MockHttpClientEngine(response: shouldNotApplyResponsePayload)
let client = S3Client(config: config)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class CheckSelectedAuthScheme<InputType, OutputType>: Interceptor {
}
}

class CheckSelectedAuthSchemeProvider: HttpInterceptorProvider {
class CheckSelectedAuthSchemeProvider: HttpInterceptorProvider, @unchecked Sendable {

let expectedAuthScheme: AuthScheme

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class S3FlexibleChecksumsReusageTests: XCTestCase {
self.tempFileURL = tempFileURL

// Create S3 client with mock HTTP client.
let config = try await S3Client.S3ClientConfiguration(region: region)
var config = try await S3Client.S3ClientConfiguration(region: region)
config.httpClientEngine = MockHTTPClientEngine(payloadFileURL: tempFileURL)
client = S3Client(config: config)
}
Expand All @@ -60,7 +60,7 @@ class S3FlexibleChecksumsReusageTests: XCTestCase {
}
}

private class MockHTTPClientEngine: HTTPClient {
private final class MockHTTPClientEngine: HTTPClient, @unchecked Sendable {
// The temporary payload file used for testing.
let payloadFileURL: URL
var requestNum = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ final class S3FlexibleChecksumsTests: S3XCTestCase {
}
}

class DisablePayloadSigningProvider: HttpInterceptorProvider {
class DisablePayloadSigningProvider: HttpInterceptorProvider, @unchecked Sendable {
func create<InputType, OutputType>() -> any Interceptor<InputType, OutputType, HTTPRequest, HTTPResponse> {
return DisablePayloadSigning()
}
}

func test_putGetObject_streamining_unsigned_chunked() async throws {
let config = try await S3Client.S3ClientConfiguration(region: region)
var config = try await S3Client.S3ClientConfiguration(region: region)
config.addInterceptorProvider(DisablePayloadSigningProvider())
let customizedClient = S3Client(config: config)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ class S3ToggleUnsignedPayloadTests: S3XCTestCase {
}
}

class CheckUnsignedPayloadHeaderProvider: HttpInterceptorProvider {
class CheckUnsignedPayloadHeaderProvider: HttpInterceptorProvider, @unchecked Sendable {
func create<InputType, OutputType>() -> any Interceptor<InputType, OutputType, HTTPRequest, HTTPResponse> {
return CheckUnsignedPayloadHeader()
}
}

class CheckStreamingUnsignedPayloadHeaderProvider: HttpInterceptorProvider {
class CheckStreamingUnsignedPayloadHeaderProvider: HttpInterceptorProvider, @unchecked Sendable {
func create<InputType, OutputType>() -> any Interceptor<InputType, OutputType, HTTPRequest, HTTPResponse> {
return CheckStreamingUnsignedPayloadHeader()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class SSOAWSCredentialIdentityResolverTests : XCTestCase {
let ssoAWSCredentialIdentityResolver = try SSOAWSCredentialIdentityResolver()

// Setup S3ClientConfiguration to use SSOAWSCredentialIdentityResolver
let testConfig = try await S3Client.S3ClientConfiguration()
var testConfig = try await S3Client.S3ClientConfiguration()
testConfig.awsCredentialIdentityResolver = ssoAWSCredentialIdentityResolver
testConfig.region = region

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SigningRegionAssertInterceptor<InputType, OutputType>: Interceptor {
}
}

class SigningRegionAssertInterceptorProvider: HttpInterceptorProvider {
class SigningRegionAssertInterceptorProvider: HttpInterceptorProvider, @unchecked Sendable {
func create<InputType, OutputType>() -> any Interceptor<InputType, OutputType, HTTPRequest, HTTPResponse> {
return SigningRegionAssertInterceptor()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ final class QueryCompatibleTests: XCTestCase {

// Mock HTTP Client Implementation

private class MockHTTPClient: HTTPClient {
private final class MockHTTPClient: HTTPClient, @unchecked Sendable {
private let handler: (HTTPRequest) async throws -> HTTPResponse

init(handler: @escaping (HTTPRequest) -> HTTPResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DefaultAWSCredentialIdentityResolverChainTests: XCTestCase {

override func setUp() async throws {
try await super.setUp()
let stsConfig = try await STSClient.STSClientConfiguration(region: region)
var stsConfig = try await STSClient.STSClientConfiguration(region: region)
stsConfig.addInterceptorProvider(XCTestAssertionInterceptorProvider())
stsClient = STSClient(config: stsConfig)
}
Expand Down Expand Up @@ -56,7 +56,7 @@ class DefaultAWSCredentialIdentityResolverChainTests: XCTestCase {
}
}

class XCTestAssertionInterceptorProvider: HttpInterceptorProvider {
class XCTestAssertionInterceptorProvider: HttpInterceptorProvider, @unchecked Sendable {
private let checker = XCTestAssertionChecker()
func create<InputType, OutputType>() -> any Interceptor<InputType, OutputType, HTTPRequest, HTTPResponse> {
return InterceptorContainer(checker: checker)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import enum AWSSDKChecksums.AWSChecksumCalculationMode
import SmithyIdentity

public protocol AWSDefaultClientConfiguration {
public protocol AWSDefaultClientConfiguration: Sendable {
/// The AWS credential identity resolver to be used for AWS credentials.
///
/// If no resolver is supplied, `AWSSDKIdentity.DefaultAWSCredentialIdentityResolverChain` gets used by default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// SPDX-License-Identifier: Apache-2.0
//

public protocol AWSRegionClientConfiguration {
public protocol AWSRegionClientConfiguration: Sendable {

/// The AWS region to use, i.e. `us-east-1` or `us-west-2`, etc.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public class DefaultAWSClientPlugin: Plugin {
self.clientName = clientName
}

public func configureClient(clientConfiguration: ClientConfiguration) throws {
if var config = clientConfiguration as? (DefaultClientConfiguration
public func configureClient(clientConfiguration: inout ClientConfiguration) async throws {
guard var config = clientConfiguration as? (DefaultClientConfiguration
& AWSDefaultClientConfiguration
& AWSRegionClientConfiguration) {
config.retryStrategyOptions = try AWSClientConfigDefaultsProvider.retryStrategyOptions(
config.awsRetryMode,
config.maxAttempts
)
}
& AWSRegionClientConfiguration) else { return }
config.retryStrategyOptions = try AWSClientConfigDefaultsProvider.retryStrategyOptions(
config.awsRetryMode,
config.maxAttempts
)
clientConfiguration = config as ClientConfiguration
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ public class RegionPlugin: Plugin {
self.region = region
}

public func configureClient(clientConfiguration: ClientConfiguration) {
if var config = clientConfiguration as? AWSRegionClientConfiguration {
config.region = self.region
config.signingRegion = self.region
}
public func configureClient(clientConfiguration: inout ClientConfiguration) async throws {
guard var config = clientConfiguration as? any AWSRegionClientConfiguration else { return }
config.region = self.region
config.signingRegion = self.region
// Force cast is safe since config originated from clientConfiguration which conforms to ClientConfiguration
// swiftlint:disable:next force_cast
clientConfiguration = config as! ClientConfiguration
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/// The mode of operation for the SDK's retry mechanism.
///
/// This may be specified using the `AWS_RETRY_MODE` environment var, or the `retry_mode` field of the AWS config file.
public enum AWSRetryMode: String {
public enum AWSRetryMode: String, Sendable {

/// Use the retry behavior that this SDK implemented before the "Retry Behavior 2.0" spec.
/// For the Swift SDK, this is the same behavior as standard.
Expand Down
Loading
Loading