aws_sdk_iot/operation/associate_targets_with_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::associate_targets_with_job::_associate_targets_with_job_output::AssociateTargetsWithJobOutputBuilder;
3
4pub use crate::operation::associate_targets_with_job::_associate_targets_with_job_input::AssociateTargetsWithJobInputBuilder;
5
6impl crate::operation::associate_targets_with_job::builders::AssociateTargetsWithJobInputBuilder {
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::associate_targets_with_job::AssociateTargetsWithJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::associate_targets_with_job::AssociateTargetsWithJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.associate_targets_with_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `AssociateTargetsWithJob`.
24///
25/// <p>Associates a group with a continuous job. The following criteria must be met:</p>
26/// <ul>
27/// <li>
28/// <p>The job must have been created with the <code>targetSelection</code> field set to "CONTINUOUS".</p></li>
29/// <li>
30/// <p>The job status must currently be "IN_PROGRESS".</p></li>
31/// <li>
32/// <p>The total number of targets associated with a job must not exceed 100.</p></li>
33/// </ul>
34/// <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">AssociateTargetsWithJob</a> action.</p>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct AssociateTargetsWithJobFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::associate_targets_with_job::builders::AssociateTargetsWithJobInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::associate_targets_with_job::AssociateTargetsWithJobOutput,
44        crate::operation::associate_targets_with_job::AssociateTargetsWithJobError,
45    > for AssociateTargetsWithJobFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<
52            crate::operation::associate_targets_with_job::AssociateTargetsWithJobOutput,
53            crate::operation::associate_targets_with_job::AssociateTargetsWithJobError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl AssociateTargetsWithJobFluentBuilder {
60    /// Creates a new `AssociateTargetsWithJobFluentBuilder`.
61    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
62        Self {
63            handle,
64            inner: ::std::default::Default::default(),
65            config_override: ::std::option::Option::None,
66        }
67    }
68    /// Access the AssociateTargetsWithJob as a reference.
69    pub fn as_input(&self) -> &crate::operation::associate_targets_with_job::builders::AssociateTargetsWithJobInputBuilder {
70        &self.inner
71    }
72    /// Sends the request and returns the response.
73    ///
74    /// If an error occurs, an `SdkError` will be returned with additional details that
75    /// can be matched against.
76    ///
77    /// By default, any retryable failures will be retried twice. Retry behavior
78    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
79    /// set when configuring the client.
80    pub async fn send(
81        self,
82    ) -> ::std::result::Result<
83        crate::operation::associate_targets_with_job::AssociateTargetsWithJobOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::associate_targets_with_job::AssociateTargetsWithJobError,
86            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
87        >,
88    > {
89        let input = self
90            .inner
91            .build()
92            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
93        let runtime_plugins = crate::operation::associate_targets_with_job::AssociateTargetsWithJob::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::associate_targets_with_job::AssociateTargetsWithJob::orchestrate(&runtime_plugins, input).await
99    }
100
101    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
102    pub fn customize(
103        self,
104    ) -> crate::client::customize::CustomizableOperation<
105        crate::operation::associate_targets_with_job::AssociateTargetsWithJobOutput,
106        crate::operation::associate_targets_with_job::AssociateTargetsWithJobError,
107        Self,
108    > {
109        crate::client::customize::CustomizableOperation::new(self)
110    }
111    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
112        self.set_config_override(::std::option::Option::Some(config_override.into()));
113        self
114    }
115
116    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
117        self.config_override = config_override;
118        self
119    }
120    ///
121    /// Appends an item to `targets`.
122    ///
123    /// To override the contents of this collection use [`set_targets`](Self::set_targets).
124    ///
125    /// <p>A list of thing group ARNs that define the targets of the job.</p>
126    pub fn targets(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.targets(input.into());
128        self
129    }
130    /// <p>A list of thing group ARNs that define the targets of the job.</p>
131    pub fn set_targets(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
132        self.inner = self.inner.set_targets(input);
133        self
134    }
135    /// <p>A list of thing group ARNs that define the targets of the job.</p>
136    pub fn get_targets(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
137        self.inner.get_targets()
138    }
139    /// <p>The unique identifier you assigned to this job when it was created.</p>
140    pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.job_id(input.into());
142        self
143    }
144    /// <p>The unique identifier you assigned to this job when it was created.</p>
145    pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_job_id(input);
147        self
148    }
149    /// <p>The unique identifier you assigned to this job when it was created.</p>
150    pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_job_id()
152    }
153    /// <p>An optional comment string describing why the job was associated with the targets.</p>
154    pub fn comment(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155        self.inner = self.inner.comment(input.into());
156        self
157    }
158    /// <p>An optional comment string describing why the job was associated with the targets.</p>
159    pub fn set_comment(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160        self.inner = self.inner.set_comment(input);
161        self
162    }
163    /// <p>An optional comment string describing why the job was associated with the targets.</p>
164    pub fn get_comment(&self) -> &::std::option::Option<::std::string::String> {
165        self.inner.get_comment()
166    }
167    /// <p>The namespace used to indicate that a job is a customer-managed job.</p>
168    /// <p>When you specify a value for this parameter, Amazon Web Services IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.</p>
169    /// <p><code>$aws/things/<i>THING_NAME</i>/jobs/<i>JOB_ID</i>/notify-namespace-<i>NAMESPACE_ID</i>/</code></p><note>
170    /// <p>The <code>namespaceId</code> feature is only supported by IoT Greengrass at this time. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/setting-up.html">Setting up IoT Greengrass core devices.</a></p>
171    /// </note>
172    pub fn namespace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
173        self.inner = self.inner.namespace_id(input.into());
174        self
175    }
176    /// <p>The namespace used to indicate that a job is a customer-managed job.</p>
177    /// <p>When you specify a value for this parameter, Amazon Web Services IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.</p>
178    /// <p><code>$aws/things/<i>THING_NAME</i>/jobs/<i>JOB_ID</i>/notify-namespace-<i>NAMESPACE_ID</i>/</code></p><note>
179    /// <p>The <code>namespaceId</code> feature is only supported by IoT Greengrass at this time. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/setting-up.html">Setting up IoT Greengrass core devices.</a></p>
180    /// </note>
181    pub fn set_namespace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182        self.inner = self.inner.set_namespace_id(input);
183        self
184    }
185    /// <p>The namespace used to indicate that a job is a customer-managed job.</p>
186    /// <p>When you specify a value for this parameter, Amazon Web Services IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.</p>
187    /// <p><code>$aws/things/<i>THING_NAME</i>/jobs/<i>JOB_ID</i>/notify-namespace-<i>NAMESPACE_ID</i>/</code></p><note>
188    /// <p>The <code>namespaceId</code> feature is only supported by IoT Greengrass at this time. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/setting-up.html">Setting up IoT Greengrass core devices.</a></p>
189    /// </note>
190    pub fn get_namespace_id(&self) -> &::std::option::Option<::std::string::String> {
191        self.inner.get_namespace_id()
192    }
193}