aws_sdk_deadline/operation/create_limit/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_limit::_create_limit_output::CreateLimitOutputBuilder;
3
4pub use crate::operation::create_limit::_create_limit_input::CreateLimitInputBuilder;
5
6impl crate::operation::create_limit::builders::CreateLimitInputBuilder {
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::create_limit::CreateLimitOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_limit::CreateLimitError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_limit();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateLimit`.
24///
25/// <p>Creates a limit that manages the distribution of shared resources, such as floating licenses. A limit can throttle work assignments, help manage workloads, and track current usage. Before you use a limit, you must associate the limit with one or more queues.</p>
26/// <p>You must add the <code>amountRequirementName</code> to a step in a job template to declare the limit requirement.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateLimitFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_limit::builders::CreateLimitInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::create_limit::CreateLimitOutput,
36        crate::operation::create_limit::CreateLimitError,
37    > for CreateLimitFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::create_limit::CreateLimitOutput,
45            crate::operation::create_limit::CreateLimitError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl CreateLimitFluentBuilder {
52    /// Creates a new `CreateLimitFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the CreateLimit as a reference.
61    pub fn as_input(&self) -> &crate::operation::create_limit::builders::CreateLimitInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::create_limit::CreateLimitOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::create_limit::CreateLimitError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::create_limit::CreateLimit::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::create_limit::CreateLimit::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::create_limit::CreateLimitOutput,
98        crate::operation::create_limit::CreateLimitError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The unique token which the server uses to recognize retries of the same request.</p>
113    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.client_token(input.into());
115        self
116    }
117    /// <p>The unique token which the server uses to recognize retries of the same request.</p>
118    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_client_token(input);
120        self
121    }
122    /// <p>The unique token which the server uses to recognize retries of the same request.</p>
123    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_client_token()
125    }
126    /// <p>The display name of the limit.</p><important>
127    /// <p>This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.</p>
128    /// </important>
129    pub fn display_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.display_name(input.into());
131        self
132    }
133    /// <p>The display name of the limit.</p><important>
134    /// <p>This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.</p>
135    /// </important>
136    pub fn set_display_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_display_name(input);
138        self
139    }
140    /// <p>The display name of the limit.</p><important>
141    /// <p>This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.</p>
142    /// </important>
143    pub fn get_display_name(&self) -> &::std::option::Option<::std::string::String> {
144        self.inner.get_display_name()
145    }
146    /// <p>The value that you specify as the <code>name</code> in the <code>amounts</code> field of the <code>hostRequirements</code> in a step of a job template to declare the limit requirement.</p>
147    pub fn amount_requirement_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.inner = self.inner.amount_requirement_name(input.into());
149        self
150    }
151    /// <p>The value that you specify as the <code>name</code> in the <code>amounts</code> field of the <code>hostRequirements</code> in a step of a job template to declare the limit requirement.</p>
152    pub fn set_amount_requirement_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153        self.inner = self.inner.set_amount_requirement_name(input);
154        self
155    }
156    /// <p>The value that you specify as the <code>name</code> in the <code>amounts</code> field of the <code>hostRequirements</code> in a step of a job template to declare the limit requirement.</p>
157    pub fn get_amount_requirement_name(&self) -> &::std::option::Option<::std::string::String> {
158        self.inner.get_amount_requirement_name()
159    }
160    /// <p>The maximum number of resources constrained by this limit. When all of the resources are in use, steps that require the limit won't be scheduled until the resource is available.</p>
161    /// <p>The <code>maxCount</code> must not be 0. If the value is -1, there is no restriction on the number of resources that can be acquired for this limit.</p>
162    pub fn max_count(mut self, input: i32) -> Self {
163        self.inner = self.inner.max_count(input);
164        self
165    }
166    /// <p>The maximum number of resources constrained by this limit. When all of the resources are in use, steps that require the limit won't be scheduled until the resource is available.</p>
167    /// <p>The <code>maxCount</code> must not be 0. If the value is -1, there is no restriction on the number of resources that can be acquired for this limit.</p>
168    pub fn set_max_count(mut self, input: ::std::option::Option<i32>) -> Self {
169        self.inner = self.inner.set_max_count(input);
170        self
171    }
172    /// <p>The maximum number of resources constrained by this limit. When all of the resources are in use, steps that require the limit won't be scheduled until the resource is available.</p>
173    /// <p>The <code>maxCount</code> must not be 0. If the value is -1, there is no restriction on the number of resources that can be acquired for this limit.</p>
174    pub fn get_max_count(&self) -> &::std::option::Option<i32> {
175        self.inner.get_max_count()
176    }
177    /// <p>The farm ID of the farm that contains the limit.</p>
178    pub fn farm_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
179        self.inner = self.inner.farm_id(input.into());
180        self
181    }
182    /// <p>The farm ID of the farm that contains the limit.</p>
183    pub fn set_farm_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
184        self.inner = self.inner.set_farm_id(input);
185        self
186    }
187    /// <p>The farm ID of the farm that contains the limit.</p>
188    pub fn get_farm_id(&self) -> &::std::option::Option<::std::string::String> {
189        self.inner.get_farm_id()
190    }
191    /// <p>A description of the limit. A description helps you identify the purpose of the limit.</p><important>
192    /// <p>This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.</p>
193    /// </important>
194    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
195        self.inner = self.inner.description(input.into());
196        self
197    }
198    /// <p>A description of the limit. A description helps you identify the purpose of the limit.</p><important>
199    /// <p>This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.</p>
200    /// </important>
201    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
202        self.inner = self.inner.set_description(input);
203        self
204    }
205    /// <p>A description of the limit. A description helps you identify the purpose of the limit.</p><important>
206    /// <p>This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.</p>
207    /// </important>
208    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
209        self.inner.get_description()
210    }
211}