aws_sdk_sagemaker/operation/create_training_plan/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_training_plan::_create_training_plan_output::CreateTrainingPlanOutputBuilder;
3
4pub use crate::operation::create_training_plan::_create_training_plan_input::CreateTrainingPlanInputBuilder;
5
6impl crate::operation::create_training_plan::builders::CreateTrainingPlanInputBuilder {
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_training_plan::CreateTrainingPlanOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_training_plan::CreateTrainingPlanError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_training_plan();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateTrainingPlan`.
24///
25/// <p>Creates a new training plan in SageMaker to reserve compute capacity.</p>
26/// <p>Amazon SageMaker Training Plan is a capability within SageMaker that allows customers to reserve and manage GPU capacity for large-scale AI model training. It provides a way to secure predictable access to computational resources within specific timelines and budgets, without the need to manage underlying infrastructure.</p>
27/// <p><b>How it works</b></p>
28/// <p>Plans can be created for specific resources such as SageMaker Training Jobs or SageMaker HyperPod clusters, automatically provisioning resources, setting up infrastructure, executing workloads, and handling infrastructure failures.</p>
29/// <p><b>Plan creation workflow</b></p>
30/// <ul>
31/// <li>
32/// <p>Users search for available plan offerings based on their requirements (e.g., instance type, count, start time, duration) using the <code> <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_SearchTrainingPlanOfferings.html">SearchTrainingPlanOfferings</a> </code> API operation.</p></li>
33/// <li>
34/// <p>They create a plan that best matches their needs using the ID of the plan offering they want to use.</p></li>
35/// <li>
36/// <p>After successful upfront payment, the plan's status becomes <code>Scheduled</code>.</p></li>
37/// <li>
38/// <p>The plan can be used to:</p>
39/// <ul>
40/// <li>
41/// <p>Queue training jobs.</p></li>
42/// <li>
43/// <p>Allocate to an instance group of a SageMaker HyperPod cluster.</p></li>
44/// </ul></li>
45/// <li>
46/// <p>When the plan start date arrives, it becomes <code>Active</code>. Based on available reserved capacity:</p>
47/// <ul>
48/// <li>
49/// <p>Training jobs are launched.</p></li>
50/// <li>
51/// <p>Instance groups are provisioned.</p></li>
52/// </ul></li>
53/// </ul>
54/// <p><b>Plan composition</b></p>
55/// <p>A plan can consist of one or more Reserved Capacities, each defined by a specific instance type, quantity, Availability Zone, duration, and start and end times. For more information about Reserved Capacity, see <code> <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ReservedCapacitySummary.html">ReservedCapacitySummary</a> </code>.</p>
56#[derive(::std::clone::Clone, ::std::fmt::Debug)]
57pub struct CreateTrainingPlanFluentBuilder {
58    handle: ::std::sync::Arc<crate::client::Handle>,
59    inner: crate::operation::create_training_plan::builders::CreateTrainingPlanInputBuilder,
60    config_override: ::std::option::Option<crate::config::Builder>,
61}
62impl
63    crate::client::customize::internal::CustomizableSend<
64        crate::operation::create_training_plan::CreateTrainingPlanOutput,
65        crate::operation::create_training_plan::CreateTrainingPlanError,
66    > for CreateTrainingPlanFluentBuilder
67{
68    fn send(
69        self,
70        config_override: crate::config::Builder,
71    ) -> crate::client::customize::internal::BoxFuture<
72        crate::client::customize::internal::SendResult<
73            crate::operation::create_training_plan::CreateTrainingPlanOutput,
74            crate::operation::create_training_plan::CreateTrainingPlanError,
75        >,
76    > {
77        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
78    }
79}
80impl CreateTrainingPlanFluentBuilder {
81    /// Creates a new `CreateTrainingPlanFluentBuilder`.
82    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
83        Self {
84            handle,
85            inner: ::std::default::Default::default(),
86            config_override: ::std::option::Option::None,
87        }
88    }
89    /// Access the CreateTrainingPlan as a reference.
90    pub fn as_input(&self) -> &crate::operation::create_training_plan::builders::CreateTrainingPlanInputBuilder {
91        &self.inner
92    }
93    /// Sends the request and returns the response.
94    ///
95    /// If an error occurs, an `SdkError` will be returned with additional details that
96    /// can be matched against.
97    ///
98    /// By default, any retryable failures will be retried twice. Retry behavior
99    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
100    /// set when configuring the client.
101    pub async fn send(
102        self,
103    ) -> ::std::result::Result<
104        crate::operation::create_training_plan::CreateTrainingPlanOutput,
105        ::aws_smithy_runtime_api::client::result::SdkError<
106            crate::operation::create_training_plan::CreateTrainingPlanError,
107            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
108        >,
109    > {
110        let input = self
111            .inner
112            .build()
113            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
114        let runtime_plugins = crate::operation::create_training_plan::CreateTrainingPlan::operation_runtime_plugins(
115            self.handle.runtime_plugins.clone(),
116            &self.handle.conf,
117            self.config_override,
118        );
119        crate::operation::create_training_plan::CreateTrainingPlan::orchestrate(&runtime_plugins, input).await
120    }
121
122    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
123    pub fn customize(
124        self,
125    ) -> crate::client::customize::CustomizableOperation<
126        crate::operation::create_training_plan::CreateTrainingPlanOutput,
127        crate::operation::create_training_plan::CreateTrainingPlanError,
128        Self,
129    > {
130        crate::client::customize::CustomizableOperation::new(self)
131    }
132    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
133        self.set_config_override(::std::option::Option::Some(config_override.into()));
134        self
135    }
136
137    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
138        self.config_override = config_override;
139        self
140    }
141    /// <p>The name of the training plan to create.</p>
142    pub fn training_plan_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143        self.inner = self.inner.training_plan_name(input.into());
144        self
145    }
146    /// <p>The name of the training plan to create.</p>
147    pub fn set_training_plan_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148        self.inner = self.inner.set_training_plan_name(input);
149        self
150    }
151    /// <p>The name of the training plan to create.</p>
152    pub fn get_training_plan_name(&self) -> &::std::option::Option<::std::string::String> {
153        self.inner.get_training_plan_name()
154    }
155    /// <p>The unique identifier of the training plan offering to use for creating this plan.</p>
156    pub fn training_plan_offering_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157        self.inner = self.inner.training_plan_offering_id(input.into());
158        self
159    }
160    /// <p>The unique identifier of the training plan offering to use for creating this plan.</p>
161    pub fn set_training_plan_offering_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162        self.inner = self.inner.set_training_plan_offering_id(input);
163        self
164    }
165    /// <p>The unique identifier of the training plan offering to use for creating this plan.</p>
166    pub fn get_training_plan_offering_id(&self) -> &::std::option::Option<::std::string::String> {
167        self.inner.get_training_plan_offering_id()
168    }
169    ///
170    /// Appends an item to `Tags`.
171    ///
172    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
173    ///
174    /// <p>An array of key-value pairs to apply to this training plan.</p>
175    pub fn tags(mut self, input: crate::types::Tag) -> Self {
176        self.inner = self.inner.tags(input);
177        self
178    }
179    /// <p>An array of key-value pairs to apply to this training plan.</p>
180    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
181        self.inner = self.inner.set_tags(input);
182        self
183    }
184    /// <p>An array of key-value pairs to apply to this training plan.</p>
185    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
186        self.inner.get_tags()
187    }
188}