aws_sdk_bedrock/operation/create_model_customization_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_model_customization_job::_create_model_customization_job_output::CreateModelCustomizationJobOutputBuilder;
3
4pub use crate::operation::create_model_customization_job::_create_model_customization_job_input::CreateModelCustomizationJobInputBuilder;
5
6impl crate::operation::create_model_customization_job::builders::CreateModelCustomizationJobInputBuilder {
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_model_customization_job::CreateModelCustomizationJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_model_customization_job::CreateModelCustomizationJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_model_customization_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateModelCustomizationJob`.
24///
25/// <p>Creates a fine-tuning job to customize a base model.</p>
26/// <p>You specify the base foundation model and the location of the training data. After the model-customization job completes successfully, your custom model resource will be ready to use. Amazon Bedrock returns validation loss metrics and output generations after the job completes.</p>
27/// <p>For information on the format of training and validation data, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-prepare.html">Prepare the datasets</a>.</p>
28/// <p>Model-customization jobs are asynchronous and the completion time depends on the base model and the training/validation data size. To monitor a job, use the <code>GetModelCustomizationJob</code> operation to retrieve the job status.</p>
29/// <p>For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html">Custom models</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct CreateModelCustomizationJobFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::create_model_customization_job::builders::CreateModelCustomizationJobInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::create_model_customization_job::CreateModelCustomizationJobOutput,
39        crate::operation::create_model_customization_job::CreateModelCustomizationJobError,
40    > for CreateModelCustomizationJobFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::create_model_customization_job::CreateModelCustomizationJobOutput,
48            crate::operation::create_model_customization_job::CreateModelCustomizationJobError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl CreateModelCustomizationJobFluentBuilder {
55    /// Creates a new `CreateModelCustomizationJobFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the CreateModelCustomizationJob as a reference.
64    pub fn as_input(&self) -> &crate::operation::create_model_customization_job::builders::CreateModelCustomizationJobInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::create_model_customization_job::CreateModelCustomizationJobOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::create_model_customization_job::CreateModelCustomizationJobError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::create_model_customization_job::CreateModelCustomizationJob::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::create_model_customization_job::CreateModelCustomizationJob::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::create_model_customization_job::CreateModelCustomizationJobOutput,
101        crate::operation::create_model_customization_job::CreateModelCustomizationJobError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>A name for the fine-tuning job.</p>
116    pub fn job_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.inner = self.inner.job_name(input.into());
118        self
119    }
120    /// <p>A name for the fine-tuning job.</p>
121    pub fn set_job_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_job_name(input);
123        self
124    }
125    /// <p>A name for the fine-tuning job.</p>
126    pub fn get_job_name(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_job_name()
128    }
129    /// <p>A name for the resulting custom model.</p>
130    pub fn custom_model_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.custom_model_name(input.into());
132        self
133    }
134    /// <p>A name for the resulting custom model.</p>
135    pub fn set_custom_model_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_custom_model_name(input);
137        self
138    }
139    /// <p>A name for the resulting custom model.</p>
140    pub fn get_custom_model_name(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_custom_model_name()
142    }
143    /// <p>The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock can assume to perform tasks on your behalf. For example, during model training, Amazon Bedrock needs your permission to read input data from an S3 bucket, write model artifacts to an S3 bucket. To pass this role to Amazon Bedrock, the caller of this API must have the <code>iam:PassRole</code> permission.</p>
144    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.role_arn(input.into());
146        self
147    }
148    /// <p>The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock can assume to perform tasks on your behalf. For example, during model training, Amazon Bedrock needs your permission to read input data from an S3 bucket, write model artifacts to an S3 bucket. To pass this role to Amazon Bedrock, the caller of this API must have the <code>iam:PassRole</code> permission.</p>
149    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_role_arn(input);
151        self
152    }
153    /// <p>The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock can assume to perform tasks on your behalf. For example, during model training, Amazon Bedrock needs your permission to read input data from an S3 bucket, write model artifacts to an S3 bucket. To pass this role to Amazon Bedrock, the caller of this API must have the <code>iam:PassRole</code> permission.</p>
154    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_role_arn()
156    }
157    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
158    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
159        self.inner = self.inner.client_request_token(input.into());
160        self
161    }
162    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
163    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
164        self.inner = self.inner.set_client_request_token(input);
165        self
166    }
167    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
168    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
169        self.inner.get_client_request_token()
170    }
171    /// <p>Name of the base model.</p>
172    pub fn base_model_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
173        self.inner = self.inner.base_model_identifier(input.into());
174        self
175    }
176    /// <p>Name of the base model.</p>
177    pub fn set_base_model_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
178        self.inner = self.inner.set_base_model_identifier(input);
179        self
180    }
181    /// <p>Name of the base model.</p>
182    pub fn get_base_model_identifier(&self) -> &::std::option::Option<::std::string::String> {
183        self.inner.get_base_model_identifier()
184    }
185    /// <p>The customization type.</p>
186    pub fn customization_type(mut self, input: crate::types::CustomizationType) -> Self {
187        self.inner = self.inner.customization_type(input);
188        self
189    }
190    /// <p>The customization type.</p>
191    pub fn set_customization_type(mut self, input: ::std::option::Option<crate::types::CustomizationType>) -> Self {
192        self.inner = self.inner.set_customization_type(input);
193        self
194    }
195    /// <p>The customization type.</p>
196    pub fn get_customization_type(&self) -> &::std::option::Option<crate::types::CustomizationType> {
197        self.inner.get_customization_type()
198    }
199    /// <p>The custom model is encrypted at rest using this key.</p>
200    pub fn custom_model_kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
201        self.inner = self.inner.custom_model_kms_key_id(input.into());
202        self
203    }
204    /// <p>The custom model is encrypted at rest using this key.</p>
205    pub fn set_custom_model_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
206        self.inner = self.inner.set_custom_model_kms_key_id(input);
207        self
208    }
209    /// <p>The custom model is encrypted at rest using this key.</p>
210    pub fn get_custom_model_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
211        self.inner.get_custom_model_kms_key_id()
212    }
213    ///
214    /// Appends an item to `jobTags`.
215    ///
216    /// To override the contents of this collection use [`set_job_tags`](Self::set_job_tags).
217    ///
218    /// <p>Tags to attach to the job.</p>
219    pub fn job_tags(mut self, input: crate::types::Tag) -> Self {
220        self.inner = self.inner.job_tags(input);
221        self
222    }
223    /// <p>Tags to attach to the job.</p>
224    pub fn set_job_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
225        self.inner = self.inner.set_job_tags(input);
226        self
227    }
228    /// <p>Tags to attach to the job.</p>
229    pub fn get_job_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
230        self.inner.get_job_tags()
231    }
232    ///
233    /// Appends an item to `customModelTags`.
234    ///
235    /// To override the contents of this collection use [`set_custom_model_tags`](Self::set_custom_model_tags).
236    ///
237    /// <p>Tags to attach to the resulting custom model.</p>
238    pub fn custom_model_tags(mut self, input: crate::types::Tag) -> Self {
239        self.inner = self.inner.custom_model_tags(input);
240        self
241    }
242    /// <p>Tags to attach to the resulting custom model.</p>
243    pub fn set_custom_model_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
244        self.inner = self.inner.set_custom_model_tags(input);
245        self
246    }
247    /// <p>Tags to attach to the resulting custom model.</p>
248    pub fn get_custom_model_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
249        self.inner.get_custom_model_tags()
250    }
251    /// <p>Information about the training dataset.</p>
252    pub fn training_data_config(mut self, input: crate::types::TrainingDataConfig) -> Self {
253        self.inner = self.inner.training_data_config(input);
254        self
255    }
256    /// <p>Information about the training dataset.</p>
257    pub fn set_training_data_config(mut self, input: ::std::option::Option<crate::types::TrainingDataConfig>) -> Self {
258        self.inner = self.inner.set_training_data_config(input);
259        self
260    }
261    /// <p>Information about the training dataset.</p>
262    pub fn get_training_data_config(&self) -> &::std::option::Option<crate::types::TrainingDataConfig> {
263        self.inner.get_training_data_config()
264    }
265    /// <p>Information about the validation dataset.</p>
266    pub fn validation_data_config(mut self, input: crate::types::ValidationDataConfig) -> Self {
267        self.inner = self.inner.validation_data_config(input);
268        self
269    }
270    /// <p>Information about the validation dataset.</p>
271    pub fn set_validation_data_config(mut self, input: ::std::option::Option<crate::types::ValidationDataConfig>) -> Self {
272        self.inner = self.inner.set_validation_data_config(input);
273        self
274    }
275    /// <p>Information about the validation dataset.</p>
276    pub fn get_validation_data_config(&self) -> &::std::option::Option<crate::types::ValidationDataConfig> {
277        self.inner.get_validation_data_config()
278    }
279    /// <p>S3 location for the output data.</p>
280    pub fn output_data_config(mut self, input: crate::types::OutputDataConfig) -> Self {
281        self.inner = self.inner.output_data_config(input);
282        self
283    }
284    /// <p>S3 location for the output data.</p>
285    pub fn set_output_data_config(mut self, input: ::std::option::Option<crate::types::OutputDataConfig>) -> Self {
286        self.inner = self.inner.set_output_data_config(input);
287        self
288    }
289    /// <p>S3 location for the output data.</p>
290    pub fn get_output_data_config(&self) -> &::std::option::Option<crate::types::OutputDataConfig> {
291        self.inner.get_output_data_config()
292    }
293    ///
294    /// Adds a key-value pair to `hyperParameters`.
295    ///
296    /// To override the contents of this collection use [`set_hyper_parameters`](Self::set_hyper_parameters).
297    ///
298    /// <p>Parameters related to tuning the model. For details on the format for different models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models-hp.html">Custom model hyperparameters</a>.</p>
299    pub fn hyper_parameters(
300        mut self,
301        k: impl ::std::convert::Into<::std::string::String>,
302        v: impl ::std::convert::Into<::std::string::String>,
303    ) -> Self {
304        self.inner = self.inner.hyper_parameters(k.into(), v.into());
305        self
306    }
307    /// <p>Parameters related to tuning the model. For details on the format for different models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models-hp.html">Custom model hyperparameters</a>.</p>
308    pub fn set_hyper_parameters(
309        mut self,
310        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
311    ) -> Self {
312        self.inner = self.inner.set_hyper_parameters(input);
313        self
314    }
315    /// <p>Parameters related to tuning the model. For details on the format for different models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models-hp.html">Custom model hyperparameters</a>.</p>
316    pub fn get_hyper_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
317        self.inner.get_hyper_parameters()
318    }
319    /// <p>The configuration of the Virtual Private Cloud (VPC) that contains the resources that you're using for this job. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/vpc-model-customization.html">Protect your model customization jobs using a VPC</a>.</p>
320    pub fn vpc_config(mut self, input: crate::types::VpcConfig) -> Self {
321        self.inner = self.inner.vpc_config(input);
322        self
323    }
324    /// <p>The configuration of the Virtual Private Cloud (VPC) that contains the resources that you're using for this job. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/vpc-model-customization.html">Protect your model customization jobs using a VPC</a>.</p>
325    pub fn set_vpc_config(mut self, input: ::std::option::Option<crate::types::VpcConfig>) -> Self {
326        self.inner = self.inner.set_vpc_config(input);
327        self
328    }
329    /// <p>The configuration of the Virtual Private Cloud (VPC) that contains the resources that you're using for this job. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/vpc-model-customization.html">Protect your model customization jobs using a VPC</a>.</p>
330    pub fn get_vpc_config(&self) -> &::std::option::Option<crate::types::VpcConfig> {
331        self.inner.get_vpc_config()
332    }
333    /// <p>The customization configuration for the model customization job.</p>
334    pub fn customization_config(mut self, input: crate::types::CustomizationConfig) -> Self {
335        self.inner = self.inner.customization_config(input);
336        self
337    }
338    /// <p>The customization configuration for the model customization job.</p>
339    pub fn set_customization_config(mut self, input: ::std::option::Option<crate::types::CustomizationConfig>) -> Self {
340        self.inner = self.inner.set_customization_config(input);
341        self
342    }
343    /// <p>The customization configuration for the model customization job.</p>
344    pub fn get_customization_config(&self) -> &::std::option::Option<crate::types::CustomizationConfig> {
345        self.inner.get_customization_config()
346    }
347}