aws_sdk_batch/operation/update_consumable_resource/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_consumable_resource::_update_consumable_resource_output::UpdateConsumableResourceOutputBuilder;
3
4pub use crate::operation::update_consumable_resource::_update_consumable_resource_input::UpdateConsumableResourceInputBuilder;
5
6impl crate::operation::update_consumable_resource::builders::UpdateConsumableResourceInputBuilder {
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::update_consumable_resource::UpdateConsumableResourceOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_consumable_resource::UpdateConsumableResourceError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_consumable_resource();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateConsumableResource`.
24///
25/// <p>Updates a consumable resource.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct UpdateConsumableResourceFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::update_consumable_resource::builders::UpdateConsumableResourceInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::update_consumable_resource::UpdateConsumableResourceOutput,
35        crate::operation::update_consumable_resource::UpdateConsumableResourceError,
36    > for UpdateConsumableResourceFluentBuilder
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::update_consumable_resource::UpdateConsumableResourceOutput,
44            crate::operation::update_consumable_resource::UpdateConsumableResourceError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl UpdateConsumableResourceFluentBuilder {
51    /// Creates a new `UpdateConsumableResourceFluentBuilder`.
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 UpdateConsumableResource as a reference.
60    pub fn as_input(&self) -> &crate::operation::update_consumable_resource::builders::UpdateConsumableResourceInputBuilder {
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::update_consumable_resource::UpdateConsumableResourceOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::update_consumable_resource::UpdateConsumableResourceError,
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::update_consumable_resource::UpdateConsumableResource::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::update_consumable_resource::UpdateConsumableResource::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::update_consumable_resource::UpdateConsumableResourceOutput,
97        crate::operation::update_consumable_resource::UpdateConsumableResourceError,
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 name or ARN of the consumable resource to be updated.</p>
112    pub fn consumable_resource(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.consumable_resource(input.into());
114        self
115    }
116    /// <p>The name or ARN of the consumable resource to be updated.</p>
117    pub fn set_consumable_resource(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_consumable_resource(input);
119        self
120    }
121    /// <p>The name or ARN of the consumable resource to be updated.</p>
122    pub fn get_consumable_resource(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_consumable_resource()
124    }
125    /// <p>Indicates how the quantity of the consumable resource will be updated. Must be one of:</p>
126    /// <ul>
127    /// <li>
128    /// <p><code>SET</code></p>
129    /// <p>Sets the quantity of the resource to the value specified by the <code>quantity</code> parameter.</p></li>
130    /// <li>
131    /// <p><code>ADD</code></p>
132    /// <p>Increases the quantity of the resource by the value specified by the <code>quantity</code> parameter.</p></li>
133    /// <li>
134    /// <p><code>REMOVE</code></p>
135    /// <p>Reduces the quantity of the resource by the value specified by the <code>quantity</code> parameter.</p></li>
136    /// </ul>
137    pub fn operation(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.inner = self.inner.operation(input.into());
139        self
140    }
141    /// <p>Indicates how the quantity of the consumable resource will be updated. Must be one of:</p>
142    /// <ul>
143    /// <li>
144    /// <p><code>SET</code></p>
145    /// <p>Sets the quantity of the resource to the value specified by the <code>quantity</code> parameter.</p></li>
146    /// <li>
147    /// <p><code>ADD</code></p>
148    /// <p>Increases the quantity of the resource by the value specified by the <code>quantity</code> parameter.</p></li>
149    /// <li>
150    /// <p><code>REMOVE</code></p>
151    /// <p>Reduces the quantity of the resource by the value specified by the <code>quantity</code> parameter.</p></li>
152    /// </ul>
153    pub fn set_operation(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.inner = self.inner.set_operation(input);
155        self
156    }
157    /// <p>Indicates how the quantity of the consumable resource will be updated. Must be one of:</p>
158    /// <ul>
159    /// <li>
160    /// <p><code>SET</code></p>
161    /// <p>Sets the quantity of the resource to the value specified by the <code>quantity</code> parameter.</p></li>
162    /// <li>
163    /// <p><code>ADD</code></p>
164    /// <p>Increases the quantity of the resource by the value specified by the <code>quantity</code> parameter.</p></li>
165    /// <li>
166    /// <p><code>REMOVE</code></p>
167    /// <p>Reduces the quantity of the resource by the value specified by the <code>quantity</code> parameter.</p></li>
168    /// </ul>
169    pub fn get_operation(&self) -> &::std::option::Option<::std::string::String> {
170        self.inner.get_operation()
171    }
172    /// <p>The change in the total quantity of the consumable resource. The <code>operation</code> parameter determines whether the value specified here will be the new total quantity, or the amount by which the total quantity will be increased or reduced. Must be a non-negative value.</p>
173    pub fn quantity(mut self, input: i64) -> Self {
174        self.inner = self.inner.quantity(input);
175        self
176    }
177    /// <p>The change in the total quantity of the consumable resource. The <code>operation</code> parameter determines whether the value specified here will be the new total quantity, or the amount by which the total quantity will be increased or reduced. Must be a non-negative value.</p>
178    pub fn set_quantity(mut self, input: ::std::option::Option<i64>) -> Self {
179        self.inner = self.inner.set_quantity(input);
180        self
181    }
182    /// <p>The change in the total quantity of the consumable resource. The <code>operation</code> parameter determines whether the value specified here will be the new total quantity, or the amount by which the total quantity will be increased or reduced. Must be a non-negative value.</p>
183    pub fn get_quantity(&self) -> &::std::option::Option<i64> {
184        self.inner.get_quantity()
185    }
186    /// <p>If this parameter is specified and two update requests with identical payloads and <code>clientToken</code>s are received, these requests are considered the same request. Both requests will succeed, but the update will only happen once. A <code>clientToken</code> is valid for 8 hours.</p>
187    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
188        self.inner = self.inner.client_token(input.into());
189        self
190    }
191    /// <p>If this parameter is specified and two update requests with identical payloads and <code>clientToken</code>s are received, these requests are considered the same request. Both requests will succeed, but the update will only happen once. A <code>clientToken</code> is valid for 8 hours.</p>
192    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
193        self.inner = self.inner.set_client_token(input);
194        self
195    }
196    /// <p>If this parameter is specified and two update requests with identical payloads and <code>clientToken</code>s are received, these requests are considered the same request. Both requests will succeed, but the update will only happen once. A <code>clientToken</code> is valid for 8 hours.</p>
197    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
198        self.inner.get_client_token()
199    }
200}