aws_sdk_bedrock/operation/create_custom_model/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_custom_model::_create_custom_model_output::CreateCustomModelOutputBuilder;
3
4pub use crate::operation::create_custom_model::_create_custom_model_input::CreateCustomModelInputBuilder;
5
6impl crate::operation::create_custom_model::builders::CreateCustomModelInputBuilder {
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_custom_model::CreateCustomModelOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_custom_model::CreateCustomModelError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_custom_model();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateCustomModel`.
24///
25/// <p>Creates a new custom model in Amazon Bedrock. After the model is active, you can use it for inference.</p>
26/// <p>To use the model for inference, you must purchase Provisioned Throughput for it. You can't use On-demand inference with these custom models. For more information about Provisioned Throughput, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html">Provisioned Throughput</a>.</p>
27/// <p>The model appears in <code>ListCustomModels</code> with a <code>customizationType</code> of <code>imported</code>. To track the status of the new model, you use the <code>GetCustomModel</code> API operation. The model can be in the following states:</p>
28/// <ul>
29/// <li>
30/// <p><code>Creating</code> - Initial state during validation and registration</p></li>
31/// <li>
32/// <p><code>Active</code> - Model is ready for use in inference</p></li>
33/// <li>
34/// <p><code>Failed</code> - Creation process encountered an error</p></li>
35/// </ul>
36/// <p><b>Related APIs</b></p>
37/// <ul>
38/// <li>
39/// <p><a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetCustomModel.html">GetCustomModel</a></p></li>
40/// <li>
41/// <p><a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_ListCustomModels.html">ListCustomModels</a></p></li>
42/// <li>
43/// <p><a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_DeleteCustomModel.html">DeleteCustomModel</a></p></li>
44/// </ul>
45#[derive(::std::clone::Clone, ::std::fmt::Debug)]
46pub struct CreateCustomModelFluentBuilder {
47    handle: ::std::sync::Arc<crate::client::Handle>,
48    inner: crate::operation::create_custom_model::builders::CreateCustomModelInputBuilder,
49    config_override: ::std::option::Option<crate::config::Builder>,
50}
51impl
52    crate::client::customize::internal::CustomizableSend<
53        crate::operation::create_custom_model::CreateCustomModelOutput,
54        crate::operation::create_custom_model::CreateCustomModelError,
55    > for CreateCustomModelFluentBuilder
56{
57    fn send(
58        self,
59        config_override: crate::config::Builder,
60    ) -> crate::client::customize::internal::BoxFuture<
61        crate::client::customize::internal::SendResult<
62            crate::operation::create_custom_model::CreateCustomModelOutput,
63            crate::operation::create_custom_model::CreateCustomModelError,
64        >,
65    > {
66        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
67    }
68}
69impl CreateCustomModelFluentBuilder {
70    /// Creates a new `CreateCustomModelFluentBuilder`.
71    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
72        Self {
73            handle,
74            inner: ::std::default::Default::default(),
75            config_override: ::std::option::Option::None,
76        }
77    }
78    /// Access the CreateCustomModel as a reference.
79    pub fn as_input(&self) -> &crate::operation::create_custom_model::builders::CreateCustomModelInputBuilder {
80        &self.inner
81    }
82    /// Sends the request and returns the response.
83    ///
84    /// If an error occurs, an `SdkError` will be returned with additional details that
85    /// can be matched against.
86    ///
87    /// By default, any retryable failures will be retried twice. Retry behavior
88    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
89    /// set when configuring the client.
90    pub async fn send(
91        self,
92    ) -> ::std::result::Result<
93        crate::operation::create_custom_model::CreateCustomModelOutput,
94        ::aws_smithy_runtime_api::client::result::SdkError<
95            crate::operation::create_custom_model::CreateCustomModelError,
96            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
97        >,
98    > {
99        let input = self
100            .inner
101            .build()
102            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
103        let runtime_plugins = crate::operation::create_custom_model::CreateCustomModel::operation_runtime_plugins(
104            self.handle.runtime_plugins.clone(),
105            &self.handle.conf,
106            self.config_override,
107        );
108        crate::operation::create_custom_model::CreateCustomModel::orchestrate(&runtime_plugins, input).await
109    }
110
111    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
112    pub fn customize(
113        self,
114    ) -> crate::client::customize::CustomizableOperation<
115        crate::operation::create_custom_model::CreateCustomModelOutput,
116        crate::operation::create_custom_model::CreateCustomModelError,
117        Self,
118    > {
119        crate::client::customize::CustomizableOperation::new(self)
120    }
121    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
122        self.set_config_override(::std::option::Option::Some(config_override.into()));
123        self
124    }
125
126    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
127        self.config_override = config_override;
128        self
129    }
130    /// <p>A unique name for the custom model.</p>
131    pub fn model_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.inner = self.inner.model_name(input.into());
133        self
134    }
135    /// <p>A unique name for the custom model.</p>
136    pub fn set_model_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_model_name(input);
138        self
139    }
140    /// <p>A unique name for the custom model.</p>
141    pub fn get_model_name(&self) -> &::std::option::Option<::std::string::String> {
142        self.inner.get_model_name()
143    }
144    /// <p>The data source for the model. The Amazon S3 URI in the model source must be for the Amazon-managed Amazon S3 bucket containing your model artifacts.</p>
145    pub fn model_source_config(mut self, input: crate::types::ModelDataSource) -> Self {
146        self.inner = self.inner.model_source_config(input);
147        self
148    }
149    /// <p>The data source for the model. The Amazon S3 URI in the model source must be for the Amazon-managed Amazon S3 bucket containing your model artifacts.</p>
150    pub fn set_model_source_config(mut self, input: ::std::option::Option<crate::types::ModelDataSource>) -> Self {
151        self.inner = self.inner.set_model_source_config(input);
152        self
153    }
154    /// <p>The data source for the model. The Amazon S3 URI in the model source must be for the Amazon-managed Amazon S3 bucket containing your model artifacts.</p>
155    pub fn get_model_source_config(&self) -> &::std::option::Option<crate::types::ModelDataSource> {
156        self.inner.get_model_source_config()
157    }
158    /// <p>The Amazon Resource Name (ARN) of the customer managed KMS key to encrypt the custom model. If you don't provide a KMS key, Amazon Bedrock uses an Amazon Web Services-managed KMS key to encrypt the model.</p>
159    /// <p>If you provide a customer managed KMS key, your Amazon Bedrock service role must have permissions to use it. For more information see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/encryption-import-model.html">Encryption of imported models</a>.</p>
160    pub fn model_kms_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.model_kms_key_arn(input.into());
162        self
163    }
164    /// <p>The Amazon Resource Name (ARN) of the customer managed KMS key to encrypt the custom model. If you don't provide a KMS key, Amazon Bedrock uses an Amazon Web Services-managed KMS key to encrypt the model.</p>
165    /// <p>If you provide a customer managed KMS key, your Amazon Bedrock service role must have permissions to use it. For more information see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/encryption-import-model.html">Encryption of imported models</a>.</p>
166    pub fn set_model_kms_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167        self.inner = self.inner.set_model_kms_key_arn(input);
168        self
169    }
170    /// <p>The Amazon Resource Name (ARN) of the customer managed KMS key to encrypt the custom model. If you don't provide a KMS key, Amazon Bedrock uses an Amazon Web Services-managed KMS key to encrypt the model.</p>
171    /// <p>If you provide a customer managed KMS key, your Amazon Bedrock service role must have permissions to use it. For more information see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/encryption-import-model.html">Encryption of imported models</a>.</p>
172    pub fn get_model_kms_key_arn(&self) -> &::std::option::Option<::std::string::String> {
173        self.inner.get_model_kms_key_arn()
174    }
175    /// <p>The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock assumes to perform tasks on your behalf. This role must have permissions to access the Amazon S3 bucket containing your model artifacts and the KMS key (if specified). For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-import-iam-role.html">Setting up an IAM service role for importing models</a> in the Amazon Bedrock User Guide.</p>
176    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177        self.inner = self.inner.role_arn(input.into());
178        self
179    }
180    /// <p>The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock assumes to perform tasks on your behalf. This role must have permissions to access the Amazon S3 bucket containing your model artifacts and the KMS key (if specified). For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-import-iam-role.html">Setting up an IAM service role for importing models</a> in the Amazon Bedrock User Guide.</p>
181    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182        self.inner = self.inner.set_role_arn(input);
183        self
184    }
185    /// <p>The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock assumes to perform tasks on your behalf. This role must have permissions to access the Amazon S3 bucket containing your model artifacts and the KMS key (if specified). For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-import-iam-role.html">Setting up an IAM service role for importing models</a> in the Amazon Bedrock User Guide.</p>
186    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
187        self.inner.get_role_arn()
188    }
189    ///
190    /// Appends an item to `modelTags`.
191    ///
192    /// To override the contents of this collection use [`set_model_tags`](Self::set_model_tags).
193    ///
194    /// <p>A list of key-value pairs to associate with the custom model resource. You can use these tags to organize and identify your resources.</p>
195    /// <p>For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging resources</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
196    pub fn model_tags(mut self, input: crate::types::Tag) -> Self {
197        self.inner = self.inner.model_tags(input);
198        self
199    }
200    /// <p>A list of key-value pairs to associate with the custom model resource. You can use these tags to organize and identify your resources.</p>
201    /// <p>For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging resources</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
202    pub fn set_model_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
203        self.inner = self.inner.set_model_tags(input);
204        self
205    }
206    /// <p>A list of key-value pairs to associate with the custom model resource. You can use these tags to organize and identify your resources.</p>
207    /// <p>For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging resources</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
208    pub fn get_model_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
209        self.inner.get_model_tags()
210    }
211    /// <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>
212    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
213        self.inner = self.inner.client_request_token(input.into());
214        self
215    }
216    /// <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>
217    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
218        self.inner = self.inner.set_client_request_token(input);
219        self
220    }
221    /// <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>
222    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
223        self.inner.get_client_request_token()
224    }
225}