diff --git a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingCategoryClient.swift b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingCategoryClient.swift index 9416ecae34..4503f4eaf1 100644 --- a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingCategoryClient.swift +++ b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingCategoryClient.swift @@ -26,7 +26,7 @@ final class AWSCloudWatchLoggingCategoryClient { private let lock = NSLock() private let logGroupName: String private let region: String - private let credentialsProvider: CredentialsProvider + private let credentialsProvider: CredentialsProviding private let authentication: AuthCategoryUserBehavior private var loggersByKey: [LoggerKey: AWSCloudWatchLoggingSessionController] = [:] private let localStoreMaxSizeInMB: Int @@ -38,7 +38,7 @@ final class AWSCloudWatchLoggingCategoryClient { init( enable: Bool, - credentialsProvider: CredentialsProvider, + credentialsProvider: CredentialsProviding, authentication: AuthCategoryUserBehavior, loggingConstraintsResolver: AWSCloudWatchLoggingConstraintsResolver, logGroupName: String, diff --git a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingSessionController.swift b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingSessionController.swift index b12e9c134e..cb0c07da3c 100644 --- a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingSessionController.swift +++ b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingSessionController.swift @@ -25,7 +25,7 @@ final class AWSCloudWatchLoggingSessionController { private let logGroupName: String private let region: String private let localStoreMaxSizeInMB: Int - private let credentialsProvider: CredentialsProvider + private let credentialsProvider: CredentialsProviding private let authentication: AuthCategoryUserBehavior private let category: String private var session: AWSCloudWatchLoggingSession? @@ -59,7 +59,7 @@ final class AWSCloudWatchLoggingSessionController { } /// - Tag: CloudWatchLogSessionController.init - init(credentialsProvider: CredentialsProvider, + init(credentialsProvider: CredentialsProviding, authentication: AuthCategoryUserBehavior, logFilter: AWSCloudWatchLoggingFilterBehavior, category: String, @@ -103,10 +103,10 @@ final class AWSCloudWatchLoggingSessionController { private func createConsumer() throws -> LogBatchConsumer? { if self.client == nil { + // TODO: FrameworkMetadata Replacement let configuration = try CloudWatchLogsClient.CloudWatchLogsClientConfiguration( - credentialsProvider: credentialsProvider, - frameworkMetadata: AmplifyAWSServiceConfiguration.frameworkMetaData(), - region: region + region: region, + credentialsProvider: credentialsProvider ) #if os(iOS) || os(macOS) // no-op diff --git a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Configuration/DefaultRemoteLoggingConstraintsProvider.swift b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Configuration/DefaultRemoteLoggingConstraintsProvider.swift index 540bc7e3f9..5f8b29c344 100644 --- a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Configuration/DefaultRemoteLoggingConstraintsProvider.swift +++ b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Configuration/DefaultRemoteLoggingConstraintsProvider.swift @@ -14,7 +14,7 @@ import ClientRuntime public class DefaultRemoteLoggingConstraintsProvider: RemoteLoggingConstraintsProvider { public let refreshIntervalInSeconds: Int private let endpoint: URL - private let credentialProvider: CredentialsProvider? + private let credentialProvider: CredentialsProviding? private let region: String private let loggingConstraintsLocalStore: LoggingConstraintsLocalStore = UserDefaults.standard @@ -31,7 +31,7 @@ public class DefaultRemoteLoggingConstraintsProvider: RemoteLoggingConstraintsPr public init( endpoint: URL, region: String, - credentialProvider: CredentialsProvider? = nil, + credentialProvider: CredentialsProviding? = nil, refreshIntervalInSeconds: Int = 1200 ) { self.endpoint = endpoint @@ -79,7 +79,9 @@ public class DefaultRemoteLoggingConstraintsProvider: RemoteLoggingConstraintsPr let httpMethod = (request.httpMethod?.uppercased()) .flatMap(HttpMethodType.init(rawValue:)) ?? .get - let queryItems = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems ?? [] + let queryItems = URLComponents(url: url, resolvingAgainstBaseURL: false)? + .queryItems? + .map { ClientRuntime.URLQueryItem(name: $0.name, value: $0.value) } ?? [] let requestBuilder = SdkHttpRequestBuilder() .withHost(host) diff --git a/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/MockCloudWatchLogsClient.swift b/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/MockCloudWatchLogsClient.swift index e71877c8b6..1d290c6c00 100644 --- a/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/MockCloudWatchLogsClient.swift +++ b/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/MockCloudWatchLogsClient.swift @@ -224,5 +224,15 @@ class MockCloudWatchLogsClient: CloudWatchLogsClientProtocol { throw MockError.unimplemented } - + func deleteAccountPolicy(input: AWSCloudWatchLogs.DeleteAccountPolicyInput) async throws -> AWSCloudWatchLogs.DeleteAccountPolicyOutputResponse { + throw MockError.unimplemented + } + + func describeAccountPolicies(input: AWSCloudWatchLogs.DescribeAccountPoliciesInput) async throws -> AWSCloudWatchLogs.DescribeAccountPoliciesOutputResponse { + throw MockError.unimplemented + } + + func putAccountPolicy(input: AWSCloudWatchLogs.PutAccountPolicyInput) async throws -> AWSCloudWatchLogs.PutAccountPolicyOutputResponse { + throw MockError.unimplemented + } }