diff --git a/Sources/ClientRuntime/Client/Client.swift b/Sources/ClientRuntime/Client/Client.swift index 424d580fe..40742a4fd 100644 --- a/Sources/ClientRuntime/Client/Client.swift +++ b/Sources/ClientRuntime/Client/Client.swift @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: Apache-2.0 // -public protocol Client { +public protocol Client: Sendable { associatedtype Config: ClientConfiguration init(config: Config) } diff --git a/Sources/ClientRuntime/Config/ClientConfiguration.swift b/Sources/ClientRuntime/Config/ClientConfiguration.swift index 8b76fe7c5..f0a4129d7 100644 --- a/Sources/ClientRuntime/Config/ClientConfiguration.swift +++ b/Sources/ClientRuntime/Config/ClientConfiguration.swift @@ -5,6 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // -public protocol ClientConfiguration { +public protocol ClientConfiguration: Sendable { init() async throws } diff --git a/Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift b/Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift index 1b61a9467..699bef0dc 100644 --- a/Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift +++ b/Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift @@ -29,7 +29,7 @@ import Glibc import Darwin #endif -public class CRTClientEngine: HTTPClient { +public class CRTClientEngine: HTTPClient, @unchecked Sendable { public static let noOpCrtClientEngineTelemetry = HttpTelemetry( httpScope: "CRTClientEngine", telemetryProvider: DefaultTelemetry.provider @@ -171,7 +171,7 @@ public class CRTClientEngine: HTTPClient { public typealias StreamContinuation = CheckedContinuation private let telemetry: HttpTelemetry - private var logger: LogAgent + private let logger: LogAgent private let serialExecutor: SerialExecutor private let CONTENT_LENGTH_HEADER = "Content-Length" private let AWS_COMMON_RUNTIME = "AwsCommonRuntime" diff --git a/Sources/ClientRuntime/Networking/Http/SdkHttpClient.swift b/Sources/ClientRuntime/Networking/Http/SdkHttpClient.swift index 827009df6..702dff0dc 100644 --- a/Sources/ClientRuntime/Networking/Http/SdkHttpClient.swift +++ b/Sources/ClientRuntime/Networking/Http/SdkHttpClient.swift @@ -9,7 +9,7 @@ import class SmithyHTTPAPI.HTTPRequest import class SmithyHTTPAPI.HTTPResponse /// this class will implement Handler per new middleware implementation -public class SdkHttpClient: ExecuteRequest { +public class SdkHttpClient: ExecuteRequest, @unchecked Sendable { let engine: HTTPClient diff --git a/Sources/ClientRuntime/Networking/Http/URLSession/URLSessionHTTPClient.swift b/Sources/ClientRuntime/Networking/Http/URLSession/URLSessionHTTPClient.swift index 2a0c6ea20..e3594c41d 100644 --- a/Sources/ClientRuntime/Networking/Http/URLSession/URLSessionHTTPClient.swift +++ b/Sources/ClientRuntime/Networking/Http/URLSession/URLSessionHTTPClient.swift @@ -56,7 +56,7 @@ import class SmithyStreams.BufferedStream /// for details about allowable modes of networking on the Apple Watch platform.) /// /// On Linux platforms, we recommend using the CRT-based HTTP client for its configurability and performance. -public final class URLSessionHTTPClient: HTTPClient { +public final class URLSessionHTTPClient: HTTPClient, @unchecked Sendable { public static let noOpURLSessionHTTPClientTelemetry = HttpTelemetry( httpScope: "URLSessionHTTPClient", telemetryProvider: DefaultTelemetry.provider @@ -406,7 +406,7 @@ public final class URLSessionHTTPClient: HTTPClient { private let telemetry: HttpTelemetry /// The logger for this HTTP client. - private var logger: LogAgent + private let logger: LogAgent /// The TLS options for this HTTP client. private let tlsConfiguration: URLSessionTLSOptions? diff --git a/Sources/SmithyHTTPAPI/HTTPClient.swift b/Sources/SmithyHTTPAPI/HTTPClient.swift index d6268ede5..067e5d6d1 100644 --- a/Sources/SmithyHTTPAPI/HTTPClient.swift +++ b/Sources/SmithyHTTPAPI/HTTPClient.swift @@ -6,7 +6,7 @@ // /// The interface for a client that can be used to perform SDK operations over HTTP. -public protocol HTTPClient { +public protocol HTTPClient: Sendable { /// Executes an HTTP request to perform an SDK operation. /// diff --git a/Sources/SmithyHTTPClientAPI/HttpClientConfiguration.swift b/Sources/SmithyHTTPClientAPI/HttpClientConfiguration.swift index 9bec15b91..e3161d83a 100644 --- a/Sources/SmithyHTTPClientAPI/HttpClientConfiguration.swift +++ b/Sources/SmithyHTTPClientAPI/HttpClientConfiguration.swift @@ -9,7 +9,7 @@ import struct Foundation.TimeInterval import enum Smithy.URIScheme import struct SmithyHTTPAPI.Headers -public class HTTPClientConfiguration { +public class HTTPClientConfiguration: @unchecked Sendable { /// The timeout for establishing a connection, in seconds. /// diff --git a/Sources/SmithyHTTPClientAPI/TLSConfiguration.swift b/Sources/SmithyHTTPClientAPI/TLSConfiguration.swift index d4ed04ece..c957e8f95 100644 --- a/Sources/SmithyHTTPClientAPI/TLSConfiguration.swift +++ b/Sources/SmithyHTTPClientAPI/TLSConfiguration.swift @@ -10,7 +10,7 @@ * All settings are optional. * Not specifying them will use the SDK defaults */ -public protocol TLSConfiguration { +public protocol TLSConfiguration: Sendable { // Optional path to a PEM certificate var certificate: String? { get set } diff --git a/Sources/SmithyIdentity/AWSCredentialIdentityResolver.swift b/Sources/SmithyIdentity/AWSCredentialIdentityResolver.swift index 1e3e47a8b..9091cffc8 100644 --- a/Sources/SmithyIdentity/AWSCredentialIdentityResolver.swift +++ b/Sources/SmithyIdentity/AWSCredentialIdentityResolver.swift @@ -10,7 +10,7 @@ import struct Smithy.Attributes import protocol SmithyIdentityAPI.IdentityResolver /// A type that can provide credentials for authenticating with an AWS service -public protocol AWSCredentialIdentityResolver: IdentityResolver where IdentityT == AWSCredentialIdentity {} +public protocol AWSCredentialIdentityResolver: IdentityResolver, Sendable where IdentityT == AWSCredentialIdentity {} public extension AWSCredentialIdentityResolver { diff --git a/Sources/SmithyIdentity/BearerTokenIdentityResolvers/BearerTokenIdentityResolver.swift b/Sources/SmithyIdentity/BearerTokenIdentityResolvers/BearerTokenIdentityResolver.swift index 539c7cdbe..1759f9002 100644 --- a/Sources/SmithyIdentity/BearerTokenIdentityResolvers/BearerTokenIdentityResolver.swift +++ b/Sources/SmithyIdentity/BearerTokenIdentityResolvers/BearerTokenIdentityResolver.swift @@ -9,4 +9,4 @@ import protocol SmithyIdentityAPI.IdentityResolver /// The type that resolves a bearer token identity for authenticating with a service. /// All concrete implementations for bearer token identity resolver must conform to this protocol. -public protocol BearerTokenIdentityResolver: IdentityResolver where IdentityT == BearerTokenIdentity {} +public protocol BearerTokenIdentityResolver: IdentityResolver, Sendable where IdentityT == BearerTokenIdentity {} diff --git a/Sources/SmithySwiftNIO/SwiftNIOHTTPClient.swift b/Sources/SmithySwiftNIO/SwiftNIOHTTPClient.swift index 69761212c..560aadadb 100644 --- a/Sources/SmithySwiftNIO/SwiftNIOHTTPClient.swift +++ b/Sources/SmithySwiftNIO/SwiftNIOHTTPClient.swift @@ -37,7 +37,7 @@ public final class SwiftNIOHTTPClient: SmithyHTTPAPI.HTTPClient { private let telemetry: SmithyHTTPClientAPI.HttpTelemetry /// Logger for HTTP-related events. - private var logger: LogAgent + private let logger: LogAgent /// Creates a new `SwiftNIOHTTPClient`. /// diff --git a/Sources/SmithyTestUtil/ProtocolTestClient.swift b/Sources/SmithyTestUtil/ProtocolTestClient.swift index c3d591fb8..026547680 100644 --- a/Sources/SmithyTestUtil/ProtocolTestClient.swift +++ b/Sources/SmithyTestUtil/ProtocolTestClient.swift @@ -8,7 +8,7 @@ import class SmithyHTTPAPI.HTTPRequest import class SmithyHTTPAPI.HTTPResponse import ClientRuntime -public class ProtocolTestClient { +public final class ProtocolTestClient { public init() {} } diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/endpoints/EndpointResolverGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/endpoints/EndpointResolverGenerator.kt index 0b5c9179c..2969eb668 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/endpoints/EndpointResolverGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/endpoints/EndpointResolverGenerator.kt @@ -64,7 +64,7 @@ class EndpointResolverGenerator( } } writer.write("") - writer.write("extension DefaultEndpointResolver: EndpointResolver {}") + writer.write("extension DefaultEndpointResolver: EndpointResolver where Params == EndpointParams {}") } private fun renderStaticResolver(writer: SwiftWriter) { diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HttpProtocolServiceClient.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HttpProtocolServiceClient.kt index 99ba1847e..39a4d3803 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HttpProtocolServiceClient.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HttpProtocolServiceClient.kt @@ -26,7 +26,7 @@ open class HttpProtocolServiceClient( fun render(serviceSymbol: Symbol) { writer.openBlock( - "${ctx.settings.visibility} class \$L: \$N {", + "${ctx.settings.visibility} final class \$L: \$N, Sendable {", "}", serviceSymbol.name, clientProtocolSymbol, @@ -119,7 +119,7 @@ open class HttpProtocolServiceClient( .joinToString(" & ") writer.openBlock( - "public class \$LConfiguration: \$L {", + "public final class \$LConfiguration: \$L, @unchecked Sendable {", "}", serviceConfig.clientName.toUpperCamelCase(), clientConfigurationProtocols, diff --git a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt index 800f64fd3..41e19ecb4 100644 --- a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt @@ -17,7 +17,7 @@ class HttpProtocolClientGeneratorTests { val contents = getFileContents(context.manifest, "Sources/RestJson/RestJsonProtocolClient.swift") contents.shouldSyntacticSanityCheck() val expected = """ -public class RestJsonProtocolClient: ClientRuntime.Client { +public final class RestJsonProtocolClient: ClientRuntime.Client, Sendable { public static let clientName = "RestJsonProtocolClient" public static let version = "2019-12-16" let client: ClientRuntime.SdkHttpClient @@ -38,7 +38,7 @@ public class RestJsonProtocolClient: ClientRuntime.Client { extension RestJsonProtocolClient { - public class RestJsonProtocolClientConfiguration: ClientRuntime.DefaultClientConfiguration & ClientRuntime.DefaultHttpClientConfiguration { + public final class RestJsonProtocolClientConfiguration: ClientRuntime.DefaultClientConfiguration & ClientRuntime.DefaultHttpClientConfiguration, @unchecked Sendable { public var telemetryProvider: ClientRuntime.TelemetryProvider public var retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions public var clientLogMode: ClientRuntime.ClientLogMode