aws_sdk_sagemaker/operation/create_compilation_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_compilation_job::_create_compilation_job_output::CreateCompilationJobOutputBuilder;
3
4pub use crate::operation::create_compilation_job::_create_compilation_job_input::CreateCompilationJobInputBuilder;
5
6impl crate::operation::create_compilation_job::builders::CreateCompilationJobInputBuilder {
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_compilation_job::CreateCompilationJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_compilation_job::CreateCompilationJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_compilation_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateCompilationJob`.
24///
25/// <p>Starts a model compilation job. After the model has been compiled, Amazon SageMaker AI saves the resulting model artifacts to an Amazon Simple Storage Service (Amazon S3) bucket that you specify.</p>
26/// <p>If you choose to host your model using Amazon SageMaker AI hosting services, you can use the resulting model artifacts as part of the model. You can also use the artifacts with Amazon Web Services IoT Greengrass. In that case, deploy them as an ML resource.</p>
27/// <p>In the request body, you provide the following:</p>
28/// <ul>
29/// <li>
30/// <p>A name for the compilation job</p></li>
31/// <li>
32/// <p>Information about the input model artifacts</p></li>
33/// <li>
34/// <p>The output location for the compiled model and the device (target) that the model runs on</p></li>
35/// <li>
36/// <p>The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker AI assumes to perform the model compilation job.</p></li>
37/// </ul>
38/// <p>You can also provide a <code>Tag</code> to track the model compilation job's resource use and costs. The response body contains the <code>CompilationJobArn</code> for the compiled job.</p>
39/// <p>To stop a model compilation job, use <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_StopCompilationJob.html">StopCompilationJob</a>. To get information about a particular model compilation job, use <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeCompilationJob.html">DescribeCompilationJob</a>. To get information about multiple model compilation jobs, use <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListCompilationJobs.html">ListCompilationJobs</a>.</p>
40#[derive(::std::clone::Clone, ::std::fmt::Debug)]
41pub struct CreateCompilationJobFluentBuilder {
42    handle: ::std::sync::Arc<crate::client::Handle>,
43    inner: crate::operation::create_compilation_job::builders::CreateCompilationJobInputBuilder,
44    config_override: ::std::option::Option<crate::config::Builder>,
45}
46impl
47    crate::client::customize::internal::CustomizableSend<
48        crate::operation::create_compilation_job::CreateCompilationJobOutput,
49        crate::operation::create_compilation_job::CreateCompilationJobError,
50    > for CreateCompilationJobFluentBuilder
51{
52    fn send(
53        self,
54        config_override: crate::config::Builder,
55    ) -> crate::client::customize::internal::BoxFuture<
56        crate::client::customize::internal::SendResult<
57            crate::operation::create_compilation_job::CreateCompilationJobOutput,
58            crate::operation::create_compilation_job::CreateCompilationJobError,
59        >,
60    > {
61        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
62    }
63}
64impl CreateCompilationJobFluentBuilder {
65    /// Creates a new `CreateCompilationJobFluentBuilder`.
66    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
67        Self {
68            handle,
69            inner: ::std::default::Default::default(),
70            config_override: ::std::option::Option::None,
71        }
72    }
73    /// Access the CreateCompilationJob as a reference.
74    pub fn as_input(&self) -> &crate::operation::create_compilation_job::builders::CreateCompilationJobInputBuilder {
75        &self.inner
76    }
77    /// Sends the request and returns the response.
78    ///
79    /// If an error occurs, an `SdkError` will be returned with additional details that
80    /// can be matched against.
81    ///
82    /// By default, any retryable failures will be retried twice. Retry behavior
83    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
84    /// set when configuring the client.
85    pub async fn send(
86        self,
87    ) -> ::std::result::Result<
88        crate::operation::create_compilation_job::CreateCompilationJobOutput,
89        ::aws_smithy_runtime_api::client::result::SdkError<
90            crate::operation::create_compilation_job::CreateCompilationJobError,
91            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
92        >,
93    > {
94        let input = self
95            .inner
96            .build()
97            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
98        let runtime_plugins = crate::operation::create_compilation_job::CreateCompilationJob::operation_runtime_plugins(
99            self.handle.runtime_plugins.clone(),
100            &self.handle.conf,
101            self.config_override,
102        );
103        crate::operation::create_compilation_job::CreateCompilationJob::orchestrate(&runtime_plugins, input).await
104    }
105
106    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
107    pub fn customize(
108        self,
109    ) -> crate::client::customize::CustomizableOperation<
110        crate::operation::create_compilation_job::CreateCompilationJobOutput,
111        crate::operation::create_compilation_job::CreateCompilationJobError,
112        Self,
113    > {
114        crate::client::customize::CustomizableOperation::new(self)
115    }
116    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
117        self.set_config_override(::std::option::Option::Some(config_override.into()));
118        self
119    }
120
121    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
122        self.config_override = config_override;
123        self
124    }
125    /// <p>A name for the model compilation job. The name must be unique within the Amazon Web Services Region and within your Amazon Web Services account.</p>
126    pub fn compilation_job_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.compilation_job_name(input.into());
128        self
129    }
130    /// <p>A name for the model compilation job. The name must be unique within the Amazon Web Services Region and within your Amazon Web Services account.</p>
131    pub fn set_compilation_job_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_compilation_job_name(input);
133        self
134    }
135    /// <p>A name for the model compilation job. The name must be unique within the Amazon Web Services Region and within your Amazon Web Services account.</p>
136    pub fn get_compilation_job_name(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_compilation_job_name()
138    }
139    /// <p>The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker AI to perform tasks on your behalf.</p>
140    /// <p>During model compilation, Amazon SageMaker AI needs your permission to:</p>
141    /// <ul>
142    /// <li>
143    /// <p>Read input data from an S3 bucket</p></li>
144    /// <li>
145    /// <p>Write model artifacts to an S3 bucket</p></li>
146    /// <li>
147    /// <p>Write logs to Amazon CloudWatch Logs</p></li>
148    /// <li>
149    /// <p>Publish metrics to Amazon CloudWatch</p></li>
150    /// </ul>
151    /// <p>You grant permissions for all of these tasks to an IAM role. To pass this role to Amazon SageMaker AI, the caller of this API must have the <code>iam:PassRole</code> permission. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html">Amazon SageMaker AI Roles.</a></p>
152    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.inner = self.inner.role_arn(input.into());
154        self
155    }
156    /// <p>The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker AI to perform tasks on your behalf.</p>
157    /// <p>During model compilation, Amazon SageMaker AI needs your permission to:</p>
158    /// <ul>
159    /// <li>
160    /// <p>Read input data from an S3 bucket</p></li>
161    /// <li>
162    /// <p>Write model artifacts to an S3 bucket</p></li>
163    /// <li>
164    /// <p>Write logs to Amazon CloudWatch Logs</p></li>
165    /// <li>
166    /// <p>Publish metrics to Amazon CloudWatch</p></li>
167    /// </ul>
168    /// <p>You grant permissions for all of these tasks to an IAM role. To pass this role to Amazon SageMaker AI, the caller of this API must have the <code>iam:PassRole</code> permission. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html">Amazon SageMaker AI Roles.</a></p>
169    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
170        self.inner = self.inner.set_role_arn(input);
171        self
172    }
173    /// <p>The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker AI to perform tasks on your behalf.</p>
174    /// <p>During model compilation, Amazon SageMaker AI needs your permission to:</p>
175    /// <ul>
176    /// <li>
177    /// <p>Read input data from an S3 bucket</p></li>
178    /// <li>
179    /// <p>Write model artifacts to an S3 bucket</p></li>
180    /// <li>
181    /// <p>Write logs to Amazon CloudWatch Logs</p></li>
182    /// <li>
183    /// <p>Publish metrics to Amazon CloudWatch</p></li>
184    /// </ul>
185    /// <p>You grant permissions for all of these tasks to an IAM role. To pass this role to Amazon SageMaker AI, the caller of this API must have the <code>iam:PassRole</code> permission. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html">Amazon SageMaker AI Roles.</a></p>
186    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
187        self.inner.get_role_arn()
188    }
189    /// <p>The Amazon Resource Name (ARN) of a versioned model package. Provide either a <code>ModelPackageVersionArn</code> or an <code>InputConfig</code> object in the request syntax. The presence of both objects in the <code>CreateCompilationJob</code> request will return an exception.</p>
190    pub fn model_package_version_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.inner = self.inner.model_package_version_arn(input.into());
192        self
193    }
194    /// <p>The Amazon Resource Name (ARN) of a versioned model package. Provide either a <code>ModelPackageVersionArn</code> or an <code>InputConfig</code> object in the request syntax. The presence of both objects in the <code>CreateCompilationJob</code> request will return an exception.</p>
195    pub fn set_model_package_version_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196        self.inner = self.inner.set_model_package_version_arn(input);
197        self
198    }
199    /// <p>The Amazon Resource Name (ARN) of a versioned model package. Provide either a <code>ModelPackageVersionArn</code> or an <code>InputConfig</code> object in the request syntax. The presence of both objects in the <code>CreateCompilationJob</code> request will return an exception.</p>
200    pub fn get_model_package_version_arn(&self) -> &::std::option::Option<::std::string::String> {
201        self.inner.get_model_package_version_arn()
202    }
203    /// <p>Provides information about the location of input model artifacts, the name and shape of the expected data inputs, and the framework in which the model was trained.</p>
204    pub fn input_config(mut self, input: crate::types::InputConfig) -> Self {
205        self.inner = self.inner.input_config(input);
206        self
207    }
208    /// <p>Provides information about the location of input model artifacts, the name and shape of the expected data inputs, and the framework in which the model was trained.</p>
209    pub fn set_input_config(mut self, input: ::std::option::Option<crate::types::InputConfig>) -> Self {
210        self.inner = self.inner.set_input_config(input);
211        self
212    }
213    /// <p>Provides information about the location of input model artifacts, the name and shape of the expected data inputs, and the framework in which the model was trained.</p>
214    pub fn get_input_config(&self) -> &::std::option::Option<crate::types::InputConfig> {
215        self.inner.get_input_config()
216    }
217    /// <p>Provides information about the output location for the compiled model and the target device the model runs on.</p>
218    pub fn output_config(mut self, input: crate::types::OutputConfig) -> Self {
219        self.inner = self.inner.output_config(input);
220        self
221    }
222    /// <p>Provides information about the output location for the compiled model and the target device the model runs on.</p>
223    pub fn set_output_config(mut self, input: ::std::option::Option<crate::types::OutputConfig>) -> Self {
224        self.inner = self.inner.set_output_config(input);
225        self
226    }
227    /// <p>Provides information about the output location for the compiled model and the target device the model runs on.</p>
228    pub fn get_output_config(&self) -> &::std::option::Option<crate::types::OutputConfig> {
229        self.inner.get_output_config()
230    }
231    /// <p>A <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_VpcConfig.html">VpcConfig</a> object that specifies the VPC that you want your compilation job to connect to. Control access to your models by configuring the VPC. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/neo-vpc.html">Protect Compilation Jobs by Using an Amazon Virtual Private Cloud</a>.</p>
232    pub fn vpc_config(mut self, input: crate::types::NeoVpcConfig) -> Self {
233        self.inner = self.inner.vpc_config(input);
234        self
235    }
236    /// <p>A <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_VpcConfig.html">VpcConfig</a> object that specifies the VPC that you want your compilation job to connect to. Control access to your models by configuring the VPC. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/neo-vpc.html">Protect Compilation Jobs by Using an Amazon Virtual Private Cloud</a>.</p>
237    pub fn set_vpc_config(mut self, input: ::std::option::Option<crate::types::NeoVpcConfig>) -> Self {
238        self.inner = self.inner.set_vpc_config(input);
239        self
240    }
241    /// <p>A <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_VpcConfig.html">VpcConfig</a> object that specifies the VPC that you want your compilation job to connect to. Control access to your models by configuring the VPC. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/neo-vpc.html">Protect Compilation Jobs by Using an Amazon Virtual Private Cloud</a>.</p>
242    pub fn get_vpc_config(&self) -> &::std::option::Option<crate::types::NeoVpcConfig> {
243        self.inner.get_vpc_config()
244    }
245    /// <p>Specifies a limit to how long a model compilation job can run. When the job reaches the time limit, Amazon SageMaker AI ends the compilation job. Use this API to cap model training costs.</p>
246    pub fn stopping_condition(mut self, input: crate::types::StoppingCondition) -> Self {
247        self.inner = self.inner.stopping_condition(input);
248        self
249    }
250    /// <p>Specifies a limit to how long a model compilation job can run. When the job reaches the time limit, Amazon SageMaker AI ends the compilation job. Use this API to cap model training costs.</p>
251    pub fn set_stopping_condition(mut self, input: ::std::option::Option<crate::types::StoppingCondition>) -> Self {
252        self.inner = self.inner.set_stopping_condition(input);
253        self
254    }
255    /// <p>Specifies a limit to how long a model compilation job can run. When the job reaches the time limit, Amazon SageMaker AI ends the compilation job. Use this API to cap model training costs.</p>
256    pub fn get_stopping_condition(&self) -> &::std::option::Option<crate::types::StoppingCondition> {
257        self.inner.get_stopping_condition()
258    }
259    ///
260    /// Appends an item to `Tags`.
261    ///
262    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
263    ///
264    /// <p>An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a>.</p>
265    pub fn tags(mut self, input: crate::types::Tag) -> Self {
266        self.inner = self.inner.tags(input);
267        self
268    }
269    /// <p>An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a>.</p>
270    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
271        self.inner = self.inner.set_tags(input);
272        self
273    }
274    /// <p>An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a>.</p>
275    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
276        self.inner.get_tags()
277    }
278}