aws-sdk-sagemaker 1.196.0

AWS SDK for Amazon SageMaker Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::batch_replace_cluster_nodes::_batch_replace_cluster_nodes_input::BatchReplaceClusterNodesInputBuilder;

pub use crate::operation::batch_replace_cluster_nodes::_batch_replace_cluster_nodes_output::BatchReplaceClusterNodesOutputBuilder;

impl crate::operation::batch_replace_cluster_nodes::builders::BatchReplaceClusterNodesInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.batch_replace_cluster_nodes();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `BatchReplaceClusterNodes`.
///
/// <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>
/// <p>This operation is useful for recovering from hardware failures or persistent issues that cannot be resolved through a reboot.</p><important>
/// <ul>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <p>You can replace up to 25 nodes in a single request.</p></li>
/// </ul>
/// </important>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct BatchReplaceClusterNodesFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::batch_replace_cluster_nodes::builders::BatchReplaceClusterNodesInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
        crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
    > for BatchReplaceClusterNodesFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
            crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl BatchReplaceClusterNodesFluentBuilder {
    /// Creates a new `BatchReplaceClusterNodesFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the BatchReplaceClusterNodes as a reference.
    pub fn as_input(&self) -> &crate::operation::batch_replace_cluster_nodes::builders::BatchReplaceClusterNodesInputBuilder {
        &self.inner
    }
    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> ::std::result::Result<
        crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodes::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodes::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesOutput,
        crate::operation::batch_replace_cluster_nodes::BatchReplaceClusterNodesError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    /// <p>The name or Amazon Resource Name (ARN) of the SageMaker HyperPod cluster containing the nodes to replace.</p>
    pub fn cluster_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.cluster_name(input.into());
        self
    }
    /// <p>The name or Amazon Resource Name (ARN) of the SageMaker HyperPod cluster containing the nodes to replace.</p>
    pub fn set_cluster_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_cluster_name(input);
        self
    }
    /// <p>The name or Amazon Resource Name (ARN) of the SageMaker HyperPod cluster containing the nodes to replace.</p>
    pub fn get_cluster_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_cluster_name()
    }
    ///
    /// Appends an item to `NodeIds`.
    ///
    /// To override the contents of this collection use [`set_node_ids`](Self::set_node_ids).
    ///
    /// <p>A list of EC2 instance IDs to replace with new hardware. You can specify between 1 and 25 instance IDs.</p><important>
    /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p>
    /// </important> <note>
    /// <ul>
    /// <li>
    /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
    /// <li>
    /// <p>Each instance ID must follow the pattern <code>i-</code> followed by 17 hexadecimal characters (for example, <code>i-0123456789abcdef0</code>).</p></li>
    /// <li>
    /// <p>For SageMaker HyperPod clusters using the Slurm workload manager, you cannot replace instances that are configured as Slurm controller nodes.</p></li>
    /// </ul>
    /// </note>
    pub fn node_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.node_ids(input.into());
        self
    }
    /// <p>A list of EC2 instance IDs to replace with new hardware. You can specify between 1 and 25 instance IDs.</p><important>
    /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p>
    /// </important> <note>
    /// <ul>
    /// <li>
    /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
    /// <li>
    /// <p>Each instance ID must follow the pattern <code>i-</code> followed by 17 hexadecimal characters (for example, <code>i-0123456789abcdef0</code>).</p></li>
    /// <li>
    /// <p>For SageMaker HyperPod clusters using the Slurm workload manager, you cannot replace instances that are configured as Slurm controller nodes.</p></li>
    /// </ul>
    /// </note>
    pub fn set_node_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.inner = self.inner.set_node_ids(input);
        self
    }
    /// <p>A list of EC2 instance IDs to replace with new hardware. You can specify between 1 and 25 instance IDs.</p><important>
    /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p>
    /// </important> <note>
    /// <ul>
    /// <li>
    /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
    /// <li>
    /// <p>Each instance ID must follow the pattern <code>i-</code> followed by 17 hexadecimal characters (for example, <code>i-0123456789abcdef0</code>).</p></li>
    /// <li>
    /// <p>For SageMaker HyperPod clusters using the Slurm workload manager, you cannot replace instances that are configured as Slurm controller nodes.</p></li>
    /// </ul>
    /// </note>
    pub fn get_node_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        self.inner.get_node_ids()
    }
    ///
    /// Appends an item to `NodeLogicalIds`.
    ///
    /// To override the contents of this collection use [`set_node_logical_ids`](Self::set_node_logical_ids).
    ///
    /// <p>A list of logical node IDs to replace with new hardware. You can specify between 1 and 25 logical node IDs.</p>
    /// <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>
    /// <ul>
    /// <li>
    /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p></li>
    /// <li>
    /// <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>
    /// <li>
    /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
    /// </ul>
    /// </important>
    pub fn node_logical_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.node_logical_ids(input.into());
        self
    }
    /// <p>A list of logical node IDs to replace with new hardware. You can specify between 1 and 25 logical node IDs.</p>
    /// <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>
    /// <ul>
    /// <li>
    /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p></li>
    /// <li>
    /// <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>
    /// <li>
    /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
    /// </ul>
    /// </important>
    pub fn set_node_logical_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.inner = self.inner.set_node_logical_ids(input);
        self
    }
    /// <p>A list of logical node IDs to replace with new hardware. You can specify between 1 and 25 logical node IDs.</p>
    /// <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>
    /// <ul>
    /// <li>
    /// <p>Replace operations destroy all instance volumes (root and secondary). Ensure you have backed up any important data before proceeding.</p></li>
    /// <li>
    /// <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>
    /// <li>
    /// <p>Either <code>NodeIds</code> or <code>NodeLogicalIds</code> must be provided (or both), but at least one is required.</p></li>
    /// </ul>
    /// </important>
    pub fn get_node_logical_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        self.inner.get_node_logical_ids()
    }
}