aws_sdk_amp/waiters/
scraper_active.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `scraper_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 ScraperActiveFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_scraper::builders::DescribeScraperInputBuilder,
18}
19impl ScraperActiveFluentBuilder {
20    /// Creates a new `ScraperActiveFluentBuilder`.
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 DescribeScraper as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_scraper::builders::DescribeScraperInputBuilder {
29        &self.inner
30    }
31    /// Wait until a scraper reaches ACTIVE status
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::scraper_active::ScraperActiveFinalPoll, crate::waiters::scraper_active::WaitUntilScraperActiveError>
36    {
37        let input = self
38            .inner
39            .build()
40            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
41        let runtime_plugins = crate::operation::describe_scraper::DescribeScraper::operation_runtime_plugins(
42            self.handle.runtime_plugins.clone(),
43            &self.handle.conf,
44            ::std::option::Option::None,
45        )
46        .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
47        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
48        let runtime_components_builder = runtime_plugins
49            .apply_client_configuration(&mut cfg)
50            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
51        let time_components = runtime_components_builder.into_time_components();
52        let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
53        let time_source = time_components.time_source().expect("a time source is required by waiters");
54
55        let acceptor = move |result: ::std::result::Result<
56            &crate::operation::describe_scraper::DescribeScraperOutput,
57            &crate::operation::describe_scraper::DescribeScraperError,
58        >| {
59            // Matches: {"output":{"path":"scraper.status.statusCode","expected":"ACTIVE","comparator":"stringEquals"}}
60            if crate::waiters::matchers::match_describe_scraper_d63d66a520d268282(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
62            }
63            // Matches: {"output":{"path":"scraper.status.statusCode","expected":"CREATION_FAILED","comparator":"stringEquals"}}
64            if crate::waiters::matchers::match_describe_scraper_d131ca8b97ceec9e9(result) {
65                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
66            }
67            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
68        };
69        let operation = move || {
70            let input = input.clone();
71            let runtime_plugins = runtime_plugins.clone();
72            async move { crate::operation::describe_scraper::DescribeScraper::orchestrate(&runtime_plugins, input).await }
73        };
74        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
75            .min_delay(::std::time::Duration::from_secs(2))
76            .max_delay(::std::time::Duration::from_secs(120))
77            .max_wait(max_wait)
78            .time_source(time_source)
79            .sleep_impl(sleep_impl)
80            .acceptor(acceptor)
81            .operation(operation)
82            .build();
83        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
84    }
85    /// <p>The ID of the scraper to describe.</p>
86    pub fn scraper_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
87        self.inner = self.inner.scraper_id(input.into());
88        self
89    }
90    /// <p>The ID of the scraper to describe.</p>
91    pub fn set_scraper_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
92        self.inner = self.inner.set_scraper_id(input);
93        self
94    }
95    /// <p>The ID of the scraper to describe.</p>
96    pub fn get_scraper_id(&self) -> &::std::option::Option<::std::string::String> {
97        self.inner.get_scraper_id()
98    }
99}
100
101/// Successful return type for the `scraper_active` waiter.
102pub type ScraperActiveFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
103    crate::operation::describe_scraper::DescribeScraperOutput,
104    ::aws_smithy_runtime_api::client::result::SdkError<
105        crate::operation::describe_scraper::DescribeScraperError,
106        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
107    >,
108>;
109
110/// Error type for the `scraper_active` waiter.
111pub type WaitUntilScraperActiveError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
112    crate::operation::describe_scraper::DescribeScraperOutput,
113    crate::operation::describe_scraper::DescribeScraperError,
114>;