Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor endpoints resolver to extend from smithy-swift #1454

Merged
merged 3 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions Sources/Core/AWSClientRuntime/Endpoints/AWSEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,3 @@ public struct AWSEndpoint: Equatable {
return try candidate.resolveEndpoint(region: region)
}
}

/// Keys used to access auth scheme container and auth scheme properties
private enum AuthSchemeKeys {
static let authSchemes = "authSchemes"
}

extension Endpoint {
/// Returns list of auth schemes
/// This is an internal API and subject to change without notice
/// - Returns: list of auth schemes if present
public func authSchemes() -> [[String: Any]]? {
guard let schemes = properties[AuthSchemeKeys.authSchemes] as? [[String: Any]] else {
return nil
}

return schemes
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
// Partition definitions are embedded as a static resource in this project, for now.
// When Trebuchet integration is performed, partitions should be obtained from Trebuchet for every
// build instead of being loaded from a static definition.
public let partitionJSON = """
public let awsPartitionJSON = """
{
"version": "1.1",
"partitions": [
Expand Down
123 changes: 0 additions & 123 deletions Sources/Core/AWSClientRuntime/Endpoints/AuthSchemeResolver.swift

This file was deleted.

16 changes: 0 additions & 16 deletions Sources/Core/AWSClientRuntime/Endpoints/CredentialScope.swift

This file was deleted.

13 changes: 0 additions & 13 deletions Sources/Core/AWSClientRuntime/Endpoints/EndpointError.swift

This file was deleted.

7 changes: 4 additions & 3 deletions Sources/Core/AWSClientRuntime/Endpoints/Partition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// SPDX-License-Identifier: Apache-2.0
//
import ClientRuntime

public struct Partition {

Expand Down Expand Up @@ -43,19 +44,19 @@ public struct Partition {
self.endpoints = endpoints
}

func canResolveEndpoint(region: String) -> Bool {
public func canResolveEndpoint(region: String) -> Bool {
return endpoints[region] != nil || region.range(of: regionRegex,
options: .regularExpression) != nil
}

func resolveEndpoint(region: String) throws -> AWSEndpoint {
public func resolveEndpoint(region: String) throws -> AWSEndpoint {
let shouldUsePartitionEndpoint = region.isEmpty && !partitionEndpoint.isEmpty
let resolvedRegion = shouldUsePartitionEndpoint ? partitionEndpoint : region
let endpointDefinition = endpointDefinitionForRegion(region: resolvedRegion)
return try endpointDefinition.resolve(region: region, defaults: defaults)
}

func endpointDefinitionForRegion(region: String) -> ServiceEndpointMetadata {
public func endpointDefinitionForRegion(region: String) -> ServiceEndpointMetadata {
if let endpointMetadata = endpoints[region] {
return endpointMetadata
} else if !isRegionalized {
Expand Down
Loading
Loading