aws-sdk-inspector2 1.123.0

AWS SDK for Inspector2
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

///
/// Fluent builder for the `connector_enabled` waiter.
///
/// This builder is intended to be used similar to the other fluent builders for
/// normal operations on the client. However, instead of a `send` method, it has
/// a `wait` method that takes a maximum amount of time to wait.
///
/// Construct this fluent builder using the client by importing the
/// [`Waiters`](crate::client::Waiters) trait and calling the methods
/// prefixed with `wait_until`.
///
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct ConnectorEnabledFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::list_connectors::builders::ListConnectorsInputBuilder,
}
impl ConnectorEnabledFluentBuilder {
    /// Creates a new `ConnectorEnabledFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
        }
    }
    /// Access the ListConnectors as a reference.
    pub fn as_input(&self) -> &crate::operation::list_connectors::builders::ListConnectorsInputBuilder {
        &self.inner
    }
    /// Wait until a connector reaches the ENABLED state, whether after CreateConnector or UpdateConnector. Caller MUST filter ListConnectors by the specific connector ARN so the matchers apply only to the target connector. Success when all returned items have enablementStatus == ENABLED. Failure when any item is in FAILED_TO_ENABLE or FAILED_TO_UPDATE.
    pub async fn wait(
        self,
        max_wait: ::std::time::Duration,
    ) -> ::std::result::Result<
        crate::waiters::connector_enabled::ConnectorEnabledFinalPoll,
        crate::waiters::connector_enabled::WaitUntilConnectorEnabledError,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
        let runtime_plugins = crate::operation::list_connectors::ListConnectors::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            ::std::option::Option::None,
        )
        .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        let runtime_components_builder = runtime_plugins
            .apply_client_configuration(&mut cfg)
            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
        let time_components = runtime_components_builder.into_time_components();
        let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
        let time_source = time_components.time_source().expect("a time source is required by waiters");

        let acceptor = move |result: ::std::result::Result<
            &crate::operation::list_connectors::ListConnectorsOutput,
            &crate::operation::list_connectors::ListConnectorsError,
        >| {
            // Matches: {"output":{"path":"items[].enablementStatus","expected":"ENABLED","comparator":"allStringEquals"}}
            if crate::waiters::matchers::match_list_connectors_163a0de927d8f23d5(result) {
                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
            }
            // Matches: {"output":{"path":"items[].enablementStatus","expected":"FAILED_TO_ENABLE","comparator":"anyStringEquals"}}
            if crate::waiters::matchers::match_list_connectors_48595df496a2b515e(result) {
                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
            }
            // Matches: {"output":{"path":"items[].enablementStatus","expected":"FAILED_TO_UPDATE","comparator":"anyStringEquals"}}
            if crate::waiters::matchers::match_list_connectors_60febd4eb6ee9a509(result) {
                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
            }
            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
        };
        let operation = move || {
            let input = input.clone();
            let runtime_plugins = runtime_plugins.clone();
            async move { crate::operation::list_connectors::ListConnectors::orchestrate(&runtime_plugins, input).await }
        };
        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
            .min_delay(::std::time::Duration::from_secs(30))
            .max_delay(::std::time::Duration::from_secs(120))
            .max_wait(max_wait)
            .time_source(time_source)
            .sleep_impl(sleep_impl)
            .acceptor(acceptor)
            .operation(operation)
            .build();
        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
    }
    /// <p>The maximum number of results to return in a single call. To retrieve the remaining results, make another request with the <code>nextToken</code> value returned from this request.</p>
    pub fn max_results(mut self, input: i32) -> Self {
        self.inner = self.inner.max_results(input);
        self
    }
    /// <p>The maximum number of results to return in a single call. To retrieve the remaining results, make another request with the <code>nextToken</code> value returned from this request.</p>
    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
        self.inner = self.inner.set_max_results(input);
        self
    }
    /// <p>The maximum number of results to return in a single call. To retrieve the remaining results, make another request with the <code>nextToken</code> value returned from this request.</p>
    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
        self.inner.get_max_results()
    }
    /// <p>A token to use for paginating results. Set this value to null for the first request. For subsequent calls, use the <code>nextToken</code> value returned from the previous request.</p>
    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.next_token(input.into());
        self
    }
    /// <p>A token to use for paginating results. Set this value to null for the first request. For subsequent calls, use the <code>nextToken</code> value returned from the previous request.</p>
    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_next_token(input);
        self
    }
    /// <p>A token to use for paginating results. Set this value to null for the first request. For subsequent calls, use the <code>nextToken</code> value returned from the previous request.</p>
    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_next_token()
    }
    /// <p>The filter criteria to apply to the list of connectors.</p>
    pub fn filter_criteria(mut self, input: crate::types::ConnectorFilterCriteria) -> Self {
        self.inner = self.inner.filter_criteria(input);
        self
    }
    /// <p>The filter criteria to apply to the list of connectors.</p>
    pub fn set_filter_criteria(mut self, input: ::std::option::Option<crate::types::ConnectorFilterCriteria>) -> Self {
        self.inner = self.inner.set_filter_criteria(input);
        self
    }
    /// <p>The filter criteria to apply to the list of connectors.</p>
    pub fn get_filter_criteria(&self) -> &::std::option::Option<crate::types::ConnectorFilterCriteria> {
        self.inner.get_filter_criteria()
    }
}

/// Successful return type for the `connector_enabled` waiter.
pub type ConnectorEnabledFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
    crate::operation::list_connectors::ListConnectorsOutput,
    ::aws_smithy_runtime_api::client::result::SdkError<
        crate::operation::list_connectors::ListConnectorsError,
        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
    >,
>;

/// Error type for the `connector_enabled` waiter.
pub type WaitUntilConnectorEnabledError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
    crate::operation::list_connectors::ListConnectorsOutput,
    crate::operation::list_connectors::ListConnectorsError,
>;