diff --git a/Sources/Core/AWSClientRuntime/AWSClientConfiguration.swift b/Sources/Core/AWSClientRuntime/AWSClientConfiguration.swift index 2ec22d16b17..9008a28f6ca 100644 --- a/Sources/Core/AWSClientRuntime/AWSClientConfiguration.swift +++ b/Sources/Core/AWSClientRuntime/AWSClientConfiguration.swift @@ -182,7 +182,7 @@ extension AWSClientConfiguration { if let region = region { resolvedRegion = region } else { - resolvedRegion = await resolvedRegionResolver.resolveRegion() + resolvedRegion = await resolvedRegionResolver.getRegion() } let resolvedCredentialsProvider: AWSClientRuntime.CredentialsProviding if let credentialsProvider = credentialsProvider { diff --git a/Sources/Core/AWSClientRuntime/Regions/DefaultRegionResolver.swift b/Sources/Core/AWSClientRuntime/Regions/DefaultRegionResolver.swift index 9e98e391097..fe75f01c61d 100644 --- a/Sources/Core/AWSClientRuntime/Regions/DefaultRegionResolver.swift +++ b/Sources/Core/AWSClientRuntime/Regions/DefaultRegionResolver.swift @@ -21,11 +21,11 @@ public struct DefaultRegionResolver: RegionResolver { self.logger = SwiftLogger(label: "DefaultRegionProvider") } - public func resolveRegion() async -> String? { + public func getRegion() async -> String? { for provider in providers { logger.debug("Attempting to resolve region with: \(String(describing: type(of: provider)))") do { - if let region = try await provider.resolveRegion() { + if let region = try await provider.getRegion() { logger.debug("Resolved region with: \(String(describing: type(of: provider)))") return region } @@ -49,7 +49,7 @@ public struct StaticRegionResolver: RegionResolver { self.region = region } - public func resolveRegion() async -> String? { + public func getRegion() async -> String? { return region } } diff --git a/Sources/Core/AWSClientRuntime/Regions/EnvironmentRegionProvider.swift b/Sources/Core/AWSClientRuntime/Regions/EnvironmentRegionProvider.swift index 65afbabfc78..5c7262c9366 100644 --- a/Sources/Core/AWSClientRuntime/Regions/EnvironmentRegionProvider.swift +++ b/Sources/Core/AWSClientRuntime/Regions/EnvironmentRegionProvider.swift @@ -14,7 +14,7 @@ public struct EnvironmentRegionProvider: RegionProvider { self.env = env } - public func resolveRegion() async throws -> String? { + public func getRegion() async throws -> String? { return env.environmentVariable(key: AWS_ENVIRON_REGION) } } diff --git a/Sources/Core/AWSClientRuntime/Regions/IMDSRegionProvider.swift b/Sources/Core/AWSClientRuntime/Regions/IMDSRegionProvider.swift index 4872fdc3229..7e5067c8bea 100644 --- a/Sources/Core/AWSClientRuntime/Regions/IMDSRegionProvider.swift +++ b/Sources/Core/AWSClientRuntime/Regions/IMDSRegionProvider.swift @@ -14,7 +14,7 @@ public struct IMDSRegionProvider: RegionProvider { self.imdsClient = try IMDSClient() } - public func resolveRegion() async throws -> String? { + public func getRegion() async throws -> String? { return try await imdsClient.get(path: REGION_PATH) } } diff --git a/Sources/Core/AWSClientRuntime/Regions/ProfileRegionProvider.swift b/Sources/Core/AWSClientRuntime/Regions/ProfileRegionProvider.swift index 538bf98e01b..f4f5ac0242b 100644 --- a/Sources/Core/AWSClientRuntime/Regions/ProfileRegionProvider.swift +++ b/Sources/Core/AWSClientRuntime/Regions/ProfileRegionProvider.swift @@ -26,7 +26,7 @@ struct ProfileRegionProvider: RegionProvider { self.credentialsFilePath = credentialsFilePath } - func resolveRegion() async throws -> String? { + func getRegion() async throws -> String? { guard let configuration = try await fileBasedConfigurationProvider( configFilePath, credentialsFilePath diff --git a/Sources/Core/AWSClientRuntime/Regions/RegionProvider.swift b/Sources/Core/AWSClientRuntime/Regions/RegionProvider.swift index a18a3083c90..7d78894e9fb 100644 --- a/Sources/Core/AWSClientRuntime/Regions/RegionProvider.swift +++ b/Sources/Core/AWSClientRuntime/Regions/RegionProvider.swift @@ -7,5 +7,5 @@ import AwsCommonRuntimeKit public protocol RegionProvider { - func resolveRegion() async throws -> String? + func getRegion() async throws -> String? } diff --git a/Sources/Core/AWSClientRuntime/Regions/RegionResolver.swift b/Sources/Core/AWSClientRuntime/Regions/RegionResolver.swift index a9a3ab66ea9..83bc9dc3b64 100644 --- a/Sources/Core/AWSClientRuntime/Regions/RegionResolver.swift +++ b/Sources/Core/AWSClientRuntime/Regions/RegionResolver.swift @@ -7,5 +7,5 @@ public protocol RegionResolver { var providers: [RegionProvider] {get} - func resolveRegion() async -> String? + func getRegion() async -> String? } diff --git a/Tests/Core/AWSClientRuntimeTests/Regions/DefaultRegionResolverTests.swift b/Tests/Core/AWSClientRuntimeTests/Regions/DefaultRegionResolverTests.swift index fa0d59f7439..d0165dd266f 100644 --- a/Tests/Core/AWSClientRuntimeTests/Regions/DefaultRegionResolverTests.swift +++ b/Tests/Core/AWSClientRuntimeTests/Regions/DefaultRegionResolverTests.swift @@ -28,7 +28,7 @@ class DefaultRegionResolverTests: XCTestCase { let resolver = try DefaultRegionResolver( fileBasedConfigurationProvider: fileBasedConfigProvider ) - let region = await resolver.resolveRegion() + let region = await resolver.getRegion() XCTAssertEqual(region, "us-west-1") } catch { XCTFail("Failed to resolve region") @@ -47,7 +47,7 @@ class DefaultRegionResolverTests: XCTestCase { let resolver = try DefaultRegionResolver( fileBasedConfigurationProvider: fileBasedConfigProvider ) - let region = await resolver.resolveRegion() + let region = await resolver.getRegion() XCTAssertEqual(region, "us-east-2") } catch { XCTFail("Failed to resolve region") diff --git a/Tests/Core/AWSClientRuntimeTests/Regions/ProfileRegionProviderTests.swift b/Tests/Core/AWSClientRuntimeTests/Regions/ProfileRegionProviderTests.swift index 61fca56a22e..6fbfa3d9adc 100644 --- a/Tests/Core/AWSClientRuntimeTests/Regions/ProfileRegionProviderTests.swift +++ b/Tests/Core/AWSClientRuntimeTests/Regions/ProfileRegionProviderTests.swift @@ -23,7 +23,7 @@ class ProfileRegionProviderTests: XCTestCase { fileBasedConfigurationProvider: fileBasedConfigProvider, configFilePath: configPath ) - let region = try! await provider.resolveRegion() + let region = try! await provider.getRegion() XCTAssertEqual(region, "us-east-2") } @@ -33,7 +33,7 @@ class ProfileRegionProviderTests: XCTestCase { profileName: "west", configFilePath: configPath ) - let region = try! await provider.resolveRegion() + let region = try! await provider.getRegion() XCTAssertEqual(region, "us-west-2") } @@ -44,7 +44,7 @@ class ProfileRegionProviderTests: XCTestCase { }, credentialsFilePath: configPath ) - let region = try! await provider.resolveRegion() + let region = try! await provider.getRegion() XCTAssertEqual(region, "us-east-2") } }