Skip to content

Commit

Permalink
Merge branch 'main' into jbe/swift_6_0_on_linux
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelkins committed Sep 17, 2024
2 parents bb32d4f + 6c122dc commit 55c2801
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 31 deletions.
6 changes: 3 additions & 3 deletions Sources/ClientRuntime/Config/DefaultClientConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import struct SmithyRetriesAPI.RetryStrategyOptions
public protocol DefaultClientConfiguration: ClientConfiguration {
/// The configuration for retry of failed network requests.
///
/// Default options are provided if none are set.
/// Default options are used if none are set.
var retryStrategyOptions: RetryStrategyOptions { get set }

/// The log mode to use for client logging.
/// The log mode to use for request / response messages.
///
/// If none is provided, `.none` will be used.
var clientLogMode: ClientLogMode { get set }
Expand All @@ -31,7 +31,7 @@ public protocol DefaultClientConfiguration: ClientConfiguration {
/// If none is provided, only a default logger provider will be used.
var telemetryProvider: TelemetryProvider { get set }

/// Add an `InterceptorProvider` that will be used to provide interceptors for all operations.
/// Adds an `InterceptorProvider` that will be used to provide interceptors for all operations.
///
/// - Parameter provider: The `InterceptorProvider` to add.
func addInterceptorProvider(_ provider: InterceptorProvider)
Expand Down
20 changes: 10 additions & 10 deletions Sources/ClientRuntime/Config/DefaultHttpClientConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ import protocol SmithyIdentity.BearerTokenIdentityResolver

public protocol DefaultHttpClientConfiguration: ClientConfiguration {

/// The HTTP client to be used for the target platform, configured with the supplied configuration.
/// The HTTP client to use, configured with the supplied configuration.
///
/// By default, Swift SDK will set this to `CRTClientEngine` client on Mac & Linux platforms,
/// or `URLSessionHttpClient` on non-Mac Apple platforms.
/// By default, Swift SDK will set this to `CRTClientEngine` client on Linux platforms,
/// and `URLSessionHttpClient` on Apple platforms.
var httpClientEngine: HTTPClient { get set }

/// Configuration for the HTTP client.
var httpClientConfiguration: HttpClientConfiguration { get set }

/// List of auth schemes to use for client calls.
/// List of auth schemes to use for requests.
///
/// Defaults to auth schemes defined on the Smithy service model.
/// Defaults to auth schemes defined on the underlying Smithy model of a service.
var authSchemes: [AuthScheme]? { get set }

/// The auth scheme resolver to use for resolving auth scheme.
/// The auth scheme resolver to use for resolving the auth scheme.
///
/// Defaults to a auth scheme resolver generated based on Smithy service model.
/// Defaults to an auth scheme resolver generated based on the underlying Smithy model of a service.
var authSchemeResolver: AuthSchemeResolver { get set }

/// The token identity resolver to be used for bearer token authentication.
/// The token identity resolver to use for bearer token authentication.
///
/// If no resolver is supplied, the SDK will look for token in the `~/.aws/sso/cache` directory.
/// Default resolver will look for the token in the `~/.aws/sso/cache` directory.
var bearerTokenIdentityResolver: any BearerTokenIdentityResolver { get set }

/// Add an `HttpInterceptorProvider` that will be used to provide interceptors for all HTTP operations.
/// Adds a `HttpInterceptorProvider` that will be used to provide interceptors for all HTTP operations.
///
/// - Parameter provider: The `HttpInterceptorProvider` to add.
func addInterceptorProvider(_ provider: HttpInterceptorProvider)
Expand Down
27 changes: 9 additions & 18 deletions Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import struct SmithyRetriesAPI.RetryStrategyOptions
import struct SmithyRetries.DefaultRetryStrategy
import struct SmithyRetries.ExponentialBackoffStrategy

/// Provides configuration options for a Smithy-based service.
public struct DefaultSDKRuntimeConfiguration<DefaultSDKRuntimeRetryStrategy: RetryStrategy,
DefaultSDKRuntimeRetryErrorInfoProvider: RetryErrorInfoProvider> {

Expand All @@ -27,9 +26,9 @@ public struct DefaultSDKRuntimeConfiguration<DefaultSDKRuntimeRetryStrategy: Ret
/// The name of the client this config configures.
public var clientName: String

/// The HTTP client to be used for HTTP connections.
/// The HTTP client to use for HTTP connections.
///
/// If none is provided, the AWS CRT HTTP client will be used.
/// By default, Swift SDK will set this to `CRTClientEngine` client on Linux platforms, and `URLSessionHttpClient` on Apple platforms.
public var httpClientEngine: HTTPClient

/// The HTTP client configuration.
Expand All @@ -39,7 +38,7 @@ public struct DefaultSDKRuntimeConfiguration<DefaultSDKRuntimeRetryStrategy: Ret

/// The idempotency token generator to use.
///
/// If none is provided. one will be provided that supplies UUIDs.
/// Defaults to UUID generator.
public var idempotencyTokenGenerator: IdempotencyTokenGenerator

/// Configuration for telemetry, including tracing, metrics, and logging.
Expand All @@ -52,7 +51,7 @@ public struct DefaultSDKRuntimeConfiguration<DefaultSDKRuntimeRetryStrategy: Ret
/// If none is provided, default retry options will be used.
public var retryStrategyOptions: RetryStrategyOptions

/// The log mode to use for client logging.
/// The log mode to use for request / response messages.
///
/// If none is provided, `.none` will be used.
public var clientLogMode: ClientLogMode
Expand Down Expand Up @@ -88,7 +87,7 @@ public extension DefaultSDKRuntimeConfiguration {
/// The default HTTP client for the target platform, configured with the supplied configuration.
///
/// - Parameter httpClientConfiguration: The configuration for the HTTP client.
/// - Returns: The `CRTClientEngine` client on Mac & Linux platforms, returns `URLSessionHttpClient` on non-Mac Apple platforms.
/// - Returns: The `CRTClientEngine` client on Linux platforms, returns `URLSessionHttpClient` on Apple platforms.
static func makeClient(
httpClientConfiguration: HttpClientConfiguration = defaultHttpClientConfiguration
) -> HTTPClient {
Expand All @@ -107,26 +106,18 @@ public extension DefaultSDKRuntimeConfiguration {
#endif
}

/// The HTTP client configuration to use when none is provided.
///
/// Is the CRT HTTP client's configuration.
/// The default HTTP client configuration to use.
static var defaultHttpClientConfiguration: HttpClientConfiguration { HttpClientConfiguration() }

/// The idempotency token generator to use when none is provided.
///
/// Defaults to one that provides UUIDs.
/// The default idempotency token generator that returns UUIDs.
static var defaultIdempotencyTokenGenerator: IdempotencyTokenGenerator { DefaultIdempotencyTokenGenerator() }

/// The retry strategy options to use when none is provided.
///
/// Defaults to options with the defaults defined in `RetryStrategyOptions`.
/// The default retry strategy options with the exponential backoff strategy & other defaults defined in `RetryStrategyOptions`.
static var defaultRetryStrategyOptions: RetryStrategyOptions {
RetryStrategyOptions(backoffStrategy: ExponentialBackoffStrategy())
}

/// The log mode to use when none is provided
///
/// Defaults to `.none`.
/// The default client log mode is `.none`.
static var defaultClientLogMode: ClientLogMode { .none }

static var defaultAuthSchemeResolver: AuthSchemeResolver { DefaultAuthSchemeResolver() }
Expand Down

0 comments on commit 55c2801

Please sign in to comment.