aws_sdk_sagemaker/operation/create_inference_experiment/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_inference_experiment::_create_inference_experiment_output::CreateInferenceExperimentOutputBuilder;
3
4pub use crate::operation::create_inference_experiment::_create_inference_experiment_input::CreateInferenceExperimentInputBuilder;
5
6impl crate::operation::create_inference_experiment::builders::CreateInferenceExperimentInputBuilder {
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_inference_experiment::CreateInferenceExperimentOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_inference_experiment::CreateInferenceExperimentError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_inference_experiment();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateInferenceExperiment`.
24///
25/// <p>Creates an inference experiment using the configurations specified in the request.</p>
26/// <p>Use this API to setup and schedule an experiment to compare model variants on a Amazon SageMaker inference endpoint. For more information about inference experiments, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/shadow-tests.html">Shadow tests</a>.</p>
27/// <p>Amazon SageMaker begins your experiment at the scheduled time and routes traffic to your endpoint's model variants based on your specified configuration.</p>
28/// <p>While the experiment is in progress or after it has concluded, you can view metrics that compare your model variants. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/shadow-tests-view-monitor-edit.html">View, monitor, and edit shadow tests</a>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct CreateInferenceExperimentFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::create_inference_experiment::builders::CreateInferenceExperimentInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::create_inference_experiment::CreateInferenceExperimentOutput,
38        crate::operation::create_inference_experiment::CreateInferenceExperimentError,
39    > for CreateInferenceExperimentFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::create_inference_experiment::CreateInferenceExperimentOutput,
47            crate::operation::create_inference_experiment::CreateInferenceExperimentError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl CreateInferenceExperimentFluentBuilder {
54    /// Creates a new `CreateInferenceExperimentFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the CreateInferenceExperiment as a reference.
63    pub fn as_input(&self) -> &crate::operation::create_inference_experiment::builders::CreateInferenceExperimentInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::create_inference_experiment::CreateInferenceExperimentOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::create_inference_experiment::CreateInferenceExperimentError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::create_inference_experiment::CreateInferenceExperiment::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::create_inference_experiment::CreateInferenceExperiment::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::create_inference_experiment::CreateInferenceExperimentOutput,
100        crate::operation::create_inference_experiment::CreateInferenceExperimentError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// <p>The name for the inference experiment.</p>
115    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.inner = self.inner.name(input.into());
117        self
118    }
119    /// <p>The name for the inference experiment.</p>
120    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.inner = self.inner.set_name(input);
122        self
123    }
124    /// <p>The name for the inference experiment.</p>
125    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
126        self.inner.get_name()
127    }
128    /// <p>The type of the inference experiment that you want to run. The following types of experiments are possible:</p>
129    /// <ul>
130    /// <li>
131    /// <p><code>ShadowMode</code>: You can use this type to validate a shadow variant. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/shadow-tests.html">Shadow tests</a>.</p></li>
132    /// </ul>
133    pub fn r#type(mut self, input: crate::types::InferenceExperimentType) -> Self {
134        self.inner = self.inner.r#type(input);
135        self
136    }
137    /// <p>The type of the inference experiment that you want to run. The following types of experiments are possible:</p>
138    /// <ul>
139    /// <li>
140    /// <p><code>ShadowMode</code>: You can use this type to validate a shadow variant. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/shadow-tests.html">Shadow tests</a>.</p></li>
141    /// </ul>
142    pub fn set_type(mut self, input: ::std::option::Option<crate::types::InferenceExperimentType>) -> Self {
143        self.inner = self.inner.set_type(input);
144        self
145    }
146    /// <p>The type of the inference experiment that you want to run. The following types of experiments are possible:</p>
147    /// <ul>
148    /// <li>
149    /// <p><code>ShadowMode</code>: You can use this type to validate a shadow variant. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/shadow-tests.html">Shadow tests</a>.</p></li>
150    /// </ul>
151    pub fn get_type(&self) -> &::std::option::Option<crate::types::InferenceExperimentType> {
152        self.inner.get_type()
153    }
154    /// <p>The duration for which you want the inference experiment to run. If you don't specify this field, the experiment automatically starts immediately upon creation and concludes after 7 days.</p>
155    pub fn schedule(mut self, input: crate::types::InferenceExperimentSchedule) -> Self {
156        self.inner = self.inner.schedule(input);
157        self
158    }
159    /// <p>The duration for which you want the inference experiment to run. If you don't specify this field, the experiment automatically starts immediately upon creation and concludes after 7 days.</p>
160    pub fn set_schedule(mut self, input: ::std::option::Option<crate::types::InferenceExperimentSchedule>) -> Self {
161        self.inner = self.inner.set_schedule(input);
162        self
163    }
164    /// <p>The duration for which you want the inference experiment to run. If you don't specify this field, the experiment automatically starts immediately upon creation and concludes after 7 days.</p>
165    pub fn get_schedule(&self) -> &::std::option::Option<crate::types::InferenceExperimentSchedule> {
166        self.inner.get_schedule()
167    }
168    /// <p>A description for the inference experiment.</p>
169    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170        self.inner = self.inner.description(input.into());
171        self
172    }
173    /// <p>A description for the inference experiment.</p>
174    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175        self.inner = self.inner.set_description(input);
176        self
177    }
178    /// <p>A description for the inference experiment.</p>
179    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
180        self.inner.get_description()
181    }
182    /// <p>The ARN of the IAM role that Amazon SageMaker can assume to access model artifacts and container images, and manage Amazon SageMaker Inference endpoints for model deployment.</p>
183    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184        self.inner = self.inner.role_arn(input.into());
185        self
186    }
187    /// <p>The ARN of the IAM role that Amazon SageMaker can assume to access model artifacts and container images, and manage Amazon SageMaker Inference endpoints for model deployment.</p>
188    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189        self.inner = self.inner.set_role_arn(input);
190        self
191    }
192    /// <p>The ARN of the IAM role that Amazon SageMaker can assume to access model artifacts and container images, and manage Amazon SageMaker Inference endpoints for model deployment.</p>
193    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
194        self.inner.get_role_arn()
195    }
196    /// <p>The name of the Amazon SageMaker endpoint on which you want to run the inference experiment.</p>
197    pub fn endpoint_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
198        self.inner = self.inner.endpoint_name(input.into());
199        self
200    }
201    /// <p>The name of the Amazon SageMaker endpoint on which you want to run the inference experiment.</p>
202    pub fn set_endpoint_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
203        self.inner = self.inner.set_endpoint_name(input);
204        self
205    }
206    /// <p>The name of the Amazon SageMaker endpoint on which you want to run the inference experiment.</p>
207    pub fn get_endpoint_name(&self) -> &::std::option::Option<::std::string::String> {
208        self.inner.get_endpoint_name()
209    }
210    ///
211    /// Appends an item to `ModelVariants`.
212    ///
213    /// To override the contents of this collection use [`set_model_variants`](Self::set_model_variants).
214    ///
215    /// <p>An array of <code>ModelVariantConfig</code> objects. There is one for each variant in the inference experiment. Each <code>ModelVariantConfig</code> object in the array describes the infrastructure configuration for the corresponding variant.</p>
216    pub fn model_variants(mut self, input: crate::types::ModelVariantConfig) -> Self {
217        self.inner = self.inner.model_variants(input);
218        self
219    }
220    /// <p>An array of <code>ModelVariantConfig</code> objects. There is one for each variant in the inference experiment. Each <code>ModelVariantConfig</code> object in the array describes the infrastructure configuration for the corresponding variant.</p>
221    pub fn set_model_variants(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ModelVariantConfig>>) -> Self {
222        self.inner = self.inner.set_model_variants(input);
223        self
224    }
225    /// <p>An array of <code>ModelVariantConfig</code> objects. There is one for each variant in the inference experiment. Each <code>ModelVariantConfig</code> object in the array describes the infrastructure configuration for the corresponding variant.</p>
226    pub fn get_model_variants(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ModelVariantConfig>> {
227        self.inner.get_model_variants()
228    }
229    /// <p>The Amazon S3 location and configuration for storing inference request and response data.</p>
230    /// <p>This is an optional parameter that you can use for data capture. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/model-monitor-data-capture.html">Capture data</a>.</p>
231    pub fn data_storage_config(mut self, input: crate::types::InferenceExperimentDataStorageConfig) -> Self {
232        self.inner = self.inner.data_storage_config(input);
233        self
234    }
235    /// <p>The Amazon S3 location and configuration for storing inference request and response data.</p>
236    /// <p>This is an optional parameter that you can use for data capture. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/model-monitor-data-capture.html">Capture data</a>.</p>
237    pub fn set_data_storage_config(mut self, input: ::std::option::Option<crate::types::InferenceExperimentDataStorageConfig>) -> Self {
238        self.inner = self.inner.set_data_storage_config(input);
239        self
240    }
241    /// <p>The Amazon S3 location and configuration for storing inference request and response data.</p>
242    /// <p>This is an optional parameter that you can use for data capture. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/model-monitor-data-capture.html">Capture data</a>.</p>
243    pub fn get_data_storage_config(&self) -> &::std::option::Option<crate::types::InferenceExperimentDataStorageConfig> {
244        self.inner.get_data_storage_config()
245    }
246    /// <p>The configuration of <code>ShadowMode</code> inference experiment type. Use this field to specify a production variant which takes all the inference requests, and a shadow variant to which Amazon SageMaker replicates a percentage of the inference requests. For the shadow variant also specify the percentage of requests that Amazon SageMaker replicates.</p>
247    pub fn shadow_mode_config(mut self, input: crate::types::ShadowModeConfig) -> Self {
248        self.inner = self.inner.shadow_mode_config(input);
249        self
250    }
251    /// <p>The configuration of <code>ShadowMode</code> inference experiment type. Use this field to specify a production variant which takes all the inference requests, and a shadow variant to which Amazon SageMaker replicates a percentage of the inference requests. For the shadow variant also specify the percentage of requests that Amazon SageMaker replicates.</p>
252    pub fn set_shadow_mode_config(mut self, input: ::std::option::Option<crate::types::ShadowModeConfig>) -> Self {
253        self.inner = self.inner.set_shadow_mode_config(input);
254        self
255    }
256    /// <p>The configuration of <code>ShadowMode</code> inference experiment type. Use this field to specify a production variant which takes all the inference requests, and a shadow variant to which Amazon SageMaker replicates a percentage of the inference requests. For the shadow variant also specify the percentage of requests that Amazon SageMaker replicates.</p>
257    pub fn get_shadow_mode_config(&self) -> &::std::option::Option<crate::types::ShadowModeConfig> {
258        self.inner.get_shadow_mode_config()
259    }
260    /// <p>The Amazon Web Services Key Management Service (Amazon Web Services KMS) key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance that hosts the endpoint. The <code>KmsKey</code> can be any of the following formats:</p>
261    /// <ul>
262    /// <li>
263    /// <p>KMS key ID</p>
264    /// <p><code>"1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
265    /// <li>
266    /// <p>Amazon Resource Name (ARN) of a KMS key</p>
267    /// <p><code>"arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
268    /// <li>
269    /// <p>KMS key Alias</p>
270    /// <p><code>"alias/ExampleAlias"</code></p></li>
271    /// <li>
272    /// <p>Amazon Resource Name (ARN) of a KMS key Alias</p>
273    /// <p><code>"arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias"</code></p></li>
274    /// </ul>
275    /// <p>If you use a KMS key ID or an alias of your KMS key, the Amazon SageMaker execution role must include permissions to call <code>kms:Encrypt</code>. If you don't provide a KMS key ID, Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account. Amazon SageMaker uses server-side encryption with KMS managed keys for <code>OutputDataConfig</code>. If you use a bucket policy with an <code>s3:PutObject</code> permission that only allows objects with server-side encryption, set the condition key of <code>s3:x-amz-server-side-encryption</code> to <code>"aws:kms"</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html">KMS managed Encryption Keys</a> in the <i>Amazon Simple Storage Service Developer Guide.</i></p>
276    /// <p>The KMS key policy must grant permission to the IAM role that you specify in your <code>CreateEndpoint</code> and <code>UpdateEndpoint</code> requests. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html">Using Key Policies in Amazon Web Services KMS</a> in the <i>Amazon Web Services Key Management Service Developer Guide</i>.</p>
277    pub fn kms_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
278        self.inner = self.inner.kms_key(input.into());
279        self
280    }
281    /// <p>The Amazon Web Services Key Management Service (Amazon Web Services KMS) key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance that hosts the endpoint. The <code>KmsKey</code> can be any of the following formats:</p>
282    /// <ul>
283    /// <li>
284    /// <p>KMS key ID</p>
285    /// <p><code>"1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
286    /// <li>
287    /// <p>Amazon Resource Name (ARN) of a KMS key</p>
288    /// <p><code>"arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
289    /// <li>
290    /// <p>KMS key Alias</p>
291    /// <p><code>"alias/ExampleAlias"</code></p></li>
292    /// <li>
293    /// <p>Amazon Resource Name (ARN) of a KMS key Alias</p>
294    /// <p><code>"arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias"</code></p></li>
295    /// </ul>
296    /// <p>If you use a KMS key ID or an alias of your KMS key, the Amazon SageMaker execution role must include permissions to call <code>kms:Encrypt</code>. If you don't provide a KMS key ID, Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account. Amazon SageMaker uses server-side encryption with KMS managed keys for <code>OutputDataConfig</code>. If you use a bucket policy with an <code>s3:PutObject</code> permission that only allows objects with server-side encryption, set the condition key of <code>s3:x-amz-server-side-encryption</code> to <code>"aws:kms"</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html">KMS managed Encryption Keys</a> in the <i>Amazon Simple Storage Service Developer Guide.</i></p>
297    /// <p>The KMS key policy must grant permission to the IAM role that you specify in your <code>CreateEndpoint</code> and <code>UpdateEndpoint</code> requests. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html">Using Key Policies in Amazon Web Services KMS</a> in the <i>Amazon Web Services Key Management Service Developer Guide</i>.</p>
298    pub fn set_kms_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
299        self.inner = self.inner.set_kms_key(input);
300        self
301    }
302    /// <p>The Amazon Web Services Key Management Service (Amazon Web Services KMS) key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance that hosts the endpoint. The <code>KmsKey</code> can be any of the following formats:</p>
303    /// <ul>
304    /// <li>
305    /// <p>KMS key ID</p>
306    /// <p><code>"1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
307    /// <li>
308    /// <p>Amazon Resource Name (ARN) of a KMS key</p>
309    /// <p><code>"arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"</code></p></li>
310    /// <li>
311    /// <p>KMS key Alias</p>
312    /// <p><code>"alias/ExampleAlias"</code></p></li>
313    /// <li>
314    /// <p>Amazon Resource Name (ARN) of a KMS key Alias</p>
315    /// <p><code>"arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias"</code></p></li>
316    /// </ul>
317    /// <p>If you use a KMS key ID or an alias of your KMS key, the Amazon SageMaker execution role must include permissions to call <code>kms:Encrypt</code>. If you don't provide a KMS key ID, Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account. Amazon SageMaker uses server-side encryption with KMS managed keys for <code>OutputDataConfig</code>. If you use a bucket policy with an <code>s3:PutObject</code> permission that only allows objects with server-side encryption, set the condition key of <code>s3:x-amz-server-side-encryption</code> to <code>"aws:kms"</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html">KMS managed Encryption Keys</a> in the <i>Amazon Simple Storage Service Developer Guide.</i></p>
318    /// <p>The KMS key policy must grant permission to the IAM role that you specify in your <code>CreateEndpoint</code> and <code>UpdateEndpoint</code> requests. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html">Using Key Policies in Amazon Web Services KMS</a> in the <i>Amazon Web Services Key Management Service Developer Guide</i>.</p>
319    pub fn get_kms_key(&self) -> &::std::option::Option<::std::string::String> {
320        self.inner.get_kms_key()
321    }
322    ///
323    /// Appends an item to `Tags`.
324    ///
325    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
326    ///
327    /// <p>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/ARG/latest/userguide/tagging.html">Tagging your Amazon Web Services Resources</a>.</p>
328    pub fn tags(mut self, input: crate::types::Tag) -> Self {
329        self.inner = self.inner.tags(input);
330        self
331    }
332    /// <p>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/ARG/latest/userguide/tagging.html">Tagging your Amazon Web Services Resources</a>.</p>
333    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
334        self.inner = self.inner.set_tags(input);
335        self
336    }
337    /// <p>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/ARG/latest/userguide/tagging.html">Tagging your Amazon Web Services Resources</a>.</p>
338    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
339        self.inner.get_tags()
340    }
341}