aws_sdk_gameliftstreams/waiters/
stream_group_active.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `stream_group_active` waiter.
5///
6/// This builder is intended to be used similar to the other fluent builders for
7/// normal operations on the client. However, instead of a `send` method, it has
8/// a `wait` method that takes a maximum amount of time to wait.
9///
10/// Construct this fluent builder using the client by importing the
11/// [`Waiters`](crate::client::Waiters) trait and calling the methods
12/// prefixed with `wait_until`.
13///
14#[derive(::std::clone::Clone, ::std::fmt::Debug)]
15pub struct StreamGroupActiveFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::get_stream_group::builders::GetStreamGroupInputBuilder,
18}
19impl StreamGroupActiveFluentBuilder {
20    /// Creates a new `StreamGroupActiveFluentBuilder`.
21    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
22        Self {
23            handle,
24            inner: ::std::default::Default::default(),
25        }
26    }
27    /// Access the GetStreamGroup as a reference.
28    pub fn as_input(&self) -> &crate::operation::get_stream_group::builders::GetStreamGroupInputBuilder {
29        &self.inner
30    }
31    /// Waits until a stream group is active
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::stream_group_active::StreamGroupActiveFinalPoll,
37        crate::waiters::stream_group_active::WaitUntilStreamGroupActiveError,
38    > {
39        let input = self
40            .inner
41            .build()
42            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
43        let runtime_plugins = crate::operation::get_stream_group::GetStreamGroup::operation_runtime_plugins(
44            self.handle.runtime_plugins.clone(),
45            &self.handle.conf,
46            ::std::option::Option::None,
47        )
48        .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
49        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
50        let runtime_components_builder = runtime_plugins
51            .apply_client_configuration(&mut cfg)
52            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
53        let time_components = runtime_components_builder.into_time_components();
54        let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
55        let time_source = time_components.time_source().expect("a time source is required by waiters");
56
57        let acceptor = move |result: ::std::result::Result<
58            &crate::operation::get_stream_group::GetStreamGroupOutput,
59            &crate::operation::get_stream_group::GetStreamGroupError,
60        >| {
61            // Matches: {"output":{"path":"Status","expected":"ACTIVE","comparator":"stringEquals"}}
62            if crate::waiters::matchers::match_get_stream_group_43a57eebc26a79968(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"Status","expected":"ERROR","comparator":"stringEquals"}}
66            if crate::waiters::matchers::match_get_stream_group_bd8922a7d94e1a858(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
68            }
69            // Matches: {"output":{"path":"Status","expected":"ACTIVE_WITH_ERRORS","comparator":"stringEquals"}}
70            if crate::waiters::matchers::match_get_stream_group_92a7ee4ef44adc1de(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
72            }
73            // Matches: {"output":{"path":"Status","expected":"DELETING","comparator":"stringEquals"}}
74            if crate::waiters::matchers::match_get_stream_group_8bb501de29126687a(result) {
75                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
76            }
77            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
78        };
79        let operation = move || {
80            let input = input.clone();
81            let runtime_plugins = runtime_plugins.clone();
82            async move { crate::operation::get_stream_group::GetStreamGroup::orchestrate(&runtime_plugins, input).await }
83        };
84        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
85            .min_delay(::std::time::Duration::from_secs(30))
86            .max_delay(::std::time::Duration::from_secs(3600))
87            .max_wait(max_wait)
88            .time_source(time_source)
89            .sleep_impl(sleep_impl)
90            .acceptor(acceptor)
91            .operation(operation)
92            .build();
93        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
94    }
95    /// <p>An <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream group resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4</code>. Example ID: <code>sg-1AB2C3De4</code>.</p>
96    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.inner = self.inner.identifier(input.into());
98        self
99    }
100    /// <p>An <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream group resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4</code>. Example ID: <code>sg-1AB2C3De4</code>.</p>
101    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.inner = self.inner.set_identifier(input);
103        self
104    }
105    /// <p>An <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream group resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4</code>. Example ID: <code>sg-1AB2C3De4</code>.</p>
106    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
107        self.inner.get_identifier()
108    }
109}
110
111/// Successful return type for the `stream_group_active` waiter.
112pub type StreamGroupActiveFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
113    crate::operation::get_stream_group::GetStreamGroupOutput,
114    ::aws_smithy_runtime_api::client::result::SdkError<
115        crate::operation::get_stream_group::GetStreamGroupError,
116        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
117    >,
118>;
119
120/// Error type for the `stream_group_active` waiter.
121pub type WaitUntilStreamGroupActiveError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
122    crate::operation::get_stream_group::GetStreamGroupOutput,
123    crate::operation::get_stream_group::GetStreamGroupError,
124>;