aws_sdk_pcs/operation/create_cluster/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_cluster::_create_cluster_output::CreateClusterOutputBuilder;
3
4pub use crate::operation::create_cluster::_create_cluster_input::CreateClusterInputBuilder;
5
6impl crate::operation::create_cluster::builders::CreateClusterInputBuilder {
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_cluster::CreateClusterOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_cluster::CreateClusterError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_cluster();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateCluster`.
24///
25/// <p>Creates a cluster in your account. PCS creates the cluster controller in a service-owned account. The cluster controller communicates with the cluster resources in your account. The subnets and security groups for the cluster must already exist before you use this API action.</p><note>
26/// <p>It takes time for PCS to create the cluster. The cluster is in a <code>Creating</code> state until it is ready to use. There can only be 1 cluster in a <code>Creating</code> state per Amazon Web Services Region per Amazon Web Services account. <code>CreateCluster</code> fails with a <code>ServiceQuotaExceededException</code> if there is already a cluster in a <code>Creating</code> state.</p>
27/// </note>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct CreateClusterFluentBuilder {
30 handle: ::std::sync::Arc<crate::client::Handle>,
31 inner: crate::operation::create_cluster::builders::CreateClusterInputBuilder,
32 config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35 crate::client::customize::internal::CustomizableSend<
36 crate::operation::create_cluster::CreateClusterOutput,
37 crate::operation::create_cluster::CreateClusterError,
38 > for CreateClusterFluentBuilder
39{
40 fn send(
41 self,
42 config_override: crate::config::Builder,
43 ) -> crate::client::customize::internal::BoxFuture<
44 crate::client::customize::internal::SendResult<
45 crate::operation::create_cluster::CreateClusterOutput,
46 crate::operation::create_cluster::CreateClusterError,
47 >,
48 > {
49 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50 }
51}
52impl CreateClusterFluentBuilder {
53 /// Creates a new `CreateClusterFluentBuilder`.
54 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55 Self {
56 handle,
57 inner: ::std::default::Default::default(),
58 config_override: ::std::option::Option::None,
59 }
60 }
61 /// Access the CreateCluster as a reference.
62 pub fn as_input(&self) -> &crate::operation::create_cluster::builders::CreateClusterInputBuilder {
63 &self.inner
64 }
65 /// Sends the request and returns the response.
66 ///
67 /// If an error occurs, an `SdkError` will be returned with additional details that
68 /// can be matched against.
69 ///
70 /// By default, any retryable failures will be retried twice. Retry behavior
71 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72 /// set when configuring the client.
73 pub async fn send(
74 self,
75 ) -> ::std::result::Result<
76 crate::operation::create_cluster::CreateClusterOutput,
77 ::aws_smithy_runtime_api::client::result::SdkError<
78 crate::operation::create_cluster::CreateClusterError,
79 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80 >,
81 > {
82 let input = self
83 .inner
84 .build()
85 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86 let runtime_plugins = crate::operation::create_cluster::CreateCluster::operation_runtime_plugins(
87 self.handle.runtime_plugins.clone(),
88 &self.handle.conf,
89 self.config_override,
90 );
91 crate::operation::create_cluster::CreateCluster::orchestrate(&runtime_plugins, input).await
92 }
93
94 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95 pub fn customize(
96 self,
97 ) -> crate::client::customize::CustomizableOperation<
98 crate::operation::create_cluster::CreateClusterOutput,
99 crate::operation::create_cluster::CreateClusterError,
100 Self,
101 > {
102 crate::client::customize::CustomizableOperation::new(self)
103 }
104 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105 self.set_config_override(::std::option::Option::Some(config_override.into()));
106 self
107 }
108
109 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110 self.config_override = config_override;
111 self
112 }
113 /// <p>A name to identify the cluster. Example: <code>MyCluster</code></p>
114 pub fn cluster_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115 self.inner = self.inner.cluster_name(input.into());
116 self
117 }
118 /// <p>A name to identify the cluster. Example: <code>MyCluster</code></p>
119 pub fn set_cluster_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120 self.inner = self.inner.set_cluster_name(input);
121 self
122 }
123 /// <p>A name to identify the cluster. Example: <code>MyCluster</code></p>
124 pub fn get_cluster_name(&self) -> &::std::option::Option<::std::string::String> {
125 self.inner.get_cluster_name()
126 }
127 /// <p>The cluster management and job scheduling software associated with the cluster.</p>
128 pub fn scheduler(mut self, input: crate::types::SchedulerRequest) -> Self {
129 self.inner = self.inner.scheduler(input);
130 self
131 }
132 /// <p>The cluster management and job scheduling software associated with the cluster.</p>
133 pub fn set_scheduler(mut self, input: ::std::option::Option<crate::types::SchedulerRequest>) -> Self {
134 self.inner = self.inner.set_scheduler(input);
135 self
136 }
137 /// <p>The cluster management and job scheduling software associated with the cluster.</p>
138 pub fn get_scheduler(&self) -> &::std::option::Option<crate::types::SchedulerRequest> {
139 self.inner.get_scheduler()
140 }
141 /// <p>A value that determines the maximum number of compute nodes in the cluster and the maximum number of jobs (active and queued).</p>
142 /// <ul>
143 /// <li>
144 /// <p><code>SMALL</code>: 32 compute nodes and 256 jobs</p></li>
145 /// <li>
146 /// <p><code>MEDIUM</code>: 512 compute nodes and 8192 jobs</p></li>
147 /// <li>
148 /// <p><code>LARGE</code>: 2048 compute nodes and 16,384 jobs</p></li>
149 /// </ul>
150 pub fn size(mut self, input: crate::types::Size) -> Self {
151 self.inner = self.inner.size(input);
152 self
153 }
154 /// <p>A value that determines the maximum number of compute nodes in the cluster and the maximum number of jobs (active and queued).</p>
155 /// <ul>
156 /// <li>
157 /// <p><code>SMALL</code>: 32 compute nodes and 256 jobs</p></li>
158 /// <li>
159 /// <p><code>MEDIUM</code>: 512 compute nodes and 8192 jobs</p></li>
160 /// <li>
161 /// <p><code>LARGE</code>: 2048 compute nodes and 16,384 jobs</p></li>
162 /// </ul>
163 pub fn set_size(mut self, input: ::std::option::Option<crate::types::Size>) -> Self {
164 self.inner = self.inner.set_size(input);
165 self
166 }
167 /// <p>A value that determines the maximum number of compute nodes in the cluster and the maximum number of jobs (active and queued).</p>
168 /// <ul>
169 /// <li>
170 /// <p><code>SMALL</code>: 32 compute nodes and 256 jobs</p></li>
171 /// <li>
172 /// <p><code>MEDIUM</code>: 512 compute nodes and 8192 jobs</p></li>
173 /// <li>
174 /// <p><code>LARGE</code>: 2048 compute nodes and 16,384 jobs</p></li>
175 /// </ul>
176 pub fn get_size(&self) -> &::std::option::Option<crate::types::Size> {
177 self.inner.get_size()
178 }
179 /// <p>The networking configuration used to set up the cluster's control plane.</p>
180 pub fn networking(mut self, input: crate::types::NetworkingRequest) -> Self {
181 self.inner = self.inner.networking(input);
182 self
183 }
184 /// <p>The networking configuration used to set up the cluster's control plane.</p>
185 pub fn set_networking(mut self, input: ::std::option::Option<crate::types::NetworkingRequest>) -> Self {
186 self.inner = self.inner.set_networking(input);
187 self
188 }
189 /// <p>The networking configuration used to set up the cluster's control plane.</p>
190 pub fn get_networking(&self) -> &::std::option::Option<crate::types::NetworkingRequest> {
191 self.inner.get_networking()
192 }
193 /// <p>Additional options related to the Slurm scheduler.</p>
194 pub fn slurm_configuration(mut self, input: crate::types::ClusterSlurmConfigurationRequest) -> Self {
195 self.inner = self.inner.slurm_configuration(input);
196 self
197 }
198 /// <p>Additional options related to the Slurm scheduler.</p>
199 pub fn set_slurm_configuration(mut self, input: ::std::option::Option<crate::types::ClusterSlurmConfigurationRequest>) -> Self {
200 self.inner = self.inner.set_slurm_configuration(input);
201 self
202 }
203 /// <p>Additional options related to the Slurm scheduler.</p>
204 pub fn get_slurm_configuration(&self) -> &::std::option::Option<crate::types::ClusterSlurmConfigurationRequest> {
205 self.inner.get_slurm_configuration()
206 }
207 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.</p>
208 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209 self.inner = self.inner.client_token(input.into());
210 self
211 }
212 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.</p>
213 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
214 self.inner = self.inner.set_client_token(input);
215 self
216 }
217 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.</p>
218 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
219 self.inner.get_client_token()
220 }
221 ///
222 /// Adds a key-value pair to `tags`.
223 ///
224 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
225 ///
226 /// <p>1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.</p>
227 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
228 self.inner = self.inner.tags(k.into(), v.into());
229 self
230 }
231 /// <p>1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.</p>
232 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
233 self.inner = self.inner.set_tags(input);
234 self
235 }
236 /// <p>1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.</p>
237 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
238 self.inner.get_tags()
239 }
240}