commonMain.aws.sdk.kotlin.services.nimble.waiters.Waiters.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nimble-jvm Show documentation
Show all versions of nimble-jvm Show documentation
The AWS SDK for Kotlin client for nimble
The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.nimble.waiters
import aws.sdk.kotlin.services.nimble.NimbleClient
import aws.sdk.kotlin.services.nimble.model.GetLaunchProfileRequest
import aws.sdk.kotlin.services.nimble.model.GetLaunchProfileResponse
import aws.sdk.kotlin.services.nimble.model.GetStreamingImageRequest
import aws.sdk.kotlin.services.nimble.model.GetStreamingImageResponse
import aws.sdk.kotlin.services.nimble.model.GetStreamingSessionRequest
import aws.sdk.kotlin.services.nimble.model.GetStreamingSessionResponse
import aws.sdk.kotlin.services.nimble.model.GetStreamingSessionStreamRequest
import aws.sdk.kotlin.services.nimble.model.GetStreamingSessionStreamResponse
import aws.sdk.kotlin.services.nimble.model.GetStudioComponentRequest
import aws.sdk.kotlin.services.nimble.model.GetStudioComponentResponse
import aws.sdk.kotlin.services.nimble.model.GetStudioRequest
import aws.sdk.kotlin.services.nimble.model.GetStudioResponse
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
/**
* Wait until a LaunchProfile is Ready. Use this after invoking CreateLaunchProfile or UpdateLaunchProfile
*/
public suspend fun NimbleClient.waitUntilLaunchProfileReady(request: GetLaunchProfileRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 5_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 750_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val launchProfile = it.launchProfile
val state = launchProfile?.state?.value
state == "READY"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val launchProfile = it.launchProfile
val state = launchProfile?.state?.value
state == "CREATE_FAILED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val launchProfile = it.launchProfile
val state = launchProfile?.state?.value
state == "UPDATE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getLaunchProfile(request) }
}
/**
* Wait until a LaunchProfile is Ready. Use this after invoking CreateLaunchProfile or UpdateLaunchProfile
*/
public suspend fun NimbleClient.waitUntilLaunchProfileReady(block: GetLaunchProfileRequest.Builder.() -> Unit): Outcome =
waitUntilLaunchProfileReady(GetLaunchProfileRequest.Builder().apply(block).build())
/**
* Wait until a LaunchProfile is Deleted. Use this after invoking DeleteLaunchProfile
*/
public suspend fun NimbleClient.waitUntilLaunchProfileDeleted(request: GetLaunchProfileRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 5_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 750_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val launchProfile = it.launchProfile
val state = launchProfile?.state?.value
state == "DELETED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val launchProfile = it.launchProfile
val state = launchProfile?.state?.value
state == "DELETE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getLaunchProfile(request) }
}
/**
* Wait until a LaunchProfile is Deleted. Use this after invoking DeleteLaunchProfile
*/
public suspend fun NimbleClient.waitUntilLaunchProfileDeleted(block: GetLaunchProfileRequest.Builder.() -> Unit): Outcome =
waitUntilLaunchProfileDeleted(GetLaunchProfileRequest.Builder().apply(block).build())
/**
* Wait until a StreamingImage is Ready. Use this after invoking CreateStreamingImage or UpdateStreamingImage
*/
public suspend fun NimbleClient.waitUntilStreamingImageReady(request: GetStreamingImageRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 2_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 120_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val streamingImage = it.streamingImage
val state = streamingImage?.state?.value
state == "READY"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val streamingImage = it.streamingImage
val state = streamingImage?.state?.value
state == "CREATE_FAILED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val streamingImage = it.streamingImage
val state = streamingImage?.state?.value
state == "UPDATE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStreamingImage(request) }
}
/**
* Wait until a StreamingImage is Ready. Use this after invoking CreateStreamingImage or UpdateStreamingImage
*/
public suspend fun NimbleClient.waitUntilStreamingImageReady(block: GetStreamingImageRequest.Builder.() -> Unit): Outcome =
waitUntilStreamingImageReady(GetStreamingImageRequest.Builder().apply(block).build())
/**
* Wait until a StreamingImage Deleted. Use this after invoking DeleteStreamingImage
*/
public suspend fun NimbleClient.waitUntilStreamingImageDeleted(request: GetStreamingImageRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 2_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 120_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val streamingImage = it.streamingImage
val state = streamingImage?.state?.value
state == "DELETED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val streamingImage = it.streamingImage
val state = streamingImage?.state?.value
state == "DELETE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStreamingImage(request) }
}
/**
* Wait until a StreamingImage Deleted. Use this after invoking DeleteStreamingImage
*/
public suspend fun NimbleClient.waitUntilStreamingImageDeleted(block: GetStreamingImageRequest.Builder.() -> Unit): Outcome =
waitUntilStreamingImageDeleted(GetStreamingImageRequest.Builder().apply(block).build())
/**
* Wait until a StreamingSession is ready. Use this after invoking CreateStreamingSession, StartStreamingSession
*/
public suspend fun NimbleClient.waitUntilStreamingSessionReady(request: GetStreamingSessionRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 10_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 1_800_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val session = it.session
val state = session?.state?.value
state == "READY"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val session = it.session
val state = session?.state?.value
state == "CREATE_FAILED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val session = it.session
val state = session?.state?.value
state == "START_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStreamingSession(request) }
}
/**
* Wait until a StreamingSession is ready. Use this after invoking CreateStreamingSession, StartStreamingSession
*/
public suspend fun NimbleClient.waitUntilStreamingSessionReady(block: GetStreamingSessionRequest.Builder.() -> Unit): Outcome =
waitUntilStreamingSessionReady(GetStreamingSessionRequest.Builder().apply(block).build())
/**
* Wait until a StreamingSessionStopped. Use this after invoking StopStreamingSession
*/
public suspend fun NimbleClient.waitUntilStreamingSessionStopped(request: GetStreamingSessionRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 5_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 900_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val session = it.session
val state = session?.state?.value
state == "STOPPED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val session = it.session
val state = session?.state?.value
state == "STOP_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStreamingSession(request) }
}
/**
* Wait until a StreamingSessionStopped. Use this after invoking StopStreamingSession
*/
public suspend fun NimbleClient.waitUntilStreamingSessionStopped(block: GetStreamingSessionRequest.Builder.() -> Unit): Outcome =
waitUntilStreamingSessionStopped(GetStreamingSessionRequest.Builder().apply(block).build())
/**
* Wait until a StreamingSessionDeleted. Use this after invoking DeleteStreamingSession
*/
public suspend fun NimbleClient.waitUntilStreamingSessionDeleted(request: GetStreamingSessionRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 5_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 900_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val session = it.session
val state = session?.state?.value
state == "DELETED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val session = it.session
val state = session?.state?.value
state == "DELETE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStreamingSession(request) }
}
/**
* Wait until a StreamingSessionDeleted. Use this after invoking DeleteStreamingSession
*/
public suspend fun NimbleClient.waitUntilStreamingSessionDeleted(block: GetStreamingSessionRequest.Builder.() -> Unit): Outcome =
waitUntilStreamingSessionDeleted(GetStreamingSessionRequest.Builder().apply(block).build())
/**
* Wait until a StreamingSessionStream is ready. Use this after invoking CreateStreamingSessionStream
*/
public suspend fun NimbleClient.waitUntilStreamingSessionStreamReady(request: GetStreamingSessionStreamRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 5_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 150_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val stream = it.stream
val state = stream?.state?.value
state == "READY"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val stream = it.stream
val state = stream?.state?.value
state == "CREATE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStreamingSessionStream(request) }
}
/**
* Wait until a StreamingSessionStream is ready. Use this after invoking CreateStreamingSessionStream
*/
public suspend fun NimbleClient.waitUntilStreamingSessionStreamReady(block: GetStreamingSessionStreamRequest.Builder.() -> Unit): Outcome =
waitUntilStreamingSessionStreamReady(GetStreamingSessionStreamRequest.Builder().apply(block).build())
/**
* Wait until a Studio is Ready. Use this after invoking CreateStudio, UpdateStudio, or StartStudioSSOConfigurationRepair
*/
public suspend fun NimbleClient.waitUntilStudioReady(request: GetStudioRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 2_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 120_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val studio = it.studio
val state = studio?.state?.value
state == "READY"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val studio = it.studio
val state = studio?.state?.value
state == "CREATE_FAILED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val studio = it.studio
val state = studio?.state?.value
state == "UPDATE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStudio(request) }
}
/**
* Wait until a Studio is Ready. Use this after invoking CreateStudio, UpdateStudio, or StartStudioSSOConfigurationRepair
*/
public suspend fun NimbleClient.waitUntilStudioReady(block: GetStudioRequest.Builder.() -> Unit): Outcome =
waitUntilStudioReady(GetStudioRequest.Builder().apply(block).build())
/**
* Wait until a Studio is Deleted. Use this after invoking DeleteStudio.
*/
public suspend fun NimbleClient.waitUntilStudioDeleted(request: GetStudioRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 2_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 120_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val studio = it.studio
val state = studio?.state?.value
state == "DELETED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val studio = it.studio
val state = studio?.state?.value
state == "DELETE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStudio(request) }
}
/**
* Wait until a Studio is Deleted. Use this after invoking DeleteStudio.
*/
public suspend fun NimbleClient.waitUntilStudioDeleted(block: GetStudioRequest.Builder.() -> Unit): Outcome =
waitUntilStudioDeleted(GetStudioRequest.Builder().apply(block).build())
/**
* Wait until a StudioComponent is Ready. Use this after invoking CreateStudioComponent or UpdateStudioComponent
*/
public suspend fun NimbleClient.waitUntilStudioComponentReady(request: GetStudioComponentRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 2_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 120_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val studioComponent = it.studioComponent
val state = studioComponent?.state?.value
state == "READY"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val studioComponent = it.studioComponent
val state = studioComponent?.state?.value
state == "CREATE_FAILED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val studioComponent = it.studioComponent
val state = studioComponent?.state?.value
state == "UPDATE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStudioComponent(request) }
}
/**
* Wait until a StudioComponent is Ready. Use this after invoking CreateStudioComponent or UpdateStudioComponent
*/
public suspend fun NimbleClient.waitUntilStudioComponentReady(block: GetStudioComponentRequest.Builder.() -> Unit): Outcome =
waitUntilStudioComponentReady(GetStudioComponentRequest.Builder().apply(block).build())
/**
* Wait until a StudioComponent Deleted. Use this after invoking DeleteStudioComponent
*/
public suspend fun NimbleClient.waitUntilStudioComponentDeleted(request: GetStudioComponentRequest): Outcome {
val strategy = StandardRetryStrategy {
maxAttempts = 20
tokenBucket = InfiniteTokenBucket
delayProvider {
initialDelay = 1_000.milliseconds
scaleFactor = 1.5
jitter = 1.0
maxBackoff = 120_000.milliseconds
}
}
val acceptors = listOf>(
OutputAcceptor(RetryDirective.TerminateAndSucceed) {
val studioComponent = it.studioComponent
val state = studioComponent?.state?.value
state == "DELETED"
},
OutputAcceptor(RetryDirective.TerminateAndFail) {
val studioComponent = it.studioComponent
val state = studioComponent?.state?.value
state == "DELETE_FAILED"
},
)
val policy = AcceptorRetryPolicy(request, acceptors)
return strategy.retry(policy) { getStudioComponent(request) }
}
/**
* Wait until a StudioComponent Deleted. Use this after invoking DeleteStudioComponent
*/
public suspend fun NimbleClient.waitUntilStudioComponentDeleted(block: GetStudioComponentRequest.Builder.() -> Unit): Outcome =
waitUntilStudioComponentDeleted(GetStudioComponentRequest.Builder().apply(block).build())