-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update epic branch with new changes in main (#617)
* chore: Require Swift 5.7, fix deprecation warnings (#600) * feat: support initial-response in RPC based event streams (#597) * chore: Updates version to 0.32.0 * chore: Add newline to README.md (#602) * feat: add limited support in smithy-swift for visionOS (#606) * feat: add support for requiresLength trait and Transfer-Encoding: Chunked (#604) * chore: Update to aws-crt-swift 0.15.0 (#607) * fix: content-length middleware should not error on event streams (#608) * chore: Updates version to 0.33.0 * chore: Improved downstream task (#568) * chore: Convert idempotency token middleware from closure to reusable type (#610) * fix: Update aws-crt-swift dependency to 0.17.0 (#612) * chore: Updates version to 0.34.0 * fix: Endpoint url should be nil if host or scheme is missing (#614) * fix: Pool HTTP connections based on scheme, host, and port (#615) * add default log level to initialize method (#616) * feat: add utility method for converting SdkHttpRequest to URLRequest. (#613) * Add extension constructor to URLRequest to convert SDKHttpRequest * Add preprocessor conditional import functionality to SwiftWriter. --------- Co-authored-by: Sichan Yoo <[email protected]> * chore: Updates version to 0.35.0 * Update test cases added from main to reflect sra identity & auth fields in middleware context & sra identity & auth middlewares in operation stack. --------- Co-authored-by: Josh Elkins <[email protected]> Co-authored-by: David Yaffe <[email protected]> Co-authored-by: AWS SDK Swift Automation <[email protected]> Co-authored-by: Cyprien Ricque <[email protected]> Co-authored-by: Sichan Yoo <[email protected]>
- Loading branch information
1 parent
1b62ed9
commit 6b8a015
Showing
32 changed files
with
914 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.31.0 | ||
0.35.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Sources/ClientRuntime/Idempotency/IdempotencyTokenMiddleware.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// Copyright Amazon.com Inc. or its affiliates. | ||
// All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
public struct IdempotencyTokenMiddleware<OperationStackInput, | ||
OperationStackOutput: HttpResponseBinding, | ||
OperationStackError: HttpResponseErrorBinding>: ClientRuntime.Middleware { | ||
public let id: Swift.String = "IdempotencyTokenMiddleware" | ||
private let keyPath: WritableKeyPath<OperationStackInput, String?> | ||
|
||
public init(keyPath: WritableKeyPath<OperationStackInput, String?>) { | ||
self.keyPath = keyPath | ||
} | ||
|
||
public func handle<H>(context: Context, | ||
input: MInput, | ||
next: H) async throws -> MOutput | ||
where H: Handler, Self.MInput == H.Input, Self.MOutput == H.Output, Self.Context == H.Context { | ||
var copiedInput = input | ||
if input[keyPath: keyPath] == nil { | ||
let idempotencyTokenGenerator = context.getIdempotencyTokenGenerator() | ||
copiedInput[keyPath: keyPath] = idempotencyTokenGenerator.generateToken() | ||
} | ||
return try await next.handle(context: context, input: copiedInput) | ||
} | ||
|
||
public typealias MInput = OperationStackInput | ||
public typealias MOutput = OperationOutput<OperationStackOutput> | ||
public typealias Context = HttpContext | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.