102 102 |
|
103 103 | override suspend fun finalizeEnvironmentalConfig(builder: Builder, sharedConfig: LazyAsyncValue<AwsSharedConfig>, activeProfile: LazyAsyncValue<AwsProfile>) {
|
104 104 | super.finalizeEnvironmentalConfig(builder, sharedConfig, activeProfile)
|
105 105 | builder.config.endpointUrl = builder.config.endpointUrl ?: resolveEndpointUrl(
|
106 106 | sharedConfig,
|
107 107 | "Sts",
|
108 108 | "STS",
|
109 109 | "sts",
|
110 110 | )
|
111 111 | }
|
112 112 | }
|
113 113 |
|
114 114 | public class Builder internal constructor(): AbstractSdkClientBuilder<Config, Config.Builder, StsClient>() {
|
115 115 | override val config: Config.Builder = Config.Builder()
|
116 116 | override fun newClient(config: Config): StsClient = DefaultStsClient(config)
|
117 117 | }
|
118 118 |
|
119 119 | public class Config private constructor(builder: Builder) : AwsSdkClientConfig, CredentialsProviderConfig, HttpAuthConfig, HttpClientConfig, HttpEngineConfig by builder.buildHttpEngineConfig(), RetryClientConfig, RetryStrategyClientConfig by builder.buildRetryStrategyClientConfig(), SdkClientConfig, SigV4aClientConfig, TelemetryConfig, TimeoutConfig {
|
120 120 | override val clientName: String = builder.clientName
|
121 121 | override val region: String? = (builder.region ?: runBlocking { builder.regionProvider?.getRegion() ?: resolveRegion() })?.let { validateRegion(it) }
|
122 122 | override val regionProvider: RegionProvider = builder.regionProvider ?: DefaultRegionProviderChain()
|
123 123 | override val attemptTimeout: Duration? = builder.attemptTimeout
|
124 124 | override val authSchemePreference: kotlin.collections.List<aws.smithy.kotlin.runtime.auth.AuthSchemeId>? = builder.authSchemePreference
|
125 125 | override val authSchemes: kotlin.collections.List<aws.smithy.kotlin.runtime.http.auth.AuthScheme> = builder.authSchemes
|
126 126 | override val callTimeout: Duration? = builder.callTimeout
|
127 127 | override val credentialsProvider: CredentialsProvider = builder.credentialsProvider ?: DefaultChainCredentialsProvider(httpClient = httpClient, region = region).manage()
|
128 128 | public val endpointProvider: StsEndpointProvider = builder.endpointProvider ?: DefaultStsEndpointProvider()
|
129 129 | public val endpointUrl: Url? = builder.endpointUrl
|
130 130 | override val interceptors: kotlin.collections.List<aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor> = builder.interceptors
|
131 131 | override val logMode: LogMode = builder.logMode ?: LogMode.Default
|
132 + | override val logRedactedHeaders: kotlin.collections.Set<kotlin.String> = builder.logRedactedHeaders ?: emptySet()
|
132 133 | override val retryPolicy: RetryPolicy<Any?> = builder.retryPolicy ?: AwsRetryPolicy.Default
|
133 134 | override val sigV4aSigningRegionSet: kotlin.collections.Set<kotlin.String>? = builder.sigV4aSigningRegionSet
|
134 135 | override val telemetryProvider: TelemetryProvider = builder.telemetryProvider ?: TelemetryProvider.Global
|
135 136 | override val useDualStack: Boolean = builder.useDualStack ?: false
|
136 137 | override val useFips: Boolean = builder.useFips ?: false
|
137 138 | override val applicationId: String? = builder.applicationId
|
138 139 | public val authSchemeProvider: StsAuthSchemeProvider = builder.authSchemeProvider ?: DefaultStsAuthSchemeProvider(authSchemePreference = authSchemePreference)
|
139 140 | public companion object {
|
140 141 | public inline operator fun invoke(block: Builder.() -> kotlin.Unit): Config = Builder().apply(block).build()
|
141 142 | }
|
142 143 |
|
143 144 | public fun toBuilder(): Builder = Builder().apply {
|
144 145 | clientName = this@Config.clientName
|
145 146 | region = this@Config.region
|
146 147 | regionProvider = this@Config.regionProvider
|
147 148 | attemptTimeout = this@Config.attemptTimeout
|
148 149 | authSchemePreference = this@Config.authSchemePreference
|
149 150 | authSchemes = this@Config.authSchemes
|
150 151 | callTimeout = this@Config.callTimeout
|
151 152 | credentialsProvider = this@Config.credentialsProvider
|
152 153 | endpointProvider = this@Config.endpointProvider
|
153 154 | endpointUrl = this@Config.endpointUrl
|
154 155 | httpClient = this@Config.httpClient
|
155 156 | interceptors = this@Config.interceptors.toMutableList()
|
156 157 | logMode = this@Config.logMode
|
158 + | logRedactedHeaders = this@Config.logRedactedHeaders
|
157 159 | retryPolicy = this@Config.retryPolicy
|
158 160 | retryStrategy = this@Config.retryStrategy
|
159 161 | sigV4aSigningRegionSet = this@Config.sigV4aSigningRegionSet
|
160 162 | telemetryProvider = this@Config.telemetryProvider
|
161 163 | useDualStack = this@Config.useDualStack
|
162 164 | useFips = this@Config.useFips
|
163 165 | applicationId = this@Config.applicationId
|
164 166 | authSchemeProvider = this@Config.authSchemeProvider
|
165 167 | }
|
166 168 |
|
167 169 | public class Builder : AwsSdkClientConfig.Builder, CredentialsProviderConfig.Builder, HttpAuthConfig.Builder, HttpClientConfig.Builder, HttpEngineConfig.Builder by HttpEngineConfigImpl.BuilderImpl(), RetryClientConfig.Builder, RetryStrategyClientConfig.Builder by RetryStrategyClientConfigImpl.BuilderImpl(), SdkClientConfig.Builder<Config>, SigV4aClientConfig.Builder, TelemetryConfig.Builder, TimeoutConfig.Builder {
|
168 170 | /**
|
169 171 | * A reader-friendly name for the client.
|
170 172 | */
|
171 173 | override var clientName: String = "STS"
|
172 174 |
|
173 175 | /**
|
174 176 | * The AWS region (e.g. `us-west-2`) to make requests to. See about AWS
|
175 177 | * [global infrastructure](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/) for more information.
|
176 178 | * When specified, this static region configuration takes precedence over other region resolution methods.
|
177 179 | *
|
178 180 | * The region resolution order is:
|
179 181 | * 1. Static region (if specified)
|
180 182 | * 2. Custom region provider (if configured)
|
181 183 | * 3. Default region provider chain
|
182 184 | */
|
183 185 | override var region: String? = null
|
184 186 |
|
185 187 | /**
|
186 188 | * An optional region provider that determines the AWS region for client operations. When specified, this provider
|
241 243 | * A custom endpoint to route requests to. The endpoint set here is passed to the configured
|
242 244 | * [endpointProvider], which may inspect and modify it as needed.
|
243 245 | *
|
244 246 | * Setting a custom endpointUrl should generally be preferred to overriding the [endpointProvider] and is
|
245 247 | * the recommended way to route requests to development or preview instances of a service.
|
246 248 | *
|
247 249 | * **This is an advanced config option.**
|
248 250 | */
|
249 251 | public var endpointUrl: Url? = null
|
250 252 |
|
251 253 | /**
|
252 254 | * Add an [aws.smithy.kotlin.runtime.client.Interceptor] that will have access to read and modify
|
253 255 | * the request and response objects as they are processed by the SDK.
|
254 256 | * Interceptors added using this method are executed in the order they are configured and are always
|
255 257 | * later than any added automatically by the SDK.
|
256 258 | */
|
257 259 | override var interceptors: kotlin.collections.MutableList<aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor> = kotlin.collections.mutableListOf()
|
258 260 |
|
259 261 | /**
|
260 262 | * Configure events that will be logged. By default clients will not output
|
261 263 | * raw requests or responses. Use this setting to opt-in to additional debug logging.
|
262 264 | *
|
263 265 | * This can be used to configure logging of requests, responses, retries, etc of SDK clients.
|
264 266 | *
|
265 267 | * **NOTE**: Logging of raw requests or responses may leak sensitive information! It may also have
|
266 268 | * performance considerations when dumping the request/response body. This is primarily a tool for
|
267 269 | * debug purposes.
|
268 270 | */
|
269 271 | override var logMode: LogMode? = null
|
270 272 |
|
273 + | /**
|
274 + | * Set of HTTP header names whose values will be replaced with "<REDACTED>" in
|
275 + | * request/response debug logging. Matching is case-insensitive. Empty by default
|
276 + | * (no headers are redacted).
|
277 + | */
|
278 + | override var logRedactedHeaders: kotlin.collections.Set<kotlin.String>? = null
|
279 + |
|
271 280 | /**
|
272 281 | * The policy to use for evaluating operation results and determining whether/how to retry.
|
273 282 | */
|
274 283 | override var retryPolicy: RetryPolicy<Any?>? = null
|
275 284 |
|
276 285 | /**
|
277 286 | * The set of regions to use when signing a request with SigV4a. If not provided this will automatically be set by the SDK.
|
278 287 | */
|
279 288 | override var sigV4aSigningRegionSet: kotlin.collections.Set<kotlin.String>? = null
|
280 289 |
|