commonMain.aws.sdk.kotlin.services.route53.waiters.Waiters.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of route53-jvm Show documentation
Show all versions of route53-jvm Show documentation
The AWS SDK for Kotlin client for Route 53
The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.route53.waiters
import aws.sdk.kotlin.services.route53.Route53Client
import aws.sdk.kotlin.services.route53.model.GetChangeRequest
import aws.sdk.kotlin.services.route53.model.GetChangeResponse
import aws.smithy.kotlin.runtime.retries.Outcome
import aws.smithy.kotlin.runtime.retries.StandardRetryStrategy
import aws.smithy.kotlin.runtime.retries.delay.InfiniteTokenBucket
import aws.smithy.kotlin.runtime.retries.policy.Acceptor
import aws.smithy.kotlin.runtime.retries.policy.AcceptorRetryPolicy
import aws.smithy.kotlin.runtime.retries.policy.OutputAcceptor
import aws.smithy.kotlin.runtime.retries.policy.RetryDirective
import kotlin.time.Duration.Companion.milliseconds
public suspend fun Route53Client.waitUntilResourceRecordSetsChanged(request: GetChangeRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 30_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 120_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val changeInfo = it.changeInfo
val status = changeInfo?.status?.value
status == "INSYNC"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getChange(request) }
}
public suspend fun Route53Client.waitUntilResourceRecordSetsChanged(block: GetChangeRequest.Builder.() -> Unit): Outcome =
waitUntilResourceRecordSetsChanged(GetChangeRequest.Builder().apply(block).build())