139 139 | import aws.sdk.kotlin.services.dynamodb.model.UpdateTimeToLiveResponse
|
140 140 | import aws.smithy.kotlin.runtime.auth.AuthSchemeId
|
141 141 | import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider
|
142 142 | import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderConfig
|
143 143 | import aws.smithy.kotlin.runtime.awsprotocol.ClockSkewInterceptor
|
144 144 | import aws.smithy.kotlin.runtime.client.AbstractSdkClientBuilder
|
145 145 | import aws.smithy.kotlin.runtime.client.AbstractSdkClientFactory
|
146 146 | import aws.smithy.kotlin.runtime.client.IdempotencyTokenConfig
|
147 147 | import aws.smithy.kotlin.runtime.client.IdempotencyTokenProvider
|
148 148 | import aws.smithy.kotlin.runtime.client.LogMode
|
149 + | import aws.smithy.kotlin.runtime.client.LogRedactionConfig
|
149 150 | import aws.smithy.kotlin.runtime.client.RetryClientConfig
|
150 151 | import aws.smithy.kotlin.runtime.client.RetryStrategyClientConfig
|
151 152 | import aws.smithy.kotlin.runtime.client.RetryStrategyClientConfigImpl
|
152 153 | import aws.smithy.kotlin.runtime.client.SdkClient
|
153 154 | import aws.smithy.kotlin.runtime.client.SdkClientConfig
|
154 155 | import aws.smithy.kotlin.runtime.client.region.RegionProvider
|
155 156 | import aws.smithy.kotlin.runtime.http.auth.AuthScheme
|
156 157 | import aws.smithy.kotlin.runtime.http.auth.HttpAuthConfig
|
157 158 | import aws.smithy.kotlin.runtime.http.config.HttpClientConfig
|
158 159 | import aws.smithy.kotlin.runtime.http.config.HttpEngineConfig
|
159 160 | import aws.smithy.kotlin.runtime.http.config.TimeoutConfig
|
160 161 | import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine
|
161 162 | import aws.smithy.kotlin.runtime.http.engine.HttpEngineConfigImpl
|
162 163 | import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor
|
163 164 | import aws.smithy.kotlin.runtime.net.url.Url
|
164 165 | import aws.smithy.kotlin.runtime.retries.RetryStrategy
|
165 166 | import aws.smithy.kotlin.runtime.retries.policy.RetryPolicy
|
166 167 | import aws.smithy.kotlin.runtime.telemetry.Global
|
167 168 | import aws.smithy.kotlin.runtime.telemetry.TelemetryConfig
|
168 169 | import aws.smithy.kotlin.runtime.telemetry.TelemetryProvider
|
169 170 | import aws.smithy.kotlin.runtime.util.LazyAsyncValue
|
170 171 | import kotlin.collections.List
|
172 + | import kotlin.collections.Set
|
171 173 | import kotlin.jvm.JvmStatic
|
172 174 | import kotlin.time.Duration
|
173 175 | import kotlin.time.Duration.Companion.milliseconds
|
174 176 | import kotlinx.coroutines.runBlocking
|
175 177 |
|
176 178 |
|
177 179 | public const val ServiceId: String = "DynamoDB"
|
178 180 | public const val SdkVersion: String = "1.6.108-SNAPSHOT"
|
179 181 | public const val ServiceApiVersion: String = "2012-08-10"
|
180 182 |
|
181 183 | /**
|
182 184 | * # Amazon DynamoDB
|
183 185 | * Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. DynamoDB lets you offload the administrative burdens of operating and scaling a distributed database, so that you don't have to worry about hardware provisioning, setup and configuration, replication, software patching, or cluster scaling.
|
184 186 | *
|
185 187 | * With DynamoDB, you can create database tables that can store and retrieve any amount of data, and serve any level of request traffic. You can scale up or scale down your tables' throughput capacity without downtime or performance degradation, and use the Amazon Web Services Management Console to monitor resource utilization and performance metrics.
|
186 188 | *
|
187 189 | * DynamoDB automatically spreads the data and traffic for your tables over a sufficient number of servers to handle your throughput and storage requirements, while maintaining consistent and fast performance. All of your data is stored on solid state disks (SSDs) and automatically replicated across multiple Availability Zones in an Amazon Web Services Region, providing built-in high availability and data durability.
|
188 190 | */
|
189 191 | public interface DynamoDbClient : SdkClient {
|
190 192 | /**
|
191 193 | * DynamoDbClient's configuration
|
192 194 | */
|
193 195 | public override val config: Config
|
194 196 |
|
195 197 | public companion object : AbstractAwsSdkClientFactory<Config, Config.Builder, DynamoDbClient, Builder>()
|
196 198 | {
|
197 199 | @JvmStatic
|
198 200 | override fun builder(): Builder = Builder()
|
199 201 |
|
200 202 | override fun finalizeConfig(builder: Builder) {
|
201 203 | super.finalizeConfig(builder)
|
202 204 | builder.config.interceptors.add(0, ClockSkewInterceptor())
|
203 205 | }
|
204 206 |
|
205 207 | override suspend fun finalizeEnvironmentalConfig(builder: Builder, sharedConfig: LazyAsyncValue<AwsSharedConfig>, activeProfile: LazyAsyncValue<AwsProfile>) {
|
206 208 | super.finalizeEnvironmentalConfig(builder, sharedConfig, activeProfile)
|
207 209 | builder.config.endpointUrl = builder.config.endpointUrl ?: resolveEndpointUrl(
|
208 210 | sharedConfig,
|
209 211 | "DynamoDb",
|
210 212 | "DYNAMODB",
|
211 213 | "dynamodb",
|
212 214 | )
|
213 215 | builder.config.accountIdEndpointMode = builder.config.accountIdEndpointMode ?: resolveAccountIdEndpointMode(profile = activeProfile)
|
214 216 | val epDiscoveryEnabled = resolveEndpointDiscoveryEnabled(profile = activeProfile, serviceRequiresEpDiscovery = false)
|
215 217 | builder.config.endpointDiscoverer = builder.config.endpointDiscoverer ?: if (epDiscoveryEnabled) DefaultDynamoDbEndpointDiscoverer() else null
|
216 218 | }
|
217 219 |
|
218 220 | override val defaultMaxAttempts: Int = 4
|
219 221 | override val defaultInitialDelay: Duration = 25.milliseconds
|
220 222 | }
|
221 223 |
|
222 224 | public class Builder internal constructor(): AbstractSdkClientBuilder<Config, Config.Builder, DynamoDbClient>() {
|
223 225 | override val config: Config.Builder = Config.Builder()
|
224 226 | override fun newClient(config: Config): DynamoDbClient = DefaultDynamoDbClient(config)
|
225 227 | }
|
226 228 |
|
227 - | public class Config private constructor(builder: Builder) : AwsSdkClientConfig, CredentialsProviderConfig, HttpAuthConfig, HttpClientConfig, HttpEngineConfig by builder.buildHttpEngineConfig(), IdempotencyTokenConfig, RetryClientConfig, RetryStrategyClientConfig by builder.buildRetryStrategyClientConfig(), SdkClientConfig, TelemetryConfig, TimeoutConfig {
|
229 + | public class Config private constructor(builder: Builder) : AwsSdkClientConfig, CredentialsProviderConfig, HttpAuthConfig, HttpClientConfig, HttpEngineConfig by builder.buildHttpEngineConfig(), IdempotencyTokenConfig, LogRedactionConfig, RetryClientConfig, RetryStrategyClientConfig by builder.buildRetryStrategyClientConfig(), SdkClientConfig, TelemetryConfig, TimeoutConfig {
|
228 230 | override val clientName: String = builder.clientName
|
229 231 | override val region: String? = (builder.region ?: runBlocking { builder.regionProvider?.getRegion() ?: resolveRegion() })?.let { validateRegion(it) }
|
230 232 | override val regionProvider: RegionProvider = builder.regionProvider ?: DefaultRegionProviderChain()
|
231 233 | public val accountIdEndpointMode: AccountIdEndpointMode = builder.accountIdEndpointMode ?: AccountIdEndpointMode.PREFERRED
|
232 234 | override val attemptTimeout: Duration? = builder.attemptTimeout
|
233 235 | override val authSchemePreference: kotlin.collections.List<aws.smithy.kotlin.runtime.auth.AuthSchemeId>? = builder.authSchemePreference
|
234 236 | override val authSchemes: kotlin.collections.List<aws.smithy.kotlin.runtime.http.auth.AuthScheme> = builder.authSchemes
|
235 237 | override val callTimeout: Duration? = builder.callTimeout
|
236 238 | override val credentialsProvider: CredentialsProvider = builder.credentialsProvider ?: DefaultChainCredentialsProvider(httpClient = httpClient, region = region).manage()
|
237 239 | public val endpointDiscoverer: DynamoDbEndpointDiscoverer? = builder.endpointDiscoverer
|
238 240 | public val endpointProvider: DynamoDbEndpointProvider = builder.endpointProvider ?: DefaultDynamoDbEndpointProvider()
|
239 241 | public val endpointUrl: Url? = builder.endpointUrl
|
240 242 | override val idempotencyTokenProvider: IdempotencyTokenProvider = builder.idempotencyTokenProvider ?: IdempotencyTokenProvider.Default
|
241 243 | override val interceptors: kotlin.collections.List<aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor> = builder.interceptors
|
242 244 | override val logMode: LogMode = builder.logMode ?: LogMode.Default
|
245 + | override val logRedactedHeaders: kotlin.collections.Set<kotlin.String> = builder.logRedactedHeaders
|
243 246 | override val retryPolicy: RetryPolicy<Any?> = builder.retryPolicy ?: AwsRetryPolicy.Default
|
244 247 | override val telemetryProvider: TelemetryProvider = builder.telemetryProvider ?: TelemetryProvider.Global
|
245 248 | override val useDualStack: Boolean = builder.useDualStack ?: false
|
246 249 | override val useFips: Boolean = builder.useFips ?: false
|
247 250 | override val applicationId: String? = builder.applicationId
|
248 251 | public val authSchemeProvider: DynamoDbAuthSchemeProvider = builder.authSchemeProvider ?: DefaultDynamoDbAuthSchemeProvider(authSchemePreference = authSchemePreference)
|
249 252 | public companion object {
|
250 253 | public inline operator fun invoke(block: Builder.() -> kotlin.Unit): Config = Builder().apply(block).build()
|
251 254 | }
|
252 255 |
|
253 256 | public fun toBuilder(): Builder = Builder().apply {
|
254 257 | clientName = this@Config.clientName
|
255 258 | region = this@Config.region
|
256 259 | regionProvider = this@Config.regionProvider
|
257 260 | accountIdEndpointMode = this@Config.accountIdEndpointMode
|
258 261 | attemptTimeout = this@Config.attemptTimeout
|
259 262 | authSchemePreference = this@Config.authSchemePreference
|
260 263 | authSchemes = this@Config.authSchemes
|
261 264 | callTimeout = this@Config.callTimeout
|
262 265 | credentialsProvider = this@Config.credentialsProvider
|
263 266 | endpointDiscoverer = this@Config.endpointDiscoverer
|
264 267 | endpointProvider = this@Config.endpointProvider
|
265 268 | endpointUrl = this@Config.endpointUrl
|
266 269 | httpClient = this@Config.httpClient
|
267 270 | idempotencyTokenProvider = this@Config.idempotencyTokenProvider
|
268 271 | interceptors = this@Config.interceptors.toMutableList()
|
269 272 | logMode = this@Config.logMode
|
273 + | logRedactedHeaders = this@Config.logRedactedHeaders.toMutableSet()
|
270 274 | retryPolicy = this@Config.retryPolicy
|
271 275 | retryStrategy = this@Config.retryStrategy
|
272 276 | telemetryProvider = this@Config.telemetryProvider
|
273 277 | useDualStack = this@Config.useDualStack
|
274 278 | useFips = this@Config.useFips
|
275 279 | applicationId = this@Config.applicationId
|
276 280 | authSchemeProvider = this@Config.authSchemeProvider
|
277 281 | }
|
278 282 |
|
279 - | public class Builder : AwsSdkClientConfig.Builder, CredentialsProviderConfig.Builder, HttpAuthConfig.Builder, HttpClientConfig.Builder, HttpEngineConfig.Builder by HttpEngineConfigImpl.BuilderImpl(), IdempotencyTokenConfig.Builder, RetryClientConfig.Builder, RetryStrategyClientConfig.Builder by RetryStrategyClientConfigImpl.BuilderImpl(), SdkClientConfig.Builder<Config>, TelemetryConfig.Builder, TimeoutConfig.Builder {
|
283 + | public class Builder : AwsSdkClientConfig.Builder, CredentialsProviderConfig.Builder, HttpAuthConfig.Builder, HttpClientConfig.Builder, HttpEngineConfig.Builder by HttpEngineConfigImpl.BuilderImpl(), IdempotencyTokenConfig.Builder, LogRedactionConfig.Builder, RetryClientConfig.Builder, RetryStrategyClientConfig.Builder by RetryStrategyClientConfigImpl.BuilderImpl(), SdkClientConfig.Builder<Config>, TelemetryConfig.Builder, TimeoutConfig.Builder {
|
280 284 | /**
|
281 285 | * A reader-friendly name for the client.
|
282 286 | */
|
283 287 | override var clientName: String = "DynamoDB"
|
284 288 |
|
285 289 | /**
|
286 290 | * The AWS region (e.g. `us-west-2`) to make requests to. See about AWS
|
287 291 | * [global infrastructure](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/) for more information.
|
288 292 | * When specified, this static region configuration takes precedence over other region resolution methods.
|
289 293 | *
|