aws_sdk_ssm/waiters/
command_executed.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `command_executed` 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 CommandExecutedFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::get_command_invocation::builders::GetCommandInvocationInputBuilder,
18}
19impl CommandExecutedFluentBuilder {
20    /// Creates a new `CommandExecutedFluentBuilder`.
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 GetCommandInvocation as a reference.
28    pub fn as_input(&self) -> &crate::operation::get_command_invocation::builders::GetCommandInvocationInputBuilder {
29        &self.inner
30    }
31    /// Wait for `command_executed`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::command_executed::CommandExecutedFinalPoll,
37        crate::waiters::command_executed::WaitUntilCommandExecutedError,
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_command_invocation::GetCommandInvocation::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_command_invocation::GetCommandInvocationOutput,
59            &crate::operation::get_command_invocation::GetCommandInvocationError,
60        >| {
61            // Matches: {"output":{"path":"Status","expected":"Pending","comparator":"stringEquals"}}
62            if crate::waiters::matchers::match_get_command_invocation_6f9158f9231e5d6f7(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
64            }
65            // Matches: {"output":{"path":"Status","expected":"InProgress","comparator":"stringEquals"}}
66            if crate::waiters::matchers::match_get_command_invocation_00bb09b3077ef8fe3(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
68            }
69            // Matches: {"output":{"path":"Status","expected":"Delayed","comparator":"stringEquals"}}
70            if crate::waiters::matchers::match_get_command_invocation_af4f0e62bb4e2df8e(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
72            }
73            // Matches: {"output":{"path":"Status","expected":"Success","comparator":"stringEquals"}}
74            if crate::waiters::matchers::match_get_command_invocation_1cbdfd792e1f604ca(result) {
75                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
76            }
77            // Matches: {"output":{"path":"Status","expected":"Cancelled","comparator":"stringEquals"}}
78            if crate::waiters::matchers::match_get_command_invocation_c1220f1751678bdb8(result) {
79                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
80            }
81            // Matches: {"output":{"path":"Status","expected":"TimedOut","comparator":"stringEquals"}}
82            if crate::waiters::matchers::match_get_command_invocation_6566d5bc527202e21(result) {
83                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
84            }
85            // Matches: {"output":{"path":"Status","expected":"Failed","comparator":"stringEquals"}}
86            if crate::waiters::matchers::match_get_command_invocation_74e589a66394e154b(result) {
87                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
88            }
89            // Matches: {"output":{"path":"Status","expected":"Cancelling","comparator":"stringEquals"}}
90            if crate::waiters::matchers::match_get_command_invocation_f9ea517237b0ffd40(result) {
91                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
92            }
93            // Matches: {"errorType":"InvocationDoesNotExist"}
94            if crate::waiters::matchers::match_get_command_invocation_bbe7351a13d015aba(result) {
95                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
96            }
97            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
98        };
99        let operation = move || {
100            let input = input.clone();
101            let runtime_plugins = runtime_plugins.clone();
102            async move { crate::operation::get_command_invocation::GetCommandInvocation::orchestrate(&runtime_plugins, input).await }
103        };
104        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
105            .min_delay(::std::time::Duration::from_secs(5))
106            .max_delay(::std::time::Duration::from_secs(120))
107            .max_wait(max_wait)
108            .time_source(time_source)
109            .sleep_impl(sleep_impl)
110            .acceptor(acceptor)
111            .operation(operation)
112            .build();
113        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
114    }
115    /// <p>(Required) The parent command ID of the invocation plugin.</p>
116    pub fn command_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.inner = self.inner.command_id(input.into());
118        self
119    }
120    /// <p>(Required) The parent command ID of the invocation plugin.</p>
121    pub fn set_command_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_command_id(input);
123        self
124    }
125    /// <p>(Required) The parent command ID of the invocation plugin.</p>
126    pub fn get_command_id(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_command_id()
128    }
129    /// <p>(Required) The ID of the managed node targeted by the command. A <i>managed node</i> can be an Amazon Elastic Compute Cloud (Amazon EC2) instance, edge device, and on-premises server or VM in your hybrid environment that is configured for Amazon Web Services Systems Manager.</p>
130    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.instance_id(input.into());
132        self
133    }
134    /// <p>(Required) The ID of the managed node targeted by the command. A <i>managed node</i> can be an Amazon Elastic Compute Cloud (Amazon EC2) instance, edge device, and on-premises server or VM in your hybrid environment that is configured for Amazon Web Services Systems Manager.</p>
135    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_instance_id(input);
137        self
138    }
139    /// <p>(Required) The ID of the managed node targeted by the command. A <i>managed node</i> can be an Amazon Elastic Compute Cloud (Amazon EC2) instance, edge device, and on-premises server or VM in your hybrid environment that is configured for Amazon Web Services Systems Manager.</p>
140    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_instance_id()
142    }
143    /// <p>The name of the step for which you want detailed results. If the document contains only one step, you can omit the name and details for that step. If the document contains more than one step, you must specify the name of the step for which you want to view details. Be sure to specify the name of the step, not the name of a plugin like <code>aws:RunShellScript</code>.</p>
144    /// <p>To find the <code>PluginName</code>, check the document content and find the name of the step you want details for. Alternatively, use <code>ListCommandInvocations</code> with the <code>CommandId</code> and <code>Details</code> parameters. The <code>PluginName</code> is the <code>Name</code> attribute of the <code>CommandPlugin</code> object in the <code>CommandPlugins</code> list.</p>
145    pub fn plugin_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.plugin_name(input.into());
147        self
148    }
149    /// <p>The name of the step for which you want detailed results. If the document contains only one step, you can omit the name and details for that step. If the document contains more than one step, you must specify the name of the step for which you want to view details. Be sure to specify the name of the step, not the name of a plugin like <code>aws:RunShellScript</code>.</p>
150    /// <p>To find the <code>PluginName</code>, check the document content and find the name of the step you want details for. Alternatively, use <code>ListCommandInvocations</code> with the <code>CommandId</code> and <code>Details</code> parameters. The <code>PluginName</code> is the <code>Name</code> attribute of the <code>CommandPlugin</code> object in the <code>CommandPlugins</code> list.</p>
151    pub fn set_plugin_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_plugin_name(input);
153        self
154    }
155    /// <p>The name of the step for which you want detailed results. If the document contains only one step, you can omit the name and details for that step. If the document contains more than one step, you must specify the name of the step for which you want to view details. Be sure to specify the name of the step, not the name of a plugin like <code>aws:RunShellScript</code>.</p>
156    /// <p>To find the <code>PluginName</code>, check the document content and find the name of the step you want details for. Alternatively, use <code>ListCommandInvocations</code> with the <code>CommandId</code> and <code>Details</code> parameters. The <code>PluginName</code> is the <code>Name</code> attribute of the <code>CommandPlugin</code> object in the <code>CommandPlugins</code> list.</p>
157    pub fn get_plugin_name(&self) -> &::std::option::Option<::std::string::String> {
158        self.inner.get_plugin_name()
159    }
160}
161
162/// Successful return type for the `command_executed` waiter.
163pub type CommandExecutedFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
164    crate::operation::get_command_invocation::GetCommandInvocationOutput,
165    ::aws_smithy_runtime_api::client::result::SdkError<
166        crate::operation::get_command_invocation::GetCommandInvocationError,
167        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
168    >,
169>;
170
171/// Error type for the `command_executed` waiter.
172pub type WaitUntilCommandExecutedError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
173    crate::operation::get_command_invocation::GetCommandInvocationOutput,
174    crate::operation::get_command_invocation::GetCommandInvocationError,
175>;