aws_sdk_sagemaker/operation/batch_replace_cluster_nodes/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::batch_replace_cluster_nodes::_batch_replace_cluster_nodes_output::BatchReplaceClusterNodesOutputBuilder;
3
4pub use crate::operation::batch_replace_cluster_nodes::_batch_replace_cluster_nodes_input::BatchReplaceClusterNodesInputBuilder;
5
6impl crate::operation::batch_replace_cluster_nodes::builders::BatchReplaceClusterNodesInputBuilder {
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::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.batch_replace_cluster_nodes();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `BatchReplaceClusterNodes`.
24///
25/// <p>Replaces specific nodes within a SageMaker HyperPod cluster with new hardware. <code>BatchReplaceClusterNodes</code> terminates the specified instances and provisions new replacement instances with the same configuration but fresh hardware. The Amazon Machine Image (AMI) and instance configuration remain the same.</p>
26/// <p>This operation is useful for recovering from hardware failures or persistent issues that cannot be resolved through a reboot.</p><important>
27/// <ul>
28/// <li>
29/// <p><b>Data Loss Warning:</b> Replacing nodes destroys all instance volumes, including both root and secondary volumes. All data stored on these volumes will be permanently lost and cannot be recovered.</p></li>
30/// <li>
31/// <p>To safeguard your work, back up your data to Amazon S3 or an FSx for Lustre file system before invoking the API on a worker node group. This will help prevent any potential data loss from the instance root volume. For more information about backup, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-hyperpod-operate-cli-command.html#sagemaker-hyperpod-operate-cli-command-update-cluster-software-backup">Use the backup script provided by SageMaker HyperPod</a>.</p></li>
32/// <li>
33/// <p>If you want to invoke this API on an existing cluster, you'll first need to patch the cluster by running the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateClusterSoftware.html">UpdateClusterSoftware API</a>. For more information about patching a cluster, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-hyperpod-operate-cli-command.html#sagemaker-hyperpod-operate-cli-command-update-cluster-software">Update the SageMaker HyperPod platform software of a cluster</a>.</p></li>
34/// <li>
35/// <p>You can replace up to 25 nodes in a single request.</p></li>
36/// </ul>
37/// </important>
38#[derive(::std::clone::Clone, ::std::fmt::Debug)]
39pub struct BatchReplaceClusterNodesFluentBuilder {
40 handle: ::std::sync::Arc<crate::client::Handle>,
41 inner: crate::operation::batch_replace_cluster_nodes::builders::BatchReplaceClusterNodesInputBuilder,
42 config_override: ::std::option::Option<crate::config::Builder>,
43}
44impl
45 crate::client::customize::internal::CustomizableSend<
46 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
47 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
48 > for BatchReplaceClusterNodesFluentBuilder
49{
50 fn send(
51 self,
52 config_override: crate::config::Builder,
53 ) -> crate::client::customize::internal::BoxFuture<
54 crate::client::customize::internal::SendResult<
55 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
56 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
57 >,
58 > {
59 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
60 }
61}
62impl BatchReplaceClusterNodesFluentBuilder {
63 /// Creates a new `BatchReplaceClusterNodesFluentBuilder`.
64 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
65 Self {
66 handle,
67 inner: ::std::default::Default::default(),
68 config_override: ::std::option::Option::None,
69 }
70 }
71 /// Access the BatchReplaceClusterNodes as a reference.
72 pub fn as_input(&self) -> &crate::operation::batch_replace_cluster_nodes::builders::BatchReplaceClusterNodesInputBuilder {
73 &self.inner
74 }
75 /// Sends the request and returns the response.
76 ///
77 /// If an error occurs, an `SdkError` will be returned with additional details that
78 /// can be matched against.
79 ///
80 /// By default, any retryable failures will be retried twice. Retry behavior
81 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
82 /// set when configuring the client.
83 pub async fn send(
84 self,
85 ) -> ::std::result::Result<
86 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
87 ::aws_smithy_runtime_api::client::result::SdkError<
88 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
89 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
90 >,
91 > {
92 let input = self
93 .inner
94 .build()
95 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
96 let runtime_plugins = crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodes::operation_runtime_plugins(
97 self.handle.runtime_plugins.clone(),
98 &self.handle.conf,
99 self.config_override,
100 );
101 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodes::orchestrate(&runtime_plugins, input).await
102 }
103
104 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
105 pub fn customize(
106 self,
107 ) -> crate::client::customize::CustomizableOperation<
108 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
109 crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
110 Self,
111 > {
112 crate::client::customize::CustomizableOperation::new(self)
113 }
114 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
115 self.set_config_override(::std::option::Option::Some(config_override.into()));
116 self
117 }
118
119 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
120 self.config_override = config_override;
121 self
122 }
123 /// <p>The name or Amazon Resource Name (ARN) of the SageMaker HyperPod cluster containing the nodes to replace.</p>
124 pub fn cluster_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125 self.inner = self.inner.cluster_name(input.into());
126 self
127 }
128 /// <p>The name or Amazon Resource Name (ARN) of the SageMaker HyperPod cluster containing the nodes to replace.</p>
129 pub fn set_cluster_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130 self.inner = self.inner.set_cluster_name(input);
131 self
132 }
133 /// <p>The name or Amazon Resource Name (ARN) of the SageMaker HyperPod cluster containing the nodes to replace.</p>
134 pub fn get_cluster_name(&self) -> &::std::option::Option<::std::string::String> {
135 self.inner.get_cluster_name()
136 }
137 ///
138 /// Appends an item to `NodeIds`.
139 ///
140 /// To override the contents of this collection use [`set_node_ids`](Self::set_node_ids).
141 ///
142 /// <p>A list of EC2 instance IDs to replace with new hardware. You can specify between 1 and 25 instance IDs.</p><important>
143 /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p>
144 /// </important> <note>
145 /// <ul>
146 /// <li>
147 /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
148 /// <li>
149 /// <p>Each instance ID must follow the pattern <code>i-</code> followed by 17 hexadecimal characters (for example, <code>i-0123456789abcdef0</code>).</p></li>
150 /// <li>
151 /// <p>For SageMaker HyperPod clusters using the Slurm workload manager, you cannot replace instances that are configured as Slurm controller nodes.</p></li>
152 /// </ul>
153 /// </note>
154 pub fn node_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155 self.inner = self.inner.node_ids(input.into());
156 self
157 }
158 /// <p>A list of EC2 instance IDs to replace with new hardware. You can specify between 1 and 25 instance IDs.</p><important>
159 /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p>
160 /// </important> <note>
161 /// <ul>
162 /// <li>
163 /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
164 /// <li>
165 /// <p>Each instance ID must follow the pattern <code>i-</code> followed by 17 hexadecimal characters (for example, <code>i-0123456789abcdef0</code>).</p></li>
166 /// <li>
167 /// <p>For SageMaker HyperPod clusters using the Slurm workload manager, you cannot replace instances that are configured as Slurm controller nodes.</p></li>
168 /// </ul>
169 /// </note>
170 pub fn set_node_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
171 self.inner = self.inner.set_node_ids(input);
172 self
173 }
174 /// <p>A list of EC2 instance IDs to replace with new hardware. You can specify between 1 and 25 instance IDs.</p><important>
175 /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p>
176 /// </important> <note>
177 /// <ul>
178 /// <li>
179 /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
180 /// <li>
181 /// <p>Each instance ID must follow the pattern <code>i-</code> followed by 17 hexadecimal characters (for example, <code>i-0123456789abcdef0</code>).</p></li>
182 /// <li>
183 /// <p>For SageMaker HyperPod clusters using the Slurm workload manager, you cannot replace instances that are configured as Slurm controller nodes.</p></li>
184 /// </ul>
185 /// </note>
186 pub fn get_node_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
187 self.inner.get_node_ids()
188 }
189 ///
190 /// Appends an item to `NodeLogicalIds`.
191 ///
192 /// To override the contents of this collection use [`set_node_logical_ids`](Self::set_node_logical_ids).
193 ///
194 /// <p>A list of logical node IDs to replace with new hardware. You can specify between 1 and 25 logical node IDs.</p>
195 /// <p>The <code>NodeLogicalId</code> is a unique identifier that persists throughout the node's lifecycle and can be used to track nodes that are still being provisioned and don't yet have an EC2 instance ID assigned.</p><important>
196 /// <ul>
197 /// <li>
198 /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p></li>
199 /// <li>
200 /// <p>This parameter is only supported for clusters using <code>Continuous</code> as the <code>NodeProvisioningMode</code>. For clusters using the default provisioning mode, use <code>NodeIds</code> instead.</p></li>
201 /// <li>
202 /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
203 /// </ul>
204 /// </important>
205 pub fn node_logical_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
206 self.inner = self.inner.node_logical_ids(input.into());
207 self
208 }
209 /// <p>A list of logical node IDs to replace with new hardware. You can specify between 1 and 25 logical node IDs.</p>
210 /// <p>The <code>NodeLogicalId</code> is a unique identifier that persists throughout the node's lifecycle and can be used to track nodes that are still being provisioned and don't yet have an EC2 instance ID assigned.</p><important>
211 /// <ul>
212 /// <li>
213 /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p></li>
214 /// <li>
215 /// <p>This parameter is only supported for clusters using <code>Continuous</code> as the <code>NodeProvisioningMode</code>. For clusters using the default provisioning mode, use <code>NodeIds</code> instead.</p></li>
216 /// <li>
217 /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
218 /// </ul>
219 /// </important>
220 pub fn set_node_logical_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
221 self.inner = self.inner.set_node_logical_ids(input);
222 self
223 }
224 /// <p>A list of logical node IDs to replace with new hardware. You can specify between 1 and 25 logical node IDs.</p>
225 /// <p>The <code>NodeLogicalId</code> is a unique identifier that persists throughout the node's lifecycle and can be used to track nodes that are still being provisioned and don't yet have an EC2 instance ID assigned.</p><important>
226 /// <ul>
227 /// <li>
228 /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p></li>
229 /// <li>
230 /// <p>This parameter is only supported for clusters using <code>Continuous</code> as the <code>NodeProvisioningMode</code>. For clusters using the default provisioning mode, use <code>NodeIds</code> instead.</p></li>
231 /// <li>
232 /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
233 /// </ul>
234 /// </important>
235 pub fn get_node_logical_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
236 self.inner.get_node_logical_ids()
237 }
238}