Skip to content

Commit 91ca23c

Browse files
authored
Merge branch 'main' into jbe/smithy_1_59_0
2 parents 61c8fd6 + 34fe2eb commit 91ca23c

File tree

38 files changed

+2192
-126
lines changed

38 files changed

+2192
-126
lines changed

.swiftlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ included:
44
- Sources/Core/AWSSDKCommon/Sources
55
- Sources/Core/AWSSDKEventStreamsAuth/Sources
66
- Sources/Core/AWSSDKHTTPAuth/Sources
7-
- Sources/Core/AWSSDKIdentity/Sources
7+
- Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity
88

99
analyzer_rules:
1010
- unused_import

AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/PrepareRelease.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ struct PrepareRelease {
209209
"Sources/Services",
210210
"Sources/Core/AWSSDKForSwift/Documentation.docc/AWSSDKForSwift.md",
211211
"Sources/Core/AWSSDKPartitions/Sources/AWSSDKPartitions/Partitions.swift",
212+
"Sources/Core/AWSSDKIdentity/",
212213
]
213214
case .smithySwift:
214215
files = ["Package.version", "Package.version.next"]

AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.txt

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,37 @@ private var runtimeTargets: [Target] {
129129
),
130130
.target(
131131
name: "AWSSDKHTTPAuth",
132-
dependencies: [.crt, .smithy, .clientRuntime, .smithyHTTPAuth, "AWSSDKIdentity", "AWSSDKChecksums"],
132+
dependencies: [.crt, .smithy, .clientRuntime, .smithyHTTPAuth, "AWSSDKChecksums"],
133133
path: "Sources/Core/AWSSDKHTTPAuth/Sources"
134134
),
135135
.target(
136136
name: "AWSSDKIdentity",
137137
dependencies: [.crt, .smithy, .clientRuntime, .smithyIdentity, .smithyIdentityAPI, .smithyHTTPAPI, .awsSDKCommon],
138-
path: "Sources/Core/AWSSDKIdentity/Sources"
138+
path: "Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity"
139+
),
140+
.target(
141+
name: "InternalAWSSTS",
142+
dependencies: [
143+
.clientRuntime,
144+
.awsClientRuntime,
145+
.smithyRetriesAPI,
146+
.smithyRetries,
147+
.smithy,
148+
.smithyIdentity,
149+
.smithyIdentityAPI,
150+
.smithyEventStreamsAPI,
151+
.smithyEventStreamsAuthAPI,
152+
.smithyEventStreams,
153+
.smithyChecksumsAPI,
154+
.smithyChecksums,
155+
.smithyWaitersAPI,
156+
.awsSDKCommon,
157+
.awsSDKIdentity,
158+
.awsSDKHTTPAuth,
159+
.awsSDKEventStreamsAuth,
160+
.awsSDKChecksums,
161+
],
162+
path: "Sources/Core/AWSSDKIdentity/Sources/InternalAWSSTS"
139163
),
140164
.target(
141165
name: "AWSSDKChecksums",
@@ -160,7 +184,7 @@ private var runtimeTestTargets: [Target] {
160184
),
161185
.testTarget(
162186
name: "AWSSDKEventStreamsAuthTests",
163-
dependencies: ["AWSClientRuntime", "AWSSDKEventStreamsAuth", .smithyStreams, .smithyTestUtils],
187+
dependencies: ["AWSClientRuntime", "AWSSDKEventStreamsAuth", "AWSSDKIdentity", .smithyStreams, .smithyTestUtils],
164188
path: "Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests"
165189
),
166190
.testTarget(
@@ -199,6 +223,7 @@ private func target(_ service: String) -> Target {
199223
.awsSDKHTTPAuth,
200224
.awsSDKEventStreamsAuth,
201225
.awsSDKChecksums,
226+
"InternalAWSSTS",
202227
],
203228
path: "Sources/Services/\(service)/Sources/\(service)"
204229
)

AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/PrepareReleaseTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class PrepareReleaseTests: CLITestCase {
184184
ProcessRunner.testRunner = runner
185185
let subject = PrepareRelease.mock(repoType: .awsSdkSwift)
186186
try! subject.stageFiles()
187-
XCTAssertTrue(command.hasSuffix("git add Package.swift Package.version Package.version.next packageDependencies.plist Sources/Services Sources/Core/AWSSDKForSwift/Documentation.docc/AWSSDKForSwift.md Sources/Core/AWSSDKPartitions/Sources/AWSSDKPartitions/Partitions.swift"))
187+
XCTAssertTrue(command.hasSuffix("git add Package.swift Package.version Package.version.next packageDependencies.plist Sources/Services Sources/Core/AWSSDKForSwift/Documentation.docc/AWSSDKForSwift.md Sources/Core/AWSSDKPartitions/Sources/AWSSDKPartitions/Partitions.swift Sources/Core/AWSSDKIdentity/"))
188188
}
189189

190190
func testStageFilesForSmithySwift() {

IntegrationTests/Services/AWSSTSIntegrationTests/STSAssumeRoleAWSCredentialIdentityResolverTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class STSAssumeRoleAWSCredentialIdentityResolverTests: XCTestCase {
9797
))
9898

9999
// Construct STS client wih assume-role credentials provider.
100-
let underlyingResolver = try DefaultAWSCredentialIdentityResolverChain()
100+
let underlyingResolver = DefaultAWSCredentialIdentityResolverChain()
101101
let assumeRoleAWSCredentialIdentityResolver = try STSAssumeRoleAWSCredentialIdentityResolver(
102102
awsCredentialIdentityResolver: underlyingResolver,
103103
roleArn: roleArn,

IntegrationTests/Services/AWSSTSIntegrationTests/STSWebIdentityAWSCredentialIdentityResolverTests.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ class STSWebIdentityAWSCredentialIdentityResolverTests: XCTestCase {
115115
// Delete token file
116116
try? deleteTokenFile()
117117

118+
// Unset env variables set for the test.
119+
unsetenv("AWS_REGION")
120+
unsetenv("AWS_ROLE_ARN")
121+
unsetenv("AWS_ROLE_SESSION_NAME")
122+
unsetenv("AWS_WEB_IDENTITY_TOKEN_FILE")
123+
118124
try await super.tearDown()
119125
}
120126

@@ -196,12 +202,11 @@ class STSWebIdentityAWSCredentialIdentityResolverTests: XCTestCase {
196202
}
197203

198204
private func constructSTSConfigWithWebIdentityAWSCredentialIdentityResolver() async throws {
199-
let webIdentityAWSCredentialIdentityResolver = try STSWebIdentityAWSCredentialIdentityResolver(
200-
region: region,
201-
roleArn: roleArn,
202-
roleSessionName: roleSessionName,
203-
tokenFilePath: oidcTokenFilePath
204-
)
205+
setenv("AWS_REGION", region, 1)
206+
setenv("AWS_ROLE_ARN", roleArn, 1)
207+
setenv("AWS_ROLE_SESSION_NAME", roleSessionName, 1)
208+
setenv("AWS_WEB_IDENTITY_TOKEN_FILE", oidcTokenFilePath, 1)
209+
let webIdentityAWSCredentialIdentityResolver = try STSWebIdentityAWSCredentialIdentityResolver(source: .env)
205210
stsConfig = try await STSClient.STSClientConfiguration(
206211
awsCredentialIdentityResolver: webIdentityAWSCredentialIdentityResolver,
207212
region: region

Package.swift

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,13 +561,37 @@ private var runtimeTargets: [Target] {
561561
),
562562
.target(
563563
name: "AWSSDKHTTPAuth",
564-
dependencies: [.crt, .smithy, .clientRuntime, .smithyHTTPAuth, "AWSSDKIdentity", "AWSSDKChecksums"],
564+
dependencies: [.crt, .smithy, .clientRuntime, .smithyHTTPAuth, "AWSSDKChecksums"],
565565
path: "Sources/Core/AWSSDKHTTPAuth/Sources"
566566
),
567567
.target(
568568
name: "AWSSDKIdentity",
569569
dependencies: [.crt, .smithy, .clientRuntime, .smithyIdentity, .smithyIdentityAPI, .smithyHTTPAPI, .awsSDKCommon],
570-
path: "Sources/Core/AWSSDKIdentity/Sources"
570+
path: "Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity"
571+
),
572+
.target(
573+
name: "InternalAWSSTS",
574+
dependencies: [
575+
.clientRuntime,
576+
.awsClientRuntime,
577+
.smithyRetriesAPI,
578+
.smithyRetries,
579+
.smithy,
580+
.smithyIdentity,
581+
.smithyIdentityAPI,
582+
.smithyEventStreamsAPI,
583+
.smithyEventStreamsAuthAPI,
584+
.smithyEventStreams,
585+
.smithyChecksumsAPI,
586+
.smithyChecksums,
587+
.smithyWaitersAPI,
588+
.awsSDKCommon,
589+
.awsSDKIdentity,
590+
.awsSDKHTTPAuth,
591+
.awsSDKEventStreamsAuth,
592+
.awsSDKChecksums,
593+
],
594+
path: "Sources/Core/AWSSDKIdentity/Sources/InternalAWSSTS"
571595
),
572596
.target(
573597
name: "AWSSDKChecksums",
@@ -592,7 +616,7 @@ private var runtimeTestTargets: [Target] {
592616
),
593617
.testTarget(
594618
name: "AWSSDKEventStreamsAuthTests",
595-
dependencies: ["AWSClientRuntime", "AWSSDKEventStreamsAuth", .smithyStreams, .smithyTestUtils],
619+
dependencies: ["AWSClientRuntime", "AWSSDKEventStreamsAuth", "AWSSDKIdentity", .smithyStreams, .smithyTestUtils],
596620
path: "Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests"
597621
),
598622
.testTarget(
@@ -631,6 +655,7 @@ private func target(_ service: String) -> Target {
631655
.awsSDKHTTPAuth,
632656
.awsSDKEventStreamsAuth,
633657
.awsSDKChecksums,
658+
"InternalAWSSTS",
634659
],
635660
path: "Sources/Services/\(service)/Sources/\(service)"
636661
)

Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Config/FieldResolverTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import Foundation
99
import XCTest
10-
@testable @_spi(FileBasedConfig) import AWSClientRuntime
1110
@testable @_spi(FileBasedConfig) import AWSSDKCommon
1211

1312
class FieldResolverTests: XCTestCase {
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
//
77

88
import class Foundation.ProcessInfo
9-
@_spi(FileBasedConfig) import AWSSDKCommon
109

1110
/// Resolves a configuration field for an AWS SDK feature.
12-
struct FieldResolver<T> {
11+
public struct FieldResolver<T> {
1312
let configValue: T?
1413
let envVarName: String?
1514
let configFieldName: String?
1615
let fileBasedConfig: FileBasedConfiguration
1716
let profileName: String?
1817
let converter: (String) -> T?
1918

20-
init(configValue: T?,
21-
envVarName: String?,
22-
configFieldName: String?,
23-
fileBasedConfig: FileBasedConfiguration,
24-
profileName: String?,
25-
converter: @escaping (String) -> T?
19+
@_spi(FileBasedConfig) public init(
20+
configValue: T? = nil,
21+
envVarName: String? = nil,
22+
configFieldName: String? = nil,
23+
fileBasedConfig: FileBasedConfiguration,
24+
profileName: String? = nil,
25+
converter: @escaping (String) -> T?
2626
) {
2727
self.configValue = configValue
2828
self.envVarName = envVarName
@@ -39,7 +39,7 @@ struct FieldResolver<T> {
3939
/// - If an environment var named `envVarName` is set, its value is used to create a value.
4040
/// - If a config field is set in the config file for the current profile, its value is used to create a value.
4141
/// - Finally, if none of the above yield a value, `nil` is returned.
42-
var value: T? {
42+
public var value: T? {
4343
let env = ProcessInfo.processInfo.environment
4444
if let value = configValue {
4545
return value

Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests/SigV4SigningTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import AwsCommonRuntimeKit
1616
@_spi(SmithyTimestamps) import SmithyTimestamps
1717
import SmithyEventStreams
1818
import SmithyEventStreamsAPI
19-
import AWSSDKIdentity
2019
import AWSSDKHTTPAuth
2120

2221
class Sigv4SigningTests: XCTestCase {

0 commit comments

Comments
 (0)