Skip to main content

aws_sdk_pcs/operation/create_compute_node_group/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_compute_node_group::_create_compute_node_group_input::CreateComputeNodeGroupInputBuilder;
3
4pub use crate::operation::create_compute_node_group::_create_compute_node_group_output::CreateComputeNodeGroupOutputBuilder;
5
6impl crate::operation::create_compute_node_group::builders::CreateComputeNodeGroupInputBuilder {
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_compute_node_group::CreateComputeNodeGroupOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_compute_node_group::CreateComputeNodeGroupError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_compute_node_group();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateComputeNodeGroup`.
24///
25/// <p>Creates a managed set of compute nodes. You associate a compute node group with a cluster through 1 or more PCS queues or as part of the login fleet. A compute node group includes the definition of the compute properties and lifecycle management. PCS uses the information you provide to this API action to launch compute nodes in your account. You can only specify subnets in the same Amazon VPC as your cluster. You receive billing charges for the compute nodes that PCS launches in your account. You must already have a launch template before you call this API. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html">Launch an instance from a launch template</a> in the <i>Amazon Elastic Compute Cloud User Guide for Linux Instances</i>.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateComputeNodeGroupFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_compute_node_group::builders::CreateComputeNodeGroupInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_compute_node_group::CreateComputeNodeGroupOutput,
35        crate::operation::create_compute_node_group::CreateComputeNodeGroupError,
36    > for CreateComputeNodeGroupFluentBuilder
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::create_compute_node_group::CreateComputeNodeGroupOutput,
44            crate::operation::create_compute_node_group::CreateComputeNodeGroupError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreateComputeNodeGroupFluentBuilder {
51    /// Creates a new `CreateComputeNodeGroupFluentBuilder`.
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 CreateComputeNodeGroup as a reference.
60    pub fn as_input(&self) -> &crate::operation::create_compute_node_group::builders::CreateComputeNodeGroupInputBuilder {
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::create_compute_node_group::CreateComputeNodeGroupOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::create_compute_node_group::CreateComputeNodeGroupError,
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::create_compute_node_group::CreateComputeNodeGroup::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::create_compute_node_group::CreateComputeNodeGroup::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::create_compute_node_group::CreateComputeNodeGroupOutput,
97        crate::operation::create_compute_node_group::CreateComputeNodeGroupError,
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 ID of the cluster to create a compute node group in.</p>
112    pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.cluster_identifier(input.into());
114        self
115    }
116    /// <p>The name or ID of the cluster to create a compute node group in.</p>
117    pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_cluster_identifier(input);
119        self
120    }
121    /// <p>The name or ID of the cluster to create a compute node group in.</p>
122    pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_cluster_identifier()
124    }
125    /// <p>A name to identify the cluster. Example: <code>MyCluster</code></p>
126    pub fn compute_node_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.compute_node_group_name(input.into());
128        self
129    }
130    /// <p>A name to identify the cluster. Example: <code>MyCluster</code></p>
131    pub fn set_compute_node_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_compute_node_group_name(input);
133        self
134    }
135    /// <p>A name to identify the cluster. Example: <code>MyCluster</code></p>
136    pub fn get_compute_node_group_name(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_compute_node_group_name()
138    }
139    /// <p>The ID of the Amazon Machine Image (AMI) that PCS uses to launch compute nodes (Amazon EC2 instances). If you don't provide this value, PCS uses the AMI ID specified in the custom launch template.</p>
140    pub fn ami_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.ami_id(input.into());
142        self
143    }
144    /// <p>The ID of the Amazon Machine Image (AMI) that PCS uses to launch compute nodes (Amazon EC2 instances). If you don't provide this value, PCS uses the AMI ID specified in the custom launch template.</p>
145    pub fn set_ami_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_ami_id(input);
147        self
148    }
149    /// <p>The ID of the Amazon Machine Image (AMI) that PCS uses to launch compute nodes (Amazon EC2 instances). If you don't provide this value, PCS uses the AMI ID specified in the custom launch template.</p>
150    pub fn get_ami_id(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_ami_id()
152    }
153    ///
154    /// Appends an item to `subnetIds`.
155    ///
156    /// To override the contents of this collection use [`set_subnet_ids`](Self::set_subnet_ids).
157    ///
158    /// <p>The list of subnet IDs where the compute node group launches instances. Subnets must be in the same VPC as the cluster.</p>
159    pub fn subnet_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.subnet_ids(input.into());
161        self
162    }
163    /// <p>The list of subnet IDs where the compute node group launches instances. Subnets must be in the same VPC as the cluster.</p>
164    pub fn set_subnet_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
165        self.inner = self.inner.set_subnet_ids(input);
166        self
167    }
168    /// <p>The list of subnet IDs where the compute node group launches instances. Subnets must be in the same VPC as the cluster.</p>
169    pub fn get_subnet_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
170        self.inner.get_subnet_ids()
171    }
172    /// <p>Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, and Amazon EC2 Capacity Blocks for ML. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-purchasing-options.html">Amazon EC2 billing and purchasing options</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. For more information about PCS support for Capacity Blocks, see <a href="https://docs.aws.amazon.com/pcs/latest/userguide/capacity-blocks.html">Using Amazon EC2 Capacity Blocks for ML with PCS</a> in the <i>PCS User Guide</i>. If you don't provide this option, it defaults to On-Demand.</p>
173    pub fn purchase_option(mut self, input: crate::types::PurchaseOption) -> Self {
174        self.inner = self.inner.purchase_option(input);
175        self
176    }
177    /// <p>Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, and Amazon EC2 Capacity Blocks for ML. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-purchasing-options.html">Amazon EC2 billing and purchasing options</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. For more information about PCS support for Capacity Blocks, see <a href="https://docs.aws.amazon.com/pcs/latest/userguide/capacity-blocks.html">Using Amazon EC2 Capacity Blocks for ML with PCS</a> in the <i>PCS User Guide</i>. If you don't provide this option, it defaults to On-Demand.</p>
178    pub fn set_purchase_option(mut self, input: ::std::option::Option<crate::types::PurchaseOption>) -> Self {
179        self.inner = self.inner.set_purchase_option(input);
180        self
181    }
182    /// <p>Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, and Amazon EC2 Capacity Blocks for ML. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-purchasing-options.html">Amazon EC2 billing and purchasing options</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. For more information about PCS support for Capacity Blocks, see <a href="https://docs.aws.amazon.com/pcs/latest/userguide/capacity-blocks.html">Using Amazon EC2 Capacity Blocks for ML with PCS</a> in the <i>PCS User Guide</i>. If you don't provide this option, it defaults to On-Demand.</p>
183    pub fn get_purchase_option(&self) -> &::std::option::Option<crate::types::PurchaseOption> {
184        self.inner.get_purchase_option()
185    }
186    /// <p>An Amazon EC2 launch template PCS uses to launch compute nodes.</p>
187    pub fn custom_launch_template(mut self, input: crate::types::CustomLaunchTemplate) -> Self {
188        self.inner = self.inner.custom_launch_template(input);
189        self
190    }
191    /// <p>An Amazon EC2 launch template PCS uses to launch compute nodes.</p>
192    pub fn set_custom_launch_template(mut self, input: ::std::option::Option<crate::types::CustomLaunchTemplate>) -> Self {
193        self.inner = self.inner.set_custom_launch_template(input);
194        self
195    }
196    /// <p>An Amazon EC2 launch template PCS uses to launch compute nodes.</p>
197    pub fn get_custom_launch_template(&self) -> &::std::option::Option<crate::types::CustomLaunchTemplate> {
198        self.inner.get_custom_launch_template()
199    }
200    /// <p>The Amazon Resource Name (ARN) of the IAM instance profile used to pass an IAM role when launching EC2 instances. The role contained in your instance profile must have the <code>pcs:RegisterComputeNodeGroupInstance</code> permission and the role name must start with <code>AWSPCS</code> or must have the path <code>/aws-pcs/</code>. For more information, see <a href="https://docs.aws.amazon.com/pcs/latest/userguide/security-instance-profiles.html">IAM instance profiles for PCS</a> in the <i>PCS User Guide</i>.</p>
201    pub fn iam_instance_profile_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
202        self.inner = self.inner.iam_instance_profile_arn(input.into());
203        self
204    }
205    /// <p>The Amazon Resource Name (ARN) of the IAM instance profile used to pass an IAM role when launching EC2 instances. The role contained in your instance profile must have the <code>pcs:RegisterComputeNodeGroupInstance</code> permission and the role name must start with <code>AWSPCS</code> or must have the path <code>/aws-pcs/</code>. For more information, see <a href="https://docs.aws.amazon.com/pcs/latest/userguide/security-instance-profiles.html">IAM instance profiles for PCS</a> in the <i>PCS User Guide</i>.</p>
206    pub fn set_iam_instance_profile_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
207        self.inner = self.inner.set_iam_instance_profile_arn(input);
208        self
209    }
210    /// <p>The Amazon Resource Name (ARN) of the IAM instance profile used to pass an IAM role when launching EC2 instances. The role contained in your instance profile must have the <code>pcs:RegisterComputeNodeGroupInstance</code> permission and the role name must start with <code>AWSPCS</code> or must have the path <code>/aws-pcs/</code>. For more information, see <a href="https://docs.aws.amazon.com/pcs/latest/userguide/security-instance-profiles.html">IAM instance profiles for PCS</a> in the <i>PCS User Guide</i>.</p>
211    pub fn get_iam_instance_profile_arn(&self) -> &::std::option::Option<::std::string::String> {
212        self.inner.get_iam_instance_profile_arn()
213    }
214    /// <p>Specifies the boundaries of the compute node group auto scaling.</p>
215    pub fn scaling_configuration(mut self, input: crate::types::ScalingConfigurationRequest) -> Self {
216        self.inner = self.inner.scaling_configuration(input);
217        self
218    }
219    /// <p>Specifies the boundaries of the compute node group auto scaling.</p>
220    pub fn set_scaling_configuration(mut self, input: ::std::option::Option<crate::types::ScalingConfigurationRequest>) -> Self {
221        self.inner = self.inner.set_scaling_configuration(input);
222        self
223    }
224    /// <p>Specifies the boundaries of the compute node group auto scaling.</p>
225    pub fn get_scaling_configuration(&self) -> &::std::option::Option<crate::types::ScalingConfigurationRequest> {
226        self.inner.get_scaling_configuration()
227    }
228    ///
229    /// Appends an item to `instanceConfigs`.
230    ///
231    /// To override the contents of this collection use [`set_instance_configs`](Self::set_instance_configs).
232    ///
233    /// <p>A list of EC2 instance configurations that PCS can provision in the compute node group.</p>
234    pub fn instance_configs(mut self, input: crate::types::InstanceConfig) -> Self {
235        self.inner = self.inner.instance_configs(input);
236        self
237    }
238    /// <p>A list of EC2 instance configurations that PCS can provision in the compute node group.</p>
239    pub fn set_instance_configs(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::InstanceConfig>>) -> Self {
240        self.inner = self.inner.set_instance_configs(input);
241        self
242    }
243    /// <p>A list of EC2 instance configurations that PCS can provision in the compute node group.</p>
244    pub fn get_instance_configs(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::InstanceConfig>> {
245        self.inner.get_instance_configs()
246    }
247    /// <p>Additional configuration when you specify <code>SPOT</code> as the <code>purchaseOption</code> for the <code>CreateComputeNodeGroup</code> API action.</p>
248    pub fn spot_options(mut self, input: crate::types::SpotOptions) -> Self {
249        self.inner = self.inner.spot_options(input);
250        self
251    }
252    /// <p>Additional configuration when you specify <code>SPOT</code> as the <code>purchaseOption</code> for the <code>CreateComputeNodeGroup</code> API action.</p>
253    pub fn set_spot_options(mut self, input: ::std::option::Option<crate::types::SpotOptions>) -> Self {
254        self.inner = self.inner.set_spot_options(input);
255        self
256    }
257    /// <p>Additional configuration when you specify <code>SPOT</code> as the <code>purchaseOption</code> for the <code>CreateComputeNodeGroup</code> API action.</p>
258    pub fn get_spot_options(&self) -> &::std::option::Option<crate::types::SpotOptions> {
259        self.inner.get_spot_options()
260    }
261    /// <p>Additional options related to the Slurm scheduler.</p>
262    pub fn slurm_configuration(mut self, input: crate::types::ComputeNodeGroupSlurmConfigurationRequest) -> Self {
263        self.inner = self.inner.slurm_configuration(input);
264        self
265    }
266    /// <p>Additional options related to the Slurm scheduler.</p>
267    pub fn set_slurm_configuration(mut self, input: ::std::option::Option<crate::types::ComputeNodeGroupSlurmConfigurationRequest>) -> Self {
268        self.inner = self.inner.set_slurm_configuration(input);
269        self
270    }
271    /// <p>Additional options related to the Slurm scheduler.</p>
272    pub fn get_slurm_configuration(&self) -> &::std::option::Option<crate::types::ComputeNodeGroupSlurmConfigurationRequest> {
273        self.inner.get_slurm_configuration()
274    }
275    /// <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>
276    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
277        self.inner = self.inner.client_token(input.into());
278        self
279    }
280    /// <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>
281    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
282        self.inner = self.inner.set_client_token(input);
283        self
284    }
285    /// <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>
286    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
287        self.inner.get_client_token()
288    }
289    ///
290    /// Adds a key-value pair to `tags`.
291    ///
292    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
293    ///
294    /// <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>
295    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
296        self.inner = self.inner.tags(k.into(), v.into());
297        self
298    }
299    /// <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>
300    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
301        self.inner = self.inner.set_tags(input);
302        self
303    }
304    /// <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>
305    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
306        self.inner.get_tags()
307    }
308}