diff --git a/.gitignore b/.gitignore index 204db90d638..e1f7d79c4e2 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,7 @@ codegen/protocol-test-codegen/smithy-build.json # VS Code config files .vscode/ + +# Allow the AWSSDKSwiftCLI Package.resolved +# while excluding all other Package.resolved files +!/AWSSDKSwiftCLI/Package.resolved diff --git a/.swiftlint.yml b/.swiftlint.yml index 16596878fa2..987cb705e38 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,5 +1,10 @@ included: - - Sources/Core + - Sources/Core/AWSClientRuntime/Sources + - Sources/Core/AWSSDKChecksums/Sources + - Sources/Core/AWSSDKCommon/Sources + - Sources/Core/AWSSDKEventStreamsAuth/Sources + - Sources/Core/AWSSDKHTTPAuth/Sources + - Sources/Core/AWSSDKIdentity/Sources analyzer_rules: - unused_import diff --git a/AWSSDKSwiftCLI/Package.resolved b/AWSSDKSwiftCLI/Package.resolved new file mode 100644 index 00000000000..5f97649aaa5 --- /dev/null +++ b/AWSSDKSwiftCLI/Package.resolved @@ -0,0 +1,95 @@ +{ + "pins" : [ + { + "identity" : "aws-crt-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/awslabs/aws-crt-swift", + "state" : { + "revision" : "b6380f683b31072d77b601c88674461c11bcad5a", + "version" : "0.30.0" + } + }, + { + "identity" : "aws-sdk-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/awslabs/aws-sdk-swift", + "state" : { + "revision" : "3c20e0be8c8246de8b8e04372404ef1f90be71b6", + "version" : "0.46.0" + } + }, + { + "identity" : "smithy-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/smithy-lang/smithy-swift", + "state" : { + "revision" : "b2322a067f85c230f17c80be8a67dd543454b081", + "version" : "0.51.0" + } + }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms", + "state" : { + "revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42", + "version" : "1.2.0" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser", + "state" : { + "revision" : "46989693916f56d1186bd59ac15124caef896560", + "version" : "1.3.1" + } + }, + { + "identity" : "swift-llbuild", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-llbuild.git", + "state" : { + "revision" : "fb7ebf0b06c0d7c45ca8e18b3371424503a38b5c", + "version" : "0.3.0" + } + }, + { + "identity" : "swift-log", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-log.git", + "state" : { + "revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5", + "version" : "1.5.4" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "0a5bc04095a675662cf24757cc0640aa2204253b", + "version" : "1.0.2" + } + }, + { + "identity" : "swift-package-manager", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-package-manager", + "state" : { + "revision" : "f5ea3972d7d6c574e8bb16a19b2a7bca98ea131b", + "version" : "0.6.0" + } + }, + { + "identity" : "swift-tools-support-core", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-tools-support-core.git", + "state" : { + "revision" : "98a5916a811fcaaed770f1ed812e9405be762945", + "version" : "0.1.0" + } + } + ], + "version" : 2 +} diff --git a/AWSSDKSwiftCLI/Package.swift b/AWSSDKSwiftCLI/Package.swift index 401e2cf5b2c..aac80645a88 100644 --- a/AWSSDKSwiftCLI/Package.swift +++ b/AWSSDKSwiftCLI/Package.swift @@ -5,28 +5,61 @@ import PackageDescription let package = Package( name: "AWSSDKSwiftCLI", platforms: [ - .macOS(.v10_15) + .macOS(.v13) ], dependencies: [ .package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.0"), .package(url: "https://github.com/apple/swift-package-manager", from: "0.6.0"), .package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0"), .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), + .package(url: "https://github.com/awslabs/aws-sdk-swift", from: "0.46.0"), ], targets: [ .executableTarget( name: "AWSSDKSwiftCLI", dependencies: [ + "AWSCLIUtils", .product(name: "ArgumentParser", package: "swift-argument-parser"), - .product(name: "PackageDescription", package: "swift-package-manager"), .product(name: "Algorithms", package: "swift-algorithms"), - .product(name: "Logging", package: "swift-log"), ], resources: [ .process("Resources/Package.Base.swift"), .process("Resources/DocIndex.Base.md") ] ), + .executableTarget( + name: "spr-publish", + dependencies: [ + "SPR", + "AWSCLIUtils", + .product(name: "ArgumentParser", package: "swift-argument-parser"), + ] + ), + .executableTarget( + name: "spr-multi-publish", + dependencies: [ + "SPR", + "AWSCLIUtils", + "spr-publish", + ] + ), + .target( + name: "SPR", + dependencies: [ + "AWSCLIUtils", + .product(name: "ArgumentParser", package: "swift-argument-parser"), + .product(name: "AWSS3", package: "aws-sdk-swift"), + .product(name: "AWSCloudFront", package: "aws-sdk-swift"), + ] + ), + .target( + name: "AWSCLIUtils", + dependencies: [ + .product(name: "ArgumentParser", package: "swift-argument-parser"), + .product(name: "Logging", package: "swift-log"), + .product(name: "PackageDescription", package: "swift-package-manager"), + ] + ), .testTarget( name: "AWSSDKSwiftCLITests", dependencies: ["AWSSDKSwiftCLI"] diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/Error.swift b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Error.swift similarity index 52% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/Error.swift rename to AWSSDKSwiftCLI/Sources/AWSCLIUtils/Error.swift index 55cd245a140..0512b780dae 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/Error.swift +++ b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Error.swift @@ -7,11 +7,11 @@ import Foundation -struct Error: LocalizedError { - var message: String - var errorDescription: String? { message } - - init(_ message: String) { +public struct Error: LocalizedError { + public var message: String + public var errorDescription: String? { message } + + public init(_ message: String) { self.message = message } } diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/FileManager+Utils.swift b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/FileManager+Utils.swift similarity index 98% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/FileManager+Utils.swift rename to AWSSDKSwiftCLI/Sources/AWSCLIUtils/FileManager+Utils.swift index c5599bf51a0..b55e800854e 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/FileManager+Utils.swift +++ b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/FileManager+Utils.swift @@ -7,7 +7,7 @@ import Foundation -extension FileManager { +public extension FileManager { /// Changes the working directory to the provided path func changeWorkingDirectory(_ path: String) throws { log("Changing working directory to: \(path)") diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/Logger.swift b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Logger.swift similarity index 87% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/Logger.swift rename to AWSSDKSwiftCLI/Sources/AWSCLIUtils/Logger.swift index a011762888f..4e06afebc60 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/Logger.swift +++ b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Logger.swift @@ -10,7 +10,11 @@ import Logging struct Logger { static let standard = Logging.Logger( label: "com.aws.sdk.swift.cli", - factory: { StreamLogHandler.standardOutput(label: $0) } + factory: { + var logger = StreamLogHandler.standardOutput(label: $0) + logger.logLevel = .info + return logger + } ) } diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Process+Git.swift b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Process+Git.swift similarity index 91% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Process+Git.swift rename to AWSSDKSwiftCLI/Sources/AWSCLIUtils/Process+Git.swift index cd51df61459..a8aaa603fae 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Process+Git.swift +++ b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Process+Git.swift @@ -9,7 +9,7 @@ import Foundation import PackageDescription import struct ArgumentParser.ExitCode -extension Process { +public extension Process { /// A struct to create processes for executing git commands. struct Git { /// Returns a process for executing git commands. @@ -18,31 +18,31 @@ extension Process { } /// Returns a process for executing `git status` - func status() -> Process { + public func status() -> Process { gitProcess(["status"]) } /// Returns a process for executing `git diff .. --quiet` /// This is used for determining if `` is different from `` and therefore - func diff(_ a: String, _ b: String) -> Process { + public func diff(_ a: String, _ b: String) -> Process { gitProcess(["diff", "\(a)..\(b)", "--quiet"]) } /// Returns a process for executing `git add ` /// This is used for staging specific files. - func add(_ files: [String]) -> Process { + public func add(_ files: [String]) -> Process { gitProcess(["add"] + files) } /// Returns a process for executing `git commit -m ` /// This is used for committing changes with the provided message - func commit(_ message: String) -> Process { + public func commit(_ message: String) -> Process { gitProcess(["commit", "-m", message]) } /// Returns a process for executing `git tag -a -m ` /// This is used for creating a tag with the provided version and message. - func tag(_ version: Version, _ message: String) -> Process { + public func tag(_ version: Version, _ message: String) -> Process { gitProcess(["tag", "-a", "\(version)", "-m", message]) } @@ -69,7 +69,7 @@ extension Process { static var git: Git { Git() } } -extension Process.Git { +public extension Process.Git { /// Returns true if the provided commits/branches/trees are different, otherwise returns false func diffHasChanges(_ a: String, _ b: String) throws -> Bool { let task = diff(a, b) diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Process+Swift.swift b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Process+Swift.swift similarity index 88% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Process+Swift.swift rename to AWSSDKSwiftCLI/Sources/AWSCLIUtils/Process+Swift.swift index b8b96cf9465..6d452578c40 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Process+Swift.swift +++ b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Process+Swift.swift @@ -8,7 +8,7 @@ import Foundation import PackageDescription -extension Process { +public extension Process { struct Swift { /// Returns a process for executing swift commands. private func swiftProcess(_ args: [String]) -> Process { @@ -16,7 +16,7 @@ extension Process { } /// Returns a process for executing `swift test` - func test() -> Process { + public func test() -> Process { swiftProcess(["test"]) } } diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Process+Utils.swift b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Process+Utils.swift similarity index 77% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Process+Utils.swift rename to AWSSDKSwiftCLI/Sources/AWSCLIUtils/Process+Utils.swift index 4f66da0d358..25a76634b58 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Process+Utils.swift +++ b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Process+Utils.swift @@ -8,7 +8,7 @@ import Foundation import ArgumentParser -extension Process { +public extension Process { /// Creates a process using `/usr/bin/env` as the executable /// This makes it easy to create a process for any command, as long as the corresponding executable exists in the PATH. /// @@ -29,14 +29,14 @@ extension Process { /// Returns the executable and arguments combined as a string var commandString: String { - let items = [executableURL?.path] + (arguments ?? []) + let items = [urlPath(executableURL)] + (arguments ?? []) return items .compactMap { $0 } .joined(separator: " ") } } -func _run(_ process: Process) throws { +public func _run(_ process: Process) throws { // If debug and we have a non-nil test runner, then use that // This allows developers to intercept processes when they run to assert that it is the expected process #if DEBUG @@ -48,30 +48,31 @@ func _run(_ process: Process) throws { try ProcessRunner.standard.run(process) } -func _runReturningStdOut(_ process: Process) throws -> String? { +public func _runReturningStdOut(_ process: Process) throws -> String? { let stdOut = Pipe() process.standardOutput = stdOut - var data = Data() - stdOut.fileHandleForReading.readabilityHandler = { handle in - data += handle.availableData - } - try _run(process) process.waitUntilExit() + let data = try stdOut.fileHandleForReading.readToEnd() ?? Data() return String(data: data, encoding: .utf8) } /// A simple struct that runs a process -struct ProcessRunner { - let run: (Process) throws -> Void +public struct ProcessRunner { + + public init(_ run: @escaping (Process) throws -> Void) { + self.run = run + } + + public let run: (Process) throws -> Void /// Creates the standard runner to be used by the release version of this CLI /// /// Runs the process and prints out the process's full command. - static let standard = ProcessRunner { process in - log("Running process: \(process.commandString)") + public static let standard = ProcessRunner { process in + log(level: .debug, "Running process: \(process.commandString)") try process.run() process.waitUntilExit() let exitCode = ExitCode(process.terminationStatus) @@ -82,6 +83,6 @@ struct ProcessRunner { #if DEBUG // Set this to a non-nil value in tests to intercept when a process is run - static var testRunner: ProcessRunner? = nil + public static var testRunner: ProcessRunner? = nil #endif } diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/String+Utils.swift b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/String+Utils.swift similarity index 78% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/String+Utils.swift rename to AWSSDKSwiftCLI/Sources/AWSCLIUtils/String+Utils.swift index 19dae1c6f15..409ab988dc0 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/String+Utils.swift +++ b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/String+Utils.swift @@ -7,7 +7,7 @@ import Foundation -extension String { +public extension String { /// Returns the receiver wrapped in the provided string /// /// ```swift @@ -37,3 +37,9 @@ extension String { /// Returns the string that represents a newline static var newline: Self { "\n" } } + +public func printError(_ items: Any..., separator: String = " ", terminator: String = "\n") throws { + var s = "" + print(items, separator: separator, terminator: terminator, to: &s) + try FileHandle.standardError.write(contentsOf: Data(s.utf8)) +} diff --git a/AWSSDKSwiftCLI/Sources/AWSCLIUtils/URL+Path.swift b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/URL+Path.swift new file mode 100644 index 00000000000..a3803cfac48 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/URL+Path.swift @@ -0,0 +1,22 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation + +@_disfavoredOverload +public func urlPath(_ url: URL?) -> String? { + guard let url else { return nil } + return urlPath(url) +} + +public func urlPath(_ url: URL) -> String { + #if os(Linux) + return url.path + #else + return url.path() + #endif +} diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Version+Utils.swift b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Version+Utils.swift similarity index 98% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Version+Utils.swift rename to AWSSDKSwiftCLI/Sources/AWSCLIUtils/Version+Utils.swift index e931990ea99..c82099e650e 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Utils/Version+Utils.swift +++ b/AWSSDKSwiftCLI/Sources/AWSCLIUtils/Version+Utils.swift @@ -21,7 +21,7 @@ extension Version: Decodable { // MARK: - Loading from File -extension Version { +public extension Version { /// Returns a version loaded from the provided file. /// The file's contents must only contain the version and nothing else. /// This is used to load a Version from a `Package.version` file. @@ -47,7 +47,7 @@ extension Version { // MARK: - Incrementing versions -extension Version { +public extension Version { /// Returns a new version by incrementing the major version of the receiver /// /// - Returns: A new version by incrementing the major version of the receiver diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/AWSSDKSwiftCLI.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/AWSSDKSwiftCLI.swift similarity index 100% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/AWSSDKSwiftCLI.swift rename to AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/AWSSDKSwiftCLI.swift diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GenerateDocIndex.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/GenerateDocIndex.swift similarity index 99% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GenerateDocIndex.swift rename to AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/GenerateDocIndex.swift index 1f4509dc2da..ff1cdab4c61 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GenerateDocIndex.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/GenerateDocIndex.swift @@ -7,6 +7,7 @@ import ArgumentParser import Foundation +import AWSCLIUtils // MARK: - Command diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GeneratePackageManifest.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/GeneratePackageManifest.swift similarity index 99% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GeneratePackageManifest.swift rename to AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/GeneratePackageManifest.swift index 5e9ff625517..e25e1f812d6 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GeneratePackageManifest.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/GeneratePackageManifest.swift @@ -8,6 +8,7 @@ import ArgumentParser import Foundation import PackageDescription +import AWSCLIUtils // MARK: - Command diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/PrepareRelease.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/PrepareRelease.swift similarity index 99% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/PrepareRelease.swift rename to AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/PrepareRelease.swift index 04e2a47b693..2aee189d19e 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/PrepareRelease.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/PrepareRelease.swift @@ -8,6 +8,7 @@ import ArgumentParser import Foundation import PackageDescription +import AWSCLIUtils // MARK: - Command diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/SyncClientRuntimeVersion.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/SyncClientRuntimeVersion.swift similarity index 99% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/SyncClientRuntimeVersion.swift rename to AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/SyncClientRuntimeVersion.swift index 0dc3211cbc5..2d08594d12d 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/SyncClientRuntimeVersion.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/SyncClientRuntimeVersion.swift @@ -8,6 +8,7 @@ import ArgumentParser import Foundation import PackageDescription +import AWSCLIUtils // MARK: - Command diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/TestAWSSDK.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/TestAWSSDK.swift similarity index 99% rename from AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/TestAWSSDK.swift rename to AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/TestAWSSDK.swift index 49563838fa7..efa47b3d1b2 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/TestAWSSDK.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/TestAWSSDK.swift @@ -9,6 +9,7 @@ import Algorithms import ArgumentParser import Foundation import PackageDescription +import AWSCLIUtils // MARK: - Command diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/DocIndexBuilder.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/DocIndexBuilder.swift index e678ae31797..c70d560fdc4 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/DocIndexBuilder.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/DocIndexBuilder.swift @@ -7,6 +7,7 @@ import Foundation import PackageDescription +import AWSCLIUtils /// Builds the contents of the package manifest file. struct DocIndexBuilder { diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/LazyValue.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/LazyValue.swift index 59362e45d0a..95cd9e733f2 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/LazyValue.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/LazyValue.swift @@ -6,6 +6,7 @@ // import Foundation +import AWSCLIUtils /// A class that enables lazy loading a value. /// This is useful when you want to lazy load a value within a local scope. diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/PackageManifestBuilder.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/PackageManifestBuilder.swift index 7f015759c1f..dad382bdbbb 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/PackageManifestBuilder.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/PackageManifestBuilder.swift @@ -7,6 +7,7 @@ import Foundation import PackageDescription +import AWSCLIUtils /// Builds the contents of the package manifest file. struct PackageManifestBuilder { diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/ReleaseNotesBuilder.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/ReleaseNotesBuilder.swift index e35ab256e14..eaaca9be4b6 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/ReleaseNotesBuilder.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/ReleaseNotesBuilder.swift @@ -7,6 +7,7 @@ import Foundation import PackageDescription +import AWSCLIUtils // Builds the release notes struct ReleaseNotesBuilder { diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift index c81a58090e5..df346cdb2e1 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift @@ -83,56 +83,56 @@ let package = Package( .awsSDKHTTPAuth, .awsSDKIdentity ], - path: "./Sources/Core/AWSClientRuntime", + path: "Sources/Core/AWSClientRuntime/Sources", resources: [ - .copy("PrivacyInfo.xcprivacy") + .process("AWSClientRuntime/Resources") ] ), .target( name: "AWSSDKCommon", dependencies: [.crt], - path: "./Sources/Core/AWSSDKCommon" + path: "Sources/Core/AWSSDKCommon/Sources" ), .target( name: "AWSSDKEventStreamsAuth", dependencies: [.smithyEventStreamsAPI, .smithyEventStreamsAuthAPI, .smithyEventStreams, .crt, .clientRuntime, "AWSSDKHTTPAuth"], - path: "./Sources/Core/AWSSDKEventStreamsAuth" + path: "Sources/Core/AWSSDKEventStreamsAuth/Sources" ), .target( name: "AWSSDKHTTPAuth", dependencies: [.crt, .smithy, .clientRuntime, .smithyHTTPAuth, "AWSSDKIdentity", "AWSSDKChecksums"], - path: "./Sources/Core/AWSSDKHTTPAuth" + path: "Sources/Core/AWSSDKHTTPAuth/Sources" ), .target( name: "AWSSDKIdentity", dependencies: [.crt, .smithy, .clientRuntime, .smithyIdentity, .smithyIdentityAPI, .smithyHTTPAPI, .awsSDKCommon], - path: "./Sources/Core/AWSSDKIdentity" + path: "Sources/Core/AWSSDKIdentity/Sources" ), .target( name: "AWSSDKChecksums", dependencies: [.crt, .smithy, .clientRuntime, .smithyChecksumsAPI, .smithyChecksums, .smithyHTTPAPI], - path: "./Sources/Core/AWSSDKChecksums" + path: "Sources/Core/AWSSDKChecksums/Sources" ), .testTarget( name: "AWSClientRuntimeTests", dependencies: [.awsClientRuntime, .clientRuntime, .smithyTestUtils, .awsSDKCommon], - path: "./Tests/Core/AWSClientRuntimeTests", + path: "Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests", resources: [.process("Resources")] ), .testTarget( name: "AWSSDKEventStreamsAuthTests", dependencies: ["AWSClientRuntime", "AWSSDKEventStreamsAuth", .smithyStreams], - path: "./Tests/Core/AWSSDKEventStreamsAuthTests" + path: "Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests" ), .testTarget( name: "AWSSDKHTTPAuthTests", dependencies: ["AWSSDKHTTPAuth", "AWSClientRuntime", "AWSSDKEventStreamsAuth", .crt, .clientRuntime, .smithyTestUtils], - path: "./Tests/Core/AWSSDKHTTPAuthTests" + path: "Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests" ), .testTarget( name: "AWSSDKIdentityTests", dependencies: [.smithy, .smithyIdentity, "AWSSDKIdentity", .awsClientRuntime], - path: "./Tests/Core/AWSSDKIdentityTests", + path: "Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests", resources: [.process("Resources")] ) ] @@ -212,7 +212,8 @@ func addServiceTarget(_ name: String) { .target( name: name, dependencies: serviceTargetDependencies, - path: "./Sources/Services/\(name)/Sources/\(name)" + path: "Sources/Services/\(name)/Sources/\(name)", + resources: [.process("Resources")] ) ] } @@ -223,7 +224,7 @@ func addServiceUnitTestTarget(_ name: String) { .testTarget( name: "\(testName)", dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils], - path: "./Sources/Services/\(name)/Tests/\(testName)" + path: "Sources/Services/\(name)/Tests/\(testName)" ) ] } diff --git a/AWSSDKSwiftCLI/Sources/SPR/Invalidate.swift b/AWSSDKSwiftCLI/Sources/SPR/Invalidate.swift new file mode 100644 index 00000000000..6c3be477e3c --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/Invalidate.swift @@ -0,0 +1,25 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import AWSCLIUtils +import AWSCloudFront + +extension SPRPublisher { + + public static func invalidate(region: String, distributionID: String?, invalidations: [String]) async throws { + let cloudFrontClient = try CloudFrontClient(region: region) + let resolvedDistributionID = resolvedDistributionID(from: distributionID) + guard let resolvedDistributionID, !resolvedDistributionID.isEmpty else { + throw Error("CloudFront DistributionID not provided") + } + let invalidationPaths = invalidations.map { "/\($0)" } + let invalidationBatch = CloudFrontClientTypes.InvalidationBatch(callerReference: UUID().uuidString, paths: CloudFrontClientTypes.Paths(items: invalidationPaths, quantity: invalidationPaths.count)) + let input = CreateInvalidationInput(distributionId: distributionID, invalidationBatch: invalidationBatch) + _ = try await cloudFrontClient.createInvalidation(input: input) + } +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/Models/Describe/Describe.swift b/AWSSDKSwiftCLI/Sources/SPR/Models/Describe/Describe.swift new file mode 100644 index 00000000000..d8c440fe731 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/Models/Describe/Describe.swift @@ -0,0 +1,12 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation + +public struct Describe: Codable { + public let name: String +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/Models/Info/Metadata.swift b/AWSSDKSwiftCLI/Sources/SPR/Models/Info/Metadata.swift new file mode 100644 index 00000000000..547593d5691 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/Models/Info/Metadata.swift @@ -0,0 +1,36 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import struct Foundation.URL + +extension PackageInfo { + + public struct Metadata: Codable { + + public struct Author: Codable { + public let name: String + public let email: String? + public let description: String? + public let organization: Organization? + public let url: URL? + + public struct Organization: Codable { + public let name: String + public let email: String? + public let description: String? + public let url: URL? + } + } + + public let author: Author? + public let description: String? + public let licenseURL: URL? + public let originalPublicationTime: String? + public let readmeURL: URL? + public let repositoryURLs: [URL]? + } +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/Models/Info/PackageInfo.swift b/AWSSDKSwiftCLI/Sources/SPR/Models/Info/PackageInfo.swift new file mode 100644 index 00000000000..d1cac6ea8e9 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/Models/Info/PackageInfo.swift @@ -0,0 +1,14 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +public struct PackageInfo: Codable { + public let id: String + public let version: String + public let resources: [Resource] + public let metadata: Metadata + public let publishedAt: String? +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/Models/Info/Resource.swift b/AWSSDKSwiftCLI/Sources/SPR/Models/Info/Resource.swift new file mode 100644 index 00000000000..4cbbd09cfe5 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/Models/Info/Resource.swift @@ -0,0 +1,19 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +public struct Resource: Codable { + + public struct Signing: Codable { + public let signatureBase64Encoded: String + public let signatureFormat: String + } + + public let name: String + public let type: String + public let checksum: String + public let signing: Signing? +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/Models/List/ListPackageReleases.swift b/AWSSDKSwiftCLI/Sources/SPR/Models/List/ListPackageReleases.swift new file mode 100644 index 00000000000..75bf4f463ef --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/Models/List/ListPackageReleases.swift @@ -0,0 +1,27 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import struct Foundation.URL + +public struct ListPackageReleases: Codable { + + public struct Release: Codable { + + public struct Problem: Codable { + public let type: URL? + public let title: String? + public let status: Int? + public let detail: String? + public let instance: URL? + } + + public let url: URL? + public let problem: Problem? + } + + public var releases: [String: Release] +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/Process+SPR.swift b/AWSSDKSwiftCLI/Sources/SPR/Process+SPR.swift new file mode 100644 index 00000000000..513c162a3cc --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/Process+SPR.swift @@ -0,0 +1,36 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import PackageDescription +import AWSCLIUtils + +extension Process { + + enum SPR { + /// Returns a process for executing `swift describe --type json` in a relative path + static func describe(packagePath: String) -> Process { + let process = Process(["swift", "package", "describe", "--type", "json"]) + process.currentDirectoryURL = packageFileURL(packagePath: packagePath) + return process + } + + static func archive(name: String, packagePath: String, archiveFileURL: URL) -> Process { + let process = Process(["swift", "package", "archive-source", "--output", urlPath(archiveFileURL)]) + process.currentDirectoryURL = packageFileURL(packagePath: packagePath) + return process + } + + static func checksum(archiveFileURL: URL) -> Process { + Process(["shasum", "-b", "-a", "256", urlPath(archiveFileURL)]) + } + + private static func packageFileURL(packagePath: String) -> URL { + URL(fileURLWithPath: packagePath).standardizedFileURL + } + } +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/SPRPublisher.swift b/AWSSDKSwiftCLI/Sources/SPR/SPRPublisher.swift new file mode 100644 index 00000000000..681b0875b34 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/SPRPublisher.swift @@ -0,0 +1,81 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import ClientRuntime + +public struct SPRPublisher { + + public var scope: String + public var name: String + public var version: String + public var path: String + public var region: String = "" + public var bucket: String? + public var url: String + public var distributionID: String? + public var replace = false + + var checksum = "" + public var invalidations = [String]() + + public init( + scope: String, + name: String, + version: String, + path: String, + region: String, + bucket: String?, + url: String, + distributionID: String?, + replace: Bool + ) { + self.scope = scope + self.name = name + self.version = version + self.path = path + self.region = region + self.bucket = bucket + self.url = url + self.distributionID = distributionID + self.replace = replace + } + + public mutating func run() async throws { + await setOptions() + print(" Verifying package... ", terminator: "") + try verifyPackage() + print("[done]") + print(" Generating & uploading archive... ", terminator: "") + try await uploadArchive() + print("[done]") + print(" Uploading Package.swift... ", terminator: "") + try await uploadManifest() + print("[done]") + print(" Uploading package metadata... ", terminator: "") + try await uploadMetadata() + print("[done]") + print(" Updating package list... ", terminator: "") + try await updateList() + print("[done]") + } + + private mutating func setOptions() async { + await SDKLoggingSystem.initialize(logLevel: .error) + let env = ProcessInfo.processInfo.environment + bucket = bucket ?? env["AWS_SDK_SPR_BUCKET"] + if region.isEmpty { + region = env["AWS_SDK_SPR_REGION"] ?? "us-east-1" + } + distributionID = Self.resolvedDistributionID(from: distributionID) + } + + static func resolvedDistributionID(from distributionID: String?) -> String? { + let env = ProcessInfo.processInfo.environment + return distributionID ?? env["AWS_SDK_SPR_DISTRIBUTION_ID"] + } +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/UpdateList.swift b/AWSSDKSwiftCLI/Sources/SPR/UpdateList.swift new file mode 100644 index 00000000000..1e6aa876b3b --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/UpdateList.swift @@ -0,0 +1,71 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import AWSS3 +import Smithy +import SmithyStreams +import ClientRuntime +import AWSCLIUtils + +extension SPRPublisher { + + mutating func updateList() async throws { + let s3Client = try S3Client(region: region) + var list = try await verify(s3Client: s3Client) + list.releases[version] = try makeRelease() + try await upload(s3Client: s3Client, list: list) + invalidations.append(listKey) + } + + private func verify(s3Client: S3Client) async throws -> ListPackageReleases { + let input = GetObjectInput(bucket: bucket, key: listKey) + let list: ListPackageReleases + do { + let output = try await s3Client.getObject(input: input) + guard let data = try await output.body?.readData() else { + throw Error("Could not get version list.") + } + list = try JSONDecoder().decode(ListPackageReleases.self, from: data) + } catch is NoSuchKey { + list = ListPackageReleases(releases: [:]) + } + guard !list.releases.keys.contains(version) || replace else { + throw Error("This version already exists in the list.") + } + return list + } + + private func makeRelease() throws -> ListPackageReleases.Release { + try ListPackageReleases.Release(url: releaseURL, problem: nil) + } + + private func upload(s3Client: S3Client, list: ListPackageReleases) async throws { + let jsonEncoder = JSONEncoder() + jsonEncoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let data = try jsonEncoder.encode(list) + let body = ByteStream.data(data) + let input = PutObjectInput(body: body, bucket: bucket, contentType: "application/json", key: listKey) + _ = try await s3Client.putObject(input: input) + } + + var listKey: String { + "\(scope)/\(name)" + } + + private var releaseURL: URL { + get throws { + guard let baseURL = URL(string: url) else { + throw Error("URL is invalid") + } + return baseURL + .appending(component: scope) + .appending(component: name) + .appending(component: version) + } + } +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/UploadArchive.swift b/AWSSDKSwiftCLI/Sources/SPR/UploadArchive.swift new file mode 100644 index 00000000000..4298d47f6ba --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/UploadArchive.swift @@ -0,0 +1,60 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import AWSS3 +import Smithy +import SmithyStreams +import AWSCLIUtils + +extension SPRPublisher { + + mutating func uploadArchive() async throws { + let tmpDirFileURL = FileManager.default.temporaryDirectory + let archiveFileURL = tmpDirFileURL.appending(component: "\(UUID().uuidString).zip") + let archiveProcess = Process.SPR.archive(name: name, packagePath: path, archiveFileURL: archiveFileURL) + _ = try _runReturningStdOut(archiveProcess) + guard FileManager.default.fileExists(atPath: urlPath(archiveFileURL)) else { + throw Error("Archive process succeeded but archive does not exist.") + } + let checksumProcess = Process.SPR.checksum(archiveFileURL: archiveFileURL) + let checksumStdout = try _runReturningStdOut(checksumProcess) + guard let checksum = checksumStdout?.split(separator: " ").first else { + throw Error("Checksum could not be parsed. Output: \(checksumStdout ?? "")") + } + self.checksum = String(checksum) + let s3Client = try S3Client(region: region) + try await verify(s3Client: s3Client) + try await upload(s3Client: s3Client, archiveFileURL: archiveFileURL) + } + + private func verify(s3Client: S3Client) async throws { + do { + let input = GetObjectInput(bucket: bucket, key: archiveKey) + _ = try await s3Client.getObject(input: input) + // If getObject did not throw, the archive must already exist. + guard replace else { + throw Error("Archive for this version already exists.") + } + } catch is NoSuchKey { + // This is expected. Any other error is unexpected and should + // throw back to the caller. + } + } + + private func upload(s3Client: S3Client, archiveFileURL: URL) async throws { + let fileHandle = try FileHandle(forReadingFrom: archiveFileURL) + let stream = FileStream(fileHandle: fileHandle) + let body = ByteStream.stream(stream) + let input = PutObjectInput(body: body, bucket: bucket, contentType: "application/zip", key: archiveKey) + _ = try await s3Client.putObject(input: input) + } + + private var archiveKey: String { + "\(scope)/\(name)/\(version).zip" + } +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/UploadManifest.swift b/AWSSDKSwiftCLI/Sources/SPR/UploadManifest.swift new file mode 100644 index 00000000000..99e54001700 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/UploadManifest.swift @@ -0,0 +1,48 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import AWSS3 +import Smithy +import SmithyStreams +import AWSCLIUtils + +extension SPRPublisher { + + func uploadManifest() async throws { + let packageFileURL = URL(fileURLWithPath: path).standardizedFileURL + let manifestFileURL = packageFileURL.appending(component: "Package.swift") + let s3Client = try S3Client(region: region) + try await verify(s3Client: s3Client) + try await upload(s3Client: s3Client, manifestFileURL: manifestFileURL) + } + + private func verify(s3Client: S3Client) async throws { + do { + let input = GetObjectInput(bucket: bucket, key: manifestKey) + _ = try await s3Client.getObject(input: input) + guard replace else { + throw Error("Package.swift for this version already exists.") + } + } catch is NoSuchKey { + // This is expected. Any other error is unexpected and should + // throw back to the caller. + } + } + + private func upload(s3Client: S3Client, manifestFileURL: URL) async throws { + let fileHandle = try FileHandle(forReadingFrom: manifestFileURL) + let stream = FileStream(fileHandle: fileHandle) + let body = ByteStream.stream(stream) + let input = PutObjectInput(body: body, bucket: bucket, contentType: "text/x-swift", key: manifestKey) + _ = try await s3Client.putObject(input: input) + } + + private var manifestKey: String { + "\(scope)/\(name)/\(version)/Package.swift" + } +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/UploadMetadata.swift b/AWSSDKSwiftCLI/Sources/SPR/UploadMetadata.swift new file mode 100644 index 00000000000..f1af783de45 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/UploadMetadata.swift @@ -0,0 +1,57 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import AWSS3 +import Smithy +import SmithyStreams +import AWSCLIUtils + +extension SPRPublisher { + + func uploadMetadata() async throws { + let s3Client = try S3Client(region: region) + try await verify(s3Client: s3Client) + try await upload(s3Client: s3Client) + } + + private func verify(s3Client: S3Client) async throws { + do { + let input = GetObjectInput(bucket: bucket, key: metadataKey) + _ = try await s3Client.getObject(input: input) + guard replace else { + throw Error("Metadata for this version already exists.") + } + } catch is NoSuchKey { + // This is expected. Any other error is unexpected and should + // throw back to the caller. + } + } + + private func upload(s3Client: S3Client) async throws { + let metadata = createMetadata() + let jsonEncoder = JSONEncoder() + jsonEncoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let data = try jsonEncoder.encode(metadata) + let body = ByteStream.data(data) + let input = PutObjectInput(body: body, bucket: bucket, contentType: "application/json", key: metadataKey) + _ = try await s3Client.putObject(input: input) + } + + private var metadataKey: String { + "\(scope)/\(name)/\(version)" + } + + private func createMetadata() -> PackageInfo { + let now = Date().ISO8601Format() + let organization = PackageInfo.Metadata.Author.Organization(name: "Amazon Web Services", email: nil, description: nil, url: URL(string: "https://aws.amazon.com/")!) + let author = PackageInfo.Metadata.Author(name: "AWS SDK for Swift Team", email: nil, description: nil, organization: organization, url: nil) + let resource = Resource(name: "source-archive", type: "application/zip", checksum: checksum, signing: nil) + let metadata = PackageInfo.Metadata(author: author, description: "A Swift package, what can I say?", licenseURL: nil, originalPublicationTime: now, readmeURL: nil, repositoryURLs: nil) + return PackageInfo(id: "\(scope).\(name)", version: version, resources: [resource], metadata: metadata, publishedAt: now) + } +} diff --git a/AWSSDKSwiftCLI/Sources/SPR/VerifyPackage.swift b/AWSSDKSwiftCLI/Sources/SPR/VerifyPackage.swift new file mode 100644 index 00000000000..1f28a8a60d3 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/SPR/VerifyPackage.swift @@ -0,0 +1,31 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import AWSCLIUtils + +extension SPRPublisher { + + func verifyPackage() throws { + let description = try getPackageDescription() + guard description.name == name else { + throw Error("Supplied name does not match package") + } + } + + private func getPackageDescription() throws -> Describe { + guard let stdout = try _runReturningStdOut(Process.SPR.describe(packagePath: path)) else { + throw Error("no stdout from Describe command") + } + do { + return try JSONDecoder().decode(Describe.self, from: Data(stdout.utf8)) + } catch { + try printError("Error occurred while parsing JSON package description.") + throw error + } + } +} diff --git a/AWSSDKSwiftCLI/Sources/spr-multi-publish/SPRMultiPublish.swift b/AWSSDKSwiftCLI/Sources/spr-multi-publish/SPRMultiPublish.swift new file mode 100644 index 00000000000..60ac67f8805 --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/spr-multi-publish/SPRMultiPublish.swift @@ -0,0 +1,110 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import ArgumentParser +import SPR +import AWSCLIUtils + +@main +struct SPRMultiPublish: AsyncParsableCommand { + + static var configuration = CommandConfiguration( + commandName: "spr-multi-publish", + abstract: "Publishes a new version of all aws-sdk-swift & smithy-swift packages to SPR.", + version: "0.0.1" + ) + + @Option(help: "The scope of the package being published. Must meet the requirements of the Swift Package Registry spec.") + var scope: String + + @Option(help: "The version of the package to be published, i.e. \"1.2.3\". The version must be valid per Semantic Versioning 2.0 (https://semver.org/).") + var version: String + + @Option(help: "The AWS region in which the registry is located. Alternate to this option, the region may be obtained from environment var AWS_SDK_SPR_REGION. Defaults to us-east-1.") + var region: String = "" + + @Option(help: "The bucket name for the S3 bucket hosting the Registry. Alternate to this option, the bucket may be obtained from environment var AWS_SDK_SPR_BUCKET.") + var bucket: String? + + @Option(help: "The base URL for the registry.") + var url: String + + @Option(help: "The CloudFront distribution ID for the registry. Alternate to this option, the distribution ID may be obtained from environment var AWS_SDK_SPR_DISTRIBUTION_ID.") + var distributionID: String? + + @Option(help: "If true, any existing release matching this version will be replaced. If false and the selected version already exists, the publish command fails. Defaults to false.") + var replace = false + + mutating func run() async throws { + let start = Date() + let allPackages = try runtimePackages + serviceClientPackages + var allInvalidations = [String]() + do { + for (name, path) in allPackages { + print("Package: \(name)") + var publisher = SPRPublisher( + scope: scope, + name: name, + version: version, + path: path, + region: region, + bucket: bucket, + url: url, + distributionID: distributionID, + replace: replace + ) + try await publisher.run() + allInvalidations.append(contentsOf: publisher.invalidations) + print("") + } + try await invalidate(allInvalidations) + } catch { + try printError("Error caught while publishing.") + try await invalidate(allInvalidations) + throw error + } + + let elapsed = Date().timeIntervalSince(start) + print("Time elapsed: \(String(format: "%.2f", elapsed)) sec") + } + + private func invalidate(_ invalidations: [String]) async throws { + print("Finishing & invalidating \(invalidations.count) package lists.") + try await SPRPublisher.invalidate(region: region, distributionID: distributionID, invalidations: invalidations) + } + + private var runtimePackages: [(String, String)] { + return [ + ("smithy-swift", "../../smithy-swift/"), + awsRuntimePackage("AWSClientRuntime"), + awsRuntimePackage("AWSSDKChecksums"), + awsRuntimePackage("AWSSDKCommon"), + awsRuntimePackage("AWSSDKEventStreamsAuth"), + awsRuntimePackage("AWSSDKHTTPAuth"), + awsRuntimePackage("AWSSDKIdentity"), + ] + } + + private var serviceClientPackages: [(String, String)] { + get throws { + try FileManager.default + .contentsOfDirectory(atPath: "../Sources/Services") + .sorted() + .filter { !$0.hasPrefix(".") } + .map { serviceClientPackage($0) } + } + } + + private func awsRuntimePackage(_ name: String) -> (String, String) { + return (name, "../Sources/Core/\(name)/") + } + + private func serviceClientPackage(_ name: String) -> (String, String) { + return (name, "../Sources/Services/\(name)/") + } +} diff --git a/AWSSDKSwiftCLI/Sources/spr-publish/SPRPublish.swift b/AWSSDKSwiftCLI/Sources/spr-publish/SPRPublish.swift new file mode 100644 index 00000000000..e19c4c49e8a --- /dev/null +++ b/AWSSDKSwiftCLI/Sources/spr-publish/SPRPublish.swift @@ -0,0 +1,68 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import ArgumentParser +import SPR + +@main +struct SPRPublish: AsyncParsableCommand { + + static var configuration = CommandConfiguration( + commandName: "spr-publish", + abstract: "Publishes a new version of a package to SPR.", + version: "0.0.1" + ) + + @Option(help: "The ID of the package being published. Must meet the requirements of the Swift Package Registry spec.") + var scope: String + + @Option(help: "The name of the package being published. Must match the name defined in the package's Package.swift.") + var name: String + + @Option(help: "The version of the package to be published, i.e. \"1.2.3\". The version must be valid per Semantic Versioning 2.0 (https://semver.org/).") + var version: String + + @Option(help: "The path to the Swift package being published.") + var path: String + + @Option(help: "The AWS region in which the registry is located. Alternate to this option, the region may be obtained from environment var AWS_SDK_SPR_REGION. Defaults to us-east-1.") + var region: String = "" + + @Option(help: "The bucket name for the S3 bucket hosting the Registry. Alternate to this option, the bucket may be obtained from environment var AWS_SDK_SPR_BUCKET.") + public var bucket: String? + + @Option(help: "The base URL for the registry.") + var url: String + + @Option(help: "The CloudFront distribution ID for the registry. Alternate to this option, the distribution ID may be obtained from environment var AWS_SDK_SPR_DISTRIBUTION_ID.") + var distributionID: String? + + @Option(help: "If true, any existing release matching this version will be replaced. If false and the selected version already exists, the publish command fails. Defaults to false.") + var replace = false + + mutating func run() async throws { + let start = Date() + print("Package: \(name)") + var publisher = SPRPublisher( + scope: scope, + name: name, + version: version, + path: path, + region: region, + bucket: bucket, + url: url, + distributionID: distributionID, + replace: replace + ) + try await publisher.run() + try await SPRPublisher.invalidate(region: region, distributionID: distributionID, invalidations: publisher.invalidations) + + let elapsed = Date().timeIntervalSince(start) + print("Time elapsed: \(String(format: "%.2f", elapsed)) sec") + } +} diff --git a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/CLITestCase.swift b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/CLITestCase.swift index 949ed32fa74..c5a6698db4c 100644 --- a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/CLITestCase.swift +++ b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/CLITestCase.swift @@ -7,6 +7,7 @@ @testable import AWSSDKSwiftCLI import XCTest +import AWSCLIUtils class CLITestCase: XCTestCase { let tmpPath = "tmp" diff --git a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/GeneratePackageManifestTests.swift b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/GeneratePackageManifestTests.swift index 1f8a0953dae..77aa1c0e67a 100644 --- a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/GeneratePackageManifestTests.swift +++ b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/GeneratePackageManifestTests.swift @@ -114,7 +114,6 @@ extension GeneratePackageManifest { clientRuntimeVersion: Version? = nil, crtVersion: Version? = nil, services: [String]? = nil, - includeProtocolTests: Bool = false, excludeAWSServices: Bool = false, excludeRuntimeTests: Bool = false, buildPackageManifest: @escaping BuildPackageManifest = { (_,_,_) throws -> String in "" } @@ -125,7 +124,6 @@ extension GeneratePackageManifest { clientRuntimeVersion: clientRuntimeVersion, crtVersion: crtVersion, services: services, - includeProtocolTests: includeProtocolTests, excludeAWSServices: excludeAWSServices, excludeRuntimeTests: excludeRuntimeTests, buildPackageManifest: buildPackageManifest diff --git a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/PrepareReleaseTests.swift b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/PrepareReleaseTests.swift index f9b1a9cb4d6..59aa1539581 100644 --- a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/PrepareReleaseTests.swift +++ b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/PrepareReleaseTests.swift @@ -8,6 +8,7 @@ @testable import AWSSDKSwiftCLI import PackageDescription import XCTest +import AWSCLIUtils class PrepareReleaseTests: CLITestCase { diff --git a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/TestAWSSDKTests.swift b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/TestAWSSDKTests.swift index 222db5f73da..1b17a84d9d4 100644 --- a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/TestAWSSDKTests.swift +++ b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/TestAWSSDKTests.swift @@ -9,6 +9,7 @@ import Algorithms import PackageDescription import XCTest +import AWSCLIUtils class TestAWSSDKTests: CLITestCase { diff --git a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Models/PackageManifestBuilderTests.swift b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Models/PackageManifestBuilderTests.swift index 8c3afba0c4c..e06039553be 100644 --- a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Models/PackageManifestBuilderTests.swift +++ b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Models/PackageManifestBuilderTests.swift @@ -34,9 +34,6 @@ let serviceTargets: [String] = [ // Uncomment this line to enable all services addAllServices() -// Uncomment this line to enable protocol tests -// addProtocolTests() - addResolvedTargets() @@ -47,7 +44,6 @@ addResolvedTargets() clientRuntimeVersion: .init("1.2.3"), crtVersion: .init("4.5.6"), services: ["A","B","C","D","E"].map { PackageManifestBuilder.Service(name: $0) }, - includeProtocolTests: false, excludeAWSServices: false, excludeRuntimeTests: false, basePackageContents: { "" } diff --git a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Utils/ProcessUtilsTests.swift b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Utils/ProcessUtilsTests.swift index d2124be186b..fc81690d763 100644 --- a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Utils/ProcessUtilsTests.swift +++ b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Utils/ProcessUtilsTests.swift @@ -9,6 +9,7 @@ import PackageDescription import ArgumentParser import XCTest +import AWSCLIUtils class ProcessUtilsTests: XCTestCase { diff --git a/Package.swift b/Package.swift index 495eb78f3a3..e9ff4f24d19 100644 --- a/Package.swift +++ b/Package.swift @@ -83,56 +83,56 @@ let package = Package( .awsSDKHTTPAuth, .awsSDKIdentity ], - path: "./Sources/Core/AWSClientRuntime", + path: "Sources/Core/AWSClientRuntime/Sources", resources: [ - .copy("PrivacyInfo.xcprivacy") + .process("AWSClientRuntime/Resources") ] ), .target( name: "AWSSDKCommon", dependencies: [.crt], - path: "./Sources/Core/AWSSDKCommon" + path: "Sources/Core/AWSSDKCommon/Sources" ), .target( name: "AWSSDKEventStreamsAuth", dependencies: [.smithyEventStreamsAPI, .smithyEventStreamsAuthAPI, .smithyEventStreams, .crt, .clientRuntime, "AWSSDKHTTPAuth"], - path: "./Sources/Core/AWSSDKEventStreamsAuth" + path: "Sources/Core/AWSSDKEventStreamsAuth/Sources" ), .target( name: "AWSSDKHTTPAuth", dependencies: [.crt, .smithy, .clientRuntime, .smithyHTTPAuth, "AWSSDKIdentity", "AWSSDKChecksums"], - path: "./Sources/Core/AWSSDKHTTPAuth" + path: "Sources/Core/AWSSDKHTTPAuth/Sources" ), .target( name: "AWSSDKIdentity", dependencies: [.crt, .smithy, .clientRuntime, .smithyIdentity, .smithyIdentityAPI, .smithyHTTPAPI, .awsSDKCommon], - path: "./Sources/Core/AWSSDKIdentity" + path: "Sources/Core/AWSSDKIdentity/Sources" ), .target( name: "AWSSDKChecksums", dependencies: [.crt, .smithy, .clientRuntime, .smithyChecksumsAPI, .smithyChecksums, .smithyHTTPAPI], - path: "./Sources/Core/AWSSDKChecksums" + path: "Sources/Core/AWSSDKChecksums/Sources" ), .testTarget( name: "AWSClientRuntimeTests", dependencies: [.awsClientRuntime, .clientRuntime, .smithyTestUtils, .awsSDKCommon], - path: "./Tests/Core/AWSClientRuntimeTests", + path: "Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests", resources: [.process("Resources")] ), .testTarget( name: "AWSSDKEventStreamsAuthTests", dependencies: ["AWSClientRuntime", "AWSSDKEventStreamsAuth", .smithyStreams], - path: "./Tests/Core/AWSSDKEventStreamsAuthTests" + path: "Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests" ), .testTarget( name: "AWSSDKHTTPAuthTests", dependencies: ["AWSSDKHTTPAuth", "AWSClientRuntime", "AWSSDKEventStreamsAuth", .crt, .clientRuntime, .smithyTestUtils], - path: "./Tests/Core/AWSSDKHTTPAuthTests" + path: "Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests" ), .testTarget( name: "AWSSDKIdentityTests", dependencies: [.smithy, .smithyIdentity, "AWSSDKIdentity", .awsClientRuntime], - path: "./Tests/Core/AWSSDKIdentityTests", + path: "Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests", resources: [.process("Resources")] ) ] @@ -212,7 +212,8 @@ func addServiceTarget(_ name: String) { .target( name: name, dependencies: serviceTargetDependencies, - path: "./Sources/Services/\(name)/Sources/\(name)" + path: "Sources/Services/\(name)/Sources/\(name)", + resources: [.process("Resources")] ) ] } @@ -223,7 +224,7 @@ func addServiceUnitTestTarget(_ name: String) { .testTarget( name: "\(testName)", dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils], - path: "./Sources/Services/\(name)/Tests/\(testName)" + path: "Sources/Services/\(name)/Tests/\(testName)" ) ] } diff --git a/ServiceClientVersions.json b/ServiceClientVersions.json new file mode 100644 index 00000000000..ad020bfaace --- /dev/null +++ b/ServiceClientVersions.json @@ -0,0 +1,4 @@ +{ + "sdk": "0.15.0", + "s3": "0.15.0" +} diff --git a/Sources/Core/AWSClientRuntime/Package.swift.txt b/Sources/Core/AWSClientRuntime/Package.swift.txt new file mode 100644 index 00000000000..6ff028b3ac0 --- /dev/null +++ b/Sources/Core/AWSClientRuntime/Package.swift.txt @@ -0,0 +1,50 @@ +// swift-tools-version: 5.9 + +import PackageDescription + +let package = Package( + name: "AWSClientRuntime", + platforms: [ + .macOS(.v10_15), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6) + ], + products: [ + .library(name: "AWSClientRuntime", targets: ["AWSClientRuntime"]), + ], + dependencies: [ + .package(id: "aws-sdk-swift.AWSSDKCommon", from: "0.0.1"), + .package(id: "aws-sdk-swift.AWSSDKHTTPAuth", from: "0.0.1"), + .package(id: "aws-sdk-swift.AWSSDKIdentity", from: "0.0.1"), + .package(url: "https://github.com/awslabs/aws-crt-swift", exact: "0.30.0"), + .package(id: "aws-sdk-swift.smithy-swift", from: "0.0.1"), + ], + targets: [ + .target( + name: "AWSClientRuntime", + dependencies: [ + .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), + .product(name: "ClientRuntime", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyRetriesAPI", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyRetries", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyEventStreamsAPI", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyEventStreamsAuthAPI", package: "aws-sdk-swift.smithy-swift"), + .product(name: "AWSSDKCommon", package: "aws-sdk-swift.AWSSDKCommon"), + .product(name: "AWSSDKHTTPAuth", package: "aws-sdk-swift.AWSSDKHTTPAuth"), + .product(name: "AWSSDKIdentity", package: "aws-sdk-swift.AWSSDKIdentity"), + ], + resources: [.process("Resources")] + ), + .testTarget( + name: "AWSClientRuntimeTests", + dependencies: [ + "AWSClientRuntime", + .product(name: "ClientRuntime", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyTestUtil", package: "aws-sdk-swift.smithy-swift"), + .product(name: "AWSSDKCommon", package: "aws-sdk-swift.AWSSDKCommon"), + ], + resources: [.process("Resources")] + ), + ] +) diff --git a/Sources/Core/AWSClientRuntime/AWSClientConfigDefaultsProvider.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/AWSClientConfigDefaultsProvider.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/AWSClientConfigDefaultsProvider.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/AWSClientConfigDefaultsProvider.swift diff --git a/Sources/Core/AWSClientRuntime/Config/AWSDefaultClientConfiguration.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Config/AWSDefaultClientConfiguration.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Config/AWSDefaultClientConfiguration.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Config/AWSDefaultClientConfiguration.swift diff --git a/Sources/Core/AWSClientRuntime/Config/AWSRegionClientConfiguration.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Config/AWSRegionClientConfiguration.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Config/AWSRegionClientConfiguration.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Config/AWSRegionClientConfiguration.swift diff --git a/Sources/Core/AWSClientRuntime/Config/FieldResolver.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Config/FieldResolver.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Config/FieldResolver.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Config/FieldResolver.swift diff --git a/Sources/Core/AWSClientRuntime/Endpoints/AWSEndpoint.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/AWSEndpoint.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Endpoints/AWSEndpoint.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/AWSEndpoint.swift diff --git a/Sources/Core/AWSClientRuntime/Endpoints/AWSPartitionDefinition.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/AWSPartitionDefinition.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Endpoints/AWSPartitionDefinition.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/AWSPartitionDefinition.swift diff --git a/Sources/Core/AWSClientRuntime/Endpoints/EndpointResolverMiddleware.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/EndpointResolverMiddleware.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Endpoints/EndpointResolverMiddleware.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/EndpointResolverMiddleware.swift diff --git a/Sources/Core/AWSClientRuntime/Endpoints/Partition.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/Partition.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Endpoints/Partition.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/Partition.swift diff --git a/Sources/Core/AWSClientRuntime/Endpoints/ServiceEndpointMetadata+Extension.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/ServiceEndpointMetadata+Extension.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Endpoints/ServiceEndpointMetadata+Extension.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Endpoints/ServiceEndpointMetadata+Extension.swift diff --git a/Sources/Core/AWSClientRuntime/Environment.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Environment.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Environment.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Environment.swift diff --git a/Sources/Core/AWSClientRuntime/Errors/AWSS3ServiceError.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/AWSS3ServiceError.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Errors/AWSS3ServiceError.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/AWSS3ServiceError.swift diff --git a/Sources/Core/AWSClientRuntime/Errors/AWSServiceError.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/AWSServiceError.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Errors/AWSServiceError.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/AWSServiceError.swift diff --git a/Sources/Core/AWSClientRuntime/Errors/Candidates/InvalidAccessKeyId.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/Candidates/InvalidAccessKeyId.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Errors/Candidates/InvalidAccessKeyId.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/Candidates/InvalidAccessKeyId.swift diff --git a/Sources/Core/AWSClientRuntime/Errors/Candidates/UnknownAWSHTTPErrorCandidate.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/Candidates/UnknownAWSHTTPErrorCandidate.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Errors/Candidates/UnknownAWSHTTPErrorCandidate.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/Candidates/UnknownAWSHTTPErrorCandidate.swift diff --git a/Sources/Core/AWSClientRuntime/Errors/UnknownAWSHTTPServiceError.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/UnknownAWSHTTPServiceError.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Errors/UnknownAWSHTTPServiceError.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Errors/UnknownAWSHTTPServiceError.swift diff --git a/Sources/Core/AWSClientRuntime/HTTP/HttpResponse+AWS.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/HTTP/HttpResponse+AWS.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/HTTP/HttpResponse+AWS.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/HTTP/HttpResponse+AWS.swift diff --git a/Sources/Core/AWSClientRuntime/IMDS/IMDSClient.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/IMDS/IMDSClient.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/IMDS/IMDSClient.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/IMDS/IMDSClient.swift diff --git a/Sources/Core/AWSClientRuntime/IMDS/IMDSConfig.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/IMDS/IMDSConfig.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/IMDS/IMDSConfig.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/IMDS/IMDSConfig.swift diff --git a/Sources/Core/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift similarity index 97% rename from Sources/Core/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift index 087f0913b53..a579135a0ea 100644 --- a/Sources/Core/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift +++ b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift @@ -47,7 +47,7 @@ public struct AWSS3ErrorWith200StatusXMLMiddleware") } diff --git a/Sources/Core/AWSClientRuntime/Middlewares/FlexibleChecksumsRequestMiddleware.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/FlexibleChecksumsRequestMiddleware.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Middlewares/FlexibleChecksumsRequestMiddleware.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/FlexibleChecksumsRequestMiddleware.swift diff --git a/Sources/Core/AWSClientRuntime/Middlewares/FlexibleChecksumsResponseMiddleware.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/FlexibleChecksumsResponseMiddleware.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Middlewares/FlexibleChecksumsResponseMiddleware.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/FlexibleChecksumsResponseMiddleware.swift diff --git a/Sources/Core/AWSClientRuntime/Middlewares/Route53TrimHostedZoneMiddleware.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/Route53TrimHostedZoneMiddleware.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Middlewares/Route53TrimHostedZoneMiddleware.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/Route53TrimHostedZoneMiddleware.swift diff --git a/Sources/Core/AWSClientRuntime/Middlewares/Sha256TreeHashMiddleware.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/Sha256TreeHashMiddleware.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Middlewares/Sha256TreeHashMiddleware.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/Sha256TreeHashMiddleware.swift diff --git a/Sources/Core/AWSClientRuntime/Middlewares/UserAgentMiddleware.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/UserAgentMiddleware.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Middlewares/UserAgentMiddleware.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/UserAgentMiddleware.swift diff --git a/Sources/Core/AWSClientRuntime/Middlewares/XAmzTargetMiddleware.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/XAmzTargetMiddleware.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Middlewares/XAmzTargetMiddleware.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/XAmzTargetMiddleware.swift diff --git a/Sources/Core/AWSClientRuntime/Plugins/DefaultAWSClientPlugin.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Plugins/DefaultAWSClientPlugin.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Plugins/DefaultAWSClientPlugin.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Plugins/DefaultAWSClientPlugin.swift diff --git a/Sources/Core/AWSClientRuntime/Plugins/RegionPlugin.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Plugins/RegionPlugin.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Plugins/RegionPlugin.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Plugins/RegionPlugin.swift diff --git a/Sources/Core/AWSClientRuntime/PrimitiveExtensions/Data+Extension.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/PrimitiveExtensions/Data+Extension.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/PrimitiveExtensions/Data+Extension.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/PrimitiveExtensions/Data+Extension.swift diff --git a/Sources/Core/AWSClientRuntime/PrimitiveExtensions/String+Extension.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/PrimitiveExtensions/String+Extension.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/PrimitiveExtensions/String+Extension.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/PrimitiveExtensions/String+Extension.swift diff --git a/Sources/Core/AWSClientRuntime/PrimitiveExtensions/TimeInterval+Extension.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/PrimitiveExtensions/TimeInterval+Extension.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/PrimitiveExtensions/TimeInterval+Extension.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/PrimitiveExtensions/TimeInterval+Extension.swift diff --git a/Sources/Core/AWSClientRuntime/Protocols/AWSJSON/AWSJSONError.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/AWSJSON/AWSJSONError.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Protocols/AWSJSON/AWSJSONError.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/AWSJSON/AWSJSONError.swift diff --git a/Sources/Core/AWSClientRuntime/Protocols/AWSQuery/AWSQueryError.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/AWSQuery/AWSQueryError.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Protocols/AWSQuery/AWSQueryError.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/AWSQuery/AWSQueryError.swift diff --git a/Sources/Core/AWSClientRuntime/Protocols/Ec2Query/EC2QueryError.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/Ec2Query/EC2QueryError.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Protocols/Ec2Query/EC2QueryError.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/Ec2Query/EC2QueryError.swift diff --git a/Sources/Core/AWSClientRuntime/Protocols/RestJSON/RestJSONError.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/RestJSON/RestJSONError.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Protocols/RestJSON/RestJSONError.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/RestJSON/RestJSONError.swift diff --git a/Sources/Core/AWSClientRuntime/Protocols/RestXML/RestXMLError.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/RestXML/RestXMLError.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Protocols/RestXML/RestXMLError.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Protocols/RestXML/RestXMLError.swift diff --git a/Sources/Core/AWSClientRuntime/Regions/DefaultRegionResolver.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/DefaultRegionResolver.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Regions/DefaultRegionResolver.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/DefaultRegionResolver.swift diff --git a/Sources/Core/AWSClientRuntime/Regions/EnvironmentRegionProvider.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/EnvironmentRegionProvider.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Regions/EnvironmentRegionProvider.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/EnvironmentRegionProvider.swift diff --git a/Sources/Core/AWSClientRuntime/Regions/IMDSRegionProvider.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/IMDSRegionProvider.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Regions/IMDSRegionProvider.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/IMDSRegionProvider.swift diff --git a/Sources/Core/AWSClientRuntime/Regions/ProfileRegionProvider.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/ProfileRegionProvider.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Regions/ProfileRegionProvider.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/ProfileRegionProvider.swift diff --git a/Sources/Core/AWSClientRuntime/Regions/RegionProvider.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/RegionProvider.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Regions/RegionProvider.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/RegionProvider.swift diff --git a/Sources/Core/AWSClientRuntime/Regions/RegionResolver.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/RegionResolver.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Regions/RegionResolver.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Regions/RegionResolver.swift diff --git a/Sources/Core/AWSClientRuntime/PrivacyInfo.xcprivacy b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Resources/PrivacyInfo.xcprivacy similarity index 100% rename from Sources/Core/AWSClientRuntime/PrivacyInfo.xcprivacy rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Resources/PrivacyInfo.xcprivacy diff --git a/Sources/Core/AWSClientRuntime/Retry/AWSRetryConfig.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Retry/AWSRetryConfig.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Retry/AWSRetryConfig.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Retry/AWSRetryConfig.swift diff --git a/Sources/Core/AWSClientRuntime/Retry/AWSRetryErrorInfoProvider.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Retry/AWSRetryErrorInfoProvider.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Retry/AWSRetryErrorInfoProvider.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Retry/AWSRetryErrorInfoProvider.swift diff --git a/Sources/Core/AWSClientRuntime/Retry/AWSRetryMode.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Retry/AWSRetryMode.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Retry/AWSRetryMode.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Retry/AWSRetryMode.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/APIMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/APIMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/APIMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/APIMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/AWSUserAgentMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/AWSUserAgentMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/AWSUserAgentMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/AWSUserAgentMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/AdditionalMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/AdditionalMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/AdditionalMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/AdditionalMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/AppIDConfig.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/AppIDConfig.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/AppIDConfig.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/AppIDConfig.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/AppIDMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/AppIDMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/AppIDMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/AppIDMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/ConfigMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/ConfigMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/ConfigMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/ConfigMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/ExecutionEnvMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/ExecutionEnvMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/ExecutionEnvMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/ExecutionEnvMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/FeatureMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/FeatureMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/FeatureMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/FeatureMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/FrameworkMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/FrameworkMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/FrameworkMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/FrameworkMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/InternalMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/InternalMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/InternalMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/InternalMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/LanguageMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/LanguageMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/LanguageMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/LanguageMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/OSMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/OSMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/OSMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/OSMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/SDKMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/SDKMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/SDKMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/SDKMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/UserAgent/UserAgentMetadata.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/UserAgentMetadata.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/UserAgent/UserAgentMetadata.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/UserAgent/UserAgentMetadata.swift diff --git a/Sources/Core/AWSClientRuntime/Utils.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Utils.swift similarity index 100% rename from Sources/Core/AWSClientRuntime/Utils.swift rename to Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Utils.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Config/FieldResolverTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Config/FieldResolverTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Config/FieldResolverTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Config/FieldResolverTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/DataExtensionTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/DataExtensionTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/DataExtensionTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/DataExtensionTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Endpoints/EndpointsTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Endpoints/EndpointsTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Endpoints/EndpointsTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Endpoints/EndpointsTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/FileBasedConfiguration/FileBasedConfigurationTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/FileBasedConfiguration/FileBasedConfigurationTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/FileBasedConfiguration/FileBasedConfigurationTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/FileBasedConfiguration/FileBasedConfigurationTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Middlewares/FlexibleChecksumsMiddlewareTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Middlewares/FlexibleChecksumsMiddlewareTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Middlewares/FlexibleChecksumsMiddlewareTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Middlewares/FlexibleChecksumsMiddlewareTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Middlewares/Sha256TreeHashMiddlewareTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Middlewares/Sha256TreeHashMiddlewareTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Middlewares/Sha256TreeHashMiddlewareTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Middlewares/Sha256TreeHashMiddlewareTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Protocols/Ec2Query/Ec2ErrorRequestIdTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Protocols/Ec2Query/Ec2ErrorRequestIdTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Protocols/Ec2Query/Ec2ErrorRequestIdTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Protocols/Ec2Query/Ec2ErrorRequestIdTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Protocols/RestJSON/RestJSONErrorTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Protocols/RestJSON/RestJSONErrorTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Protocols/RestJSON/RestJSONErrorTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Protocols/RestJSON/RestJSONErrorTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Regions/DefaultRegionResolverTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Regions/DefaultRegionResolverTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Regions/DefaultRegionResolverTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Regions/DefaultRegionResolverTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Regions/ProfileRegionProviderTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Regions/ProfileRegionProviderTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Regions/ProfileRegionProviderTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Regions/ProfileRegionProviderTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Resources/app_id_config_tests b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/app_id_config_tests similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Resources/app_id_config_tests rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/app_id_config_tests diff --git a/Tests/Core/AWSClientRuntimeTests/Resources/field_resolver_tests b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/field_resolver_tests similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Resources/field_resolver_tests rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/field_resolver_tests diff --git a/Tests/Core/AWSClientRuntimeTests/Resources/file_based_config_tests b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/file_based_config_tests similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Resources/file_based_config_tests rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/file_based_config_tests diff --git a/Tests/Core/AWSClientRuntimeTests/Resources/profile_region_provider_tests b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/profile_region_provider_tests similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Resources/profile_region_provider_tests rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/profile_region_provider_tests diff --git a/Tests/Core/AWSClientRuntimeTests/Resources/retry_config_tests b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/retry_config_tests similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Resources/retry_config_tests rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Resources/retry_config_tests diff --git a/Tests/Core/AWSClientRuntimeTests/Retry/AWSRetryConfigTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Retry/AWSRetryConfigTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Retry/AWSRetryConfigTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Retry/AWSRetryConfigTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/Retry/AWSRetryErrorInfoProviderTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Retry/AWSRetryErrorInfoProviderTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/Retry/AWSRetryErrorInfoProviderTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/Retry/AWSRetryErrorInfoProviderTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/APIMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/APIMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/APIMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/APIMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/AWSUserAgentMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/AWSUserAgentMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/AWSUserAgentMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/AWSUserAgentMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/AppIDConfigTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/AppIDConfigTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/AppIDConfigTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/AppIDConfigTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/AppIDMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/AppIDMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/AppIDMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/AppIDMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/ConfigMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/ConfigMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/ConfigMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/ConfigMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/ExecutionEnvMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/ExecutionEnvMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/ExecutionEnvMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/ExecutionEnvMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/FeatureMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/FeatureMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/FeatureMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/FeatureMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/FrameworkMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/FrameworkMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/FrameworkMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/FrameworkMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/InternalMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/InternalMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/InternalMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/InternalMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/LanguageMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/LanguageMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/LanguageMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/LanguageMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/OSMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/OSMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/OSMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/OSMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/SDKMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/SDKMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/SDKMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/SDKMetadataTests.swift diff --git a/Tests/Core/AWSClientRuntimeTests/UserAgent/UserAgentMetadataTests.swift b/Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/UserAgentMetadataTests.swift similarity index 100% rename from Tests/Core/AWSClientRuntimeTests/UserAgent/UserAgentMetadataTests.swift rename to Sources/Core/AWSClientRuntime/Tests/AWSClientRuntimeTests/UserAgent/UserAgentMetadataTests.swift diff --git a/Sources/Core/AWSSDKChecksums/Package.swift.txt b/Sources/Core/AWSSDKChecksums/Package.swift.txt new file mode 100644 index 00000000000..999e4d8a110 --- /dev/null +++ b/Sources/Core/AWSSDKChecksums/Package.swift.txt @@ -0,0 +1,35 @@ +// swift-tools-version: 5.9 + +import PackageDescription + +let package = Package( + name: "AWSSDKChecksums", + platforms: [ + .macOS(.v10_15), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6) + ], + products: [ + .library(name: "AWSSDKChecksums", targets: ["AWSSDKChecksums"]), + ], + dependencies: [ + .package(id: "aws-sdk-swift.AWSSDKCommon", from: "0.0.1"), + .package(url: "https://github.com/awslabs/aws-crt-swift", exact: "0.30.0"), + .package(id: "aws-sdk-swift.smithy-swift", from: "0.0.1"), + ], + targets: [ + .target( + name: "AWSSDKChecksums", + dependencies: [ + .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), + .product(name: "ClientRuntime", package: "aws-sdk-swift.smithy-swift"), + .product(name: "Smithy", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyHTTPAPI", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyIdentityAPI", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyIdentity", package: "aws-sdk-swift.smithy-swift"), + .product(name: "AWSSDKCommon", package: "aws-sdk-swift.AWSSDKCommon"), + ] + ), + ] +) diff --git a/Sources/Core/AWSSDKChecksums/AWSChunkedUtil.swift b/Sources/Core/AWSSDKChecksums/Sources/AWSSDKChecksums/AWSChunkedUtil.swift similarity index 100% rename from Sources/Core/AWSSDKChecksums/AWSChunkedUtil.swift rename to Sources/Core/AWSSDKChecksums/Sources/AWSSDKChecksums/AWSChunkedUtil.swift diff --git a/Sources/Core/AWSSDKCommon/Package.swift.txt b/Sources/Core/AWSSDKCommon/Package.swift.txt new file mode 100644 index 00000000000..37e3a8b9101 --- /dev/null +++ b/Sources/Core/AWSSDKCommon/Package.swift.txt @@ -0,0 +1,27 @@ +// swift-tools-version: 5.9 + +import PackageDescription + +let package = Package( + name: "AWSSDKCommon", + platforms: [ + .macOS(.v10_15), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6) + ], + products: [ + .library(name: "AWSSDKCommon", targets: ["AWSSDKCommon"]), + ], + dependencies: [ + .package(url: "https://github.com/awslabs/aws-crt-swift", exact: "0.30.0"), + ], + targets: [ + .target( + name: "AWSSDKCommon", + dependencies: [ + .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), + ] + ), + ] +) diff --git a/Sources/Core/AWSSDKCommon/FileBasedConfiguration/CRTFileBasedConfiguration.swift b/Sources/Core/AWSSDKCommon/Sources/AWSSDKCommon/FileBasedConfiguration/CRTFileBasedConfiguration.swift similarity index 100% rename from Sources/Core/AWSSDKCommon/FileBasedConfiguration/CRTFileBasedConfiguration.swift rename to Sources/Core/AWSSDKCommon/Sources/AWSSDKCommon/FileBasedConfiguration/CRTFileBasedConfiguration.swift diff --git a/Sources/Core/AWSSDKCommon/FileBasedConfiguration/FileBasedConfiguration.swift b/Sources/Core/AWSSDKCommon/Sources/AWSSDKCommon/FileBasedConfiguration/FileBasedConfiguration.swift similarity index 100% rename from Sources/Core/AWSSDKCommon/FileBasedConfiguration/FileBasedConfiguration.swift rename to Sources/Core/AWSSDKCommon/Sources/AWSSDKCommon/FileBasedConfiguration/FileBasedConfiguration.swift diff --git a/Sources/Core/AWSSDKCommon/FileBasedConfiguration/FileBasedConfigurationKeys.swift b/Sources/Core/AWSSDKCommon/Sources/AWSSDKCommon/FileBasedConfiguration/FileBasedConfigurationKeys.swift similarity index 100% rename from Sources/Core/AWSSDKCommon/FileBasedConfiguration/FileBasedConfigurationKeys.swift rename to Sources/Core/AWSSDKCommon/Sources/AWSSDKCommon/FileBasedConfiguration/FileBasedConfigurationKeys.swift diff --git a/Sources/Core/AWSSDKEventStreamsAuth/Package.swift.txt b/Sources/Core/AWSSDKEventStreamsAuth/Package.swift.txt new file mode 100644 index 00000000000..e112cd9014b --- /dev/null +++ b/Sources/Core/AWSSDKEventStreamsAuth/Package.swift.txt @@ -0,0 +1,39 @@ +// swift-tools-version: 5.9 + +import PackageDescription + +let package = Package( + name: "AWSSDKEventStreamsAuth", + platforms: [ + .macOS(.v10_15), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6) + ], + products: [ + .library(name: "AWSSDKEventStreamsAuth", targets: ["AWSSDKEventStreamsAuth"]), + ], + dependencies: [ + .package(id: "aws-sdk-swift.AWSSDKHTTPAuth", from: "0.0.1"), + .package(url: "https://github.com/awslabs/aws-crt-swift", exact: "0.30.0"), + .package(id: "aws-sdk-swift.smithy-swift", from: "0.0.1"), + ], + targets: [ + .target( + name: "AWSSDKEventStreamsAuth", + dependencies: [ + .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), + .product(name: "ClientRuntime", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyEventStreamsAPI", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyEventStreamsAuthAPI", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyEventStreams", package: "aws-sdk-swift.smithy-swift"), + .product(name: "AWSSDKHTTPAuth", package: "aws-sdk-swift.AWSSDKHTTPAuth"), + ] + ), + .testTarget(name: "AWSSDKEventStreamsAuthTests", dependencies: [ + "AWSSDKEventStreamsAuth", + .product(name: "SmithyStreams", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyTestUtil", package: "aws-sdk-swift.smithy-swift"), + ]), + ] +) diff --git a/Sources/Core/AWSSDKEventStreamsAuth/AWSMessageSigner.swift b/Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/AWSMessageSigner.swift similarity index 100% rename from Sources/Core/AWSSDKEventStreamsAuth/AWSMessageSigner.swift rename to Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/AWSMessageSigner.swift diff --git a/Sources/Core/AWSSDKEventStreamsAuth/AWSSigV4Signer+EventStreams.swift b/Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/AWSSigV4Signer+EventStreams.swift similarity index 100% rename from Sources/Core/AWSSDKEventStreamsAuth/AWSSigV4Signer+EventStreams.swift rename to Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/AWSSigV4Signer+EventStreams.swift diff --git a/Sources/Core/AWSSDKEventStreamsAuth/Context+AWSEventStreamsAuth.swift b/Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/Context+AWSEventStreamsAuth.swift similarity index 100% rename from Sources/Core/AWSSDKEventStreamsAuth/Context+AWSEventStreamsAuth.swift rename to Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/Context+AWSEventStreamsAuth.swift diff --git a/Sources/Core/AWSSDKEventStreamsAuth/Context+Signing.swift b/Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/Context+Signing.swift similarity index 100% rename from Sources/Core/AWSSDKEventStreamsAuth/Context+Signing.swift rename to Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/Context+Signing.swift diff --git a/Sources/Core/AWSSDKEventStreamsAuth/String+hexaData.swift b/Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/String+hexaData.swift similarity index 100% rename from Sources/Core/AWSSDKEventStreamsAuth/String+hexaData.swift rename to Sources/Core/AWSSDKEventStreamsAuth/Sources/AWSSSDKEventStreamsAuth/String+hexaData.swift diff --git a/Tests/Core/AWSSDKEventStreamsAuthTests/AWSMessageDecoderStreamTests.swift b/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/AWSMessageDecoderStreamTests.swift similarity index 98% rename from Tests/Core/AWSSDKEventStreamsAuthTests/AWSMessageDecoderStreamTests.swift rename to Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/AWSMessageDecoderStreamTests.swift index 6adcfe86278..3978b1eb5f0 100644 --- a/Tests/Core/AWSSDKEventStreamsAuthTests/AWSMessageDecoderStreamTests.swift +++ b/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/AWSMessageDecoderStreamTests.swift @@ -9,10 +9,10 @@ import SmithyEventStreamsAPI import SmithyEventStreams import XCTest import ClientRuntime -import AWSClientRuntime import class SmithyStreams.BufferedStream final class AWSMessageDecoderStreamTests: XCTestCase { + func testIterator() async throws { let bufferedStream = BufferedStream( data: EventStreamTestData.validMessageDataWithAllHeaders() + diff --git a/Tests/Core/AWSSDKEventStreamsAuthTests/AWSMessageEncoderStreamTests.swift b/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/AWSMessageEncoderStreamTests.swift similarity index 88% rename from Tests/Core/AWSSDKEventStreamsAuthTests/AWSMessageEncoderStreamTests.swift rename to Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/AWSMessageEncoderStreamTests.swift index 583339f6fa3..8517cb9cce2 100644 --- a/Tests/Core/AWSSDKEventStreamsAuthTests/AWSMessageEncoderStreamTests.swift +++ b/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/AWSMessageEncoderStreamTests.swift @@ -16,7 +16,6 @@ import AWSSDKEventStreamsAuth import XCTest import AwsCommonRuntimeKit import ClientRuntime -@testable import AWSClientRuntime final class AWSMessageEncoderStreamTests: XCTestCase { let baseStream = AsyncThrowingStream { continuation in @@ -170,27 +169,3 @@ final class AWSMessageEncoderStreamTests: XCTestCase { ) } } - -class TestCustomAWSCredentialIdentityResolver: AWSCredentialIdentityResolver { - let credentials: AWSCredentialIdentity - - init(credentials: AWSCredentialIdentity) { - self.credentials = credentials - } - - convenience init() { - self.init(credentials: AWSCredentialIdentity( - accessKey: "AKIDEXAMPLE", - secret: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY", - expiration: .init(timeIntervalSinceNow: 30) - )) - } - - func getIdentity(identityProperties: Attributes?) async throws -> AWSCredentialIdentity { - return AWSCredentialIdentity( - accessKey: "AKIDEXAMPLE", - secret: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY", - expiration: .init(timeIntervalSinceNow: 30) - ) - } -} diff --git a/Tests/Core/AWSSDKEventStreamsAuthTests/EventStreamTestData.swift b/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/EventStreamTestData.swift similarity index 100% rename from Tests/Core/AWSSDKEventStreamsAuthTests/EventStreamTestData.swift rename to Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/EventStreamTestData.swift diff --git a/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/SigV4EventSigningTests.swift b/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/SigV4EventSigningTests.swift new file mode 100644 index 00000000000..45c7f4578b8 --- /dev/null +++ b/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/SigV4EventSigningTests.swift @@ -0,0 +1,93 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Smithy +import XCTest +import SmithyHTTPAuthAPI +import SmithyHTTPAuth +import SmithyHTTPAPI +import SmithyIdentity +import SmithyTestUtil +import AwsCommonRuntimeKit +import SmithyTimestamps +import SmithyEventStreams +import SmithyEventStreamsAPI +import AWSSDKIdentity +import AWSSDKHTTPAuth + +class SigV4EventSigningTests: XCTestCase { + + override func setUp() { + CommonRuntimeKit.initialize() + } + + func testSignEvent() async { + let credentials = AWSCredentialIdentity(accessKey: "fake access key", secret: "fake secret key") + + let encoder = SmithyEventStreams.DefaultMessageEncoder() + + let message = Message( + headers: [ + .init(name: "some-header", value: .string("value")), + ], + payload: "test payload".data(using: .utf8)! + ) + + // create Date with fractional seconds + let formatter = ISO8601DateFormatter() + formatter.timeZone = TimeZone(identifier: "UTC") + formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds] + let epoch = formatter.date(from: "1973-11-29T21:33:09.000001234Z")! + + let staticAWSCredentialIdentityResolver = try! StaticAWSCredentialIdentityResolver( + credentials + ) + + let context = ContextBuilder() + .withSigningName(value: "testservice") + .withRegion(value: "us-east-1") + .withIdentityResolver( + value: staticAWSCredentialIdentityResolver, + schemeID: "aws.auth#sigv4" + ) + .withIdentityResolver( + value: staticAWSCredentialIdentityResolver, + schemeID: "aws.auth#sigv4a" + ) + .build() + + let signingConfig = try! await context.makeEventStreamSigningConfig(date: epoch.withoutFractionalSeconds()) + + let prevSignature = try! "last message sts".data(using: .utf8)!.computeSHA256().encodeToHexString() + + let messagePayload = try! encoder.encode(message: message) + + let result = try! await AWSSigV4Signer().signEvent(payload: messagePayload, + previousSignature: prevSignature, + signingConfig: signingConfig) + XCTAssertEqual(":date", result.output.headers[0].name) + + guard case let .timestamp(dateHeaderValue) = result.output.headers[0].value else { + XCTFail() + return + } + + XCTAssertEqual(epoch.timeIntervalSince1970, dateHeaderValue.timeIntervalSince1970) + + XCTAssertEqual(":chunk-signature", result.output.headers[1].name) + print(result.signature) + guard case let .byteArray(actualSignatureBuffer) = result.output.headers[1].value else { + XCTFail() + return + } + let actualSignature = actualSignatureBuffer.encodeToHexString() + XCTAssertEqual(result.signature, actualSignature) + + let expected = "1ea04a4f6becd85ae3e38e379ffaf4bb95042603f209512476cc6416868b31ee" + XCTAssertEqual(expected, actualSignature) + } +} diff --git a/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/TestCustomAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/TestCustomAWSCredentialIdentityResolver.swift new file mode 100644 index 00000000000..4a67919cef5 --- /dev/null +++ b/Sources/Core/AWSSDKEventStreamsAuth/Tests/AWSSDKEventStreamsAuthTests/TestCustomAWSCredentialIdentityResolver.swift @@ -0,0 +1,33 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Smithy +import SmithyIdentity + +class TestCustomAWSCredentialIdentityResolver: AWSCredentialIdentityResolver { + let credentials: AWSCredentialIdentity + + init(credentials: AWSCredentialIdentity) { + self.credentials = credentials + } + + convenience init() { + self.init(credentials: AWSCredentialIdentity( + accessKey: "AKIDEXAMPLE", + secret: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY", + expiration: .init(timeIntervalSinceNow: 30) + )) + } + + func getIdentity(identityProperties: Attributes?) async throws -> AWSCredentialIdentity { + return AWSCredentialIdentity( + accessKey: "AKIDEXAMPLE", + secret: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY", + expiration: .init(timeIntervalSinceNow: 30) + ) + } +} diff --git a/Sources/Core/AWSSDKHTTPAuth/Package.swift.txt b/Sources/Core/AWSSDKHTTPAuth/Package.swift.txt new file mode 100644 index 00000000000..76728defcc9 --- /dev/null +++ b/Sources/Core/AWSSDKHTTPAuth/Package.swift.txt @@ -0,0 +1,44 @@ +// swift-tools-version: 5.9 + +import PackageDescription + +let package = Package( + name: "AWSSDKHTTPAuth", + platforms: [ + .macOS(.v10_15), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6) + ], + products: [ + .library(name: "AWSSDKHTTPAuth", targets: ["AWSSDKHTTPAuth"]), + ], + dependencies: [ + .package(id: "aws-sdk-swift.AWSSDKIdentity", from: "0.0.1"), + .package(id: "aws-sdk-swift.AWSSDKChecksums", from: "0.0.1"), + .package(url: "https://github.com/awslabs/aws-crt-swift", exact: "0.30.0"), + .package(id: "aws-sdk-swift.smithy-swift", from: "0.0.1"), + ], + targets: [ + .target( + name: "AWSSDKHTTPAuth", + dependencies: [ + .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), + .product(name: "ClientRuntime", package: "aws-sdk-swift.smithy-swift"), + .product(name: "Smithy", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyHTTPAuth", package: "aws-sdk-swift.smithy-swift"), + .product(name: "AWSSDKIdentity", package: "aws-sdk-swift.AWSSDKIdentity"), + .product(name: "AWSSDKChecksums", package: "aws-sdk-swift.AWSSDKChecksums"), + ] + ), + .testTarget( + name: "AWSSDKHTTPAuthTests", + dependencies: [ + "AWSSDKHTTPAuth", + .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), + .product(name: "ClientRuntime", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyTestUtil", package: "aws-sdk-swift.smithy-swift"), + ] + ), + ] +) diff --git a/Sources/Core/AWSSDKHTTPAuth/AWSSigV4Signer.swift b/Sources/Core/AWSSDKHTTPAuth/Sources/AWSSDKHTTPAuth/AWSSigV4Signer.swift similarity index 100% rename from Sources/Core/AWSSDKHTTPAuth/AWSSigV4Signer.swift rename to Sources/Core/AWSSDKHTTPAuth/Sources/AWSSDKHTTPAuth/AWSSigV4Signer.swift diff --git a/Sources/Core/AWSSDKHTTPAuth/CustomSigningPropertiesSetter.swift b/Sources/Core/AWSSDKHTTPAuth/Sources/AWSSDKHTTPAuth/CustomSigningPropertiesSetter.swift similarity index 100% rename from Sources/Core/AWSSDKHTTPAuth/CustomSigningPropertiesSetter.swift rename to Sources/Core/AWSSDKHTTPAuth/Sources/AWSSDKHTTPAuth/CustomSigningPropertiesSetter.swift diff --git a/Sources/Core/AWSSDKHTTPAuth/SigV4AAuthScheme.swift b/Sources/Core/AWSSDKHTTPAuth/Sources/AWSSDKHTTPAuth/SigV4AAuthScheme.swift similarity index 100% rename from Sources/Core/AWSSDKHTTPAuth/SigV4AAuthScheme.swift rename to Sources/Core/AWSSDKHTTPAuth/Sources/AWSSDKHTTPAuth/SigV4AAuthScheme.swift diff --git a/Sources/Core/AWSSDKHTTPAuth/SigV4AuthScheme.swift b/Sources/Core/AWSSDKHTTPAuth/Sources/AWSSDKHTTPAuth/SigV4AuthScheme.swift similarity index 100% rename from Sources/Core/AWSSDKHTTPAuth/SigV4AuthScheme.swift rename to Sources/Core/AWSSDKHTTPAuth/Sources/AWSSDKHTTPAuth/SigV4AuthScheme.swift diff --git a/Tests/Core/AWSSDKHTTPAuthTests/CustomSigningPropertiesSetterTests.swift b/Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests/CustomSigningPropertiesSetterTests.swift similarity index 99% rename from Tests/Core/AWSSDKHTTPAuthTests/CustomSigningPropertiesSetterTests.swift rename to Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests/CustomSigningPropertiesSetterTests.swift index 8c5adfdadb8..0a422706f8c 100644 --- a/Tests/Core/AWSSDKHTTPAuthTests/CustomSigningPropertiesSetterTests.swift +++ b/Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests/CustomSigningPropertiesSetterTests.swift @@ -12,7 +12,6 @@ import AWSSDKHTTPAuth import XCTest import SmithyTestUtil import ClientRuntime -@testable import AWSClientRuntime class CustomSigningPropertiesSetterTests: XCTestCase { private var customSetter: AWSSDKHTTPAuth.CustomSigningPropertiesSetter! diff --git a/Tests/Core/AWSSDKHTTPAuthTests/SigV4AuthSchemeTests.swift b/Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests/SigV4AuthSchemeTests.swift similarity index 100% rename from Tests/Core/AWSSDKHTTPAuthTests/SigV4AuthSchemeTests.swift rename to Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests/SigV4AuthSchemeTests.swift diff --git a/Tests/Core/AWSSDKHTTPAuthTests/SigV4SigningTests.swift b/Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests/SigV4SigningTests.swift similarity index 84% rename from Tests/Core/AWSSDKHTTPAuthTests/SigV4SigningTests.swift rename to Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests/SigV4SigningTests.swift index 9db2f5f32ba..153de6a97d2 100644 --- a/Tests/Core/AWSSDKHTTPAuthTests/SigV4SigningTests.swift +++ b/Sources/Core/AWSSDKHTTPAuth/Tests/AWSSDKHTTPAuthTests/SigV4SigningTests.swift @@ -17,11 +17,8 @@ import SmithyTimestamps import SmithyEventStreams import SmithyEventStreamsAPI import AWSSDKIdentity -import AWSSDKEventStreamsAuth import AWSSDKHTTPAuth -//@testable import AWSClientRuntime - class Sigv4SigningTests: XCTestCase { override func setUp() { CommonRuntimeKit.initialize() @@ -303,72 +300,6 @@ class Sigv4SigningTests: XCTestCase { } XCTAssertEqual("http://example.amazonaws.com:443?%E1%88%B4=bar&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Signature=32dea9080047b41e56ee852fe3eba49dae1911b9c5e5728cc1691704f168c70f", url.absoluteString) } - - func testSignEvent() async { - let credentials = AWSCredentialIdentity(accessKey: "fake access key", secret: "fake secret key") - - let encoder = SmithyEventStreams.DefaultMessageEncoder() - - let message = Message( - headers: [ - .init(name: "some-header", value: .string("value")), - ], - payload: "test payload".data(using: .utf8)! - ) - - // create Date with fractional seconds - let formatter = ISO8601DateFormatter() - formatter.timeZone = TimeZone(identifier: "UTC") - formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds] - let epoch = formatter.date(from: "1973-11-29T21:33:09.000001234Z")! - - let staticAWSCredentialIdentityResolver = try! StaticAWSCredentialIdentityResolver( - credentials - ) - - let context = ContextBuilder() - .withSigningName(value: "testservice") - .withRegion(value: "us-east-1") - .withIdentityResolver( - value: staticAWSCredentialIdentityResolver, - schemeID: "aws.auth#sigv4" - ) - .withIdentityResolver( - value: staticAWSCredentialIdentityResolver, - schemeID: "aws.auth#sigv4a" - ) - .build() - - let signingConfig = try! await context.makeEventStreamSigningConfig(date: epoch.withoutFractionalSeconds()) - - let prevSignature = try! "last message sts".data(using: .utf8)!.computeSHA256().encodeToHexString() - - let messagePayload = try! encoder.encode(message: message) - - let result = try! await AWSSigV4Signer().signEvent(payload: messagePayload, - previousSignature: prevSignature, - signingConfig: signingConfig) - XCTAssertEqual(":date", result.output.headers[0].name) - - guard case let .timestamp(dateHeaderValue) = result.output.headers[0].value else { - XCTFail() - return - } - - XCTAssertEqual(epoch.timeIntervalSince1970, dateHeaderValue.timeIntervalSince1970) - - XCTAssertEqual(":chunk-signature", result.output.headers[1].name) - print(result.signature) - guard case let .byteArray(actualSignatureBuffer) = result.output.headers[1].value else { - XCTFail() - return - } - let actualSignature = actualSignatureBuffer.encodeToHexString() - XCTAssertEqual(result.signature, actualSignature) - - let expected = "1ea04a4f6becd85ae3e38e379ffaf4bb95042603f209512476cc6416868b31ee" - XCTAssertEqual(expected, actualSignature) - } } class TestCustomAWSCredentialIdentityResolver: AWSCredentialIdentityResolver { diff --git a/Sources/Core/AWSSDKIdentity/Package.swift.txt b/Sources/Core/AWSSDKIdentity/Package.swift.txt new file mode 100644 index 00000000000..0a7f692819e --- /dev/null +++ b/Sources/Core/AWSSDKIdentity/Package.swift.txt @@ -0,0 +1,43 @@ +// swift-tools-version: 5.9 + +import PackageDescription + +let package = Package( + name: "AWSSDKIdentity", + platforms: [ + .macOS(.v10_15), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6) + ], + products: [ + .library(name: "AWSSDKIdentity", targets: ["AWSSDKIdentity"]), + ], + dependencies: [ + .package(id: "aws-sdk-swift.AWSSDKCommon", from: "0.0.1"), + .package(url: "https://github.com/awslabs/aws-crt-swift", exact: "0.30.0"), + .package(id: "aws-sdk-swift.smithy-swift", from: "0.0.1"), + ], + targets: [ + .target( + name: "AWSSDKIdentity", + dependencies: [ + .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), + .product(name: "ClientRuntime", package: "aws-sdk-swift.smithy-swift"), + .product(name: "Smithy", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyHTTPAPI", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyIdentityAPI", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyIdentity", package: "aws-sdk-swift.smithy-swift"), + .product(name: "AWSSDKCommon", package: "aws-sdk-swift.AWSSDKCommon"), + ] + ), + .testTarget( + name: "AWSSDKIdentityTests", + dependencies: [ + "AWSSDKIdentity", + .product(name: "Smithy", package: "aws-sdk-swift.smithy-swift"), + .product(name: "SmithyIdentity", package: "aws-sdk-swift.smithy-swift"), + ] + ), + ] +) diff --git a/Sources/Core/AWSSDKIdentity/CachedAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/CachedAWSCredentialIdentityResolver.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/CachedAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/CachedAWSCredentialIdentityResolver.swift diff --git a/Sources/Core/AWSSDKIdentity/DefaultAWSCredentialIdentityResolverChain.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/DefaultAWSCredentialIdentityResolverChain.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/DefaultAWSCredentialIdentityResolverChain.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/DefaultAWSCredentialIdentityResolverChain.swift diff --git a/Sources/Core/AWSSDKIdentity/ECSAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/ECSAWSCredentialIdentityResolver.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/ECSAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/ECSAWSCredentialIdentityResolver.swift diff --git a/Sources/Core/AWSSDKIdentity/EnvironmentAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/EnvironmentAWSCredentialIdentityResolver.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/EnvironmentAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/EnvironmentAWSCredentialIdentityResolver.swift diff --git a/Sources/Core/AWSSDKIdentity/IMDSAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/IMDSAWSCredentialIdentityResolver.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/IMDSAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/IMDSAWSCredentialIdentityResolver.swift diff --git a/Sources/Core/AWSSDKIdentity/ProcessAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/ProcessAWSCredentialIdentityResolver.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/ProcessAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/ProcessAWSCredentialIdentityResolver.swift diff --git a/Sources/Core/AWSSDKIdentity/ProfileAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/ProfileAWSCredentialIdentityResolver.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/ProfileAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/ProfileAWSCredentialIdentityResolver.swift diff --git a/Sources/Core/AWSSDKIdentity/SSOAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/SSOAWSCredentialIdentityResolver.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/SSOAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/SSOAWSCredentialIdentityResolver.swift diff --git a/Sources/Core/AWSSDKIdentity/STSAssumeRoleAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/STSAssumeRoleAWSCredentialIdentityResolver.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/STSAssumeRoleAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/STSAssumeRoleAWSCredentialIdentityResolver.swift diff --git a/Sources/Core/AWSSDKIdentity/STSWebIdentityAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/STSWebIdentityAWSCredentialIdentityResolver.swift similarity index 100% rename from Sources/Core/AWSSDKIdentity/STSWebIdentityAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Sources/AWSSDKIdentity/STSWebIdentityAWSCredentialIdentityResolver.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/CachedAWSCredentialIdentityResolverTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/CachedAWSCredentialIdentityResolverTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/CachedAWSCredentialIdentityResolverTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/CachedAWSCredentialIdentityResolverTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/DefaultAWSCredentialIdentityResolverChainTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/DefaultAWSCredentialIdentityResolverChainTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/DefaultAWSCredentialIdentityResolverChainTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/DefaultAWSCredentialIdentityResolverChainTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ECSAWSCredentialIdentityResolverTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ECSAWSCredentialIdentityResolverTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ECSAWSCredentialIdentityResolverTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ECSAWSCredentialIdentityResolverTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/EnvironmentAWSCredentialIdentityResolverTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/EnvironmentAWSCredentialIdentityResolverTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/EnvironmentAWSCredentialIdentityResolverTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/EnvironmentAWSCredentialIdentityResolverTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ProcessAWSCredentialIdentityResolverTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ProcessAWSCredentialIdentityResolverTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ProcessAWSCredentialIdentityResolverTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ProcessAWSCredentialIdentityResolverTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ProfileAWSCredentialIdentityResolverTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ProfileAWSCredentialIdentityResolverTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ProfileAWSCredentialIdentityResolverTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/ProfileAWSCredentialIdentityResolverTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/SSOAWSCredentialIdentityResolverTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/SSOAWSCredentialIdentityResolverTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/SSOAWSCredentialIdentityResolverTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/SSOAWSCredentialIdentityResolverTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/STSAssumeRoleAWSCredentialIdentityResolverTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/STSAssumeRoleAWSCredentialIdentityResolverTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/STSAssumeRoleAWSCredentialIdentityResolverTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityResolverTests/STSAssumeRoleAWSCredentialIdentityResolverTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityTests.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityTests.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/AWSCredentialIdentityTests.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/AWSCredentialIdentityTests.swift diff --git a/Tests/Core/AWSSDKIdentityTests/Mocks/MockAWSCredentialIdentityResolver.swift b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/Mocks/MockAWSCredentialIdentityResolver.swift similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/Mocks/MockAWSCredentialIdentityResolver.swift rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/Mocks/MockAWSCredentialIdentityResolver.swift diff --git a/Tests/Core/AWSSDKIdentityTests/Resources/config b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/Resources/config similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/Resources/config rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/Resources/config diff --git a/Tests/Core/AWSSDKIdentityTests/Resources/credentials b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/Resources/credentials similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/Resources/credentials rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/Resources/credentials diff --git a/Tests/Core/AWSSDKIdentityTests/Resources/sso_tests b/Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/Resources/sso_tests similarity index 100% rename from Tests/Core/AWSSDKIdentityTests/Resources/sso_tests rename to Sources/Core/AWSSDKIdentity/Tests/AWSSDKIdentityTests/Resources/sso_tests diff --git a/codegen/sdk-codegen/build.gradle.kts b/codegen/sdk-codegen/build.gradle.kts index 159421bd33a..eca9f6b4649 100644 --- a/codegen/sdk-codegen/build.gradle.kts +++ b/codegen/sdk-codegen/build.gradle.kts @@ -6,9 +6,12 @@ // This build file has been adapted from the Go v2 SDK, here: // https://github.com/aws/aws-sdk-go-v2/blob/master/codegen/sdk-codegen/build.gradle.kts +import org.jetbrains.kotlin.com.google.common.primitives.Chars import software.amazon.smithy.gradle.tasks.SmithyBuild import software.amazon.smithy.model.Model +import software.amazon.smithy.model.node.Node import software.amazon.smithy.model.shapes.ServiceShape +import java.nio.charset.Charset import java.util.Properties import kotlin.streams.toList @@ -167,13 +170,16 @@ fun discoverServices(): List { val serviceApi = service.getTrait(software.amazon.smithy.aws.traits.ServiceTrait::class.java).orNull() ?: error { "Expected aws.api#service trait attached to model ${file.absolutePath}" } val (name, version, _) = file.name.split(".") + val serviceClientVersions = Node.parse(rootProject.file("ServiceClientVersions.json").readText(Charset.forName("UTF-8"))) + val packageVersion = serviceClientVersions.expectObjectNode().getStringMember(name).orNull()?.value ?: + serviceClientVersions.expectObjectNode().getStringMember("sdk").get().value logger.info("discovered service: ${serviceApi.sdkId}") AwsService( name = service.id.toString(), packageName = "AWS${serviceApi.sdkId.filterNot { it.isWhitespace() }.capitalize()}", - packageVersion = "1.0", + packageVersion = packageVersion, modelFile = file, projectionName = name + "." + version.toLowerCase(), sdkId = serviceApi.sdkId, @@ -205,7 +211,6 @@ task("stageSdks") { copy { from("${it.outputDir}") into("${it.sourcesDir}") - exclude("Package.swift") } } } diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSSwiftDependency.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSSwiftDependency.kt index 2d856817d82..0d1dcdcf80a 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSSwiftDependency.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSSwiftDependency.kt @@ -11,34 +11,38 @@ class AWSSwiftDependency { val AWS_SDK_IDENTITY = SwiftDependency( "AWSSDKIdentity", "main", - "0.1.0", - "https://github.com/awslabs/aws-sdk-swift", - "../../../aws-sdk-swift", + "0.0.1", "aws-sdk-swift", + "../../../aws-sdk-swift", + "AWSSDKIdentity", + SwiftDependency.DistributionMethod.SPR, ) val AWS_SDK_HTTP_AUTH = SwiftDependency( "AWSSDKHTTPAuth", "main", - "0.1.0", - "https://github.com/awslabs/aws-sdk-swift", - "../../../aws-sdk-swift", + "0.0.1", "aws-sdk-swift", + "../../../aws-sdk-swift", + "AWSSDKHTTPAuth", + SwiftDependency.DistributionMethod.SPR, ) val AWS_SDK_EVENT_STREAMS_AUTH = SwiftDependency( "AWSSDKEventStreamsAuth", "main", - "0.1.0", - "https://github.com/awslabs/aws-sdk-swift", - "../../../aws-sdk-swift", + "0.0.1", "aws-sdk-swift", + "../../../aws-sdk-swift", + "AWSSDKEventStreamsAuth", + SwiftDependency.DistributionMethod.SPR, ) val AWS_CLIENT_RUNTIME = SwiftDependency( "AWSClientRuntime", "main", - "0.1.0", - "https://github.com/awslabs/aws-sdk-swift", - "../../../aws-sdk-swift", + "0.0.1", "aws-sdk-swift", + "../../../aws-sdk-swift", + "AWSClientRuntime", + SwiftDependency.DistributionMethod.SPR, ) } } diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftintegrations/PackageVersionIntegration.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftintegrations/PackageVersionIntegration.kt new file mode 100644 index 00000000000..fb16f7820b7 --- /dev/null +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftintegrations/PackageVersionIntegration.kt @@ -0,0 +1,24 @@ +package software.amazon.smithy.aws.swift.codegen.swiftintegrations + +import software.amazon.smithy.model.Model +import software.amazon.smithy.swift.codegen.SwiftDelegator +import software.amazon.smithy.swift.codegen.SwiftSettings +import software.amazon.smithy.swift.codegen.core.SwiftCodegenContext +import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator +import software.amazon.smithy.swift.codegen.integration.SwiftIntegration + +class PackageVersionIntegration : SwiftIntegration { + + override fun enabledForService(model: Model, settings: SwiftSettings): Boolean = true + + override fun writeAdditionalFiles( + ctx: SwiftCodegenContext, + protocolGenerationContext: ProtocolGenerator.GenerationContext, + delegator: SwiftDelegator + ) { + val path = "Sources/${ctx.settings.moduleName}/Resources/Package.version" + protocolGenerationContext.delegator.useFileWriter(path) { writer -> + writer.writeInline(ctx.settings.moduleVersion) + } + } +} diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftintegrations/RegistryConfigIntegration.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftintegrations/RegistryConfigIntegration.kt new file mode 100644 index 00000000000..2c49b72c557 --- /dev/null +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftintegrations/RegistryConfigIntegration.kt @@ -0,0 +1,43 @@ +package software.amazon.smithy.aws.swift.codegen.swiftintegrations + +import software.amazon.smithy.model.Model +import software.amazon.smithy.swift.codegen.SwiftDelegator +import software.amazon.smithy.swift.codegen.SwiftSettings +import software.amazon.smithy.swift.codegen.core.SwiftCodegenContext +import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator +import software.amazon.smithy.swift.codegen.integration.SwiftIntegration + +class RegistryConfigIntegration : SwiftIntegration { + + override fun enabledForService(model: Model, settings: SwiftSettings): Boolean = true + + override fun writeAdditionalFiles( + ctx: SwiftCodegenContext, + protocolGenerationContext: ProtocolGenerator.GenerationContext, + delegator: SwiftDelegator + ) { + protocolGenerationContext.delegator.useFileWriter(".swiftpm/configuration/registries.json") { writer -> + val json = """ + { + "registries" : { + "aws-sdk-swift" : { + "supportsAvailability" : false, + "url" : "https://d1b0xmm48lrxf5.cloudfront.net/" + } + }, + "security": { + "scopeOverrides": { + "aws-sdk-swift": { + "signing": { + "onUnsigned": "silentAllow" + } + } + } + }, + "version" : 1 + } + """.trimIndent() + writer.write(json) + } + } +} diff --git a/codegen/smithy-aws-swift-codegen/src/main/resources/META-INF/services/software.amazon.smithy.swift.codegen.integration.SwiftIntegration b/codegen/smithy-aws-swift-codegen/src/main/resources/META-INF/services/software.amazon.smithy.swift.codegen.integration.SwiftIntegration index 5be00c33f94..d3caedc2d82 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/resources/META-INF/services/software.amazon.smithy.swift.codegen.integration.SwiftIntegration +++ b/codegen/smithy-aws-swift-codegen/src/main/resources/META-INF/services/software.amazon.smithy.swift.codegen.integration.SwiftIntegration @@ -23,3 +23,5 @@ software.amazon.smithy.aws.swift.codegen.model.AWSEndpointTraitTransformer software.amazon.smithy.aws.swift.codegen.model.AWSDeprecatedShapeRemover software.amazon.smithy.aws.swift.codegen.AWSClientConfigurationIntegration software.amazon.smithy.swift.codegen.swiftintegrations.InitialRequestIntegration +software.amazon.smithy.aws.swift.codegen.swiftintegrations.RegistryConfigIntegration +software.amazon.smithy.aws.swift.codegen.swiftintegrations.PackageVersionIntegration \ No newline at end of file diff --git a/scripts/ci_steps/codegen_sdk.sh b/scripts/ci_steps/codegen_sdk.sh index e58c957808a..bcc3edbf418 100755 --- a/scripts/ci_steps/codegen_sdk.sh +++ b/scripts/ci_steps/codegen_sdk.sh @@ -12,6 +12,7 @@ rm -rf Tests/Services/* ./gradlew --stop # Regenerate the SDK Package.swift with all services +unset AWS_SWIFT_SDK_USE_LOCAL_DEPS cd AWSSDKSwiftCLI swift run AWSSDKSwiftCLI generate-package-manifest .. cd .. diff --git a/scripts/ci_steps/prepare_integration_tests.sh b/scripts/ci_steps/prepare_integration_tests.sh index bbcee456878..86476aa7ed0 100755 --- a/scripts/ci_steps/prepare_integration_tests.sh +++ b/scripts/ci_steps/prepare_integration_tests.sh @@ -15,6 +15,7 @@ rm -rf Sources/Services/* # Regenerate the SDK Package.swift to run only integration tests cd AWSSDKSwiftCLI +unset AWS_SWIFT_SDK_USE_LOCAL_DEPS swift run AWSSDKSwiftCLI generate-package-manifest --exclude-runtime-tests .. cd .. diff --git a/scripts/ci_steps/prepare_protocol_and_unit_tests.sh b/scripts/ci_steps/prepare_protocol_and_unit_tests.sh index f25745227fb..b2641ab0c21 100755 --- a/scripts/ci_steps/prepare_protocol_and_unit_tests.sh +++ b/scripts/ci_steps/prepare_protocol_and_unit_tests.sh @@ -3,6 +3,7 @@ set -e cd AWSSDKSwiftCLI +unset AWS_SWIFT_SDK_USE_LOCAL_DEPS swift run AWSSDKSwiftCLI generate-package-manifest --exclude-aws-services .. cd .. diff --git a/scripts/codegen.sh b/scripts/codegen.sh index 506fbbbc4ae..e04596ab867 100755 --- a/scripts/codegen.sh +++ b/scripts/codegen.sh @@ -32,6 +32,7 @@ rm -rf Tests/Services/* # Regenerate the package manifest and doc index, with args passed into this script cd AWSSDKSwiftCLI +unset AWS_SWIFT_SDK_USE_LOCAL_DEPS swift run AWSSDKSwiftCLI generate-package-manifest "$@" .. swift run AWSSDKSwiftCLI generate-doc-index .. cd ..