aws-sdk-eventbridgev2 1.2.0

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

///
/// Fluent builder for the `event_bus_active` 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 EventBusActiveFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::describe_event_bus::builders::DescribeEventBusInputBuilder,
}
impl EventBusActiveFluentBuilder {
    /// Creates a new `EventBusActiveFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
        }
    }
    /// Access the DescribeEventBus as a reference.
    pub fn as_input(&self) -> &crate::operation::describe_event_bus::builders::DescribeEventBusInputBuilder {
        &self.inner
    }
    /// Waits until the event bus reports ACTIVE. Use after CreateEventBus (bus starts in CREATING) or UpdateEventBus (bus moves to UPDATING) before invoking operations that require an ACTIVE bus. Fails fast on the terminal failure states CREATE_FAILED, UPDATE_FAILED, and DELETE_FAILED, surfacing StateReason. CREATING, UPDATING, and DELETING are intentionally unmodeled intermediate states that fall through to the implicit retry.
    pub async fn wait(
        self,
        max_wait: ::std::time::Duration,
    ) -> ::std::result::Result<
        crate::waiters::event_bus_active::EventBusActiveFinalPoll,
        crate::waiters::event_bus_active::WaitUntilEventBusActiveError,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
        let runtime_plugins = crate::operation::describe_event_bus::DescribeEventBus::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::describe_event_bus::DescribeEventBusOutput,
            &crate::operation::describe_event_bus::DescribeEventBusError,
        >| {
            // Matches: {"output":{"path":"State","expected":"CREATE_FAILED","comparator":"stringEquals"}}
            if crate::waiters::matchers::match_describe_event_bus_8659e07b86810791e(result) {
                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
            }
            // Matches: {"output":{"path":"State","expected":"UPDATE_FAILED","comparator":"stringEquals"}}
            if crate::waiters::matchers::match_describe_event_bus_8597c34e347acea88(result) {
                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
            }
            // Matches: {"output":{"path":"State","expected":"DELETE_FAILED","comparator":"stringEquals"}}
            if crate::waiters::matchers::match_describe_event_bus_ea347153e485d2f14(result) {
                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
            }
            // Matches: {"output":{"path":"State","expected":"ACTIVE","comparator":"stringEquals"}}
            if crate::waiters::matchers::match_describe_event_bus_a84ba26c6d32fa04e(result) {
                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
            }
            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
        };
        let operation = move || {
            let input = input.clone();
            let runtime_plugins = runtime_plugins.clone();
            async move { crate::operation::describe_event_bus::DescribeEventBus::orchestrate(&runtime_plugins, input).await }
        };
        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
            .min_delay(::std::time::Duration::from_secs(2))
            .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
    }
    /// The Amazon Resource Name (ARN) that uniquely identifies an event bus.
    pub fn event_bus_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.event_bus_arn(input.into());
        self
    }
    /// The Amazon Resource Name (ARN) that uniquely identifies an event bus.
    pub fn set_event_bus_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_event_bus_arn(input);
        self
    }
    /// The Amazon Resource Name (ARN) that uniquely identifies an event bus.
    pub fn get_event_bus_arn(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_event_bus_arn()
    }
}

/// Successful return type for the `event_bus_active` waiter.
pub type EventBusActiveFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
    crate::operation::describe_event_bus::DescribeEventBusOutput,
    ::aws_smithy_runtime_api::client::result::SdkError<
        crate::operation::describe_event_bus::DescribeEventBusError,
        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
    >,
>;

/// Error type for the `event_bus_active` waiter.
pub type WaitUntilEventBusActiveError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
    crate::operation::describe_event_bus::DescribeEventBusOutput,
    crate::operation::describe_event_bus::DescribeEventBusError,
>;