aws_sdk_iotjobsdataplane/operation/start_command_execution/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_command_execution::_start_command_execution_output::StartCommandExecutionOutputBuilder;
3
4pub use crate::operation::start_command_execution::_start_command_execution_input::StartCommandExecutionInputBuilder;
5
6impl crate::operation::start_command_execution::builders::StartCommandExecutionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::start_command_execution::StartCommandExecutionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_command_execution::StartCommandExecutionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_command_execution();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartCommandExecution`.
24///
25/// <p>Using the command created with the <code>CreateCommand</code> API, start a command execution on a specific device.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct StartCommandExecutionFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::start_command_execution::builders::StartCommandExecutionInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::start_command_execution::StartCommandExecutionOutput,
35        crate::operation::start_command_execution::StartCommandExecutionError,
36    > for StartCommandExecutionFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::start_command_execution::StartCommandExecutionOutput,
44            crate::operation::start_command_execution::StartCommandExecutionError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl StartCommandExecutionFluentBuilder {
51    /// Creates a new `StartCommandExecutionFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the StartCommandExecution as a reference.
60    pub fn as_input(&self) -> &crate::operation::start_command_execution::builders::StartCommandExecutionInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::start_command_execution::StartCommandExecutionOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::start_command_execution::StartCommandExecutionError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::start_command_execution::StartCommandExecution::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::start_command_execution::StartCommandExecution::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::start_command_execution::StartCommandExecutionOutput,
97        crate::operation::start_command_execution::StartCommandExecutionError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The Amazon Resource Number (ARN) of the device where the command execution is occurring.</p>
112    pub fn target_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.target_arn(input.into());
114        self
115    }
116    /// <p>The Amazon Resource Number (ARN) of the device where the command execution is occurring.</p>
117    pub fn set_target_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_target_arn(input);
119        self
120    }
121    /// <p>The Amazon Resource Number (ARN) of the device where the command execution is occurring.</p>
122    pub fn get_target_arn(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_target_arn()
124    }
125    /// <p>The Amazon Resource Number (ARN) of the command. For example, <code>arn:aws:iot:<region>
126    /// :
127    /// <accountid>
128    /// :command/
129    /// <commandname></commandname>
130    /// </accountid>
131    /// </region></code></p>
132    pub fn command_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.inner = self.inner.command_arn(input.into());
134        self
135    }
136    /// <p>The Amazon Resource Number (ARN) of the command. For example, <code>arn:aws:iot:<region>
137    /// :
138    /// <accountid>
139    /// :command/
140    /// <commandname></commandname>
141    /// </accountid>
142    /// </region></code></p>
143    pub fn set_command_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144        self.inner = self.inner.set_command_arn(input);
145        self
146    }
147    /// <p>The Amazon Resource Number (ARN) of the command. For example, <code>arn:aws:iot:<region>
148    /// :
149    /// <accountid>
150    /// :command/
151    /// <commandname></commandname>
152    /// </accountid>
153    /// </region></code></p>
154    pub fn get_command_arn(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_command_arn()
156    }
157    ///
158    /// Adds a key-value pair to `parameters`.
159    ///
160    /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
161    ///
162    /// <p>A list of parameters that are required by the <code>StartCommandExecution</code> API when performing the command on a device.</p>
163    pub fn parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::CommandParameterValue) -> Self {
164        self.inner = self.inner.parameters(k.into(), v);
165        self
166    }
167    /// <p>A list of parameters that are required by the <code>StartCommandExecution</code> API when performing the command on a device.</p>
168    pub fn set_parameters(
169        mut self,
170        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CommandParameterValue>>,
171    ) -> Self {
172        self.inner = self.inner.set_parameters(input);
173        self
174    }
175    /// <p>A list of parameters that are required by the <code>StartCommandExecution</code> API when performing the command on a device.</p>
176    pub fn get_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CommandParameterValue>> {
177        self.inner.get_parameters()
178    }
179    /// <p>Specifies the amount of time in second the device has to finish the command execution. A timer is started as soon as the command execution is created. If the command execution status is not set to another terminal state before the timer expires, it will automatically update to <code>TIMED_OUT</code>.</p>
180    pub fn execution_timeout_seconds(mut self, input: i64) -> Self {
181        self.inner = self.inner.execution_timeout_seconds(input);
182        self
183    }
184    /// <p>Specifies the amount of time in second the device has to finish the command execution. A timer is started as soon as the command execution is created. If the command execution status is not set to another terminal state before the timer expires, it will automatically update to <code>TIMED_OUT</code>.</p>
185    pub fn set_execution_timeout_seconds(mut self, input: ::std::option::Option<i64>) -> Self {
186        self.inner = self.inner.set_execution_timeout_seconds(input);
187        self
188    }
189    /// <p>Specifies the amount of time in second the device has to finish the command execution. A timer is started as soon as the command execution is created. If the command execution status is not set to another terminal state before the timer expires, it will automatically update to <code>TIMED_OUT</code>.</p>
190    pub fn get_execution_timeout_seconds(&self) -> &::std::option::Option<i64> {
191        self.inner.get_execution_timeout_seconds()
192    }
193    /// <p>The client token is used to implement idempotency. It ensures that the request completes no more than one time. If you retry a request with the same token and the same parameters, the request will complete successfully. However, if you retry the request using the same token but different parameters, an HTTP 409 conflict occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.</p>
194    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
195        self.inner = self.inner.client_token(input.into());
196        self
197    }
198    /// <p>The client token is used to implement idempotency. It ensures that the request completes no more than one time. If you retry a request with the same token and the same parameters, the request will complete successfully. However, if you retry the request using the same token but different parameters, an HTTP 409 conflict occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.</p>
199    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
200        self.inner = self.inner.set_client_token(input);
201        self
202    }
203    /// <p>The client token is used to implement idempotency. It ensures that the request completes no more than one time. If you retry a request with the same token and the same parameters, the request will complete successfully. However, if you retry the request using the same token but different parameters, an HTTP 409 conflict occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.</p>
204    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
205        self.inner.get_client_token()
206    }
207}