Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extension Target.Dependency {
// Smithy modules
static var ClientRuntime: Self { .product(name: "ClientRuntime", package: "smithy-swift") }
static var Smithy: Self { .product(name: "Smithy", package: "smithy-swift") }
static var SmithyAWSJSON: Self { .product(name: "SmithyAWSJSON", package: "smithy-swift") }
static var SmithyRPCv2CBOR: Self { .product(name: "SmithyRPCv2CBOR", package: "smithy-swift") }
static var SmithyCBOR: Self { .product(name: "SmithyCBOR", package: "smithy-swift") }
static var SmithyChecksumsAPI: Self { .product(name: "SmithyChecksumsAPI", package: "smithy-swift") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ final class QueryCompatibleTests: XCTestCase {
do {
_ = try await mockClient.getQueueUrl(input: .init(queueName: "non-existent-queue"))
XCTFail("Expected QueueDoesNotExist error")
} catch let error as AWSServiceError {
} catch let error as QueueDoesNotExist {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were not checking for this modeled error type before (we would have failed if we did, because an unknown error was being thrown.)

// TC2: Verify error code falls back to __type field
XCTAssertNotNil(error.errorCode, "Error code should not be nil")
XCTAssertEqual(error.errorCode, "QueueDoesNotExist",
"Error code should be parsed from __type field when header is missing")
// TODO: Establish why errorCode should be different depending on how the
// error was matched (this exposes implementation)
// XCTAssertEqual(error.errorCode, "QueueDoesNotExist",
// "Error code should be parsed from __type field when header is missing")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer checking this code value because we model error code as static for a modeled error type, and passing TC1 & TC2 requires passing different error codes for the same type

}
}

Expand Down
303 changes: 152 additions & 151 deletions Package.swift

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This SDK is open-source. Code is available on Github [here](https://github.com/

[Smithy](../../../../../swift/api/smithy/latest)

[SmithyAWSJSON](../../../../../swift/api/smithyawsjson/latest)

[SmithyCBOR](../../../../../swift/api/smithycbor/latest)

[SmithyChecksums](../../../../../swift/api/smithychecksums/latest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
"AWSSDKHTTPAuth",
"ClientRuntime",
"Smithy",
"SmithyAWSJSON",
"SmithyHTTPAPI",
"SmithyHTTPAuthAPI",
"SmithyIdentity",
"SmithyJSON",
"SmithyReadWrite",
"SmithyRetries",
"SmithyRetriesAPI",
"SmithyTimestamps"
"SmithyRetriesAPI"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import class ClientRuntime.OrchestratorTelemetry
import class ClientRuntime.SdkHttpClient
import class Smithy.Context
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This & the next several files contain generated changes.

import class Smithy.ContextBuilder
import class SmithyHTTPAPI.HTTPRequest
import class SmithyHTTPAPI.HTTPResponse
@_spi(SmithyReadWrite) import class SmithyJSON.Writer
import enum AWSClientRuntime.AWSClockSkewProvider
import enum AWSClientRuntime.AWSRetryErrorInfoProvider
import enum AWSClientRuntime.AWSRetryMode
Expand All @@ -37,30 +34,29 @@ import protocol ClientRuntime.DefaultHttpClientConfiguration
import protocol ClientRuntime.HttpInterceptorProvider
import protocol ClientRuntime.IdempotencyTokenGenerator
import protocol ClientRuntime.InterceptorProvider
import protocol ClientRuntime.Plugin
import protocol ClientRuntime.TelemetryProvider
import protocol Smithy.LogAgent
import protocol SmithyHTTPAPI.HTTPClient
import protocol SmithyHTTPAuthAPI.AuthSchemeResolver
@_spi(AWSCredentialIdentityResolver) import protocol SmithyIdentity.AWSCredentialIdentityResolver
import protocol SmithyIdentity.BearerTokenIdentityResolver
@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter
@_spi(AWSEndpointResolverMiddleware) import struct AWSClientRuntime.AWSEndpointResolverMiddleware
import struct AWSClientRuntime.AmzSdkInvocationIdMiddleware
import struct AWSClientRuntime.UserAgentMiddleware
import struct AWSSDKHTTPAuth.SigV4AuthScheme
import struct ClientRuntime.AuthSchemeMiddleware
@_spi(SmithyReadWrite) import struct ClientRuntime.BodyMiddleware
import struct ClientRuntime.ContentLengthMiddleware
import struct ClientRuntime.ContentTypeMiddleware
@_spi(SmithyReadWrite) import struct ClientRuntime.DeserializeMiddleware
import struct ClientRuntime.LoggerMiddleware
import struct ClientRuntime.MutateHeadersMiddleware
import struct ClientRuntime.SendableHttpInterceptorProviderBox
import struct ClientRuntime.SendableInterceptorProviderBox
import struct ClientRuntime.SignerMiddleware
import struct ClientRuntime.URLHostMiddleware
import struct ClientRuntime.URLPathMiddleware
import struct Smithy.Attributes
import struct SmithyAWSJSON.HTTPClientProtocol
import struct SmithyAWSJSON.Plugin
import struct SmithyIdentity.BearerTokenIdentity
@_spi(StaticAWSCredentialIdentityResolver) import struct SmithyIdentity.StaticAWSCredentialIdentityResolver
@_spi(StaticBearerTokenIdentityResolver) import struct SmithyIdentity.StaticBearerTokenIdentityResolver
Expand Down Expand Up @@ -631,6 +627,12 @@ extension CognitoIdentityClient {
/// - `ResourceNotFoundException` : Thrown when the requested resource (for example, a dataset or record) does not exist.
/// - `TooManyRequestsException` : Thrown when a request is throttled.
public func getCredentialsForIdentity(input: GetCredentialsForIdentityInput) async throws -> GetCredentialsForIdentityOutput {
var config = config
let plugins: [any ClientRuntime.Plugin] = [SmithyAWSJSON.Plugin()]
for plugin in plugins {
try await plugin.configureClient(clientConfiguration: &config)
}
let operation = CognitoIdentityClient.getCredentialsForIdentityOperation
let context = Smithy.ContextBuilder()
.withMethod(value: .post)
.withServiceName(value: serviceName)
Expand All @@ -641,18 +643,18 @@ extension CognitoIdentityClient {
.withRegion(value: config.region)
.withRequestChecksumCalculation(value: config.requestChecksumCalculation)
.withResponseChecksumValidation(value: config.responseChecksumValidation)
.withOperationProperties(value: operation)
.build()
let builder = ClientRuntime.OrchestratorBuilder<GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, SmithyHTTPAPI.HTTPRequest, SmithyHTTPAPI.HTTPResponse>()
let clientProtocol = SmithyAWSJSON.HTTPClientProtocol(version: .v1_1)
let builder = ClientRuntime.OrchestratorBuilder(operation, clientProtocol)
config.interceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
config.httpInterceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
builder.interceptors.add(ClientRuntime.URLPathMiddleware<GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput>(GetCredentialsForIdentityInput.urlPathProvider(_:)))
builder.interceptors.add(ClientRuntime.URLHostMiddleware<GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput>())
builder.interceptors.add(ClientRuntime.ContentLengthMiddleware<GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput>())
builder.deserialize(ClientRuntime.DeserializeMiddleware<GetCredentialsForIdentityOutput>(GetCredentialsForIdentityOutput.httpOutput(from:), GetCredentialsForIdentityOutputError.httpError(from:)))
builder.interceptors.add(ClientRuntime.LoggerMiddleware<GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput>(clientLogMode: config.clientLogMode))
builder.clockSkewProvider(AWSClientRuntime.AWSClockSkewProvider.provider())
builder.retryStrategy(SmithyRetries.DefaultRetryStrategy(options: config.retryStrategyOptions))
Expand All @@ -664,7 +666,6 @@ extension CognitoIdentityClient {
}
builder.applyEndpoint(AWSClientRuntime.AWSEndpointResolverMiddleware<GetCredentialsForIdentityOutput, EndpointParams>(paramsBlock: endpointParamsBlock, resolverBlock: { [config] in try config.endpointResolver.resolve(params: $0) }))
builder.interceptors.add(ClientRuntime.MutateHeadersMiddleware<GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput>(overrides: ["X-Amz-Target": "AWSCognitoIdentityService.GetCredentialsForIdentity"]))
builder.serialize(ClientRuntime.BodyMiddleware<GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, SmithyJSON.Writer>(rootNodeInfo: "", inputWritingClosure: GetCredentialsForIdentityInput.write(value:to:)))
builder.interceptors.add(ClientRuntime.ContentTypeMiddleware<GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput>(contentType: "application/x-amz-json-1.1"))
builder.selectAuthScheme(ClientRuntime.AuthSchemeMiddleware<GetCredentialsForIdentityOutput>())
builder.interceptors.add(AWSClientRuntime.AmzSdkInvocationIdMiddleware<GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput>())
Expand Down Expand Up @@ -705,6 +706,12 @@ extension CognitoIdentityClient {
/// - `ResourceNotFoundException` : Thrown when the requested resource (for example, a dataset or record) does not exist.
/// - `TooManyRequestsException` : Thrown when a request is throttled.
public func getId(input: GetIdInput) async throws -> GetIdOutput {
var config = config
let plugins: [any ClientRuntime.Plugin] = [SmithyAWSJSON.Plugin()]
for plugin in plugins {
try await plugin.configureClient(clientConfiguration: &config)
}
let operation = CognitoIdentityClient.getIdOperation
let context = Smithy.ContextBuilder()
.withMethod(value: .post)
.withServiceName(value: serviceName)
Expand All @@ -715,18 +722,18 @@ extension CognitoIdentityClient {
.withRegion(value: config.region)
.withRequestChecksumCalculation(value: config.requestChecksumCalculation)
.withResponseChecksumValidation(value: config.responseChecksumValidation)
.withOperationProperties(value: operation)
.build()
let builder = ClientRuntime.OrchestratorBuilder<GetIdInput, GetIdOutput, SmithyHTTPAPI.HTTPRequest, SmithyHTTPAPI.HTTPResponse>()
let clientProtocol = SmithyAWSJSON.HTTPClientProtocol(version: .v1_1)
let builder = ClientRuntime.OrchestratorBuilder(operation, clientProtocol)
config.interceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
config.httpInterceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
builder.interceptors.add(ClientRuntime.URLPathMiddleware<GetIdInput, GetIdOutput>(GetIdInput.urlPathProvider(_:)))
builder.interceptors.add(ClientRuntime.URLHostMiddleware<GetIdInput, GetIdOutput>())
builder.interceptors.add(ClientRuntime.ContentLengthMiddleware<GetIdInput, GetIdOutput>())
builder.deserialize(ClientRuntime.DeserializeMiddleware<GetIdOutput>(GetIdOutput.httpOutput(from:), GetIdOutputError.httpError(from:)))
builder.interceptors.add(ClientRuntime.LoggerMiddleware<GetIdInput, GetIdOutput>(clientLogMode: config.clientLogMode))
builder.clockSkewProvider(AWSClientRuntime.AWSClockSkewProvider.provider())
builder.retryStrategy(SmithyRetries.DefaultRetryStrategy(options: config.retryStrategyOptions))
Expand All @@ -738,7 +745,6 @@ extension CognitoIdentityClient {
}
builder.applyEndpoint(AWSClientRuntime.AWSEndpointResolverMiddleware<GetIdOutput, EndpointParams>(paramsBlock: endpointParamsBlock, resolverBlock: { [config] in try config.endpointResolver.resolve(params: $0) }))
builder.interceptors.add(ClientRuntime.MutateHeadersMiddleware<GetIdInput, GetIdOutput>(overrides: ["X-Amz-Target": "AWSCognitoIdentityService.GetId"]))
builder.serialize(ClientRuntime.BodyMiddleware<GetIdInput, GetIdOutput, SmithyJSON.Writer>(rootNodeInfo: "", inputWritingClosure: GetIdInput.write(value:to:)))
builder.interceptors.add(ClientRuntime.ContentTypeMiddleware<GetIdInput, GetIdOutput>(contentType: "application/x-amz-json-1.1"))
builder.selectAuthScheme(ClientRuntime.AuthSchemeMiddleware<GetIdOutput>())
builder.interceptors.add(AWSClientRuntime.AmzSdkInvocationIdMiddleware<GetIdInput, GetIdOutput>())
Expand Down
Loading
Loading