-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Modularize event streams & event streams auth #741
Changes from 22 commits
f3a5979
43724ef
e802518
1ceb2af
1d76efb
2186d53
c28efb4
faa8961
35772ab
5ab04b4
79c4d37
f0a8aa3
2a9dc54
6ac0242
623e2a3
3f74ad2
e15f2b8
4fbb5fa
6088055
d54e356
7c9e8d6
a4ac939
e0a5dc3
039fb4b
bb2e6cb
75d973b
c3d4eba
c86e96a
cd615c3
6e347fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,30 +28,51 @@ let package = Package( | |
.watchOS(.v6) | ||
], | ||
products: [ | ||
.library(name: "Smithy", targets: ["Smithy"]), | ||
.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: "SmithyJSON", targets: ["SmithyJSON"]), | ||
.library(name: "SmithyFormURL", targets: ["SmithyFormURL"]), | ||
.library(name: "SmithyIdentityAPI", targets: ["SmithyIdentityAPI"]), | ||
.library(name: "SmithyHTTPAPI", targets: ["SmithyHTTPAPI"]), | ||
.library(name: "SmithyHTTPAuthAPI", targets: ["SmithyHTTPAuthAPI"]), | ||
.library(name: "SmithyEventStreamsAPI", targets: ["SmithyEventStreamsAPI"]), | ||
.library(name: "SmithyEventStreamsAuthAPI", targets: ["SmithyEventStreamsAuthAPI"]), | ||
.library(name: "SmithyEventStreams", targets: ["SmithyEventStreams"]), | ||
.library(name: "SmithyChecksumsAPI", targets: ["SmithyChecksumsAPI"]), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Several new modules added for Smithy modularization. |
||
.library(name: "SmithyTestUtil", targets: ["SmithyTestUtil"]), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/awslabs/aws-crt-swift.git", exact: "0.30.0"), | ||
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), | ||
], | ||
targets: [ | ||
.target( | ||
name: "Smithy", | ||
dependencies: [ | ||
.product(name: "Logging", package: "swift-log"), | ||
] | ||
), | ||
.target( | ||
name: "ClientRuntime", | ||
dependencies: [ | ||
"Smithy", | ||
"SmithyRetriesAPI", | ||
"SmithyRetries", | ||
"SmithyXML", | ||
"SmithyJSON", | ||
"SmithyFormURL", | ||
"SmithyIdentityAPI", | ||
"SmithyHTTPAPI", | ||
"SmithyHTTPAuthAPI", | ||
"SmithyEventStreamsAPI", | ||
"SmithyEventStreams", | ||
"SmithyEventStreamsAuthAPI", | ||
"SmithyChecksumsAPI", | ||
.product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), | ||
.product(name: "Logging", package: "swift-log"), | ||
], | ||
resources: [ | ||
.copy("PrivacyInfo.xcprivacy") | ||
|
@@ -72,9 +93,7 @@ let package = Package( | |
), | ||
.target( | ||
name: "SmithyReadWrite", | ||
dependencies: [ | ||
"SmithyTimestamps" | ||
] | ||
dependencies: ["SmithyTimestamps"] | ||
), | ||
.target( | ||
name: "SmithyXML", | ||
|
@@ -106,6 +125,39 @@ let package = Package( | |
name: "SmithyTestUtil", | ||
dependencies: ["ClientRuntime"] | ||
), | ||
.target( | ||
name: "SmithyIdentityAPI", | ||
dependencies: ["Smithy"] | ||
), | ||
.target( | ||
name: "SmithyHTTPAPI", | ||
dependencies: ["Smithy"] | ||
), | ||
.target( | ||
name: "SmithyHTTPAuthAPI", | ||
dependencies: ["Smithy", "SmithyHTTPAPI"] | ||
), | ||
.target( | ||
name: "SmithyEventStreamsAPI", | ||
dependencies: ["Smithy"] | ||
), | ||
.target( | ||
name: "SmithyEventStreamsAuthAPI", | ||
dependencies: ["Smithy", "SmithyEventStreamsAPI"] | ||
), | ||
.target( | ||
name: "SmithyEventStreams", | ||
dependencies: [ | ||
"Smithy", | ||
"SmithyEventStreamsAPI", | ||
"SmithyEventStreamsAuthAPI", | ||
.product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift") | ||
] | ||
), | ||
.target( | ||
name: "SmithyChecksumsAPI", | ||
dependencies: ["Smithy"] | ||
), | ||
.testTarget( | ||
name: "ClientRuntimeTests", | ||
dependencies: ["ClientRuntime", "SmithyTestUtil"], | ||
|
@@ -131,6 +183,10 @@ let package = Package( | |
name: "SmithyTestUtilTests", | ||
dependencies: ["SmithyTestUtil"] | ||
), | ||
.testTarget( | ||
name: "SmithyEventStreamsTests", | ||
dependencies: ["SmithyEventStreams"] | ||
), | ||
].compactMap { $0 } | ||
) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,19 @@ | |
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import struct Smithy.Attributes | ||
import struct Smithy.AttributeKey | ||
import protocol SmithyIdentityAPI.IdentityResolver | ||
import protocol SmithyIdentityAPI.IdentityResolverConfiguration | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many files contain superficial changes like this, that are related to modularizing the project:
I won't comment on these types of changes, since they happen frequently in this PR. |
||
public struct DefaultIdentityResolverConfiguration: IdentityResolverConfiguration { | ||
let identityResolvers: Attributes | ||
|
||
public init(configuredIdResolvers: Attributes) { | ||
self.identityResolvers = configuredIdResolvers | ||
} | ||
|
||
func getIdentityResolver(schemeID: String) throws -> (any IdentityResolver)? { | ||
public func getIdentityResolver(schemeID: String) throws -> (any IdentityResolver)? { | ||
return self.identityResolvers.get(key: AttributeKey<any IdentityResolver>(name: schemeID)) | ||
} | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// Copyright Amazon.com Inc. or its affiliates. | ||
// All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import struct Smithy.AttributeKey | ||
import class Smithy.Context | ||
import class Smithy.ContextBuilder | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idempotency-related accessors that were broken out from the old |
||
|
||
extension Context { | ||
|
||
public func getIdempotencyTokenGenerator() -> IdempotencyTokenGenerator { | ||
return attributes.get(key: idempotencyTokenGeneratorKey)! | ||
} | ||
} | ||
|
||
extension ContextBuilder { | ||
|
||
@discardableResult | ||
public func withIdempotencyTokenGenerator(value: IdempotencyTokenGenerator) -> Self { | ||
self.attributes.set(key: idempotencyTokenGeneratorKey, value: value) | ||
return self | ||
} | ||
} | ||
|
||
private let idempotencyTokenGeneratorKey = AttributeKey<IdempotencyTokenGenerator>(name: "IdempotencyTokenGeneratorKey") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Copyright Amazon.com Inc. or its affiliates. | ||
// All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import protocol Smithy.HasAttributes | ||
import protocol Smithy.LogAgent | ||
import struct Smithy.AttributeKey | ||
|
||
extension HasAttributes { | ||
|
||
var logger: LogAgent? { | ||
get { get(key: loggerKey) } | ||
set { set(key: loggerKey, value: newValue) } | ||
} | ||
} | ||
|
||
private let loggerKey = AttributeKey<LogAgent>(name: "loggerKey") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It might be better to name this something like
SmithyCommon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not currently sure about this module's name and exact scope... this is intended to be things that Smithy uses across all modules.
I might break it down further though to have such modules for clients and for models, since it seems some smithy-swift customers use them separately.
I'd like to leave it for now, and we can revisit it later in modularization.