From 0296c2926e0f4226a6f4e4f50613fc5b87a4e693 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 2 May 2024 17:06:06 -0500 Subject: [PATCH 01/18] Created SmithyRetryAPI and SmithyRetry impl modules --- Package.swift | 15 +++++++++++++ .../Config/DefaultClientConfiguration.swift | 2 ++ .../DefaultSDKRuntimeConfiguration.swift | 7 ++++++- .../Middleware/RetryMiddleware.swift | 3 +++ .../Plugins/DefaultClientPlugin.swift | 2 ++ .../Plugins/HttpClientPlugin.swift | 2 ++ .../ClientRuntime/Plugins/RetryPlugin.swift | 2 ++ .../DefaultRetryErrorInfoProvider.swift | 4 ++++ .../ClientSideRateLimiter.swift | 0 .../DefaultRetryStrategy.swift | 3 +++ .../DefaultRetryToken.swift | 1 + .../DefaultRetryStrategy/RetryQuota.swift | 1 + .../RetryQuotaRepository.swift | 2 ++ .../ExponentialBackOffJitterType.swift | 0 .../ExponentialBackoffStrategy.swift | 1 + .../ExponentialBackoffStrategyOptions.swift | 0 .../SmithyRetries/RetryErrorType+CRT.swift | 21 +++++++++++++++++++ .../RetryBackoffStrategy.swift | 0 .../RetryErrorInfo.swift | 0 .../RetryErrorInfoProvider.swift | 0 .../RetryErrorType.swift | 13 ------------ .../RetryStrategy.swift | 0 .../RetryStrategyOptions.swift | 6 +++--- .../RetryToken.swift | 0 .../DefaultRetryErrorInfoProviderTests.swift | 0 .../ClientSideRateLimiterTests.swift | 1 + .../DefaultRetryStrategyTests.swift | 2 ++ .../ExponentialBackoffStrategyTests.swift | 1 + .../RetryQuotaTests.swift | 1 + .../RetryIntegrationTests.swift | 2 ++ 30 files changed, 75 insertions(+), 17 deletions(-) rename Sources/{ClientRuntime/Retries => SmithyRetries}/DefaultRetryStrategy/ClientSideRateLimiter.swift (100%) rename Sources/{ClientRuntime/Retries => SmithyRetries}/DefaultRetryStrategy/DefaultRetryStrategy.swift (94%) rename Sources/{ClientRuntime/Retries => SmithyRetries}/DefaultRetryStrategy/DefaultRetryToken.swift (96%) rename Sources/{ClientRuntime/Retries => SmithyRetries}/DefaultRetryStrategy/RetryQuota.swift (98%) rename Sources/{ClientRuntime/Retries => SmithyRetries}/DefaultRetryStrategy/RetryQuotaRepository.swift (94%) rename Sources/{ClientRuntime/Retries => SmithyRetries}/ExponentialBackOffJitterType.swift (100%) rename Sources/{ClientRuntime/Retries => SmithyRetries}/ExponentialBackoffStrategy.swift (93%) rename Sources/{ClientRuntime/Retries => SmithyRetries}/ExponentialBackoffStrategyOptions.swift (100%) create mode 100644 Sources/SmithyRetries/RetryErrorType+CRT.swift rename Sources/{ClientRuntime/Retries => SmithyRetriesAPI}/RetryBackoffStrategy.swift (100%) rename Sources/{ClientRuntime/Retries => SmithyRetriesAPI}/RetryErrorInfo.swift (100%) rename Sources/{ClientRuntime/Retries => SmithyRetriesAPI}/RetryErrorInfoProvider.swift (100%) rename Sources/{ClientRuntime/Retries => SmithyRetriesAPI}/RetryErrorType.swift (72%) rename Sources/{ClientRuntime/Retries => SmithyRetriesAPI}/RetryStrategy.swift (100%) rename Sources/{ClientRuntime/Retries => SmithyRetriesAPI}/RetryStrategyOptions.swift (95%) rename Sources/{ClientRuntime/Retries => SmithyRetriesAPI}/RetryToken.swift (100%) rename Tests/{ClientRuntimeTests/Retry => SmithyRetriesTests}/DefaultRetryErrorInfoProviderTests.swift (100%) rename Tests/{ClientRuntimeTests/Retry => SmithyRetriesTests}/DefaultRetryStrategy/ClientSideRateLimiterTests.swift (99%) rename Tests/{ClientRuntimeTests/Retry => SmithyRetriesTests}/DefaultRetryStrategy/DefaultRetryStrategyTests.swift (99%) rename Tests/{ClientRuntimeTests/Retry => SmithyRetriesTests}/DefaultRetryStrategy/ExponentialBackoffStrategyTests.swift (98%) rename Tests/{ClientRuntimeTests/Retry => SmithyRetriesTests}/DefaultRetryStrategy/RetryQuotaTests.swift (99%) rename Tests/{ClientRuntimeTests/Retry => SmithyRetriesTests}/RetryIntegrationTests.swift (99%) diff --git a/Package.swift b/Package.swift index cdc2bab18..cb44c6f73 100644 --- a/Package.swift +++ b/Package.swift @@ -41,6 +41,8 @@ let package = Package( .target( name: "ClientRuntime", dependencies: [ + "SmithyRetriesAPI", + "SmithyRetries", "SmithyXML", .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), .product(name: "Logging", package: "swift-log"), @@ -49,6 +51,19 @@ let package = Package( .copy("PrivacyInfo.xcprivacy") ] ), + .target( + name: "SmithyRetriesAPI" + ), + .target( + name: "SmithyRetries", + dependencies: [ + .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), + ] + ), + .testTarget( + name: "SmithyRetriesTests", + dependencies: ["ClientRuntime", "SmithyRetriesAPI", "SmithyRetries"] + ), .target(name: "SmithyReadWrite"), .target( name: "SmithyXML", diff --git a/Sources/ClientRuntime/Config/DefaultClientConfiguration.swift b/Sources/ClientRuntime/Config/DefaultClientConfiguration.swift index 17e24c31d..30df0a5b2 100644 --- a/Sources/ClientRuntime/Config/DefaultClientConfiguration.swift +++ b/Sources/ClientRuntime/Config/DefaultClientConfiguration.swift @@ -5,6 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct SmithyRetriesAPI.RetryStrategyOptions + public protocol DefaultClientConfiguration: ClientConfiguration { /// The configuration for retry of failed network requests. /// diff --git a/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift b/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift index 1018990e1..a1009b666 100644 --- a/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift +++ b/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift @@ -5,6 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 // +import protocol SmithyRetriesAPI.RetryStrategy +import protocol SmithyRetriesAPI.RetryErrorInfoProvider +import struct SmithyRetriesAPI.RetryStrategyOptions +import struct SmithyRetries.ExponentialBackoffStrategy + /// Provides configuration options for a Smithy-based service. public struct DefaultSDKRuntimeConfiguration { @@ -119,7 +124,7 @@ public extension DefaultSDKRuntimeConfiguration { /// The retry strategy options to use when none is provided. /// /// Defaults to options with the defaults defined in `RetryStrategyOptions`. - static var defaultRetryStrategyOptions: RetryStrategyOptions { RetryStrategyOptions() } + static var defaultRetryStrategyOptions: RetryStrategyOptions { RetryStrategyOptions(backoffStrategy: ExponentialBackoffStrategy()) } /// The log mode to use when none is provided /// diff --git a/Sources/ClientRuntime/Middleware/RetryMiddleware.swift b/Sources/ClientRuntime/Middleware/RetryMiddleware.swift index 317446c46..0fb167bc8 100644 --- a/Sources/ClientRuntime/Middleware/RetryMiddleware.swift +++ b/Sources/ClientRuntime/Middleware/RetryMiddleware.swift @@ -10,6 +10,9 @@ import struct Foundation.Locale import struct Foundation.TimeInterval import struct Foundation.TimeZone import struct Foundation.UUID +import protocol SmithyRetriesAPI.RetryStrategy +import protocol SmithyRetriesAPI.RetryErrorInfoProvider +import struct SmithyRetriesAPI.RetryStrategyOptions public struct RetryMiddleware AwsCommonRuntimeKit.RetryError { + switch self { + case .transient: return .transient + case .throttling: return .throttling + case .serverError: return .serverError + case .clientError: return .clientError + } + } +} diff --git a/Sources/ClientRuntime/Retries/RetryBackoffStrategy.swift b/Sources/SmithyRetriesAPI/RetryBackoffStrategy.swift similarity index 100% rename from Sources/ClientRuntime/Retries/RetryBackoffStrategy.swift rename to Sources/SmithyRetriesAPI/RetryBackoffStrategy.swift diff --git a/Sources/ClientRuntime/Retries/RetryErrorInfo.swift b/Sources/SmithyRetriesAPI/RetryErrorInfo.swift similarity index 100% rename from Sources/ClientRuntime/Retries/RetryErrorInfo.swift rename to Sources/SmithyRetriesAPI/RetryErrorInfo.swift diff --git a/Sources/ClientRuntime/Retries/RetryErrorInfoProvider.swift b/Sources/SmithyRetriesAPI/RetryErrorInfoProvider.swift similarity index 100% rename from Sources/ClientRuntime/Retries/RetryErrorInfoProvider.swift rename to Sources/SmithyRetriesAPI/RetryErrorInfoProvider.swift diff --git a/Sources/ClientRuntime/Retries/RetryErrorType.swift b/Sources/SmithyRetriesAPI/RetryErrorType.swift similarity index 72% rename from Sources/ClientRuntime/Retries/RetryErrorType.swift rename to Sources/SmithyRetriesAPI/RetryErrorType.swift index b66ccf3f6..702ddfca5 100644 --- a/Sources/ClientRuntime/Retries/RetryErrorType.swift +++ b/Sources/SmithyRetriesAPI/RetryErrorType.swift @@ -4,7 +4,6 @@ // // SPDX-License-Identifier: Apache-2.0 // -import AwsCommonRuntimeKit public enum RetryErrorType: Equatable { @@ -22,15 +21,3 @@ public enum RetryErrorType: Equatable { /// Doesn’t count against any budgets. This could be something like a 401 challenge in HTTP. case clientError } - -public extension RetryErrorType { - - func toCRTType() -> AwsCommonRuntimeKit.RetryError { - switch self { - case .transient: return .transient - case .throttling: return .throttling - case .serverError: return .serverError - case .clientError: return .clientError - } - } -} diff --git a/Sources/ClientRuntime/Retries/RetryStrategy.swift b/Sources/SmithyRetriesAPI/RetryStrategy.swift similarity index 100% rename from Sources/ClientRuntime/Retries/RetryStrategy.swift rename to Sources/SmithyRetriesAPI/RetryStrategy.swift diff --git a/Sources/ClientRuntime/Retries/RetryStrategyOptions.swift b/Sources/SmithyRetriesAPI/RetryStrategyOptions.swift similarity index 95% rename from Sources/ClientRuntime/Retries/RetryStrategyOptions.swift rename to Sources/SmithyRetriesAPI/RetryStrategyOptions.swift index 078c1136d..c0e7aea28 100644 --- a/Sources/ClientRuntime/Retries/RetryStrategyOptions.swift +++ b/Sources/SmithyRetriesAPI/RetryStrategyOptions.swift @@ -36,12 +36,12 @@ public struct RetryStrategyOptions { /// Sets the initial available capacity for this retry strategy's quotas. /// /// Used only during testing, production uses the default values. - let availableCapacity: Int + public let availableCapacity: Int /// Sets the maximum capacity for this retry strategy's quotas. /// /// Used only during testing, production uses the default values. - let maxCapacity: Int + public let maxCapacity: Int /// Creates a new set of retry strategy options /// - Parameters: @@ -50,7 +50,7 @@ public struct RetryStrategyOptions { /// - availableCapacity: The number of available tokens in a retry quota. Defaults to 500. /// - maxCapacity: The max number of tokens in a retry quota. Defaults to 500. public init( - backoffStrategy: RetryBackoffStrategy = ExponentialBackoffStrategy(), + backoffStrategy: RetryBackoffStrategy, maxRetriesBase: Int = 2, availableCapacity: Int = 500, maxCapacity: Int = 500, diff --git a/Sources/ClientRuntime/Retries/RetryToken.swift b/Sources/SmithyRetriesAPI/RetryToken.swift similarity index 100% rename from Sources/ClientRuntime/Retries/RetryToken.swift rename to Sources/SmithyRetriesAPI/RetryToken.swift diff --git a/Tests/ClientRuntimeTests/Retry/DefaultRetryErrorInfoProviderTests.swift b/Tests/SmithyRetriesTests/DefaultRetryErrorInfoProviderTests.swift similarity index 100% rename from Tests/ClientRuntimeTests/Retry/DefaultRetryErrorInfoProviderTests.swift rename to Tests/SmithyRetriesTests/DefaultRetryErrorInfoProviderTests.swift diff --git a/Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/ClientSideRateLimiterTests.swift b/Tests/SmithyRetriesTests/DefaultRetryStrategy/ClientSideRateLimiterTests.swift similarity index 99% rename from Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/ClientSideRateLimiterTests.swift rename to Tests/SmithyRetriesTests/DefaultRetryStrategy/ClientSideRateLimiterTests.swift index 909c299dc..5b8e6b5c4 100644 --- a/Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/ClientSideRateLimiterTests.swift +++ b/Tests/SmithyRetriesTests/DefaultRetryStrategy/ClientSideRateLimiterTests.swift @@ -7,6 +7,7 @@ import Foundation import XCTest +@testable import SmithyRetries @testable import ClientRuntime final class ClientSideRateLimiterTests: XCTestCase { diff --git a/Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/DefaultRetryStrategyTests.swift b/Tests/SmithyRetriesTests/DefaultRetryStrategy/DefaultRetryStrategyTests.swift similarity index 99% rename from Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/DefaultRetryStrategyTests.swift rename to Tests/SmithyRetriesTests/DefaultRetryStrategy/DefaultRetryStrategyTests.swift index b0e8d84ad..12158ec38 100644 --- a/Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/DefaultRetryStrategyTests.swift +++ b/Tests/SmithyRetriesTests/DefaultRetryStrategy/DefaultRetryStrategyTests.swift @@ -7,6 +7,8 @@ import Foundation import XCTest +import SmithyRetriesAPI +@testable import SmithyRetries @testable import ClientRuntime final class DefaultRetryStrategyTests: XCTestCase { diff --git a/Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/ExponentialBackoffStrategyTests.swift b/Tests/SmithyRetriesTests/DefaultRetryStrategy/ExponentialBackoffStrategyTests.swift similarity index 98% rename from Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/ExponentialBackoffStrategyTests.swift rename to Tests/SmithyRetriesTests/DefaultRetryStrategy/ExponentialBackoffStrategyTests.swift index 4594ea0c9..8a05f052f 100644 --- a/Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/ExponentialBackoffStrategyTests.swift +++ b/Tests/SmithyRetriesTests/DefaultRetryStrategy/ExponentialBackoffStrategyTests.swift @@ -7,6 +7,7 @@ import Foundation import XCTest +@testable import SmithyRetries @testable import ClientRuntime final class ExponentialBackoffStrategyTests: XCTestCase { diff --git a/Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/RetryQuotaTests.swift b/Tests/SmithyRetriesTests/DefaultRetryStrategy/RetryQuotaTests.swift similarity index 99% rename from Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/RetryQuotaTests.swift rename to Tests/SmithyRetriesTests/DefaultRetryStrategy/RetryQuotaTests.swift index 75f9e9427..3327a510b 100644 --- a/Tests/ClientRuntimeTests/Retry/DefaultRetryStrategy/RetryQuotaTests.swift +++ b/Tests/SmithyRetriesTests/DefaultRetryStrategy/RetryQuotaTests.swift @@ -8,6 +8,7 @@ import Foundation import XCTest @testable import ClientRuntime +@testable import SmithyRetries final class RetryQuotaTests: XCTestCase { diff --git a/Tests/ClientRuntimeTests/Retry/RetryIntegrationTests.swift b/Tests/SmithyRetriesTests/RetryIntegrationTests.swift similarity index 99% rename from Tests/ClientRuntimeTests/Retry/RetryIntegrationTests.swift rename to Tests/SmithyRetriesTests/RetryIntegrationTests.swift index 8047c1002..96f9eff0a 100644 --- a/Tests/ClientRuntimeTests/Retry/RetryIntegrationTests.swift +++ b/Tests/SmithyRetriesTests/RetryIntegrationTests.swift @@ -7,6 +7,8 @@ import Foundation import XCTest +import SmithyRetriesAPI +@testable import SmithyRetries @testable import ClientRuntime // This test class reproduces the "Standard Mode" test cases defined in "Retry Behavior 2.0" From 3933ccaf7e140cd25e0f956840bc7e117b828cc7 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 2 May 2024 17:26:33 -0500 Subject: [PATCH 02/18] Publish SmithyRetriesAPI & SmithyRetries --- Package.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Package.swift b/Package.swift index cb44c6f73..7ba387fa9 100644 --- a/Package.swift +++ b/Package.swift @@ -29,6 +29,8 @@ let package = Package( ], products: [ .library(name: "ClientRuntime", targets: ["ClientRuntime"]), + .library(name: "SmithyRetriesAPI", targets: ["SmithyRetriesAPI"]), + .library(name: "SmithyRetries", targets: ["SmithyRetries"]), .library(name: "SmithyReadWrite", targets: ["SmithyReadWrite"]), .library(name: "SmithyXML", targets: ["SmithyXML"]), .library(name: "SmithyTestUtil", targets: ["SmithyTestUtil"]), From 8dde8fc0737c57e53aedebc6b9954bede1d103cd Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 2 May 2024 18:12:56 -0500 Subject: [PATCH 03/18] Use SmithyRetriesAPI module in codegen --- .../swift/codegen/ClientRuntimeTypes.kt | 1 - .../swift/codegen/SmithyRetriesAPITypes.kt | 24 +++++++++++++++++++ .../smithy/swift/codegen/SwiftDependency.kt | 16 +++++++++++++ .../config/DefaultClientConfiguration.kt | 3 ++- 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SmithyRetriesAPITypes.kt diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ClientRuntimeTypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ClientRuntimeTypes.kt index 7411f1c91..1061327f3 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ClientRuntimeTypes.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ClientRuntimeTypes.kt @@ -120,7 +120,6 @@ object ClientRuntimeTypes { val ClientLogMode = runtimeSymbol("ClientLogMode") val IdempotencyTokenGenerator = runtimeSymbol("IdempotencyTokenGenerator") val DefaultRetryStrategy = runtimeSymbol("DefaultRetryStrategy") - val RetryStrategyOptions = runtimeSymbol("RetryStrategyOptions") val DefaultRetryErrorInfoProvider = runtimeSymbol("DefaultRetryErrorInfoProvider") val DefaultSDKRuntimeConfiguration = runtimeSymbol("DefaultSDKRuntimeConfiguration") val DateFormatter = runtimeSymbol("DateFormatter") diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SmithyRetriesAPITypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SmithyRetriesAPITypes.kt new file mode 100644 index 000000000..b15e21d8e --- /dev/null +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SmithyRetriesAPITypes.kt @@ -0,0 +1,24 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +package software.amazon.smithy.swift.codegen + +import software.amazon.smithy.codegen.core.Symbol +import software.amazon.smithy.swift.codegen.model.buildSymbol + +/** + * Commonly used runtime types. Provides a single definition of a runtime symbol such that codegen isn't littered + * with inline symbol creation which makes refactoring of the runtime more difficult and error prone. + * + * NOTE: Not all symbols need be added here but it doesn't hurt to define runtime symbols once. + */ +object SmithyRetriesAPITypes { + val RetryStrategyOptions = runtimeSymbol("RetryStrategyOptions") +} + +private fun runtimeSymbol(name: String): Symbol = buildSymbol { + this.name = name + this.namespace = SwiftDependency.SMITHY_RETRIES_API.target + dependency(SwiftDependency.SMITHY_RETRIES_API) +} diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SwiftDependency.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SwiftDependency.kt index 054012ad0..d7ed699e9 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SwiftDependency.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SwiftDependency.kt @@ -26,6 +26,22 @@ enum class SwiftDependency( Resources.computeAbsolutePath("smithy-swift", "", "SMITHY_SWIFT_CI_DIR"), "smithy-swift" ), + SMITHY_RETRIES_API( + "SmithyRetriesAPI", + "main", + "0.1.0", + "https://github.com/smithy-lang/smithy-swift", + Resources.computeAbsolutePath("smithy-swift", "", "SMITHY_SWIFT_CI_DIR"), + "smithy-swift" + ), + SMITHY_RETRIES( + "SmithyRetries", + "main", + "0.1.0", + "https://github.com/smithy-lang/smithy-swift", + Resources.computeAbsolutePath("smithy-swift", "", "SMITHY_SWIFT_CI_DIR"), + "smithy-swift" + ), XCTest("XCTest", null, "", "", "", ""), SMITHY_TEST_UTIL( "SmithyTestUtil", diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/config/DefaultClientConfiguration.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/config/DefaultClientConfiguration.kt index aea6ed9b9..7299299bc 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/config/DefaultClientConfiguration.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/config/DefaultClientConfiguration.kt @@ -7,6 +7,7 @@ package software.amazon.smithy.swift.codegen.config import software.amazon.smithy.codegen.core.Symbol import software.amazon.smithy.swift.codegen.ClientRuntimeTypes +import software.amazon.smithy.swift.codegen.SmithyRetriesAPITypes import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.SwiftTypes import software.amazon.smithy.swift.codegen.config.ClientConfiguration.Companion.runtimeSymbol @@ -25,7 +26,7 @@ class DefaultClientConfiguration : ClientConfiguration { ), ConfigProperty( "retryStrategyOptions", - ClientRuntimeTypes.Core.RetryStrategyOptions, + SmithyRetriesAPITypes.RetryStrategyOptions, "DefaultSDKRuntimeConfiguration.defaultRetryStrategyOptions" ), ConfigProperty( From 5389c3a167ed9c39b57c58fcc273b364e926f25b Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 3 May 2024 00:00:08 -0500 Subject: [PATCH 04/18] Fix codegen & codegen tests --- .../config/DefaultClientConfiguration.kt | 2 +- .../middlewares/RetryMiddleware.kt | 11 +- .../SmithyRetriesAPITypes.kt | 9 +- .../swiftmodules/SmithyRetriesTypes.kt | 21 ++ .../test/kotlin/ContentMd5MiddlewareTests.kt | 28 -- .../HttpProtocolClientGeneratorTests.kt | 277 ++++++------------ .../test/kotlin/IdempotencyTokenTraitTests.kt | 27 -- .../src/test/kotlin/RetryMiddlewareTests.kt | 2 +- 8 files changed, 130 insertions(+), 247 deletions(-) rename smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/{ => swiftmodules}/SmithyRetriesAPITypes.kt (76%) create mode 100644 smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyRetriesTypes.kt diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/config/DefaultClientConfiguration.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/config/DefaultClientConfiguration.kt index 7299299bc..929fa675f 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/config/DefaultClientConfiguration.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/config/DefaultClientConfiguration.kt @@ -7,12 +7,12 @@ package software.amazon.smithy.swift.codegen.config import software.amazon.smithy.codegen.core.Symbol import software.amazon.smithy.swift.codegen.ClientRuntimeTypes -import software.amazon.smithy.swift.codegen.SmithyRetriesAPITypes import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.SwiftTypes import software.amazon.smithy.swift.codegen.config.ClientConfiguration.Companion.runtimeSymbol import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.model.toOptional +import software.amazon.smithy.swift.codegen.swiftmodules.SmithyRetriesAPITypes class DefaultClientConfiguration : ClientConfiguration { override val swiftProtocolName: Symbol diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt index 3cb9489aa..39bb9feea 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt @@ -10,12 +10,14 @@ import software.amazon.smithy.codegen.core.SymbolProvider import software.amazon.smithy.model.Model import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.swift.codegen.ClientRuntimeTypes +import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.SwiftWriter import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.integration.middlewares.handlers.MiddlewareShapeUtils import software.amazon.smithy.swift.codegen.middleware.MiddlewarePosition import software.amazon.smithy.swift.codegen.middleware.MiddlewareRenderable import software.amazon.smithy.swift.codegen.middleware.MiddlewareStep +import software.amazon.smithy.swift.codegen.swiftmodules.SmithyRetriesTypes class RetryMiddleware( val model: Model, @@ -31,11 +33,14 @@ class RetryMiddleware( override fun render(ctx: ProtocolGenerator.GenerationContext, writer: SwiftWriter, op: OperationShape, operationStackName: String) { val output = MiddlewareShapeUtils.outputSymbol(symbolProvider, model, op) - val outputError = MiddlewareShapeUtils.outputErrorSymbol(op) + writer.addImport(SwiftDependency.SMITHY_RETRIES.target) writer.write( - "$operationStackName.${middlewareStep.stringValue()}.intercept(position: ${position.stringValue()}, middleware: \$N<\$N, \$N, \$N>(options: config.retryStrategyOptions))", + "\$L.\$L.intercept(position: \$L, middleware: \$N<\$N, \$N, \$N>(options: config.retryStrategyOptions))", + operationStackName, + middlewareStep.stringValue(), + position.stringValue(), ClientRuntimeTypes.Middleware.RetryMiddleware, - ClientRuntimeTypes.Core.DefaultRetryStrategy, + SmithyRetriesTypes.DefaultRetryStrategy, retryErrorInfoProviderSymbol, output ) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SmithyRetriesAPITypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyRetriesAPITypes.kt similarity index 76% rename from smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SmithyRetriesAPITypes.kt rename to smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyRetriesAPITypes.kt index b15e21d8e..94dadbfd4 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SmithyRetriesAPITypes.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyRetriesAPITypes.kt @@ -1,10 +1,7 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ -package software.amazon.smithy.swift.codegen +package software.amazon.smithy.swift.codegen.swiftmodules import software.amazon.smithy.codegen.core.Symbol +import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.model.buildSymbol /** @@ -20,5 +17,5 @@ object SmithyRetriesAPITypes { private fun runtimeSymbol(name: String): Symbol = buildSymbol { this.name = name this.namespace = SwiftDependency.SMITHY_RETRIES_API.target - dependency(SwiftDependency.SMITHY_RETRIES_API) + this.dependency(SwiftDependency.SMITHY_RETRIES_API) } diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyRetriesTypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyRetriesTypes.kt new file mode 100644 index 000000000..82a5dc409 --- /dev/null +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyRetriesTypes.kt @@ -0,0 +1,21 @@ +package software.amazon.smithy.swift.codegen.swiftmodules + +import software.amazon.smithy.codegen.core.Symbol +import software.amazon.smithy.swift.codegen.SwiftDependency +import software.amazon.smithy.swift.codegen.model.buildSymbol + +/** + * Commonly used runtime types. Provides a single definition of a runtime symbol such that codegen isn't littered + * with inline symbol creation which makes refactoring of the runtime more difficult and error prone. + * + * NOTE: Not all symbols need be added here but it doesn't hurt to define runtime symbols once. + */ +object SmithyRetriesTypes { + val DefaultRetryStrategy = runtimeSymbol("DefaultRetryStrategy") +} + +private fun runtimeSymbol(name: String): Symbol = buildSymbol { + this.name = name + this.namespace = SwiftDependency.SMITHY_RETRIES.target + this.dependency(SwiftDependency.SMITHY_RETRIES) +} diff --git a/smithy-swift-codegen/src/test/kotlin/ContentMd5MiddlewareTests.kt b/smithy-swift-codegen/src/test/kotlin/ContentMd5MiddlewareTests.kt index 465d54544..8d1bed9c2 100644 --- a/smithy-swift-codegen/src/test/kotlin/ContentMd5MiddlewareTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/ContentMd5MiddlewareTests.kt @@ -7,35 +7,7 @@ class ContentMd5MiddlewareTests { val context = setupTests("Isolated/contentmd5checksum.smithy", "aws.protocoltests.restxml#RestXml") val contents = getFileContents(context.manifest, "/RestXml/RestXmlProtocolClient.swift") val expectedContents = """ - public func idempotencyTokenWithStructure(input: IdempotencyTokenWithStructureInput) async throws -> IdempotencyTokenWithStructureOutput { - let context = ClientRuntime.HttpContextBuilder() - .withMethod(value: .put) - .withServiceName(value: serviceName) - .withOperation(value: "idempotencyTokenWithStructure") - .withIdempotencyTokenGenerator(value: config.idempotencyTokenGenerator) - .withLogger(value: config.logger) - .withPartitionID(value: config.partitionID) - .withAuthSchemes(value: config.authSchemes ?? []) - .withAuthSchemeResolver(value: config.authSchemeResolver) - .withUnsignedPayloadTrait(value: false) - .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) - .build() - var operation = ClientRuntime.OperationStack(id: "idempotencyTokenWithStructure") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.IdempotencyTokenMiddleware(keyPath: \.token)) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(IdempotencyTokenWithStructureInput.urlPathProvider(_:))) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.ContentMD5Middleware()) - operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/xml")) - operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.BodyMiddleware(documentWritingClosure: SmithyXML.XMLReadWrite.documentWritingClosure(rootNodeInfo: "IdempotencyToken"), inputWritingClosure: IdempotencyTokenWithStructureInput.writingClosure(_:to:))) - operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) - operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(IdempotencyTokenWithStructureOutput.httpBinding, responseDocumentBinding), responseErrorClosure(IdempotencyTokenWithStructureOutputError.httpBinding, responseDocumentBinding))) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) - let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler()) - return result - } """ contents.shouldContainOnlyOnce(expectedContents) } diff --git a/smithy-swift-codegen/src/test/kotlin/HttpProtocolClientGeneratorTests.kt b/smithy-swift-codegen/src/test/kotlin/HttpProtocolClientGeneratorTests.kt index fddd2413c..837c8ef90 100644 --- a/smithy-swift-codegen/src/test/kotlin/HttpProtocolClientGeneratorTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/HttpProtocolClientGeneratorTests.kt @@ -14,102 +14,101 @@ class HttpProtocolClientGeneratorTests { val context = setupTests("service-generator-test-operations.smithy", "com.test#Example") val contents = getFileContents(context.manifest, "/RestJson/RestJsonProtocolClient.swift") contents.shouldSyntacticSanityCheck() - contents.shouldContainOnlyOnce( - """ - public class RestJsonProtocolClient: Client { - public static let clientName = "RestJsonProtocolClient" - let client: ClientRuntime.SdkHttpClient - let config: RestJsonProtocolClient.RestJsonProtocolClientConfiguration - let serviceName = "Rest Json Protocol" - let encoder: ClientRuntime.RequestEncoder - let decoder: ClientRuntime.ResponseDecoder - - public required init(config: RestJsonProtocolClient.RestJsonProtocolClientConfiguration) { - client = ClientRuntime.SdkHttpClient(engine: config.httpClientEngine, config: config.httpClientConfiguration) - let encoder = ClientRuntime.JSONEncoder() - encoder.dateEncodingStrategy = .secondsSince1970 - encoder.nonConformingFloatEncodingStrategy = .convertToString(positiveInfinity: "Infinity", negativeInfinity: "-Infinity", nan: "NaN") - self.encoder = encoder - let decoder = ClientRuntime.JSONDecoder() - decoder.dateDecodingStrategy = .secondsSince1970 - decoder.nonConformingFloatDecodingStrategy = .convertFromString(positiveInfinity: "Infinity", negativeInfinity: "-Infinity", nan: "NaN") - self.decoder = decoder - self.config = config - } - - public convenience required init() throws { - let config = try RestJsonProtocolClient.RestJsonProtocolClientConfiguration() - self.init(config: config) - } - - } - - extension RestJsonProtocolClient { - public class RestJsonProtocolClientConfiguration: DefaultClientConfiguration & DefaultHttpClientConfiguration { - public var telemetryProvider: ClientRuntime.TelemetryProvider - - public var retryStrategyOptions: ClientRuntime.RetryStrategyOptions - - public var clientLogMode: ClientRuntime.ClientLogMode - - public var endpoint: Swift.String? - - public var idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator - - public var httpClientEngine: ClientRuntime.HTTPClient - - public var httpClientConfiguration: ClientRuntime.HttpClientConfiguration - - public var authSchemes: [ClientRuntime.AuthScheme]? - - public var authSchemeResolver: ClientRuntime.AuthSchemeResolver - - private init(_ telemetryProvider: ClientRuntime.TelemetryProvider, _ retryStrategyOptions: ClientRuntime.RetryStrategyOptions, _ clientLogMode: ClientRuntime.ClientLogMode, _ endpoint: Swift.String?, _ idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator, _ httpClientEngine: ClientRuntime.HTTPClient, _ httpClientConfiguration: ClientRuntime.HttpClientConfiguration, _ authSchemes: [ClientRuntime.AuthScheme]?, _ authSchemeResolver: ClientRuntime.AuthSchemeResolver) { - self.telemetryProvider = telemetryProvider - self.retryStrategyOptions = retryStrategyOptions - self.clientLogMode = clientLogMode - self.endpoint = endpoint - self.idempotencyTokenGenerator = idempotencyTokenGenerator - self.httpClientEngine = httpClientEngine - self.httpClientConfiguration = httpClientConfiguration - self.authSchemes = authSchemes - self.authSchemeResolver = authSchemeResolver - } - - public convenience init(telemetryProvider: ClientRuntime.TelemetryProvider? = nil, retryStrategyOptions: ClientRuntime.RetryStrategyOptions? = nil, clientLogMode: ClientRuntime.ClientLogMode? = nil, endpoint: Swift.String? = nil, idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator? = nil, httpClientEngine: ClientRuntime.HTTPClient? = nil, httpClientConfiguration: ClientRuntime.HttpClientConfiguration? = nil, authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: ClientRuntime.AuthSchemeResolver? = nil) throws { - self.init(telemetryProvider ?? ClientRuntime.DefaultTelemetry.provider, retryStrategyOptions ?? DefaultSDKRuntimeConfiguration.defaultRetryStrategyOptions, clientLogMode ?? DefaultSDKRuntimeConfiguration.defaultClientLogMode, endpoint, idempotencyTokenGenerator ?? DefaultSDKRuntimeConfiguration.defaultIdempotencyTokenGenerator, httpClientEngine ?? DefaultSDKRuntimeConfiguration.makeClient(), httpClientConfiguration ?? DefaultSDKRuntimeConfiguration.defaultHttpClientConfiguration, authSchemes, authSchemeResolver ?? DefaultSDKRuntimeConfiguration.defaultAuthSchemeResolver) - } - - public convenience required init() async throws { - try await self.init(telemetryProvider: nil, retryStrategyOptions: nil, clientLogMode: nil, endpoint: nil, idempotencyTokenGenerator: nil, httpClientEngine: nil, httpClientConfiguration: nil, authSchemes: nil, authSchemeResolver: nil) - } - - public var partitionID: String? { - return "" - } - } - - public static func builder() -> ClientBuilder { - return ClientBuilder(defaultPlugins: [ - ClientRuntime.DefaultClientPlugin() - ]) - } - } - - public struct RestJsonProtocolClientLogHandlerFactory: ClientRuntime.SDKLogHandlerFactory { - public var label = "RestJsonProtocolClient" - let logLevel: ClientRuntime.SDKLogLevel - public func construct(label: String) -> LogHandler { - var handler = StreamLogHandler.standardOutput(label: label) - handler.logLevel = logLevel.toLoggerType() - return handler - } - public init(logLevel: ClientRuntime.SDKLogLevel) { - self.logLevel = logLevel - } - } - """.trimIndent() - ) + val expected = """ +public class RestJsonProtocolClient: Client { + public static let clientName = "RestJsonProtocolClient" + let client: ClientRuntime.SdkHttpClient + let config: RestJsonProtocolClient.RestJsonProtocolClientConfiguration + let serviceName = "Rest Json Protocol" + let encoder: ClientRuntime.RequestEncoder + let decoder: ClientRuntime.ResponseDecoder + + public required init(config: RestJsonProtocolClient.RestJsonProtocolClientConfiguration) { + client = ClientRuntime.SdkHttpClient(engine: config.httpClientEngine, config: config.httpClientConfiguration) + let encoder = ClientRuntime.JSONEncoder() + encoder.dateEncodingStrategy = .secondsSince1970 + encoder.nonConformingFloatEncodingStrategy = .convertToString(positiveInfinity: "Infinity", negativeInfinity: "-Infinity", nan: "NaN") + self.encoder = encoder + let decoder = ClientRuntime.JSONDecoder() + decoder.dateDecodingStrategy = .secondsSince1970 + decoder.nonConformingFloatDecodingStrategy = .convertFromString(positiveInfinity: "Infinity", negativeInfinity: "-Infinity", nan: "NaN") + self.decoder = decoder + self.config = config + } + + public convenience required init() throws { + let config = try RestJsonProtocolClient.RestJsonProtocolClientConfiguration() + self.init(config: config) + } + +} + +extension RestJsonProtocolClient { + public class RestJsonProtocolClientConfiguration: DefaultClientConfiguration & DefaultHttpClientConfiguration { + public var telemetryProvider: ClientRuntime.TelemetryProvider + + public var retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions + + public var clientLogMode: ClientRuntime.ClientLogMode + + public var endpoint: Swift.String? + + public var idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator + + public var httpClientEngine: ClientRuntime.HTTPClient + + public var httpClientConfiguration: ClientRuntime.HttpClientConfiguration + + public var authSchemes: [ClientRuntime.AuthScheme]? + + public var authSchemeResolver: ClientRuntime.AuthSchemeResolver + + private init(_ telemetryProvider: ClientRuntime.TelemetryProvider, _ retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions, _ clientLogMode: ClientRuntime.ClientLogMode, _ endpoint: Swift.String?, _ idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator, _ httpClientEngine: ClientRuntime.HTTPClient, _ httpClientConfiguration: ClientRuntime.HttpClientConfiguration, _ authSchemes: [ClientRuntime.AuthScheme]?, _ authSchemeResolver: ClientRuntime.AuthSchemeResolver) { + self.telemetryProvider = telemetryProvider + self.retryStrategyOptions = retryStrategyOptions + self.clientLogMode = clientLogMode + self.endpoint = endpoint + self.idempotencyTokenGenerator = idempotencyTokenGenerator + self.httpClientEngine = httpClientEngine + self.httpClientConfiguration = httpClientConfiguration + self.authSchemes = authSchemes + self.authSchemeResolver = authSchemeResolver + } + + public convenience init(telemetryProvider: ClientRuntime.TelemetryProvider? = nil, retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions? = nil, clientLogMode: ClientRuntime.ClientLogMode? = nil, endpoint: Swift.String? = nil, idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator? = nil, httpClientEngine: ClientRuntime.HTTPClient? = nil, httpClientConfiguration: ClientRuntime.HttpClientConfiguration? = nil, authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: ClientRuntime.AuthSchemeResolver? = nil) throws { + self.init(telemetryProvider ?? ClientRuntime.DefaultTelemetry.provider, retryStrategyOptions ?? DefaultSDKRuntimeConfiguration.defaultRetryStrategyOptions, clientLogMode ?? DefaultSDKRuntimeConfiguration.defaultClientLogMode, endpoint, idempotencyTokenGenerator ?? DefaultSDKRuntimeConfiguration.defaultIdempotencyTokenGenerator, httpClientEngine ?? DefaultSDKRuntimeConfiguration.makeClient(), httpClientConfiguration ?? DefaultSDKRuntimeConfiguration.defaultHttpClientConfiguration, authSchemes, authSchemeResolver ?? DefaultSDKRuntimeConfiguration.defaultAuthSchemeResolver) + } + + public convenience required init() async throws { + try await self.init(telemetryProvider: nil, retryStrategyOptions: nil, clientLogMode: nil, endpoint: nil, idempotencyTokenGenerator: nil, httpClientEngine: nil, httpClientConfiguration: nil, authSchemes: nil, authSchemeResolver: nil) + } + + public var partitionID: String? { + return "" + } + } + + public static func builder() -> ClientBuilder { + return ClientBuilder(defaultPlugins: [ + ClientRuntime.DefaultClientPlugin() + ]) + } +} + +public struct RestJsonProtocolClientLogHandlerFactory: ClientRuntime.SDKLogHandlerFactory { + public var label = "RestJsonProtocolClient" + let logLevel: ClientRuntime.SDKLogLevel + public func construct(label: String) -> LogHandler { + var handler = StreamLogHandler.standardOutput(label: label) + handler.logLevel = logLevel.toLoggerType() + return handler + } + public init(logLevel: ClientRuntime.SDKLogLevel) { + self.logLevel = logLevel + } +} +""" + contents.shouldContainOnlyOnce(expected) } @Test fun `it renders host prefix with label in context correctly`() { @@ -164,7 +163,7 @@ class HttpProtocolClientGeneratorTests { operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.BodyMiddleware(documentWritingClosure: ClientRuntime.JSONReadWrite.documentWritingClosure(encoder: encoder), inputWritingClosure: JSONReadWrite.writingClosure())) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(AllocateWidgetOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -181,35 +180,7 @@ class HttpProtocolClientGeneratorTests { val contents = getFileContents(context.manifest, "/RestJson/RestJsonProtocolClient.swift") contents.shouldSyntacticSanityCheck() val expected = """ - public func unsignedFooBlobStream(input: UnsignedFooBlobStreamInput) async throws -> UnsignedFooBlobStreamOutput { - let context = ClientRuntime.HttpContextBuilder() - .withEncoder(value: encoder) - .withDecoder(value: decoder) - .withMethod(value: .post) - .withServiceName(value: serviceName) - .withOperation(value: "unsignedFooBlobStream") - .withIdempotencyTokenGenerator(value: config.idempotencyTokenGenerator) - .withLogger(value: config.logger) - .withPartitionID(value: config.partitionID) - .withAuthSchemes(value: config.authSchemes ?? []) - .withAuthSchemeResolver(value: config.authSchemeResolver) - .withUnsignedPayloadTrait(value: true) - .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) - .build() - var operation = ClientRuntime.OperationStack(id: "unsignedFooBlobStream") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(UnsignedFooBlobStreamInput.urlPathProvider(_:))) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) - operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) - operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.BodyMiddleware(documentWritingClosure: ClientRuntime.JSONReadWrite.documentWritingClosure(encoder: encoder), inputWritingClosure: JSONReadWrite.writingClosure())) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware(requiresLength: false, unsignedPayload: true)) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) - operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(UnsignedFooBlobStreamOutputError.self, decoder: decoder))) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) - let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler()) - return result - } """ contents.shouldContainOnlyOnce(expected) } @@ -220,35 +191,7 @@ class HttpProtocolClientGeneratorTests { val contents = getFileContents(context.manifest, "/RestJson/RestJsonProtocolClient.swift") contents.shouldSyntacticSanityCheck() val expected = """ - public func explicitBlobStreamWithLength(input: ExplicitBlobStreamWithLengthInput) async throws -> ExplicitBlobStreamWithLengthOutput { - let context = ClientRuntime.HttpContextBuilder() - .withEncoder(value: encoder) - .withDecoder(value: decoder) - .withMethod(value: .post) - .withServiceName(value: serviceName) - .withOperation(value: "explicitBlobStreamWithLength") - .withIdempotencyTokenGenerator(value: config.idempotencyTokenGenerator) - .withLogger(value: config.logger) - .withPartitionID(value: config.partitionID) - .withAuthSchemes(value: config.authSchemes ?? []) - .withAuthSchemeResolver(value: config.authSchemeResolver) - .withUnsignedPayloadTrait(value: false) - .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) - .build() - var operation = ClientRuntime.OperationStack(id: "explicitBlobStreamWithLength") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(ExplicitBlobStreamWithLengthInput.urlPathProvider(_:))) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) - operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/octet-stream")) - operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.BlobStreamBodyMiddleware(keyPath: \.payload1)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware(requiresLength: true, unsignedPayload: false)) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) - operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(ExplicitBlobStreamWithLengthOutputError.self, decoder: decoder))) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) - let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler()) - return result - } """ contents.shouldContainOnlyOnce(expected) } @@ -259,35 +202,7 @@ class HttpProtocolClientGeneratorTests { val contents = getFileContents(context.manifest, "/RestJson/RestJsonProtocolClient.swift") contents.shouldSyntacticSanityCheck() val expected = """ - public func unsignedFooBlobStreamWithLength(input: UnsignedFooBlobStreamWithLengthInput) async throws -> UnsignedFooBlobStreamWithLengthOutput { - let context = ClientRuntime.HttpContextBuilder() - .withEncoder(value: encoder) - .withDecoder(value: decoder) - .withMethod(value: .post) - .withServiceName(value: serviceName) - .withOperation(value: "unsignedFooBlobStreamWithLength") - .withIdempotencyTokenGenerator(value: config.idempotencyTokenGenerator) - .withLogger(value: config.logger) - .withPartitionID(value: config.partitionID) - .withAuthSchemes(value: config.authSchemes ?? []) - .withAuthSchemeResolver(value: config.authSchemeResolver) - .withUnsignedPayloadTrait(value: true) - .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) - .build() - var operation = ClientRuntime.OperationStack(id: "unsignedFooBlobStreamWithLength") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(UnsignedFooBlobStreamWithLengthInput.urlPathProvider(_:))) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) - operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/octet-stream")) - operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.BlobStreamBodyMiddleware(keyPath: \.payload1)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware(requiresLength: true, unsignedPayload: true)) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) - operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(UnsignedFooBlobStreamWithLengthOutputError.self, decoder: decoder))) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) - let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler()) - return result - } """ contents.shouldContainOnlyOnce(expected) } diff --git a/smithy-swift-codegen/src/test/kotlin/IdempotencyTokenTraitTests.kt b/smithy-swift-codegen/src/test/kotlin/IdempotencyTokenTraitTests.kt index 5fca03aa0..63f8a9920 100644 --- a/smithy-swift-codegen/src/test/kotlin/IdempotencyTokenTraitTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/IdempotencyTokenTraitTests.kt @@ -6,34 +6,7 @@ class IdempotencyTokenTraitTests { val context = setupTests("Isolated/idempotencyToken.smithy", "aws.protocoltests.restxml#RestXml") val contents = getFileContents(context.manifest, "/RestXml/RestXmlProtocolClient.swift") val expectedContents = """ - public func idempotencyTokenWithStructure(input: IdempotencyTokenWithStructureInput) async throws -> IdempotencyTokenWithStructureOutput { - let context = ClientRuntime.HttpContextBuilder() - .withMethod(value: .put) - .withServiceName(value: serviceName) - .withOperation(value: "idempotencyTokenWithStructure") - .withIdempotencyTokenGenerator(value: config.idempotencyTokenGenerator) - .withLogger(value: config.logger) - .withPartitionID(value: config.partitionID) - .withAuthSchemes(value: config.authSchemes ?? []) - .withAuthSchemeResolver(value: config.authSchemeResolver) - .withUnsignedPayloadTrait(value: false) - .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) - .build() - var operation = ClientRuntime.OperationStack(id: "idempotencyTokenWithStructure") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.IdempotencyTokenMiddleware(keyPath: \.token)) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(IdempotencyTokenWithStructureInput.urlPathProvider(_:))) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) - operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/xml")) - operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.BodyMiddleware(documentWritingClosure: SmithyXML.XMLReadWrite.documentWritingClosure(rootNodeInfo: "IdempotencyToken"), inputWritingClosure: IdempotencyTokenWithStructureInput.writingClosure(_:to:))) - operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) - operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(IdempotencyTokenWithStructureOutput.httpBinding, responseDocumentBinding), responseErrorClosure(IdempotencyTokenWithStructureOutputError.httpBinding, responseDocumentBinding))) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) - let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler()) - return result - } """ contents.shouldContainOnlyOnce(expectedContents) } diff --git a/smithy-swift-codegen/src/test/kotlin/RetryMiddlewareTests.kt b/smithy-swift-codegen/src/test/kotlin/RetryMiddlewareTests.kt index 95f6d17be..ffebd7b20 100644 --- a/smithy-swift-codegen/src/test/kotlin/RetryMiddlewareTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/RetryMiddlewareTests.kt @@ -8,7 +8,7 @@ class RetryMiddlewareTests { val context = setupTests("Isolated/contentmd5checksum.smithy", "aws.protocoltests.restxml#RestXml") val contents = getFileContents(context.manifest, "/RestXml/RestXmlProtocolClient.swift") val expectedContents = """ - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) """.trimIndent() contents.shouldContainOnlyOnce(expectedContents) } From 4b6f781e017891c23aea0121a2706712141468d5 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 3 May 2024 00:02:58 -0500 Subject: [PATCH 05/18] Update WeatherSDK --- Sources/WeatherSDK/WeatherClient.swift | 64 ++++++++++++------- Sources/WeatherSDK/models/Baz.swift | 2 +- .../WeatherSDK/models/CityCoordinates.swift | 2 +- Sources/WeatherSDK/models/CitySummary.swift | 2 +- .../WeatherSDK/models/CreateCityInput.swift | 2 +- .../CreateCityInputBody+Decodable.swift | 2 +- .../WeatherSDK/models/CreateCityOutput.swift | 2 +- .../CreateCityOutputBody+Decodable.swift | 2 +- Sources/WeatherSDK/models/Foo.swift | 2 +- .../models/GetCityAnnouncementsInput.swift | 2 +- ...CityAnnouncementsInputBody+Decodable.swift | 2 +- .../models/GetCityAnnouncementsOutput.swift | 2 +- .../WeatherSDK/models/GetCityImageInput.swift | 2 +- .../GetCityImageInputBody+Decodable.swift | 2 +- .../models/GetCityImageOutput.swift | 2 +- .../GetCityImageOutputBody+Decodable.swift | 2 +- Sources/WeatherSDK/models/GetCityInput.swift | 2 +- .../models/GetCityInputBody+Decodable.swift | 2 +- Sources/WeatherSDK/models/GetCityOutput.swift | 2 +- .../models/GetCityOutputBody+Decodable.swift | 2 +- .../models/GetCurrentTimeInput.swift | 2 +- .../GetCurrentTimeInputBody+Decodable.swift | 2 +- .../models/GetCurrentTimeOutput.swift | 2 +- .../GetCurrentTimeOutputBody+Decodable.swift | 2 +- .../WeatherSDK/models/GetForecastInput.swift | 2 +- .../GetForecastInputBody+Decodable.swift | 2 +- .../WeatherSDK/models/GetForecastOutput.swift | 2 +- .../GetForecastOutputBody+Decodable.swift | 2 +- Sources/WeatherSDK/models/InvokeInput.swift | 2 +- .../models/InvokeInputBody+Decodable.swift | 2 +- Sources/WeatherSDK/models/InvokeOutput.swift | 2 +- .../models/InvokeOutputBody+Decodable.swift | 2 +- .../WeatherSDK/models/ListCitiesInput.swift | 2 +- .../ListCitiesInputBody+Decodable.swift | 2 +- .../WeatherSDK/models/ListCitiesOutput.swift | 2 +- .../ListCitiesOutputBody+Decodable.swift | 2 +- .../models/NoSuchResourceBody+Decodable.swift | 2 +- .../WeatherSDK/models/OnlyFakeAuthInput.swift | 2 +- .../OnlyFakeAuthInputBody+Decodable.swift | 2 +- .../models/OnlyFakeAuthOptionalInput.swift | 2 +- ...yFakeAuthOptionalInputBody+Decodable.swift | 2 +- .../models/OnlyFakeAuthOptionalOutput.swift | 2 +- .../models/OnlyFakeAuthOutput.swift | 2 +- .../OnlyHttpApiKeyAndBearerAuthInput.swift | 2 +- ...iKeyAndBearerAuthInputBody+Decodable.swift | 2 +- .../OnlyHttpApiKeyAndBearerAuthOutput.swift | 2 +- ...HttpApiKeyAndBearerAuthReversedInput.swift | 2 +- ...earerAuthReversedInputBody+Decodable.swift | 2 +- ...ttpApiKeyAndBearerAuthReversedOutput.swift | 2 +- .../models/OnlyHttpApiKeyAuthInput.swift | 2 +- ...nlyHttpApiKeyAuthInputBody+Decodable.swift | 2 +- .../OnlyHttpApiKeyAuthOptionalInput.swift | 2 +- ...piKeyAuthOptionalInputBody+Decodable.swift | 2 +- .../OnlyHttpApiKeyAuthOptionalOutput.swift | 2 +- .../models/OnlyHttpApiKeyAuthOutput.swift | 2 +- .../models/OnlyHttpBearerAuthInput.swift | 2 +- ...nlyHttpBearerAuthInputBody+Decodable.swift | 2 +- .../OnlyHttpBearerAuthOptionalInput.swift | 2 +- ...earerAuthOptionalInputBody+Decodable.swift | 2 +- .../OnlyHttpBearerAuthOptionalOutput.swift | 2 +- .../models/OnlyHttpBearerAuthOutput.swift | 2 +- .../models/OnlySigv4AuthInput.swift | 2 +- .../OnlySigv4AuthInputBody+Decodable.swift | 2 +- .../models/OnlySigv4AuthOptionalInput.swift | 2 +- ...Sigv4AuthOptionalInputBody+Decodable.swift | 2 +- .../models/OnlySigv4AuthOptionalOutput.swift | 2 +- .../models/OnlySigv4AuthOutput.swift | 2 +- .../WeatherSDK/models/OtherStructure.swift | 2 +- Sources/WeatherSDK/models/Precipitation.swift | 2 +- .../models/SameAsServiceInput.swift | 2 +- .../SameAsServiceInputBody+Decodable.swift | 2 +- .../models/SameAsServiceOutput.swift | 2 +- .../GetCityAnnouncementsErrorTest.swift | 3 +- Tests/WeatherSDKTests/GetCityErrorTest.swift | 3 +- .../GetCityImageErrorTest.swift | 3 +- .../WeatherSDKTests/GetCityResponseTest.swift | 4 +- .../WeatherSDKTests/ListCitiesErrorTest.swift | 3 +- .../models/CityCoordinates+Equatable.swift | 13 ++++ .../models/CitySummary+Equatable.swift | 15 +++++ .../GetCityAnnouncementsInput+Equatable.swift | 12 ++++ ...GetCityAnnouncementsOutput+Equatable.swift | 12 ++++ .../models/GetCityImageInput+Equatable.swift | 12 ++++ .../models/GetCityImageOutput+Equatable.swift | 12 ++++ .../models/GetCityInput+Equatable.swift | 12 ++++ .../models/GetCityOutput+Equatable.swift | 14 ++++ .../models/ListCitiesInput+Equatable.swift | 11 ++++ .../models/ListCitiesOutput+Equatable.swift | 13 ++++ .../models/NoSuchResource+Equatable.swift | 13 ++++ 88 files changed, 257 insertions(+), 104 deletions(-) create mode 100644 Tests/WeatherSDKTests/models/CityCoordinates+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/CitySummary+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/GetCityAnnouncementsInput+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/GetCityAnnouncementsOutput+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/GetCityImageInput+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/GetCityImageOutput+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/GetCityInput+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/GetCityOutput+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/ListCitiesInput+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/ListCitiesOutput+Equatable.swift create mode 100644 Tests/WeatherSDKTests/models/NoSuchResource+Equatable.swift diff --git a/Sources/WeatherSDK/WeatherClient.swift b/Sources/WeatherSDK/WeatherClient.swift index b0c88206c..9726b1c65 100644 --- a/Sources/WeatherSDK/WeatherClient.swift +++ b/Sources/WeatherSDK/WeatherClient.swift @@ -3,6 +3,7 @@ import ClientRuntime import Foundation import Logging +import SmithyRetries public class WeatherClient: Client { public static let clientName = "WeatherClient" @@ -36,7 +37,7 @@ extension WeatherClient { public class WeatherClientConfiguration: DefaultClientConfiguration & DefaultHttpClientConfiguration { public var telemetryProvider: ClientRuntime.TelemetryProvider - public var retryStrategyOptions: ClientRuntime.RetryStrategyOptions + public var retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions public var clientLogMode: ClientRuntime.ClientLogMode @@ -54,7 +55,7 @@ extension WeatherClient { internal let logger: ClientRuntime.LogAgent - private init(_ telemetryProvider: ClientRuntime.TelemetryProvider, _ retryStrategyOptions: ClientRuntime.RetryStrategyOptions, _ clientLogMode: ClientRuntime.ClientLogMode, _ endpoint: Swift.String?, _ idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator, _ httpClientEngine: ClientRuntime.HTTPClient, _ httpClientConfiguration: ClientRuntime.HttpClientConfiguration, _ authSchemes: [ClientRuntime.AuthScheme]?, _ authSchemeResolver: ClientRuntime.AuthSchemeResolver) { + private init(_ telemetryProvider: ClientRuntime.TelemetryProvider, _ retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions, _ clientLogMode: ClientRuntime.ClientLogMode, _ endpoint: Swift.String?, _ idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator, _ httpClientEngine: ClientRuntime.HTTPClient, _ httpClientConfiguration: ClientRuntime.HttpClientConfiguration, _ authSchemes: [ClientRuntime.AuthScheme]?, _ authSchemeResolver: ClientRuntime.AuthSchemeResolver) { self.telemetryProvider = telemetryProvider self.retryStrategyOptions = retryStrategyOptions self.clientLogMode = clientLogMode @@ -67,7 +68,7 @@ extension WeatherClient { self.logger = telemetryProvider.loggerProvider.getLogger(name: WeatherClient.clientName) } - public convenience init(telemetryProvider: ClientRuntime.TelemetryProvider? = nil, retryStrategyOptions: ClientRuntime.RetryStrategyOptions? = nil, clientLogMode: ClientRuntime.ClientLogMode? = nil, endpoint: Swift.String? = nil, idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator? = nil, httpClientEngine: ClientRuntime.HTTPClient? = nil, httpClientConfiguration: ClientRuntime.HttpClientConfiguration? = nil, authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: ClientRuntime.AuthSchemeResolver? = nil) throws { + public convenience init(telemetryProvider: ClientRuntime.TelemetryProvider? = nil, retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions? = nil, clientLogMode: ClientRuntime.ClientLogMode? = nil, endpoint: Swift.String? = nil, idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator? = nil, httpClientEngine: ClientRuntime.HTTPClient? = nil, httpClientConfiguration: ClientRuntime.HttpClientConfiguration? = nil, authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: ClientRuntime.AuthSchemeResolver? = nil) throws { self.init(telemetryProvider ?? ClientRuntime.DefaultTelemetry.provider, retryStrategyOptions ?? DefaultSDKRuntimeConfiguration.defaultRetryStrategyOptions, clientLogMode ?? DefaultSDKRuntimeConfiguration.defaultClientLogMode, endpoint, idempotencyTokenGenerator ?? DefaultSDKRuntimeConfiguration.defaultIdempotencyTokenGenerator, httpClientEngine ?? DefaultSDKRuntimeConfiguration.makeClient(), httpClientConfiguration ?? DefaultSDKRuntimeConfiguration.defaultHttpClientConfiguration, authSchemes, authSchemeResolver ?? DefaultSDKRuntimeConfiguration.defaultAuthSchemeResolver) } @@ -120,6 +121,7 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "createCity") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(CreateCityInput.urlPathProvider(_:))) @@ -128,7 +130,7 @@ extension WeatherClient { operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.BodyMiddleware(documentWritingClosure: ClientRuntime.JSONReadWrite.documentWritingClosure(encoder: encoder), inputWritingClosure: JSONReadWrite.writingClosure())) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(CreateCityOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -160,13 +162,14 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "getCity") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetCityInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.ContentMD5Middleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(GetCityOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -198,12 +201,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "getCityAnnouncements") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetCityAnnouncementsInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(GetCityAnnouncementsOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -235,12 +239,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "getCityImage") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetCityImageInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(GetCityImageOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -267,12 +272,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "getCurrentTime") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetCurrentTimeInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(GetCurrentTimeOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -299,12 +305,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "getForecast") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetForecastInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(GetForecastOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -331,6 +338,7 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "invoke") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(InvokeInput.urlPathProvider(_:))) @@ -339,7 +347,7 @@ extension WeatherClient { operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/octet-stream")) operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.BlobBodyMiddleware(keyPath: \.payload)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(InvokeOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -371,13 +379,14 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "listCities") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(ListCitiesInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.QueryItemMiddleware(ListCitiesInput.queryItemProvider(_:))) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(ListCitiesOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -404,12 +413,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlyFakeAuth") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlyFakeAuthInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlyFakeAuthOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -436,12 +446,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlyFakeAuthOptional") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlyFakeAuthOptionalInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlyFakeAuthOptionalOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -468,12 +479,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlyHttpApiKeyAndBearerAuth") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlyHttpApiKeyAndBearerAuthInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlyHttpApiKeyAndBearerAuthOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -500,12 +512,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlyHttpApiKeyAndBearerAuthReversed") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlyHttpApiKeyAndBearerAuthReversedInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlyHttpApiKeyAndBearerAuthReversedOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -532,12 +545,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlyHttpApiKeyAuth") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlyHttpApiKeyAuthInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlyHttpApiKeyAuthOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -564,12 +578,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlyHttpApiKeyAuthOptional") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlyHttpApiKeyAuthOptionalInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlyHttpApiKeyAuthOptionalOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -596,12 +611,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlyHttpBearerAuth") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlyHttpBearerAuthInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlyHttpBearerAuthOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -628,12 +644,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlyHttpBearerAuthOptional") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlyHttpBearerAuthOptionalInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlyHttpBearerAuthOptionalOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -660,12 +677,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlySigv4Auth") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlySigv4AuthInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlySigv4AuthOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -692,12 +710,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "onlySigv4AuthOptional") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(OnlySigv4AuthOptionalInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(OnlySigv4AuthOptionalOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) @@ -724,12 +743,13 @@ extension WeatherClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .build() var operation = ClientRuntime.OperationStack(id: "sameAsService") operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(SameAsServiceInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) operation.buildStep.intercept(position: .before, middleware: ClientRuntime.AuthSchemeMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(SameAsServiceOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) diff --git a/Sources/WeatherSDK/models/Baz.swift b/Sources/WeatherSDK/models/Baz.swift index 544ad1fc2..325131cbe 100644 --- a/Sources/WeatherSDK/models/Baz.swift +++ b/Sources/WeatherSDK/models/Baz.swift @@ -3,7 +3,7 @@ import ClientRuntime extension WeatherClientTypes { - public struct Baz: Swift.Equatable { + public struct Baz { public var bar: Swift.String? public var baz: Swift.String? diff --git a/Sources/WeatherSDK/models/CityCoordinates.swift b/Sources/WeatherSDK/models/CityCoordinates.swift index 227156537..e46b2a3d7 100644 --- a/Sources/WeatherSDK/models/CityCoordinates.swift +++ b/Sources/WeatherSDK/models/CityCoordinates.swift @@ -3,7 +3,7 @@ import ClientRuntime extension WeatherClientTypes { - public struct CityCoordinates: Swift.Equatable { + public struct CityCoordinates { /// This member is required. public var latitude: Swift.Float? /// This member is required. diff --git a/Sources/WeatherSDK/models/CitySummary.swift b/Sources/WeatherSDK/models/CitySummary.swift index df3eec651..2490fb0e0 100644 --- a/Sources/WeatherSDK/models/CitySummary.swift +++ b/Sources/WeatherSDK/models/CitySummary.swift @@ -3,7 +3,7 @@ import ClientRuntime extension WeatherClientTypes { - public struct CitySummary: Swift.Equatable { + public struct CitySummary { public var `case`: Swift.String? /// This member is required. public var cityId: Swift.String? diff --git a/Sources/WeatherSDK/models/CreateCityInput.swift b/Sources/WeatherSDK/models/CreateCityInput.swift index 4f12e5b8b..a81370d61 100644 --- a/Sources/WeatherSDK/models/CreateCityInput.swift +++ b/Sources/WeatherSDK/models/CreateCityInput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct CreateCityInput: Swift.Equatable { +public struct CreateCityInput { public var city: WeatherClientTypes.CitySummary? /// This member is required. public var coordinates: WeatherClientTypes.CityCoordinates? diff --git a/Sources/WeatherSDK/models/CreateCityInputBody+Decodable.swift b/Sources/WeatherSDK/models/CreateCityInputBody+Decodable.swift index 7572a4ae7..4f7fecd0b 100644 --- a/Sources/WeatherSDK/models/CreateCityInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/CreateCityInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct CreateCityInputBody: Swift.Equatable { +struct CreateCityInputBody { let name: Swift.String? let coordinates: WeatherClientTypes.CityCoordinates? let city: WeatherClientTypes.CitySummary? diff --git a/Sources/WeatherSDK/models/CreateCityOutput.swift b/Sources/WeatherSDK/models/CreateCityOutput.swift index 9c8ca21b6..bd75e94e8 100644 --- a/Sources/WeatherSDK/models/CreateCityOutput.swift +++ b/Sources/WeatherSDK/models/CreateCityOutput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct CreateCityOutput: Swift.Equatable { +public struct CreateCityOutput { /// This member is required. public var cityId: Swift.String? diff --git a/Sources/WeatherSDK/models/CreateCityOutputBody+Decodable.swift b/Sources/WeatherSDK/models/CreateCityOutputBody+Decodable.swift index 76a25dca6..e90b52396 100644 --- a/Sources/WeatherSDK/models/CreateCityOutputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/CreateCityOutputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct CreateCityOutputBody: Swift.Equatable { +struct CreateCityOutputBody { let cityId: Swift.String? } diff --git a/Sources/WeatherSDK/models/Foo.swift b/Sources/WeatherSDK/models/Foo.swift index 3c023c29e..b60bf1c04 100644 --- a/Sources/WeatherSDK/models/Foo.swift +++ b/Sources/WeatherSDK/models/Foo.swift @@ -3,7 +3,7 @@ import ClientRuntime extension WeatherClientTypes { - public struct Foo: Swift.Equatable { + public struct Foo { public var bar: Swift.String? public var baz: Swift.String? diff --git a/Sources/WeatherSDK/models/GetCityAnnouncementsInput.swift b/Sources/WeatherSDK/models/GetCityAnnouncementsInput.swift index 98f89b7b2..04e35ef2a 100644 --- a/Sources/WeatherSDK/models/GetCityAnnouncementsInput.swift +++ b/Sources/WeatherSDK/models/GetCityAnnouncementsInput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct GetCityAnnouncementsInput: Swift.Equatable { +public struct GetCityAnnouncementsInput { /// This member is required. public var cityId: Swift.String? diff --git a/Sources/WeatherSDK/models/GetCityAnnouncementsInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityAnnouncementsInputBody+Decodable.swift index f9f6aa9f9..3b0f5f1e0 100644 --- a/Sources/WeatherSDK/models/GetCityAnnouncementsInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/GetCityAnnouncementsInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct GetCityAnnouncementsInputBody: Swift.Equatable { +struct GetCityAnnouncementsInputBody { } extension GetCityAnnouncementsInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/GetCityAnnouncementsOutput.swift b/Sources/WeatherSDK/models/GetCityAnnouncementsOutput.swift index e1ca58e45..a89d81d24 100644 --- a/Sources/WeatherSDK/models/GetCityAnnouncementsOutput.swift +++ b/Sources/WeatherSDK/models/GetCityAnnouncementsOutput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct GetCityAnnouncementsOutput: Swift.Equatable { +public struct GetCityAnnouncementsOutput { public var lastUpdated: ClientRuntime.Date? public init( diff --git a/Sources/WeatherSDK/models/GetCityImageInput.swift b/Sources/WeatherSDK/models/GetCityImageInput.swift index e9b4e40fc..a6ff8288f 100644 --- a/Sources/WeatherSDK/models/GetCityImageInput.swift +++ b/Sources/WeatherSDK/models/GetCityImageInput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct GetCityImageInput: Swift.Equatable { +public struct GetCityImageInput { /// This member is required. public var cityId: Swift.String? diff --git a/Sources/WeatherSDK/models/GetCityImageInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityImageInputBody+Decodable.swift index 565bdee13..8ecb9634e 100644 --- a/Sources/WeatherSDK/models/GetCityImageInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/GetCityImageInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct GetCityImageInputBody: Swift.Equatable { +struct GetCityImageInputBody { } extension GetCityImageInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/GetCityImageOutput.swift b/Sources/WeatherSDK/models/GetCityImageOutput.swift index 5ce05d36a..d69255663 100644 --- a/Sources/WeatherSDK/models/GetCityImageOutput.swift +++ b/Sources/WeatherSDK/models/GetCityImageOutput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct GetCityImageOutput: Swift.Equatable { +public struct GetCityImageOutput { /// This member is required. public var image: ClientRuntime.ByteStream? diff --git a/Sources/WeatherSDK/models/GetCityImageOutputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityImageOutputBody+Decodable.swift index a78ee1967..46256dea6 100644 --- a/Sources/WeatherSDK/models/GetCityImageOutputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/GetCityImageOutputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct GetCityImageOutputBody: Swift.Equatable { +struct GetCityImageOutputBody { let image: ClientRuntime.ByteStream? } diff --git a/Sources/WeatherSDK/models/GetCityInput.swift b/Sources/WeatherSDK/models/GetCityInput.swift index 339f23e28..d530d7655 100644 --- a/Sources/WeatherSDK/models/GetCityInput.swift +++ b/Sources/WeatherSDK/models/GetCityInput.swift @@ -3,7 +3,7 @@ import ClientRuntime /// The input used to get a city. -public struct GetCityInput: Swift.Equatable { +public struct GetCityInput { /// This member is required. public var cityId: Swift.String? diff --git a/Sources/WeatherSDK/models/GetCityInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityInputBody+Decodable.swift index 982c2a254..4e64ca635 100644 --- a/Sources/WeatherSDK/models/GetCityInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/GetCityInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct GetCityInputBody: Swift.Equatable { +struct GetCityInputBody { } extension GetCityInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/GetCityOutput.swift b/Sources/WeatherSDK/models/GetCityOutput.swift index 8c8ffeb0e..ee4fe056f 100644 --- a/Sources/WeatherSDK/models/GetCityOutput.swift +++ b/Sources/WeatherSDK/models/GetCityOutput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct GetCityOutput: Swift.Equatable { +public struct GetCityOutput { public var city: WeatherClientTypes.CitySummary? /// This member is required. public var coordinates: WeatherClientTypes.CityCoordinates? diff --git a/Sources/WeatherSDK/models/GetCityOutputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityOutputBody+Decodable.swift index dd84af51d..1e8e89ac4 100644 --- a/Sources/WeatherSDK/models/GetCityOutputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/GetCityOutputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct GetCityOutputBody: Swift.Equatable { +struct GetCityOutputBody { let name: Swift.String? let coordinates: WeatherClientTypes.CityCoordinates? let city: WeatherClientTypes.CitySummary? diff --git a/Sources/WeatherSDK/models/GetCurrentTimeInput.swift b/Sources/WeatherSDK/models/GetCurrentTimeInput.swift index 3ca1e530e..aec2ce184 100644 --- a/Sources/WeatherSDK/models/GetCurrentTimeInput.swift +++ b/Sources/WeatherSDK/models/GetCurrentTimeInput.swift @@ -2,7 +2,7 @@ -public struct GetCurrentTimeInput: Swift.Equatable { +public struct GetCurrentTimeInput { public init() { } } diff --git a/Sources/WeatherSDK/models/GetCurrentTimeInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCurrentTimeInputBody+Decodable.swift index 9a3eac72f..d7361aa89 100644 --- a/Sources/WeatherSDK/models/GetCurrentTimeInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/GetCurrentTimeInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct GetCurrentTimeInputBody: Swift.Equatable { +struct GetCurrentTimeInputBody { } extension GetCurrentTimeInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/GetCurrentTimeOutput.swift b/Sources/WeatherSDK/models/GetCurrentTimeOutput.swift index 3a260dedc..741d6918a 100644 --- a/Sources/WeatherSDK/models/GetCurrentTimeOutput.swift +++ b/Sources/WeatherSDK/models/GetCurrentTimeOutput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct GetCurrentTimeOutput: Swift.Equatable { +public struct GetCurrentTimeOutput { /// This member is required. public var time: ClientRuntime.Date? diff --git a/Sources/WeatherSDK/models/GetCurrentTimeOutputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCurrentTimeOutputBody+Decodable.swift index 78426b1c5..08efba7db 100644 --- a/Sources/WeatherSDK/models/GetCurrentTimeOutputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/GetCurrentTimeOutputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct GetCurrentTimeOutputBody: Swift.Equatable { +struct GetCurrentTimeOutputBody { let time: ClientRuntime.Date? } diff --git a/Sources/WeatherSDK/models/GetForecastInput.swift b/Sources/WeatherSDK/models/GetForecastInput.swift index 285f683b5..18a2ac84e 100644 --- a/Sources/WeatherSDK/models/GetForecastInput.swift +++ b/Sources/WeatherSDK/models/GetForecastInput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct GetForecastInput: Swift.Equatable { +public struct GetForecastInput { /// This member is required. public var cityId: Swift.String? diff --git a/Sources/WeatherSDK/models/GetForecastInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetForecastInputBody+Decodable.swift index deba7ff10..6262bf61f 100644 --- a/Sources/WeatherSDK/models/GetForecastInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/GetForecastInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct GetForecastInputBody: Swift.Equatable { +struct GetForecastInputBody { } extension GetForecastInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/GetForecastOutput.swift b/Sources/WeatherSDK/models/GetForecastOutput.swift index d8ea62182..52d902f25 100644 --- a/Sources/WeatherSDK/models/GetForecastOutput.swift +++ b/Sources/WeatherSDK/models/GetForecastOutput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct GetForecastOutput: Swift.Equatable { +public struct GetForecastOutput { public var chanceOfRain: Swift.Float? public var precipitation: WeatherClientTypes.Precipitation? diff --git a/Sources/WeatherSDK/models/GetForecastOutputBody+Decodable.swift b/Sources/WeatherSDK/models/GetForecastOutputBody+Decodable.swift index 087449c3f..1bfe108de 100644 --- a/Sources/WeatherSDK/models/GetForecastOutputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/GetForecastOutputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct GetForecastOutputBody: Swift.Equatable { +struct GetForecastOutputBody { let chanceOfRain: Swift.Float? let precipitation: WeatherClientTypes.Precipitation? } diff --git a/Sources/WeatherSDK/models/InvokeInput.swift b/Sources/WeatherSDK/models/InvokeInput.swift index 88de613da..d6ecd3f39 100644 --- a/Sources/WeatherSDK/models/InvokeInput.swift +++ b/Sources/WeatherSDK/models/InvokeInput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct InvokeInput: Swift.Equatable { +public struct InvokeInput { public var payload: ClientRuntime.Data? public init( diff --git a/Sources/WeatherSDK/models/InvokeInputBody+Decodable.swift b/Sources/WeatherSDK/models/InvokeInputBody+Decodable.swift index b7d4812c8..1aeed7f48 100644 --- a/Sources/WeatherSDK/models/InvokeInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/InvokeInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct InvokeInputBody: Swift.Equatable { +struct InvokeInputBody { let payload: ClientRuntime.Data? } diff --git a/Sources/WeatherSDK/models/InvokeOutput.swift b/Sources/WeatherSDK/models/InvokeOutput.swift index 6a0e86099..1b2b51a18 100644 --- a/Sources/WeatherSDK/models/InvokeOutput.swift +++ b/Sources/WeatherSDK/models/InvokeOutput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct InvokeOutput: Swift.Equatable { +public struct InvokeOutput { public var payload: ClientRuntime.Data? public init( diff --git a/Sources/WeatherSDK/models/InvokeOutputBody+Decodable.swift b/Sources/WeatherSDK/models/InvokeOutputBody+Decodable.swift index b52318cf6..c06373481 100644 --- a/Sources/WeatherSDK/models/InvokeOutputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/InvokeOutputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct InvokeOutputBody: Swift.Equatable { +struct InvokeOutputBody { let payload: ClientRuntime.Data? } diff --git a/Sources/WeatherSDK/models/ListCitiesInput.swift b/Sources/WeatherSDK/models/ListCitiesInput.swift index 80833f5b4..5af98dded 100644 --- a/Sources/WeatherSDK/models/ListCitiesInput.swift +++ b/Sources/WeatherSDK/models/ListCitiesInput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct ListCitiesInput: Swift.Equatable { +public struct ListCitiesInput { public var nextToken: Swift.String? public var pageSize: Swift.Int? diff --git a/Sources/WeatherSDK/models/ListCitiesInputBody+Decodable.swift b/Sources/WeatherSDK/models/ListCitiesInputBody+Decodable.swift index 21d0ee29d..710e33f28 100644 --- a/Sources/WeatherSDK/models/ListCitiesInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/ListCitiesInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct ListCitiesInputBody: Swift.Equatable { +struct ListCitiesInputBody { } extension ListCitiesInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/ListCitiesOutput.swift b/Sources/WeatherSDK/models/ListCitiesOutput.swift index 595160ae7..1db3594ee 100644 --- a/Sources/WeatherSDK/models/ListCitiesOutput.swift +++ b/Sources/WeatherSDK/models/ListCitiesOutput.swift @@ -2,7 +2,7 @@ import ClientRuntime -public struct ListCitiesOutput: Swift.Equatable { +public struct ListCitiesOutput { /// This member is required. public var items: [WeatherClientTypes.CitySummary]? public var nextToken: Swift.String? diff --git a/Sources/WeatherSDK/models/ListCitiesOutputBody+Decodable.swift b/Sources/WeatherSDK/models/ListCitiesOutputBody+Decodable.swift index 3242ef68b..38076bca2 100644 --- a/Sources/WeatherSDK/models/ListCitiesOutputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/ListCitiesOutputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct ListCitiesOutputBody: Swift.Equatable { +struct ListCitiesOutputBody { let nextToken: Swift.String? let items: [WeatherClientTypes.CitySummary]? } diff --git a/Sources/WeatherSDK/models/NoSuchResourceBody+Decodable.swift b/Sources/WeatherSDK/models/NoSuchResourceBody+Decodable.swift index 9abb54bb9..6b4d1e355 100644 --- a/Sources/WeatherSDK/models/NoSuchResourceBody+Decodable.swift +++ b/Sources/WeatherSDK/models/NoSuchResourceBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct NoSuchResourceBody: Swift.Equatable { +struct NoSuchResourceBody { let resourceType: Swift.String? let message: Swift.String? } diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthInput.swift b/Sources/WeatherSDK/models/OnlyFakeAuthInput.swift index a23dbe79c..9dee5845f 100644 --- a/Sources/WeatherSDK/models/OnlyFakeAuthInput.swift +++ b/Sources/WeatherSDK/models/OnlyFakeAuthInput.swift @@ -2,7 +2,7 @@ -public struct OnlyFakeAuthInput: Swift.Equatable { +public struct OnlyFakeAuthInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyFakeAuthInputBody+Decodable.swift index 2cb963a5d..85506c967 100644 --- a/Sources/WeatherSDK/models/OnlyFakeAuthInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlyFakeAuthInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlyFakeAuthInputBody: Swift.Equatable { +struct OnlyFakeAuthInputBody { } extension OnlyFakeAuthInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInput.swift b/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInput.swift index ff8e535ae..b6949b86b 100644 --- a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInput.swift +++ b/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInput.swift @@ -2,7 +2,7 @@ -public struct OnlyFakeAuthOptionalInput: Swift.Equatable { +public struct OnlyFakeAuthOptionalInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInputBody+Decodable.swift index e246468b7..b57def6fb 100644 --- a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlyFakeAuthOptionalInputBody: Swift.Equatable { +struct OnlyFakeAuthOptionalInputBody { } extension OnlyFakeAuthOptionalInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalOutput.swift b/Sources/WeatherSDK/models/OnlyFakeAuthOptionalOutput.swift index 130daa6ff..25f12b256 100644 --- a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalOutput.swift +++ b/Sources/WeatherSDK/models/OnlyFakeAuthOptionalOutput.swift @@ -2,7 +2,7 @@ -public struct OnlyFakeAuthOptionalOutput: Swift.Equatable { +public struct OnlyFakeAuthOptionalOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthOutput.swift b/Sources/WeatherSDK/models/OnlyFakeAuthOutput.swift index dda4a750a..51b267c9b 100644 --- a/Sources/WeatherSDK/models/OnlyFakeAuthOutput.swift +++ b/Sources/WeatherSDK/models/OnlyFakeAuthOutput.swift @@ -2,7 +2,7 @@ -public struct OnlyFakeAuthOutput: Swift.Equatable { +public struct OnlyFakeAuthOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInput.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInput.swift index 6e794b15c..5c7dc2de7 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpApiKeyAndBearerAuthInput: Swift.Equatable { +public struct OnlyHttpApiKeyAndBearerAuthInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInputBody+Decodable.swift index b495cc02f..1bb9402a0 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlyHttpApiKeyAndBearerAuthInputBody: Swift.Equatable { +struct OnlyHttpApiKeyAndBearerAuthInputBody { } extension OnlyHttpApiKeyAndBearerAuthInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthOutput.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthOutput.swift index 1f12742b4..0a033be71 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthOutput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthOutput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpApiKeyAndBearerAuthOutput: Swift.Equatable { +public struct OnlyHttpApiKeyAndBearerAuthOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInput.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInput.swift index e919fd0e2..a95573114 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpApiKeyAndBearerAuthReversedInput: Swift.Equatable { +public struct OnlyHttpApiKeyAndBearerAuthReversedInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInputBody+Decodable.swift index f921377c8..0ff8fccc8 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlyHttpApiKeyAndBearerAuthReversedInputBody: Swift.Equatable { +struct OnlyHttpApiKeyAndBearerAuthReversedInputBody { } extension OnlyHttpApiKeyAndBearerAuthReversedInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedOutput.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedOutput.swift index aceb1f3e4..442231c64 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedOutput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedOutput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpApiKeyAndBearerAuthReversedOutput: Swift.Equatable { +public struct OnlyHttpApiKeyAndBearerAuthReversedOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInput.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInput.swift index f2928ba63..38bcb3a92 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpApiKeyAuthInput: Swift.Equatable { +public struct OnlyHttpApiKeyAuthInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInputBody+Decodable.swift index 0cbb3d80c..d8cade4a5 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlyHttpApiKeyAuthInputBody: Swift.Equatable { +struct OnlyHttpApiKeyAuthInputBody { } extension OnlyHttpApiKeyAuthInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInput.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInput.swift index f9bf051d4..f15ca9fd5 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpApiKeyAuthOptionalInput: Swift.Equatable { +public struct OnlyHttpApiKeyAuthOptionalInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInputBody+Decodable.swift index 652cbde88..c3bfa702a 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlyHttpApiKeyAuthOptionalInputBody: Swift.Equatable { +struct OnlyHttpApiKeyAuthOptionalInputBody { } extension OnlyHttpApiKeyAuthOptionalInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalOutput.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalOutput.swift index fea3b5522..6d3fd3135 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalOutput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalOutput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpApiKeyAuthOptionalOutput: Swift.Equatable { +public struct OnlyHttpApiKeyAuthOptionalOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOutput.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOutput.swift index ac46c5dd0..0bf71ce53 100644 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOutput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOutput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpApiKeyAuthOutput: Swift.Equatable { +public struct OnlyHttpApiKeyAuthOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthInput.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthInput.swift index 32e2bce5f..beb2a0389 100644 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthInput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpBearerAuthInput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpBearerAuthInput: Swift.Equatable { +public struct OnlyHttpBearerAuthInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthInputBody+Decodable.swift index 63d4728dd..5d985f222 100644 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlyHttpBearerAuthInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlyHttpBearerAuthInputBody: Swift.Equatable { +struct OnlyHttpBearerAuthInputBody { } extension OnlyHttpBearerAuthInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInput.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInput.swift index ef5ad7ab8..431db9802 100644 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpBearerAuthOptionalInput: Swift.Equatable { +public struct OnlyHttpBearerAuthOptionalInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInputBody+Decodable.swift index 5b620925f..738c81497 100644 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlyHttpBearerAuthOptionalInputBody: Swift.Equatable { +struct OnlyHttpBearerAuthOptionalInputBody { } extension OnlyHttpBearerAuthOptionalInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalOutput.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalOutput.swift index b8318456a..fa8fa4185 100644 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalOutput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalOutput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpBearerAuthOptionalOutput: Swift.Equatable { +public struct OnlyHttpBearerAuthOptionalOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOutput.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOutput.swift index 1109f19ee..543b482db 100644 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOutput.swift +++ b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOutput.swift @@ -2,7 +2,7 @@ -public struct OnlyHttpBearerAuthOutput: Swift.Equatable { +public struct OnlyHttpBearerAuthOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthInput.swift b/Sources/WeatherSDK/models/OnlySigv4AuthInput.swift index 629904965..e8e32da66 100644 --- a/Sources/WeatherSDK/models/OnlySigv4AuthInput.swift +++ b/Sources/WeatherSDK/models/OnlySigv4AuthInput.swift @@ -2,7 +2,7 @@ -public struct OnlySigv4AuthInput: Swift.Equatable { +public struct OnlySigv4AuthInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlySigv4AuthInputBody+Decodable.swift index ee63ddd6d..bf62a34c1 100644 --- a/Sources/WeatherSDK/models/OnlySigv4AuthInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlySigv4AuthInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlySigv4AuthInputBody: Swift.Equatable { +struct OnlySigv4AuthInputBody { } extension OnlySigv4AuthInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInput.swift b/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInput.swift index 4c3e3187a..d5ed2ab51 100644 --- a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInput.swift +++ b/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInput.swift @@ -2,7 +2,7 @@ -public struct OnlySigv4AuthOptionalInput: Swift.Equatable { +public struct OnlySigv4AuthOptionalInput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInputBody+Decodable.swift index 499b8516f..f2348d1c9 100644 --- a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct OnlySigv4AuthOptionalInputBody: Swift.Equatable { +struct OnlySigv4AuthOptionalInputBody { } extension OnlySigv4AuthOptionalInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalOutput.swift b/Sources/WeatherSDK/models/OnlySigv4AuthOptionalOutput.swift index 5551fdcd3..60acbebd2 100644 --- a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalOutput.swift +++ b/Sources/WeatherSDK/models/OnlySigv4AuthOptionalOutput.swift @@ -2,7 +2,7 @@ -public struct OnlySigv4AuthOptionalOutput: Swift.Equatable { +public struct OnlySigv4AuthOptionalOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthOutput.swift b/Sources/WeatherSDK/models/OnlySigv4AuthOutput.swift index ae8505a16..4a603d7c9 100644 --- a/Sources/WeatherSDK/models/OnlySigv4AuthOutput.swift +++ b/Sources/WeatherSDK/models/OnlySigv4AuthOutput.swift @@ -2,7 +2,7 @@ -public struct OnlySigv4AuthOutput: Swift.Equatable { +public struct OnlySigv4AuthOutput { public init() { } } diff --git a/Sources/WeatherSDK/models/OtherStructure.swift b/Sources/WeatherSDK/models/OtherStructure.swift index 1fd5bfbf2..f4602049d 100644 --- a/Sources/WeatherSDK/models/OtherStructure.swift +++ b/Sources/WeatherSDK/models/OtherStructure.swift @@ -3,7 +3,7 @@ extension WeatherClientTypes { - public struct OtherStructure: Swift.Equatable { + public struct OtherStructure { public init() { } } diff --git a/Sources/WeatherSDK/models/Precipitation.swift b/Sources/WeatherSDK/models/Precipitation.swift index aba631eff..5180437f0 100644 --- a/Sources/WeatherSDK/models/Precipitation.swift +++ b/Sources/WeatherSDK/models/Precipitation.swift @@ -3,7 +3,7 @@ import ClientRuntime extension WeatherClientTypes { - public enum Precipitation: Swift.Equatable { + public enum Precipitation { case rain(Swift.Bool) case sleet(Swift.Bool) case hail([Swift.String:Swift.String]) diff --git a/Sources/WeatherSDK/models/SameAsServiceInput.swift b/Sources/WeatherSDK/models/SameAsServiceInput.swift index ceb161c9e..613cb04b1 100644 --- a/Sources/WeatherSDK/models/SameAsServiceInput.swift +++ b/Sources/WeatherSDK/models/SameAsServiceInput.swift @@ -2,7 +2,7 @@ -public struct SameAsServiceInput: Swift.Equatable { +public struct SameAsServiceInput { public init() { } } diff --git a/Sources/WeatherSDK/models/SameAsServiceInputBody+Decodable.swift b/Sources/WeatherSDK/models/SameAsServiceInputBody+Decodable.swift index 098f896cf..c7d307384 100644 --- a/Sources/WeatherSDK/models/SameAsServiceInputBody+Decodable.swift +++ b/Sources/WeatherSDK/models/SameAsServiceInputBody+Decodable.swift @@ -2,7 +2,7 @@ import ClientRuntime -struct SameAsServiceInputBody: Swift.Equatable { +struct SameAsServiceInputBody { } extension SameAsServiceInputBody: Swift.Decodable { diff --git a/Sources/WeatherSDK/models/SameAsServiceOutput.swift b/Sources/WeatherSDK/models/SameAsServiceOutput.swift index 2e9a54cc9..35ff2b086 100644 --- a/Sources/WeatherSDK/models/SameAsServiceOutput.swift +++ b/Sources/WeatherSDK/models/SameAsServiceOutput.swift @@ -2,7 +2,7 @@ -public struct SameAsServiceOutput: Swift.Equatable { +public struct SameAsServiceOutput { public init() { } } diff --git a/Tests/WeatherSDKTests/GetCityAnnouncementsErrorTest.swift b/Tests/WeatherSDKTests/GetCityAnnouncementsErrorTest.swift index 3751e824a..fe45a19a4 100644 --- a/Tests/WeatherSDKTests/GetCityAnnouncementsErrorTest.swift +++ b/Tests/WeatherSDKTests/GetCityAnnouncementsErrorTest.swift @@ -37,8 +37,7 @@ class GetCityAnnouncementsNoSuchResourceTest: HttpResponseTestBase { resourceType: "City" ) XCTAssertEqual(actual.httpResponse.statusCode, HttpStatusCode(rawValue: 404)) - XCTAssertEqual(expected.properties.resourceType, actual.properties.resourceType) - XCTAssertEqual(expected.properties.message, actual.properties.message) + XCTAssertEqual(actual, expected) } else { XCTFail("The deserialized error type does not match expected type") } diff --git a/Tests/WeatherSDKTests/GetCityErrorTest.swift b/Tests/WeatherSDKTests/GetCityErrorTest.swift index b531d37c8..0577aeb71 100644 --- a/Tests/WeatherSDKTests/GetCityErrorTest.swift +++ b/Tests/WeatherSDKTests/GetCityErrorTest.swift @@ -37,8 +37,7 @@ class GetCityNoSuchResourceTest: HttpResponseTestBase { resourceType: "City" ) XCTAssertEqual(actual.httpResponse.statusCode, HttpStatusCode(rawValue: 404)) - XCTAssertEqual(expected.properties.resourceType, actual.properties.resourceType) - XCTAssertEqual(expected.properties.message, actual.properties.message) + XCTAssertEqual(actual, expected) } else { XCTFail("The deserialized error type does not match expected type") } diff --git a/Tests/WeatherSDKTests/GetCityImageErrorTest.swift b/Tests/WeatherSDKTests/GetCityImageErrorTest.swift index dec9e7f71..c0f27a804 100644 --- a/Tests/WeatherSDKTests/GetCityImageErrorTest.swift +++ b/Tests/WeatherSDKTests/GetCityImageErrorTest.swift @@ -37,8 +37,7 @@ class GetCityImageNoSuchResourceTest: HttpResponseTestBase { resourceType: "City" ) XCTAssertEqual(actual.httpResponse.statusCode, HttpStatusCode(rawValue: 404)) - XCTAssertEqual(expected.properties.resourceType, actual.properties.resourceType) - XCTAssertEqual(expected.properties.message, actual.properties.message) + XCTAssertEqual(actual, expected) } else { XCTFail("The deserialized error type does not match expected type") } diff --git a/Tests/WeatherSDKTests/GetCityResponseTest.swift b/Tests/WeatherSDKTests/GetCityResponseTest.swift index 9e07c0da7..cd28201fb 100644 --- a/Tests/WeatherSDKTests/GetCityResponseTest.swift +++ b/Tests/WeatherSDKTests/GetCityResponseTest.swift @@ -51,9 +51,7 @@ class GetCityResponseTest: HttpResponseTestBase { name: "Seattle" ) - XCTAssertEqual(expected.name, actual.name) - XCTAssertEqual(expected.coordinates, actual.coordinates) - XCTAssertEqual(expected.city, actual.city) + XCTAssertEqual(actual, expected) } } diff --git a/Tests/WeatherSDKTests/ListCitiesErrorTest.swift b/Tests/WeatherSDKTests/ListCitiesErrorTest.swift index 48706d02b..890adb237 100644 --- a/Tests/WeatherSDKTests/ListCitiesErrorTest.swift +++ b/Tests/WeatherSDKTests/ListCitiesErrorTest.swift @@ -37,8 +37,7 @@ class ListCitiesNoSuchResourceTest: HttpResponseTestBase { resourceType: "City" ) XCTAssertEqual(actual.httpResponse.statusCode, HttpStatusCode(rawValue: 404)) - XCTAssertEqual(expected.properties.resourceType, actual.properties.resourceType) - XCTAssertEqual(expected.properties.message, actual.properties.message) + XCTAssertEqual(actual, expected) } else { XCTFail("The deserialized error type does not match expected type") } diff --git a/Tests/WeatherSDKTests/models/CityCoordinates+Equatable.swift b/Tests/WeatherSDKTests/models/CityCoordinates+Equatable.swift new file mode 100644 index 000000000..c730ee1f1 --- /dev/null +++ b/Tests/WeatherSDKTests/models/CityCoordinates+Equatable.swift @@ -0,0 +1,13 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension WeatherClientTypes.CityCoordinates: Swift.Equatable { + + public static func ==(lhs: WeatherClientTypes.CityCoordinates, rhs: WeatherClientTypes.CityCoordinates) -> Bool { + if (!floatingPointValuesMatch(lhs: lhs.latitude, rhs: rhs.latitude)) { return false } + if (!floatingPointValuesMatch(lhs: lhs.longitude, rhs: rhs.longitude)) { return false } + return true + } +} diff --git a/Tests/WeatherSDKTests/models/CitySummary+Equatable.swift b/Tests/WeatherSDKTests/models/CitySummary+Equatable.swift new file mode 100644 index 000000000..e97bddce0 --- /dev/null +++ b/Tests/WeatherSDKTests/models/CitySummary+Equatable.swift @@ -0,0 +1,15 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension WeatherClientTypes.CitySummary: Swift.Equatable { + + public static func ==(lhs: WeatherClientTypes.CitySummary, rhs: WeatherClientTypes.CitySummary) -> Bool { + if lhs.cityId != rhs.cityId { return false } + if lhs.name != rhs.name { return false } + if lhs.number != rhs.number { return false } + if lhs.`case` != rhs.`case` { return false } + return true + } +} diff --git a/Tests/WeatherSDKTests/models/GetCityAnnouncementsInput+Equatable.swift b/Tests/WeatherSDKTests/models/GetCityAnnouncementsInput+Equatable.swift new file mode 100644 index 000000000..d5108a4c5 --- /dev/null +++ b/Tests/WeatherSDKTests/models/GetCityAnnouncementsInput+Equatable.swift @@ -0,0 +1,12 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension GetCityAnnouncementsInput: Swift.Equatable { + + public static func ==(lhs: GetCityAnnouncementsInput, rhs: GetCityAnnouncementsInput) -> Bool { + if lhs.cityId != rhs.cityId { return false } + return true + } +} diff --git a/Tests/WeatherSDKTests/models/GetCityAnnouncementsOutput+Equatable.swift b/Tests/WeatherSDKTests/models/GetCityAnnouncementsOutput+Equatable.swift new file mode 100644 index 000000000..673717702 --- /dev/null +++ b/Tests/WeatherSDKTests/models/GetCityAnnouncementsOutput+Equatable.swift @@ -0,0 +1,12 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension GetCityAnnouncementsOutput: Swift.Equatable { + + public static func ==(lhs: GetCityAnnouncementsOutput, rhs: GetCityAnnouncementsOutput) -> Bool { + if lhs.lastUpdated != rhs.lastUpdated { return false } + return true + } +} diff --git a/Tests/WeatherSDKTests/models/GetCityImageInput+Equatable.swift b/Tests/WeatherSDKTests/models/GetCityImageInput+Equatable.swift new file mode 100644 index 000000000..c867036a4 --- /dev/null +++ b/Tests/WeatherSDKTests/models/GetCityImageInput+Equatable.swift @@ -0,0 +1,12 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension GetCityImageInput: Swift.Equatable { + + public static func ==(lhs: GetCityImageInput, rhs: GetCityImageInput) -> Bool { + if lhs.cityId != rhs.cityId { return false } + return true + } +} diff --git a/Tests/WeatherSDKTests/models/GetCityImageOutput+Equatable.swift b/Tests/WeatherSDKTests/models/GetCityImageOutput+Equatable.swift new file mode 100644 index 000000000..0db601b16 --- /dev/null +++ b/Tests/WeatherSDKTests/models/GetCityImageOutput+Equatable.swift @@ -0,0 +1,12 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension GetCityImageOutput: Swift.Equatable { + + public static func ==(lhs: GetCityImageOutput, rhs: GetCityImageOutput) -> Bool { + if lhs.image != rhs.image { return false } + return true + } +} diff --git a/Tests/WeatherSDKTests/models/GetCityInput+Equatable.swift b/Tests/WeatherSDKTests/models/GetCityInput+Equatable.swift new file mode 100644 index 000000000..30c818d39 --- /dev/null +++ b/Tests/WeatherSDKTests/models/GetCityInput+Equatable.swift @@ -0,0 +1,12 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension GetCityInput: Swift.Equatable { + + public static func ==(lhs: GetCityInput, rhs: GetCityInput) -> Bool { + if lhs.cityId != rhs.cityId { return false } + return true + } +} diff --git a/Tests/WeatherSDKTests/models/GetCityOutput+Equatable.swift b/Tests/WeatherSDKTests/models/GetCityOutput+Equatable.swift new file mode 100644 index 000000000..ca498e73d --- /dev/null +++ b/Tests/WeatherSDKTests/models/GetCityOutput+Equatable.swift @@ -0,0 +1,14 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension GetCityOutput: Swift.Equatable { + + public static func ==(lhs: GetCityOutput, rhs: GetCityOutput) -> Bool { + if lhs.name != rhs.name { return false } + if lhs.coordinates != rhs.coordinates { return false } + if lhs.city != rhs.city { return false } + return true + } +} diff --git a/Tests/WeatherSDKTests/models/ListCitiesInput+Equatable.swift b/Tests/WeatherSDKTests/models/ListCitiesInput+Equatable.swift new file mode 100644 index 000000000..6283df2eb --- /dev/null +++ b/Tests/WeatherSDKTests/models/ListCitiesInput+Equatable.swift @@ -0,0 +1,11 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension ListCitiesInput: Swift.Equatable { + + public static func ==(lhs: ListCitiesInput, rhs: ListCitiesInput) -> Bool { + return true + } +} diff --git a/Tests/WeatherSDKTests/models/ListCitiesOutput+Equatable.swift b/Tests/WeatherSDKTests/models/ListCitiesOutput+Equatable.swift new file mode 100644 index 000000000..8d8719237 --- /dev/null +++ b/Tests/WeatherSDKTests/models/ListCitiesOutput+Equatable.swift @@ -0,0 +1,13 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension ListCitiesOutput: Swift.Equatable { + + public static func ==(lhs: ListCitiesOutput, rhs: ListCitiesOutput) -> Bool { + if lhs.nextToken != rhs.nextToken { return false } + if lhs.items != rhs.items { return false } + return true + } +} diff --git a/Tests/WeatherSDKTests/models/NoSuchResource+Equatable.swift b/Tests/WeatherSDKTests/models/NoSuchResource+Equatable.swift new file mode 100644 index 000000000..e6dbc552a --- /dev/null +++ b/Tests/WeatherSDKTests/models/NoSuchResource+Equatable.swift @@ -0,0 +1,13 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! + +import SmithyTestUtil +import WeatherSDK + +extension NoSuchResource: Swift.Equatable { + + public static func ==(lhs: NoSuchResource, rhs: NoSuchResource) -> Bool { + if lhs.properties.resourceType != rhs.properties.resourceType { return false } + if lhs.properties.message != rhs.properties.message { return false } + return true + } +} From 0689ecb7abf7883336bdb2db7124be0c65115952 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 3 May 2024 00:39:24 -0500 Subject: [PATCH 06/18] Fix WeatherSDK --- Package.swift | 4 ++-- Sources/WeatherSDK/WeatherClient.swift | 1 + .../swift/codegen/integration/HttpProtocolServiceClient.kt | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 7ba387fa9..5e8af407e 100644 --- a/Package.swift +++ b/Package.swift @@ -106,11 +106,11 @@ func addTestServiceTargets() { package.targets += [ .target( name: "WeatherSDK", - dependencies: ["SmithyTestUtil", "ClientRuntime"] + dependencies: ["ClientRuntime", "SmithyRetriesAPI", "SmithyRetries"] ), .testTarget( name: "WeatherSDKTests", - dependencies: ["WeatherSDK"] + dependencies: ["WeatherSDK", "SmithyTestUtil"] ) ] } diff --git a/Sources/WeatherSDK/WeatherClient.swift b/Sources/WeatherSDK/WeatherClient.swift index 9726b1c65..31ef6a14e 100644 --- a/Sources/WeatherSDK/WeatherClient.swift +++ b/Sources/WeatherSDK/WeatherClient.swift @@ -4,6 +4,7 @@ import ClientRuntime import Foundation import Logging import SmithyRetries +import SmithyRetriesAPI public class WeatherClient: Client { public static let clientName = "WeatherClient" 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 1200c2a6d..49b62baf9 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 @@ -124,6 +124,7 @@ open class HttpProtocolServiceClient( val properties: List = ctx.integrations .flatMap { it.clientConfigurations(ctx).flatMap { it.getProperties(ctx) } } .let { overrideConfigProperties(it) } + properties.forEach { writer.addImport(it.type) } renderConfigClassVariables(serviceSymbol, properties) From 07140b006b90dff8793e8b4cbb44178b209e78e1 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 3 May 2024 00:47:10 -0500 Subject: [PATCH 07/18] Fix swiftlint --- .swiftlint.yml | 6 +----- .../Config/DefaultSDKRuntimeConfiguration.swift | 4 +++- .../Retries/DefaultRetryErrorInfoProvider.swift | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 1811db955..d2b385531 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -2,11 +2,7 @@ excluded: - .build - Sources/SmithyTestUtil/* - Sources/WeatherSDK/* - - Tests/ClientRuntimeTests/* - - Tests/SmithyTestUtilTests/* - - Tests/SmithyXMLTests/* - - Tests/SmithyTimestampsTests/* - - Tests/WeatherSDKTests/* + - Tests/* - smithy-swift-codegen-test/build/* analyzer_rules: diff --git a/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift b/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift index a1009b666..07d855880 100644 --- a/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift +++ b/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift @@ -124,7 +124,9 @@ public extension DefaultSDKRuntimeConfiguration { /// The retry strategy options to use when none is provided. /// /// Defaults to options with the defaults defined in `RetryStrategyOptions`. - static var defaultRetryStrategyOptions: RetryStrategyOptions { RetryStrategyOptions(backoffStrategy: ExponentialBackoffStrategy()) } + static var defaultRetryStrategyOptions: RetryStrategyOptions { + RetryStrategyOptions(backoffStrategy: ExponentialBackoffStrategy()) + } /// The log mode to use when none is provided /// diff --git a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift index 6f43069a9..195eaf2f3 100644 --- a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift +++ b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift @@ -10,7 +10,6 @@ import struct SmithyRetriesAPI.RetryErrorInfo import enum SmithyRetriesAPI.RetryErrorType import protocol SmithyRetriesAPI.RetryErrorInfoProvider - public enum DefaultRetryErrorInfoProvider: RetryErrorInfoProvider { static let retryableStatusCodes: [HttpStatusCode] = [ From 41e42aa2406edc2e692d32e591347a2ec6f09d87 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 3 May 2024 00:58:35 -0500 Subject: [PATCH 08/18] Add SmithyTestUtil back to WeatherSDK --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 5e8af407e..26853fe67 100644 --- a/Package.swift +++ b/Package.swift @@ -106,7 +106,7 @@ func addTestServiceTargets() { package.targets += [ .target( name: "WeatherSDK", - dependencies: ["ClientRuntime", "SmithyRetriesAPI", "SmithyRetries"] + dependencies: ["SmithyTestUtil", "ClientRuntime", "SmithyRetriesAPI", "SmithyRetries"] ), .testTarget( name: "WeatherSDKTests", From 104e46216b55320aaf307f1d9be586e5e98cd924 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Wed, 8 May 2024 13:44:14 -0500 Subject: [PATCH 09/18] Fix codegen tests --- .../HttpProtocolClientGeneratorTests.kt | 194 +++++++++--------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/smithy-swift-codegen/src/test/kotlin/HttpProtocolClientGeneratorTests.kt b/smithy-swift-codegen/src/test/kotlin/HttpProtocolClientGeneratorTests.kt index d8289da5c..02aea5276 100644 --- a/smithy-swift-codegen/src/test/kotlin/HttpProtocolClientGeneratorTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/HttpProtocolClientGeneratorTests.kt @@ -14,103 +14,103 @@ class HttpProtocolClientGeneratorTests { val context = setupTests("service-generator-test-operations.smithy", "com.test#Example") val contents = getFileContents(context.manifest, "/RestJson/RestJsonProtocolClient.swift") contents.shouldSyntacticSanityCheck() - contents.shouldContainOnlyOnce( - """ - public class RestJsonProtocolClient: Client { - public static let clientName = "RestJsonProtocolClient" - let client: ClientRuntime.SdkHttpClient - let config: RestJsonProtocolClient.RestJsonProtocolClientConfiguration - let serviceName = "Rest Json Protocol" - let encoder: ClientRuntime.RequestEncoder - let decoder: ClientRuntime.ResponseDecoder - - public required init(config: RestJsonProtocolClient.RestJsonProtocolClientConfiguration) { - client = ClientRuntime.SdkHttpClient(engine: config.httpClientEngine, config: config.httpClientConfiguration) - let encoder = ClientRuntime.JSONEncoder() - encoder.dateEncodingStrategy = .secondsSince1970 - encoder.nonConformingFloatEncodingStrategy = .convertToString(positiveInfinity: "Infinity", negativeInfinity: "-Infinity", nan: "NaN") - self.encoder = encoder - let decoder = ClientRuntime.JSONDecoder() - decoder.dateDecodingStrategy = .secondsSince1970 - decoder.nonConformingFloatDecodingStrategy = .convertFromString(positiveInfinity: "Infinity", negativeInfinity: "-Infinity", nan: "NaN") - self.decoder = decoder - self.config = config - } - - public convenience required init() throws { - let config = try RestJsonProtocolClient.RestJsonProtocolClientConfiguration() - self.init(config: config) - } - - } - - extension RestJsonProtocolClient { - public class RestJsonProtocolClientConfiguration: DefaultClientConfiguration & DefaultHttpClientConfiguration { - public var telemetryProvider: ClientRuntime.TelemetryProvider - - public var retryStrategyOptions: ClientRuntime.RetryStrategyOptions - - public var clientLogMode: ClientRuntime.ClientLogMode - - public var endpoint: Swift.String? - - public var idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator - - public var httpClientEngine: ClientRuntime.HTTPClient - - public var httpClientConfiguration: ClientRuntime.HttpClientConfiguration - - public var authSchemes: [ClientRuntime.AuthScheme]? - - public var authSchemeResolver: ClientRuntime.AuthSchemeResolver - - private init(_ telemetryProvider: ClientRuntime.TelemetryProvider, _ retryStrategyOptions: ClientRuntime.RetryStrategyOptions, _ clientLogMode: ClientRuntime.ClientLogMode, _ endpoint: Swift.String?, _ idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator, _ httpClientEngine: ClientRuntime.HTTPClient, _ httpClientConfiguration: ClientRuntime.HttpClientConfiguration, _ authSchemes: [ClientRuntime.AuthScheme]?, _ authSchemeResolver: ClientRuntime.AuthSchemeResolver) { - self.telemetryProvider = telemetryProvider - self.retryStrategyOptions = retryStrategyOptions - self.clientLogMode = clientLogMode - self.endpoint = endpoint - self.idempotencyTokenGenerator = idempotencyTokenGenerator - self.httpClientEngine = httpClientEngine - self.httpClientConfiguration = httpClientConfiguration - self.authSchemes = authSchemes - self.authSchemeResolver = authSchemeResolver - } - - public convenience init(telemetryProvider: ClientRuntime.TelemetryProvider? = nil, retryStrategyOptions: ClientRuntime.RetryStrategyOptions? = nil, clientLogMode: ClientRuntime.ClientLogMode? = nil, endpoint: Swift.String? = nil, idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator? = nil, httpClientEngine: ClientRuntime.HTTPClient? = nil, httpClientConfiguration: ClientRuntime.HttpClientConfiguration? = nil, authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: ClientRuntime.AuthSchemeResolver? = nil) throws { - self.init(telemetryProvider ?? ClientRuntime.DefaultTelemetry.provider, retryStrategyOptions ?? DefaultSDKRuntimeConfiguration.defaultRetryStrategyOptions, clientLogMode ?? DefaultSDKRuntimeConfiguration.defaultClientLogMode, endpoint, idempotencyTokenGenerator ?? DefaultSDKRuntimeConfiguration.defaultIdempotencyTokenGenerator, httpClientEngine ?? DefaultSDKRuntimeConfiguration.makeClient(), httpClientConfiguration ?? DefaultSDKRuntimeConfiguration.defaultHttpClientConfiguration, authSchemes, authSchemeResolver ?? DefaultSDKRuntimeConfiguration.defaultAuthSchemeResolver) - } - - public convenience required init() async throws { - try await self.init(telemetryProvider: nil, retryStrategyOptions: nil, clientLogMode: nil, endpoint: nil, idempotencyTokenGenerator: nil, httpClientEngine: nil, httpClientConfiguration: nil, authSchemes: nil, authSchemeResolver: nil) - } - - public var partitionID: String? { - return "" - } - } - - public static func builder() -> ClientBuilder { - return ClientBuilder(defaultPlugins: [ - ClientRuntime.DefaultClientPlugin() - ]) - } - } - - public struct RestJsonProtocolClientLogHandlerFactory: ClientRuntime.SDKLogHandlerFactory { - public var label = "RestJsonProtocolClient" - let logLevel: ClientRuntime.SDKLogLevel - public func construct(label: String) -> LogHandler { - var handler = StreamLogHandler.standardOutput(label: label) - handler.logLevel = logLevel.toLoggerType() - return handler - } - public init(logLevel: ClientRuntime.SDKLogLevel) { - self.logLevel = logLevel - } - } - """.trimIndent() - ) + val expected = """ +public class RestJsonProtocolClient: Client { + public static let clientName = "RestJsonProtocolClient" + let client: ClientRuntime.SdkHttpClient + let config: RestJsonProtocolClient.RestJsonProtocolClientConfiguration + let serviceName = "Rest Json Protocol" + let encoder: ClientRuntime.RequestEncoder + let decoder: ClientRuntime.ResponseDecoder + + public required init(config: RestJsonProtocolClient.RestJsonProtocolClientConfiguration) { + client = ClientRuntime.SdkHttpClient(engine: config.httpClientEngine, config: config.httpClientConfiguration) + let encoder = ClientRuntime.JSONEncoder() + encoder.dateEncodingStrategy = .secondsSince1970 + encoder.nonConformingFloatEncodingStrategy = .convertToString(positiveInfinity: "Infinity", negativeInfinity: "-Infinity", nan: "NaN") + self.encoder = encoder + let decoder = ClientRuntime.JSONDecoder() + decoder.dateDecodingStrategy = .secondsSince1970 + decoder.nonConformingFloatDecodingStrategy = .convertFromString(positiveInfinity: "Infinity", negativeInfinity: "-Infinity", nan: "NaN") + self.decoder = decoder + self.config = config + } + + public convenience required init() throws { + let config = try RestJsonProtocolClient.RestJsonProtocolClientConfiguration() + self.init(config: config) + } + +} + +extension RestJsonProtocolClient { + public class RestJsonProtocolClientConfiguration: DefaultClientConfiguration & DefaultHttpClientConfiguration { + public var telemetryProvider: ClientRuntime.TelemetryProvider + + public var retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions + + public var clientLogMode: ClientRuntime.ClientLogMode + + public var endpoint: Swift.String? + + public var idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator + + public var httpClientEngine: ClientRuntime.HTTPClient + + public var httpClientConfiguration: ClientRuntime.HttpClientConfiguration + + public var authSchemes: [ClientRuntime.AuthScheme]? + + public var authSchemeResolver: ClientRuntime.AuthSchemeResolver + + private init(_ telemetryProvider: ClientRuntime.TelemetryProvider, _ retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions, _ clientLogMode: ClientRuntime.ClientLogMode, _ endpoint: Swift.String?, _ idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator, _ httpClientEngine: ClientRuntime.HTTPClient, _ httpClientConfiguration: ClientRuntime.HttpClientConfiguration, _ authSchemes: [ClientRuntime.AuthScheme]?, _ authSchemeResolver: ClientRuntime.AuthSchemeResolver) { + self.telemetryProvider = telemetryProvider + self.retryStrategyOptions = retryStrategyOptions + self.clientLogMode = clientLogMode + self.endpoint = endpoint + self.idempotencyTokenGenerator = idempotencyTokenGenerator + self.httpClientEngine = httpClientEngine + self.httpClientConfiguration = httpClientConfiguration + self.authSchemes = authSchemes + self.authSchemeResolver = authSchemeResolver + } + + public convenience init(telemetryProvider: ClientRuntime.TelemetryProvider? = nil, retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions? = nil, clientLogMode: ClientRuntime.ClientLogMode? = nil, endpoint: Swift.String? = nil, idempotencyTokenGenerator: ClientRuntime.IdempotencyTokenGenerator? = nil, httpClientEngine: ClientRuntime.HTTPClient? = nil, httpClientConfiguration: ClientRuntime.HttpClientConfiguration? = nil, authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: ClientRuntime.AuthSchemeResolver? = nil) throws { + self.init(telemetryProvider ?? ClientRuntime.DefaultTelemetry.provider, retryStrategyOptions ?? DefaultSDKRuntimeConfiguration.defaultRetryStrategyOptions, clientLogMode ?? DefaultSDKRuntimeConfiguration.defaultClientLogMode, endpoint, idempotencyTokenGenerator ?? DefaultSDKRuntimeConfiguration.defaultIdempotencyTokenGenerator, httpClientEngine ?? DefaultSDKRuntimeConfiguration.makeClient(), httpClientConfiguration ?? DefaultSDKRuntimeConfiguration.defaultHttpClientConfiguration, authSchemes, authSchemeResolver ?? DefaultSDKRuntimeConfiguration.defaultAuthSchemeResolver) + } + + public convenience required init() async throws { + try await self.init(telemetryProvider: nil, retryStrategyOptions: nil, clientLogMode: nil, endpoint: nil, idempotencyTokenGenerator: nil, httpClientEngine: nil, httpClientConfiguration: nil, authSchemes: nil, authSchemeResolver: nil) + } + + public var partitionID: String? { + return "" + } + } + + public static func builder() -> ClientBuilder { + return ClientBuilder(defaultPlugins: [ + ClientRuntime.DefaultClientPlugin() + ]) + } +} + +public struct RestJsonProtocolClientLogHandlerFactory: ClientRuntime.SDKLogHandlerFactory { + public var label = "RestJsonProtocolClient" + let logLevel: ClientRuntime.SDKLogLevel + public func construct(label: String) -> LogHandler { + var handler = StreamLogHandler.standardOutput(label: label) + handler.logLevel = logLevel.toLoggerType() + return handler + } + public init(logLevel: ClientRuntime.SDKLogLevel) { + self.logLevel = logLevel + } +} +""" + contents.shouldContainOnlyOnce(expected) } + @Test fun `it renders host prefix with label in context correctly`() { val context = setupTests("host-prefix-operation.smithy", "com.test#Example") @@ -164,7 +164,7 @@ class HttpProtocolClientGeneratorTests { operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.BodyMiddleware(documentWritingClosure: ClientRuntime.JSONReadWrite.documentWritingClosure(encoder: encoder), inputWritingClosure: JSONReadWrite.writingClosure())) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(responseClosure(decoder: decoder), responseErrorClosure(AllocateWidgetOutputError.self, decoder: decoder))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) From 750152a149da8ee04086b325bbdc0928b2579a94 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 9 May 2024 13:33:02 -0500 Subject: [PATCH 10/18] Fix build after merging interceptors int this branch --- Sources/ClientRuntime/Orchestrator/Orchestrator.swift | 3 +++ .../Orchestrator/OrchestratorBuilder.swift | 3 +++ .../DefaultRetryStrategy/DefaultRetryStrategy.swift | 6 +----- Sources/SmithyRetriesAPI/RetryError.swift | 11 +++++++++++ .../RequestTestUtil/MockRetryStrategy.swift | 6 ++++++ .../OrchestratorTests/OrchestratorTests.swift | 8 +++++--- 6 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 Sources/SmithyRetriesAPI/RetryError.swift diff --git a/Sources/ClientRuntime/Orchestrator/Orchestrator.swift b/Sources/ClientRuntime/Orchestrator/Orchestrator.swift index ebc3d8c0c..b0df496bd 100644 --- a/Sources/ClientRuntime/Orchestrator/Orchestrator.swift +++ b/Sources/ClientRuntime/Orchestrator/Orchestrator.swift @@ -5,6 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import protocol SmithyRetriesAPI.RetryStrategy +import struct SmithyRetriesAPI.RetryErrorInfo + /// Orchestrates operation execution /// /// Execution performs the following steps in order: diff --git a/Sources/ClientRuntime/Orchestrator/OrchestratorBuilder.swift b/Sources/ClientRuntime/Orchestrator/OrchestratorBuilder.swift index 829f869ab..4b9f1ada0 100644 --- a/Sources/ClientRuntime/Orchestrator/OrchestratorBuilder.swift +++ b/Sources/ClientRuntime/Orchestrator/OrchestratorBuilder.swift @@ -5,6 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import protocol SmithyRetriesAPI.RetryStrategy +import struct SmithyRetriesAPI.RetryErrorInfo + /// Builds an Orchestrator, combining runtime components, interceptors, serializers, and deserializers. /// /// Note: This is intended to be used within generated code, not directly. diff --git a/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift index b9c5913ba..6300ec2e1 100644 --- a/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift +++ b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift @@ -9,6 +9,7 @@ import struct Foundation.TimeInterval import protocol SmithyRetriesAPI.RetryStrategy import struct SmithyRetriesAPI.RetryStrategyOptions import struct SmithyRetriesAPI.RetryErrorInfo +import enum SmithyRetriesAPI.RetryError public struct DefaultRetryStrategy: RetryStrategy { public typealias Token = DefaultRetryToken @@ -58,8 +59,3 @@ public struct DefaultRetryStrategy: RetryStrategy { await token.quota.retryQuotaRelease(isSuccess: true, capacityAmount: token.capacityAmount) } } - -enum RetryError: Error { - case maxAttemptsReached - case insufficientQuota -} diff --git a/Sources/SmithyRetriesAPI/RetryError.swift b/Sources/SmithyRetriesAPI/RetryError.swift new file mode 100644 index 000000000..a426f75be --- /dev/null +++ b/Sources/SmithyRetriesAPI/RetryError.swift @@ -0,0 +1,11 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +public enum RetryError: Error { + case maxAttemptsReached + case insufficientQuota +} diff --git a/Sources/SmithyTestUtil/RequestTestUtil/MockRetryStrategy.swift b/Sources/SmithyTestUtil/RequestTestUtil/MockRetryStrategy.swift index 6f8dda7ec..710d411fc 100644 --- a/Sources/SmithyTestUtil/RequestTestUtil/MockRetryStrategy.swift +++ b/Sources/SmithyTestUtil/RequestTestUtil/MockRetryStrategy.swift @@ -5,6 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // +import protocol SmithyRetriesAPI.RetryStrategy +import protocol SmithyRetriesAPI.RetryToken +import struct SmithyRetriesAPI.RetryStrategyOptions +import struct SmithyRetriesAPI.RetryErrorInfo +import enum SmithyRetriesAPI.RetryError + @testable import ClientRuntime public struct MockRetryStrategy: RetryStrategy { diff --git a/Tests/ClientRuntimeTests/OrchestratorTests/OrchestratorTests.swift b/Tests/ClientRuntimeTests/OrchestratorTests/OrchestratorTests.swift index 9e1fee559..23c08cb90 100644 --- a/Tests/ClientRuntimeTests/OrchestratorTests/OrchestratorTests.swift +++ b/Tests/ClientRuntimeTests/OrchestratorTests/OrchestratorTests.swift @@ -8,6 +8,8 @@ import XCTest @testable import ClientRuntime +import SmithyRetriesAPI +import SmithyRetries class OrchestratorTests: XCTestCase { struct TestInput { @@ -167,7 +169,7 @@ class OrchestratorTests: XCTestCase { } struct ThrowingRetryStrategy: RetryStrategy { - init(options: ClientRuntime.RetryStrategyOptions) {} + init(options: RetryStrategyOptions) {} public func acquireInitialRetryToken(tokenScope: String) async throws -> DefaultRetryToken { throw TestError(value: "1") @@ -210,7 +212,7 @@ class OrchestratorTests: XCTestCase { return .failure(try await UnknownHTTPServiceError.makeError(httpResponse: response)) } }) - .retryStrategy(DefaultRetryStrategy(options: RetryStrategyOptions())) + .retryStrategy(DefaultRetryStrategy(options: RetryStrategyOptions(backoffStrategy: ExponentialBackoffStrategy()))) .retryErrorInfoProvider({ e in trace.append("errorInfo") return DefaultRetryErrorInfoProvider.errorInfo(for: e) @@ -504,7 +506,7 @@ class OrchestratorTests: XCTestCase { let initialTokenTrace = Trace() let initialToken = await asyncResult { return try await self.traceOrchestrator(trace: initialTokenTrace) - .retryStrategy(ThrowingRetryStrategy(options: RetryStrategyOptions())) + .retryStrategy(ThrowingRetryStrategy(options: RetryStrategyOptions(backoffStrategy: ExponentialBackoffStrategy()))) .build() .execute(input: TestInput(foo: "")) } From c6273ac65528507a5e1852d119b2ee74d14071c0 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 9 May 2024 14:07:57 -0500 Subject: [PATCH 11/18] Fix protocol tests --- .../software/amazon/smithy/swift/codegen/ClientRuntimeTypes.kt | 1 - .../swift/codegen/integration/middlewares/RetryMiddleware.kt | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ClientRuntimeTypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ClientRuntimeTypes.kt index 0fa6b893d..e3306ccbb 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ClientRuntimeTypes.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ClientRuntimeTypes.kt @@ -120,7 +120,6 @@ object ClientRuntimeTypes { val SDKLogLevel = runtimeSymbol("SDKLogLevel") val ClientLogMode = runtimeSymbol("ClientLogMode") val IdempotencyTokenGenerator = runtimeSymbol("IdempotencyTokenGenerator") - val DefaultRetryStrategy = runtimeSymbol("DefaultRetryStrategy") val DefaultRetryErrorInfoProvider = runtimeSymbol("DefaultRetryErrorInfoProvider") val DefaultSDKRuntimeConfiguration = runtimeSymbol("DefaultSDKRuntimeConfiguration") val DateFormatter = runtimeSymbol("DateFormatter") diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt index 69f504359..d52e0b3ad 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt @@ -33,7 +33,8 @@ class RetryMiddleware( override fun render(ctx: ProtocolGenerator.GenerationContext, writer: SwiftWriter, op: OperationShape, operationStackName: String) { if (ctx.settings.useInterceptors) { - writer.write("builder.retryStrategy(\$N(options: config.retryStrategyOptions))", ClientRuntimeTypes.Core.DefaultRetryStrategy) + writer.addImport(SwiftDependency.SMITHY_RETRIES.target) + writer.write("builder.retryStrategy(\$N(options: config.retryStrategyOptions))", SmithyRetriesTypes.DefaultRetryStrategy) writer.write("builder.retryErrorInfoProvider(\$N.errorInfo(for:))", retryErrorInfoProviderSymbol) } else { val output = MiddlewareShapeUtils.outputSymbol(symbolProvider, model, op) From 045d75b32b07b31ab975787f813a9cac178dc51e Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 9 May 2024 14:27:44 -0500 Subject: [PATCH 12/18] Fix ktlint --- .../middlewares/RetryMiddleware.kt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt index d52e0b3ad..66efaba40 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/RetryMiddleware.kt @@ -20,9 +20,9 @@ import software.amazon.smithy.swift.codegen.middleware.MiddlewareStep import software.amazon.smithy.swift.codegen.swiftmodules.SmithyRetriesTypes class RetryMiddleware( - val model: Model, - val symbolProvider: SymbolProvider, - val retryErrorInfoProviderSymbol: Symbol, + val model: Model, + val symbolProvider: SymbolProvider, + val retryErrorInfoProviderSymbol: Symbol, ) : MiddlewareRenderable { override val name = "RetryMiddleware" @@ -40,14 +40,14 @@ class RetryMiddleware( val output = MiddlewareShapeUtils.outputSymbol(symbolProvider, model, op) writer.addImport(SwiftDependency.SMITHY_RETRIES.target) writer.write( - "\$L.\$L.intercept(position: \$L, middleware: \$N<\$N, \$N, \$N>(options: config.retryStrategyOptions))", - operationStackName, - middlewareStep.stringValue(), - position.stringValue(), - ClientRuntimeTypes.Middleware.RetryMiddleware, - SmithyRetriesTypes.DefaultRetryStrategy, - retryErrorInfoProviderSymbol, - output + "\$L.\$L.intercept(position: \$L, middleware: \$N<\$N, \$N, \$N>(options: config.retryStrategyOptions))", + operationStackName, + middlewareStep.stringValue(), + position.stringValue(), + ClientRuntimeTypes.Middleware.RetryMiddleware, + SmithyRetriesTypes.DefaultRetryStrategy, + retryErrorInfoProviderSymbol, + output ) } } From 4e1d8a9339da31b3b2c9d7553bf26784fad3f4a5 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 10 May 2024 14:59:22 -0500 Subject: [PATCH 13/18] Fix tests & regen WeatherSDK --- .../DefaultSDKRuntimeConfiguration.swift | 1 + Sources/WeatherSDK/models/Baz+Codable.swift | 28 ----- .../models/CityCoordinates+Codable.swift | 28 ----- .../models/CitySummary+Codable.swift | 40 ------- .../models/CreateCityInput+Encodable.swift | 24 ---- .../CreateCityInputBody+Decodable.swift | 27 ----- .../CreateCityOutputBody+Decodable.swift | 19 ---- ...eCityOutputError+HttpResponseBinding.swift | 13 --- Sources/WeatherSDK/models/Foo+Codable.swift | 28 ----- ...CityAnnouncementsInputBody+Decodable.swift | 12 -- ...mentsOutputError+HttpResponseBinding.swift | 14 --- .../GetCityImageInputBody+Decodable.swift | 12 -- .../GetCityImageOutputBody+Decodable.swift | 19 ---- ...ImageOutputError+HttpResponseBinding.swift | 14 --- .../models/GetCityInputBody+Decodable.swift | 12 -- .../models/GetCityOutputBody+Decodable.swift | 27 ----- ...tCityOutputError+HttpResponseBinding.swift | 14 --- .../GetCurrentTimeInputBody+Decodable.swift | 12 -- .../GetCurrentTimeOutputBody+Decodable.swift | 19 ---- ...tTimeOutputError+HttpResponseBinding.swift | 13 --- .../GetForecastInputBody+Decodable.swift | 12 -- .../GetForecastOutputBody+Decodable.swift | 23 ---- ...ecastOutputError+HttpResponseBinding.swift | 13 --- .../models/InvokeInput+Encodable.swift | 16 --- .../models/InvokeInputBody+Decodable.swift | 19 ---- .../models/InvokeOutputBody+Decodable.swift | 19 ---- ...nvokeOutputError+HttpResponseBinding.swift | 13 --- .../ListCitiesInputBody+Decodable.swift | 12 -- .../ListCitiesOutputBody+Decodable.swift | 32 ------ ...itiesOutputError+HttpResponseBinding.swift | 14 --- .../models/NoSuchResourceBody+Decodable.swift | 23 ---- .../OnlyFakeAuthInputBody+Decodable.swift | 12 -- ...yFakeAuthOptionalInputBody+Decodable.swift | 12 -- ...ionalOutputError+HttpResponseBinding.swift | 13 --- ...eAuthOutputError+HttpResponseBinding.swift | 13 --- ...iKeyAndBearerAuthInputBody+Decodable.swift | 12 -- ...rAuthOutputError+HttpResponseBinding.swift | 13 --- ...earerAuthReversedInputBody+Decodable.swift | 12 -- ...ersedOutputError+HttpResponseBinding.swift | 13 --- ...nlyHttpApiKeyAuthInputBody+Decodable.swift | 12 -- ...piKeyAuthOptionalInputBody+Decodable.swift | 12 -- ...ionalOutputError+HttpResponseBinding.swift | 13 --- ...yAuthOutputError+HttpResponseBinding.swift | 13 --- ...nlyHttpBearerAuthInputBody+Decodable.swift | 12 -- ...earerAuthOptionalInputBody+Decodable.swift | 12 -- ...ionalOutputError+HttpResponseBinding.swift | 13 --- ...rAuthOutputError+HttpResponseBinding.swift | 13 --- .../OnlySigv4AuthInputBody+Decodable.swift | 12 -- ...Sigv4AuthOptionalInputBody+Decodable.swift | 12 -- ...ionalOutputError+HttpResponseBinding.swift | 13 --- ...4AuthOutputError+HttpResponseBinding.swift | 13 --- .../models/OtherStructure+Codable.swift | 14 --- .../models/Precipitation+Codable.swift | 106 ------------------ .../SameAsServiceInputBody+Decodable.swift | 12 -- ...rviceOutputError+HttpResponseBinding.swift | 13 --- .../OrchestratorTests/OrchestratorTests.swift | 3 - 56 files changed, 1 insertion(+), 969 deletions(-) delete mode 100644 Sources/WeatherSDK/models/Baz+Codable.swift delete mode 100644 Sources/WeatherSDK/models/CityCoordinates+Codable.swift delete mode 100644 Sources/WeatherSDK/models/CitySummary+Codable.swift delete mode 100644 Sources/WeatherSDK/models/CreateCityInput+Encodable.swift delete mode 100644 Sources/WeatherSDK/models/CreateCityInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/CreateCityOutputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/CreateCityOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/Foo+Codable.swift delete mode 100644 Sources/WeatherSDK/models/GetCityAnnouncementsInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/GetCityAnnouncementsOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/GetCityImageInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/GetCityImageOutputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/GetCityImageOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/GetCityInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/GetCityOutputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/GetCityOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/GetCurrentTimeInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/GetCurrentTimeOutputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/GetCurrentTimeOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/GetForecastInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/GetForecastOutputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/GetForecastOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/InvokeInput+Encodable.swift delete mode 100644 Sources/WeatherSDK/models/InvokeInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/InvokeOutputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/InvokeOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/ListCitiesInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/ListCitiesOutputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/ListCitiesOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/NoSuchResourceBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlyFakeAuthInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlyFakeAuthOptionalInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlyFakeAuthOptionalOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OnlyFakeAuthOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpBearerAuthInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OnlyHttpBearerAuthOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OnlySigv4AuthInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlySigv4AuthOptionalInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/OnlySigv4AuthOptionalOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OnlySigv4AuthOutputError+HttpResponseBinding.swift delete mode 100644 Sources/WeatherSDK/models/OtherStructure+Codable.swift delete mode 100644 Sources/WeatherSDK/models/Precipitation+Codable.swift delete mode 100644 Sources/WeatherSDK/models/SameAsServiceInputBody+Decodable.swift delete mode 100644 Sources/WeatherSDK/models/SameAsServiceOutputError+HttpResponseBinding.swift diff --git a/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift b/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift index 6dc86a356..2f3197c00 100644 --- a/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift +++ b/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift @@ -8,6 +8,7 @@ import protocol SmithyRetriesAPI.RetryStrategy import protocol SmithyRetriesAPI.RetryErrorInfoProvider import struct SmithyRetriesAPI.RetryStrategyOptions +import struct SmithyRetries.DefaultRetryStrategy import struct SmithyRetries.ExponentialBackoffStrategy /// Provides configuration options for a Smithy-based service. diff --git a/Sources/WeatherSDK/models/Baz+Codable.swift b/Sources/WeatherSDK/models/Baz+Codable.swift deleted file mode 100644 index 2915f8ac2..000000000 --- a/Sources/WeatherSDK/models/Baz+Codable.swift +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -extension WeatherClientTypes.Baz: Swift.Codable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case bar - case baz - } - - public func encode(to encoder: Swift.Encoder) throws { - var encodeContainer = encoder.container(keyedBy: CodingKeys.self) - if let bar = self.bar { - try encodeContainer.encode(bar, forKey: .bar) - } - if let baz = self.baz { - try encodeContainer.encode(baz, forKey: .baz) - } - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let bazDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .baz) - baz = bazDecoded - let barDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .bar) - bar = barDecoded - } -} diff --git a/Sources/WeatherSDK/models/CityCoordinates+Codable.swift b/Sources/WeatherSDK/models/CityCoordinates+Codable.swift deleted file mode 100644 index bc2ab19c5..000000000 --- a/Sources/WeatherSDK/models/CityCoordinates+Codable.swift +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -extension WeatherClientTypes.CityCoordinates: Swift.Codable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case latitude - case longitude - } - - public func encode(to encoder: Swift.Encoder) throws { - var encodeContainer = encoder.container(keyedBy: CodingKeys.self) - if let latitude = self.latitude { - try encodeContainer.encode(latitude, forKey: .latitude) - } - if let longitude = self.longitude { - try encodeContainer.encode(longitude, forKey: .longitude) - } - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let latitudeDecoded = try containerValues.decodeIfPresent(Swift.Float.self, forKey: .latitude) - latitude = latitudeDecoded - let longitudeDecoded = try containerValues.decodeIfPresent(Swift.Float.self, forKey: .longitude) - longitude = longitudeDecoded - } -} diff --git a/Sources/WeatherSDK/models/CitySummary+Codable.swift b/Sources/WeatherSDK/models/CitySummary+Codable.swift deleted file mode 100644 index 4f74ab717..000000000 --- a/Sources/WeatherSDK/models/CitySummary+Codable.swift +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -extension WeatherClientTypes.CitySummary: Swift.Codable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case `case` = "case" - case cityId - case name - case number - } - - public func encode(to encoder: Swift.Encoder) throws { - var encodeContainer = encoder.container(keyedBy: CodingKeys.self) - if let `case` = self.`case` { - try encodeContainer.encode(`case`, forKey: .`case`) - } - if let cityId = self.cityId { - try encodeContainer.encode(cityId, forKey: .cityId) - } - if let name = self.name { - try encodeContainer.encode(name, forKey: .name) - } - if let number = self.number { - try encodeContainer.encode(number, forKey: .number) - } - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let cityIdDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .cityId) - cityId = cityIdDecoded - let nameDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .name) - name = nameDecoded - let numberDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .number) - number = numberDecoded - let caseDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .case) - `case` = caseDecoded - } -} diff --git a/Sources/WeatherSDK/models/CreateCityInput+Encodable.swift b/Sources/WeatherSDK/models/CreateCityInput+Encodable.swift deleted file mode 100644 index 1066cc373..000000000 --- a/Sources/WeatherSDK/models/CreateCityInput+Encodable.swift +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -extension CreateCityInput: Swift.Encodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case city - case coordinates - case name - } - - public func encode(to encoder: Swift.Encoder) throws { - var encodeContainer = encoder.container(keyedBy: CodingKeys.self) - if let city = self.city { - try encodeContainer.encode(city, forKey: .city) - } - if let coordinates = self.coordinates { - try encodeContainer.encode(coordinates, forKey: .coordinates) - } - if let name = self.name { - try encodeContainer.encode(name, forKey: .name) - } - } -} diff --git a/Sources/WeatherSDK/models/CreateCityInputBody+Decodable.swift b/Sources/WeatherSDK/models/CreateCityInputBody+Decodable.swift deleted file mode 100644 index 4f7fecd0b..000000000 --- a/Sources/WeatherSDK/models/CreateCityInputBody+Decodable.swift +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct CreateCityInputBody { - let name: Swift.String? - let coordinates: WeatherClientTypes.CityCoordinates? - let city: WeatherClientTypes.CitySummary? -} - -extension CreateCityInputBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case city - case coordinates - case name - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let nameDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .name) - name = nameDecoded - let coordinatesDecoded = try containerValues.decodeIfPresent(WeatherClientTypes.CityCoordinates.self, forKey: .coordinates) - coordinates = coordinatesDecoded - let cityDecoded = try containerValues.decodeIfPresent(WeatherClientTypes.CitySummary.self, forKey: .city) - city = cityDecoded - } -} diff --git a/Sources/WeatherSDK/models/CreateCityOutputBody+Decodable.swift b/Sources/WeatherSDK/models/CreateCityOutputBody+Decodable.swift deleted file mode 100644 index e90b52396..000000000 --- a/Sources/WeatherSDK/models/CreateCityOutputBody+Decodable.swift +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct CreateCityOutputBody { - let cityId: Swift.String? -} - -extension CreateCityOutputBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case cityId - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let cityIdDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .cityId) - cityId = cityIdDecoded - } -} diff --git a/Sources/WeatherSDK/models/CreateCityOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/CreateCityOutputError+HttpResponseBinding.swift deleted file mode 100644 index 9de323cb5..000000000 --- a/Sources/WeatherSDK/models/CreateCityOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum CreateCityOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/Foo+Codable.swift b/Sources/WeatherSDK/models/Foo+Codable.swift deleted file mode 100644 index c5c9af5d9..000000000 --- a/Sources/WeatherSDK/models/Foo+Codable.swift +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -extension WeatherClientTypes.Foo: Swift.Codable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case bar - case baz - } - - public func encode(to encoder: Swift.Encoder) throws { - var encodeContainer = encoder.container(keyedBy: CodingKeys.self) - if let bar = self.bar { - try encodeContainer.encode(bar, forKey: .bar) - } - if let baz = self.baz { - try encodeContainer.encode(baz, forKey: .baz) - } - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let bazDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .baz) - baz = bazDecoded - let barDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .bar) - bar = barDecoded - } -} diff --git a/Sources/WeatherSDK/models/GetCityAnnouncementsInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityAnnouncementsInputBody+Decodable.swift deleted file mode 100644 index 3b0f5f1e0..000000000 --- a/Sources/WeatherSDK/models/GetCityAnnouncementsInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct GetCityAnnouncementsInputBody { -} - -extension GetCityAnnouncementsInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/GetCityAnnouncementsOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/GetCityAnnouncementsOutputError+HttpResponseBinding.swift deleted file mode 100644 index 3774f7d3a..000000000 --- a/Sources/WeatherSDK/models/GetCityAnnouncementsOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum GetCityAnnouncementsOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - case "NoSuchResource": return try await NoSuchResource(httpResponse: httpResponse, decoder: decoder, message: defaultError.errorMessage) - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/GetCityImageInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityImageInputBody+Decodable.swift deleted file mode 100644 index 8ecb9634e..000000000 --- a/Sources/WeatherSDK/models/GetCityImageInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct GetCityImageInputBody { -} - -extension GetCityImageInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/GetCityImageOutputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityImageOutputBody+Decodable.swift deleted file mode 100644 index 46256dea6..000000000 --- a/Sources/WeatherSDK/models/GetCityImageOutputBody+Decodable.swift +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct GetCityImageOutputBody { - let image: ClientRuntime.ByteStream? -} - -extension GetCityImageOutputBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case image - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let imageDecoded = try containerValues.decodeIfPresent(ClientRuntime.ByteStream.self, forKey: .image) - image = imageDecoded - } -} diff --git a/Sources/WeatherSDK/models/GetCityImageOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/GetCityImageOutputError+HttpResponseBinding.swift deleted file mode 100644 index b781b44fa..000000000 --- a/Sources/WeatherSDK/models/GetCityImageOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum GetCityImageOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - case "NoSuchResource": return try await NoSuchResource(httpResponse: httpResponse, decoder: decoder, message: defaultError.errorMessage) - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/GetCityInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityInputBody+Decodable.swift deleted file mode 100644 index 4e64ca635..000000000 --- a/Sources/WeatherSDK/models/GetCityInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct GetCityInputBody { -} - -extension GetCityInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/GetCityOutputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCityOutputBody+Decodable.swift deleted file mode 100644 index 1e8e89ac4..000000000 --- a/Sources/WeatherSDK/models/GetCityOutputBody+Decodable.swift +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct GetCityOutputBody { - let name: Swift.String? - let coordinates: WeatherClientTypes.CityCoordinates? - let city: WeatherClientTypes.CitySummary? -} - -extension GetCityOutputBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case city - case coordinates - case name - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let nameDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .name) - name = nameDecoded - let coordinatesDecoded = try containerValues.decodeIfPresent(WeatherClientTypes.CityCoordinates.self, forKey: .coordinates) - coordinates = coordinatesDecoded - let cityDecoded = try containerValues.decodeIfPresent(WeatherClientTypes.CitySummary.self, forKey: .city) - city = cityDecoded - } -} diff --git a/Sources/WeatherSDK/models/GetCityOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/GetCityOutputError+HttpResponseBinding.swift deleted file mode 100644 index 14edc57ca..000000000 --- a/Sources/WeatherSDK/models/GetCityOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum GetCityOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - case "NoSuchResource": return try await NoSuchResource(httpResponse: httpResponse, decoder: decoder, message: defaultError.errorMessage) - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/GetCurrentTimeInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCurrentTimeInputBody+Decodable.swift deleted file mode 100644 index d7361aa89..000000000 --- a/Sources/WeatherSDK/models/GetCurrentTimeInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct GetCurrentTimeInputBody { -} - -extension GetCurrentTimeInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/GetCurrentTimeOutputBody+Decodable.swift b/Sources/WeatherSDK/models/GetCurrentTimeOutputBody+Decodable.swift deleted file mode 100644 index 08efba7db..000000000 --- a/Sources/WeatherSDK/models/GetCurrentTimeOutputBody+Decodable.swift +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct GetCurrentTimeOutputBody { - let time: ClientRuntime.Date? -} - -extension GetCurrentTimeOutputBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case time - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let timeDecoded = try containerValues.decodeTimestampIfPresent(.dateTime, forKey: .time) - time = timeDecoded - } -} diff --git a/Sources/WeatherSDK/models/GetCurrentTimeOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/GetCurrentTimeOutputError+HttpResponseBinding.swift deleted file mode 100644 index 781bbb144..000000000 --- a/Sources/WeatherSDK/models/GetCurrentTimeOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum GetCurrentTimeOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/GetForecastInputBody+Decodable.swift b/Sources/WeatherSDK/models/GetForecastInputBody+Decodable.swift deleted file mode 100644 index 6262bf61f..000000000 --- a/Sources/WeatherSDK/models/GetForecastInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct GetForecastInputBody { -} - -extension GetForecastInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/GetForecastOutputBody+Decodable.swift b/Sources/WeatherSDK/models/GetForecastOutputBody+Decodable.swift deleted file mode 100644 index 1bfe108de..000000000 --- a/Sources/WeatherSDK/models/GetForecastOutputBody+Decodable.swift +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct GetForecastOutputBody { - let chanceOfRain: Swift.Float? - let precipitation: WeatherClientTypes.Precipitation? -} - -extension GetForecastOutputBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case chanceOfRain - case precipitation - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let chanceOfRainDecoded = try containerValues.decodeIfPresent(Swift.Float.self, forKey: .chanceOfRain) - chanceOfRain = chanceOfRainDecoded - let precipitationDecoded = try containerValues.decodeIfPresent(WeatherClientTypes.Precipitation.self, forKey: .precipitation) - precipitation = precipitationDecoded - } -} diff --git a/Sources/WeatherSDK/models/GetForecastOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/GetForecastOutputError+HttpResponseBinding.swift deleted file mode 100644 index eb12dd296..000000000 --- a/Sources/WeatherSDK/models/GetForecastOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum GetForecastOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/InvokeInput+Encodable.swift b/Sources/WeatherSDK/models/InvokeInput+Encodable.swift deleted file mode 100644 index 67486ada7..000000000 --- a/Sources/WeatherSDK/models/InvokeInput+Encodable.swift +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -extension InvokeInput: Swift.Encodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case payload - } - - public func encode(to encoder: Swift.Encoder) throws { - var encodeContainer = encoder.container(keyedBy: CodingKeys.self) - if let payload = self.payload { - try encodeContainer.encode(payload.base64EncodedString(), forKey: .payload) - } - } -} diff --git a/Sources/WeatherSDK/models/InvokeInputBody+Decodable.swift b/Sources/WeatherSDK/models/InvokeInputBody+Decodable.swift deleted file mode 100644 index 1aeed7f48..000000000 --- a/Sources/WeatherSDK/models/InvokeInputBody+Decodable.swift +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct InvokeInputBody { - let payload: ClientRuntime.Data? -} - -extension InvokeInputBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case payload - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let payloadDecoded = try containerValues.decodeIfPresent(ClientRuntime.Data.self, forKey: .payload) - payload = payloadDecoded - } -} diff --git a/Sources/WeatherSDK/models/InvokeOutputBody+Decodable.swift b/Sources/WeatherSDK/models/InvokeOutputBody+Decodable.swift deleted file mode 100644 index c06373481..000000000 --- a/Sources/WeatherSDK/models/InvokeOutputBody+Decodable.swift +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct InvokeOutputBody { - let payload: ClientRuntime.Data? -} - -extension InvokeOutputBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case payload - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let payloadDecoded = try containerValues.decodeIfPresent(ClientRuntime.Data.self, forKey: .payload) - payload = payloadDecoded - } -} diff --git a/Sources/WeatherSDK/models/InvokeOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/InvokeOutputError+HttpResponseBinding.swift deleted file mode 100644 index 9d28c5c6f..000000000 --- a/Sources/WeatherSDK/models/InvokeOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum InvokeOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/ListCitiesInputBody+Decodable.swift b/Sources/WeatherSDK/models/ListCitiesInputBody+Decodable.swift deleted file mode 100644 index 710e33f28..000000000 --- a/Sources/WeatherSDK/models/ListCitiesInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct ListCitiesInputBody { -} - -extension ListCitiesInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/ListCitiesOutputBody+Decodable.swift b/Sources/WeatherSDK/models/ListCitiesOutputBody+Decodable.swift deleted file mode 100644 index 38076bca2..000000000 --- a/Sources/WeatherSDK/models/ListCitiesOutputBody+Decodable.swift +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct ListCitiesOutputBody { - let nextToken: Swift.String? - let items: [WeatherClientTypes.CitySummary]? -} - -extension ListCitiesOutputBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case items - case nextToken - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let nextTokenDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .nextToken) - nextToken = nextTokenDecoded - let itemsContainer = try containerValues.decodeIfPresent([WeatherClientTypes.CitySummary?].self, forKey: .items) - var itemsDecoded0:[WeatherClientTypes.CitySummary]? = nil - if let itemsContainer = itemsContainer { - itemsDecoded0 = [WeatherClientTypes.CitySummary]() - for structure0 in itemsContainer { - if let structure0 = structure0 { - itemsDecoded0?.append(structure0) - } - } - } - items = itemsDecoded0 - } -} diff --git a/Sources/WeatherSDK/models/ListCitiesOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/ListCitiesOutputError+HttpResponseBinding.swift deleted file mode 100644 index 49595fa8f..000000000 --- a/Sources/WeatherSDK/models/ListCitiesOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum ListCitiesOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - case "NoSuchResource": return try await NoSuchResource(httpResponse: httpResponse, decoder: decoder, message: defaultError.errorMessage) - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/NoSuchResourceBody+Decodable.swift b/Sources/WeatherSDK/models/NoSuchResourceBody+Decodable.swift deleted file mode 100644 index 6b4d1e355..000000000 --- a/Sources/WeatherSDK/models/NoSuchResourceBody+Decodable.swift +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct NoSuchResourceBody { - let resourceType: Swift.String? - let message: Swift.String? -} - -extension NoSuchResourceBody: Swift.Decodable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case message - case resourceType - } - - public init(from decoder: Swift.Decoder) throws { - let containerValues = try decoder.container(keyedBy: CodingKeys.self) - let resourceTypeDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .resourceType) - resourceType = resourceTypeDecoded - let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message) - message = messageDecoded - } -} diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyFakeAuthInputBody+Decodable.swift deleted file mode 100644 index 85506c967..000000000 --- a/Sources/WeatherSDK/models/OnlyFakeAuthInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlyFakeAuthInputBody { -} - -extension OnlyFakeAuthInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInputBody+Decodable.swift deleted file mode 100644 index b57def6fb..000000000 --- a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlyFakeAuthOptionalInputBody { -} - -extension OnlyFakeAuthOptionalInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlyFakeAuthOptionalOutputError+HttpResponseBinding.swift deleted file mode 100644 index b43abdc7b..000000000 --- a/Sources/WeatherSDK/models/OnlyFakeAuthOptionalOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlyFakeAuthOptionalOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OnlyFakeAuthOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlyFakeAuthOutputError+HttpResponseBinding.swift deleted file mode 100644 index 3390bc446..000000000 --- a/Sources/WeatherSDK/models/OnlyFakeAuthOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlyFakeAuthOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInputBody+Decodable.swift deleted file mode 100644 index 1bb9402a0..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlyHttpApiKeyAndBearerAuthInputBody { -} - -extension OnlyHttpApiKeyAndBearerAuthInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthOutputError+HttpResponseBinding.swift deleted file mode 100644 index 2b5b53b9c..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlyHttpApiKeyAndBearerAuthOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInputBody+Decodable.swift deleted file mode 100644 index 0ff8fccc8..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlyHttpApiKeyAndBearerAuthReversedInputBody { -} - -extension OnlyHttpApiKeyAndBearerAuthReversedInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedOutputError+HttpResponseBinding.swift deleted file mode 100644 index 6066752af..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAndBearerAuthReversedOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlyHttpApiKeyAndBearerAuthReversedOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInputBody+Decodable.swift deleted file mode 100644 index d8cade4a5..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlyHttpApiKeyAuthInputBody { -} - -extension OnlyHttpApiKeyAuthInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInputBody+Decodable.swift deleted file mode 100644 index c3bfa702a..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlyHttpApiKeyAuthOptionalInputBody { -} - -extension OnlyHttpApiKeyAuthOptionalInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalOutputError+HttpResponseBinding.swift deleted file mode 100644 index 91a81aa7d..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOptionalOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlyHttpApiKeyAuthOptionalOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOutputError+HttpResponseBinding.swift deleted file mode 100644 index 64e459108..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpApiKeyAuthOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlyHttpApiKeyAuthOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthInputBody+Decodable.swift deleted file mode 100644 index 5d985f222..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlyHttpBearerAuthInputBody { -} - -extension OnlyHttpBearerAuthInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInputBody+Decodable.swift deleted file mode 100644 index 738c81497..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlyHttpBearerAuthOptionalInputBody { -} - -extension OnlyHttpBearerAuthOptionalInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalOutputError+HttpResponseBinding.swift deleted file mode 100644 index a4e2e0f50..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOptionalOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlyHttpBearerAuthOptionalOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlyHttpBearerAuthOutputError+HttpResponseBinding.swift deleted file mode 100644 index 979bc7e5e..000000000 --- a/Sources/WeatherSDK/models/OnlyHttpBearerAuthOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlyHttpBearerAuthOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlySigv4AuthInputBody+Decodable.swift deleted file mode 100644 index bf62a34c1..000000000 --- a/Sources/WeatherSDK/models/OnlySigv4AuthInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlySigv4AuthInputBody { -} - -extension OnlySigv4AuthInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInputBody+Decodable.swift b/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInputBody+Decodable.swift deleted file mode 100644 index f2348d1c9..000000000 --- a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct OnlySigv4AuthOptionalInputBody { -} - -extension OnlySigv4AuthOptionalInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlySigv4AuthOptionalOutputError+HttpResponseBinding.swift deleted file mode 100644 index 74d6b1ac4..000000000 --- a/Sources/WeatherSDK/models/OnlySigv4AuthOptionalOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlySigv4AuthOptionalOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OnlySigv4AuthOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/OnlySigv4AuthOutputError+HttpResponseBinding.swift deleted file mode 100644 index 5335eee1f..000000000 --- a/Sources/WeatherSDK/models/OnlySigv4AuthOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum OnlySigv4AuthOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Sources/WeatherSDK/models/OtherStructure+Codable.swift b/Sources/WeatherSDK/models/OtherStructure+Codable.swift deleted file mode 100644 index 7e476288c..000000000 --- a/Sources/WeatherSDK/models/OtherStructure+Codable.swift +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -extension WeatherClientTypes.OtherStructure: Swift.Codable { - - public func encode(to encoder: Swift.Encoder) throws { - var container = encoder.singleValueContainer() - try container.encode([String:String]()) - } - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/Precipitation+Codable.swift b/Sources/WeatherSDK/models/Precipitation+Codable.swift deleted file mode 100644 index 93169f310..000000000 --- a/Sources/WeatherSDK/models/Precipitation+Codable.swift +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -extension WeatherClientTypes.Precipitation: Swift.Codable { - enum CodingKeys: Swift.String, Swift.CodingKey { - case baz - case blob - case foo - case hail - case mixed - case other - case rain - case sdkUnknown - case sleet - case snow - } - - public func encode(to encoder: Swift.Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - switch self { - case let .baz(baz): - try container.encode(baz, forKey: .baz) - case let .blob(blob): - try container.encode(blob.base64EncodedString(), forKey: .blob) - case let .foo(foo): - try container.encode(foo, forKey: .foo) - case let .hail(hail): - var hailContainer = container.nestedContainer(keyedBy: ClientRuntime.Key.self, forKey: .hail) - for (dictKey0, stringMap0) in hail { - try hailContainer.encode(stringMap0, forKey: ClientRuntime.Key(stringValue: dictKey0)) - } - case let .mixed(mixed): - try container.encode(mixed.rawValue, forKey: .mixed) - case let .other(other): - try container.encode(other, forKey: .other) - case let .rain(rain): - try container.encode(rain, forKey: .rain) - case let .sleet(sleet): - try container.encode(sleet, forKey: .sleet) - case let .snow(snow): - try container.encode(snow.rawValue, forKey: .snow) - case let .sdkUnknown(sdkUnknown): - try container.encode(sdkUnknown, forKey: .sdkUnknown) - } - } - - public init(from decoder: Swift.Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - let rainDecoded = try values.decodeIfPresent(Swift.Bool.self, forKey: .rain) - if let rain = rainDecoded { - self = .rain(rain) - return - } - let sleetDecoded = try values.decodeIfPresent(Swift.Bool.self, forKey: .sleet) - if let sleet = sleetDecoded { - self = .sleet(sleet) - return - } - let hailContainer = try values.decodeIfPresent([Swift.String: Swift.String?].self, forKey: .hail) - var hailDecoded0: [Swift.String:Swift.String]? = nil - if let hailContainer = hailContainer { - hailDecoded0 = [Swift.String:Swift.String]() - for (key0, string0) in hailContainer { - if let string0 = string0 { - hailDecoded0?[key0] = string0 - } - } - } - if let hail = hailDecoded0 { - self = .hail(hail) - return - } - let snowDecoded = try values.decodeIfPresent(WeatherClientTypes.SimpleYesNo.self, forKey: .snow) - if let snow = snowDecoded { - self = .snow(snow) - return - } - let mixedDecoded = try values.decodeIfPresent(WeatherClientTypes.TypedYesNo.self, forKey: .mixed) - if let mixed = mixedDecoded { - self = .mixed(mixed) - return - } - let otherDecoded = try values.decodeIfPresent(WeatherClientTypes.OtherStructure.self, forKey: .other) - if let other = otherDecoded { - self = .other(other) - return - } - let blobDecoded = try values.decodeIfPresent(ClientRuntime.Data.self, forKey: .blob) - if let blob = blobDecoded { - self = .blob(blob) - return - } - let fooDecoded = try values.decodeIfPresent(WeatherClientTypes.Foo.self, forKey: .foo) - if let foo = fooDecoded { - self = .foo(foo) - return - } - let bazDecoded = try values.decodeIfPresent(WeatherClientTypes.Baz.self, forKey: .baz) - if let baz = bazDecoded { - self = .baz(baz) - return - } - self = .sdkUnknown("") - } -} diff --git a/Sources/WeatherSDK/models/SameAsServiceInputBody+Decodable.swift b/Sources/WeatherSDK/models/SameAsServiceInputBody+Decodable.swift deleted file mode 100644 index c7d307384..000000000 --- a/Sources/WeatherSDK/models/SameAsServiceInputBody+Decodable.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime - -struct SameAsServiceInputBody { -} - -extension SameAsServiceInputBody: Swift.Decodable { - - public init(from decoder: Swift.Decoder) throws { - } -} diff --git a/Sources/WeatherSDK/models/SameAsServiceOutputError+HttpResponseBinding.swift b/Sources/WeatherSDK/models/SameAsServiceOutputError+HttpResponseBinding.swift deleted file mode 100644 index 527f9d948..000000000 --- a/Sources/WeatherSDK/models/SameAsServiceOutputError+HttpResponseBinding.swift +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by smithy-swift-codegen. DO NOT EDIT! - -import ClientRuntime -import SmithyTestUtil - -enum SameAsServiceOutputError: ClientRuntime.HttpResponseErrorBinding { - static func makeError(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws -> Swift.Error { - let defaultError = try await SmithyTestUtil.JSONError(httpResponse: httpResponse) - switch defaultError.errorType { - default: return try await ClientRuntime.UnknownHTTPServiceError.makeError(httpResponse: httpResponse, message: defaultError.errorMessage, typeName: defaultError.errorType) - } - } -} diff --git a/Tests/ClientRuntimeTests/OrchestratorTests/OrchestratorTests.swift b/Tests/ClientRuntimeTests/OrchestratorTests/OrchestratorTests.swift index 39f65cd90..904791b27 100644 --- a/Tests/ClientRuntimeTests/OrchestratorTests/OrchestratorTests.swift +++ b/Tests/ClientRuntimeTests/OrchestratorTests/OrchestratorTests.swift @@ -8,12 +8,9 @@ import XCTest @testable import ClientRuntime -<<<<<<< HEAD import SmithyRetriesAPI import SmithyRetries -======= import SmithyJSON ->>>>>>> main class OrchestratorTests: XCTestCase { struct TestInput { From ac0129a96592cb55124a95987fe32f64e1346eac Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 10 May 2024 15:19:39 -0500 Subject: [PATCH 14/18] Fix swiftlint.yml file --- .swiftlint.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index c149d82de..d2b385531 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -2,17 +2,7 @@ excluded: - .build - Sources/SmithyTestUtil/* - Sources/WeatherSDK/* -<<<<<<< HEAD - Tests/* -======= - - Tests/ClientRuntimeTests/* - - Tests/SmithyTestUtilTests/* - - Tests/SmithyXMLTests/* - - Tests/SmithyJSONTests/* - - Tests/SmithyFormURLTests/* - - Tests/SmithyTimestampsTests/* - - Tests/WeatherSDKTests/* ->>>>>>> main - smithy-swift-codegen-test/build/* analyzer_rules: From af83cff4ff3a50d0fa7e4f29a7d6f148ab504f32 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Tue, 14 May 2024 16:55:52 -0500 Subject: [PATCH 15/18] Split adaptive-related retry error from generic max attempts error; add doc comments --- .../DefaultRetryStrategy+Error.swift | 19 +++++++++++++++++++ Sources/SmithyRetriesAPI/RetryError.swift | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy+Error.swift diff --git a/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy+Error.swift b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy+Error.swift new file mode 100644 index 000000000..05d6377c5 --- /dev/null +++ b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy+Error.swift @@ -0,0 +1,19 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +public extension DefaultRetryStrategy { + + /// Errors that may be thrown when an operation is retried unsuccessfully. + public enum Error: Swift.Error { + + /// The number and frequency of retries being attempted has exceeded the + /// current limits. + /// + /// This error is only raised when the `adaptive` rate limiting mode of retry is used. + case insufficientQuota + } +} diff --git a/Sources/SmithyRetriesAPI/RetryError.swift b/Sources/SmithyRetriesAPI/RetryError.swift index a426f75be..b734f9511 100644 --- a/Sources/SmithyRetriesAPI/RetryError.swift +++ b/Sources/SmithyRetriesAPI/RetryError.swift @@ -5,7 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +/// Errors that may be thrown when an operation is retried unsuccessfully. public enum RetryError: Error { + + /// The maximum number of allowed retry attempts were made, + /// but the operation could not be successfully completed. case maxAttemptsReached - case insufficientQuota } From 457d932249531bb1520d233d283a70bb2cf22b63 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Tue, 14 May 2024 17:02:05 -0500 Subject: [PATCH 16/18] Fix tests --- Sources/ClientRuntime/Endpoints/ServiceEndpointMetadata.swift | 1 - Sources/ClientRuntime/Endpoints/SmithyEndpoint.swift | 1 - Sources/ClientRuntime/Plugins/DefaultClientPlugin.swift | 2 +- .../DefaultRetryStrategy/DefaultRetryStrategy+Error.swift | 2 +- .../DefaultRetryStrategy/DefaultRetryStrategy.swift | 2 +- .../DefaultRetryStrategy/DefaultRetryStrategyTests.swift | 2 +- 6 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Sources/ClientRuntime/Endpoints/ServiceEndpointMetadata.swift b/Sources/ClientRuntime/Endpoints/ServiceEndpointMetadata.swift index 923932a42..75b045d38 100644 --- a/Sources/ClientRuntime/Endpoints/ServiceEndpointMetadata.swift +++ b/Sources/ClientRuntime/Endpoints/ServiceEndpointMetadata.swift @@ -4,7 +4,6 @@ // // SPDX-License-Identifier: Apache-2.0 // -import ClientRuntime public struct ServiceEndpointMetadata { public let defaultProtocol = ProtocolType.https.rawValue diff --git a/Sources/ClientRuntime/Endpoints/SmithyEndpoint.swift b/Sources/ClientRuntime/Endpoints/SmithyEndpoint.swift index a2a8aaf63..f915dea85 100644 --- a/Sources/ClientRuntime/Endpoints/SmithyEndpoint.swift +++ b/Sources/ClientRuntime/Endpoints/SmithyEndpoint.swift @@ -4,7 +4,6 @@ // // SPDX-License-Identifier: Apache-2.0 // -import ClientRuntime /** A structure used by the service client to determine the endpoint. diff --git a/Sources/ClientRuntime/Plugins/DefaultClientPlugin.swift b/Sources/ClientRuntime/Plugins/DefaultClientPlugin.swift index 121a28cf3..df080b1c6 100644 --- a/Sources/ClientRuntime/Plugins/DefaultClientPlugin.swift +++ b/Sources/ClientRuntime/Plugins/DefaultClientPlugin.swift @@ -17,7 +17,7 @@ public class DefaultClientPlugin: Plugin { } if var config = clientConfiguration as? DefaultHttpClientConfiguration { - var httpClientConfiguration = + let httpClientConfiguration = DefaultSDKRuntimeConfiguration .defaultHttpClientConfiguration config.httpClientConfiguration = httpClientConfiguration diff --git a/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy+Error.swift b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy+Error.swift index 05d6377c5..3d1c8d2a3 100644 --- a/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy+Error.swift +++ b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy+Error.swift @@ -8,7 +8,7 @@ public extension DefaultRetryStrategy { /// Errors that may be thrown when an operation is retried unsuccessfully. - public enum Error: Swift.Error { + enum Error: Swift.Error { /// The number and frequency of retries being attempted has exceeded the /// current limits. diff --git a/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift index 6300ec2e1..fea3e08bc 100644 --- a/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift +++ b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift @@ -47,7 +47,7 @@ public struct DefaultRetryStrategy: RetryStrategy { if let capacityAmount = await tokenToRenew.quota.hasRetryQuota(isTimeout: errorInfo.isTimeout) { tokenToRenew.capacityAmount = capacityAmount } else { - throw RetryError.insufficientQuota + throw Error.insufficientQuota } let isThrottling = errorInfo.errorType == .throttling await tokenToRenew.quota.updateClientSendingRate(isThrottling: isThrottling) diff --git a/Tests/SmithyRetriesTests/DefaultRetryStrategy/DefaultRetryStrategyTests.swift b/Tests/SmithyRetriesTests/DefaultRetryStrategy/DefaultRetryStrategyTests.swift index 12158ec38..fa930ddb9 100644 --- a/Tests/SmithyRetriesTests/DefaultRetryStrategy/DefaultRetryStrategyTests.swift +++ b/Tests/SmithyRetriesTests/DefaultRetryStrategy/DefaultRetryStrategyTests.swift @@ -118,7 +118,7 @@ final class DefaultRetryStrategyTests: XCTestCase { do { try await subject.refreshRetryTokenForRetry(tokenToRenew: token1, errorInfo: retryableInfo) XCTFail("Should have failed") - } catch RetryError.insufficientQuota { + } catch DefaultRetryStrategy.Error.insufficientQuota { // success } catch { XCTFail("Unexpected error thrown") From 7af28e65ee7c88f619c6301d22e34aa7463d53c9 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 17 May 2024 14:08:32 -0500 Subject: [PATCH 17/18] Fix codegen tests after merge --- smithy-swift-codegen/src/test/kotlin/EventStreamTests.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smithy-swift-codegen/src/test/kotlin/EventStreamTests.kt b/smithy-swift-codegen/src/test/kotlin/EventStreamTests.kt index 0a0683f34..7f31c9373 100644 --- a/smithy-swift-codegen/src/test/kotlin/EventStreamTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/EventStreamTests.kt @@ -220,7 +220,7 @@ extension EventStreamTestClientTypes.TestStream { operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.EventStreamBodyMiddleware(keyPath: \.value, defaultBody: "{}", marshalClosure: EventStreamTestClientTypes.TestStream.marshal)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.SignerMiddleware()) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware(TestStreamOpOutput.httpOutput(from:), TestStreamOpOutputError.httpError(from:))) operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) From f4f83420f3183d39cfb41f0ac870c02cde49e9ea Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 23 May 2024 16:51:15 -0500 Subject: [PATCH 18/18] Add doc comments to RetryErrorInfo & RetryErrorType, refactor RetryMiddleware to not force-unwrap --- .../Middleware/RetryMiddleware.swift | 16 +++++++--------- Sources/SmithyRetriesAPI/RetryErrorInfo.swift | 4 ++++ Sources/SmithyRetriesAPI/RetryErrorType.swift | 4 ++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Sources/ClientRuntime/Middleware/RetryMiddleware.swift b/Sources/ClientRuntime/Middleware/RetryMiddleware.swift index 3ebd00b55..0a4eb2291 100644 --- a/Sources/ClientRuntime/Middleware/RetryMiddleware.swift +++ b/Sources/ClientRuntime/Middleware/RetryMiddleware.swift @@ -67,17 +67,15 @@ public struct RetryMiddleware