aws_sdk_bedrock/operation/create_model_invocation_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_model_invocation_job::_create_model_invocation_job_output::CreateModelInvocationJobOutputBuilder;
3
4pub use crate::operation::create_model_invocation_job::_create_model_invocation_job_input::CreateModelInvocationJobInputBuilder;
5
6impl crate::operation::create_model_invocation_job::builders::CreateModelInvocationJobInputBuilder {
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_invocation_job::CreateModelInvocationJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_model_invocation_job::CreateModelInvocationJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_model_invocation_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateModelInvocationJob`.
24///
25/// <p>Creates a batch inference job to invoke a model on multiple prompts. Format your data according to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference-data">Format your inference data</a> and upload it to an Amazon S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference.html">Process multiple prompts with batch inference</a>.</p>
26/// <p>The response returns a <code>jobArn</code> that you can use to stop or get details about the job.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateModelInvocationJobFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_model_invocation_job::builders::CreateModelInvocationJobInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::create_model_invocation_job::CreateModelInvocationJobOutput,
36        crate::operation::create_model_invocation_job::CreateModelInvocationJobError,
37    > for CreateModelInvocationJobFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::create_model_invocation_job::CreateModelInvocationJobOutput,
45            crate::operation::create_model_invocation_job::CreateModelInvocationJobError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl CreateModelInvocationJobFluentBuilder {
52    /// Creates a new `CreateModelInvocationJobFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the CreateModelInvocationJob as a reference.
61    pub fn as_input(&self) -> &crate::operation::create_model_invocation_job::builders::CreateModelInvocationJobInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::create_model_invocation_job::CreateModelInvocationJobOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::create_model_invocation_job::CreateModelInvocationJobError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::create_model_invocation_job::CreateModelInvocationJob::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::create_model_invocation_job::CreateModelInvocationJob::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::create_model_invocation_job::CreateModelInvocationJobOutput,
98        crate::operation::create_model_invocation_job::CreateModelInvocationJobError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>A name to give the batch inference job.</p>
113    pub fn job_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.job_name(input.into());
115        self
116    }
117    /// <p>A name to give the batch inference job.</p>
118    pub fn set_job_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_job_name(input);
120        self
121    }
122    /// <p>A name to give the batch inference job.</p>
123    pub fn get_job_name(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_job_name()
125    }
126    /// <p>The Amazon Resource Name (ARN) of the service role with permissions to carry out and manage batch inference. You can use the console to create a default service role or follow the steps at <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/batch-iam-sr.html">Create a service role for batch inference</a>.</p>
127    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.role_arn(input.into());
129        self
130    }
131    /// <p>The Amazon Resource Name (ARN) of the service role with permissions to carry out and manage batch inference. You can use the console to create a default service role or follow the steps at <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/batch-iam-sr.html">Create a service role for batch inference</a>.</p>
132    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_role_arn(input);
134        self
135    }
136    /// <p>The Amazon Resource Name (ARN) of the service role with permissions to carry out and manage batch inference. You can use the console to create a default service role or follow the steps at <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/batch-iam-sr.html">Create a service role for batch inference</a>.</p>
137    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_role_arn()
139    }
140    /// <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>
141    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.inner = self.inner.client_request_token(input.into());
143        self
144    }
145    /// <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>
146    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.inner = self.inner.set_client_request_token(input);
148        self
149    }
150    /// <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>
151    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
152        self.inner.get_client_request_token()
153    }
154    /// <p>The unique identifier of the foundation model to use for the batch inference job.</p>
155    pub fn model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.inner = self.inner.model_id(input.into());
157        self
158    }
159    /// <p>The unique identifier of the foundation model to use for the batch inference job.</p>
160    pub fn set_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.inner = self.inner.set_model_id(input);
162        self
163    }
164    /// <p>The unique identifier of the foundation model to use for the batch inference job.</p>
165    pub fn get_model_id(&self) -> &::std::option::Option<::std::string::String> {
166        self.inner.get_model_id()
167    }
168    /// <p>Details about the location of the input to the batch inference job.</p>
169    pub fn input_data_config(mut self, input: crate::types::ModelInvocationJobInputDataConfig) -> Self {
170        self.inner = self.inner.input_data_config(input);
171        self
172    }
173    /// <p>Details about the location of the input to the batch inference job.</p>
174    pub fn set_input_data_config(mut self, input: ::std::option::Option<crate::types::ModelInvocationJobInputDataConfig>) -> Self {
175        self.inner = self.inner.set_input_data_config(input);
176        self
177    }
178    /// <p>Details about the location of the input to the batch inference job.</p>
179    pub fn get_input_data_config(&self) -> &::std::option::Option<crate::types::ModelInvocationJobInputDataConfig> {
180        self.inner.get_input_data_config()
181    }
182    /// <p>Details about the location of the output of the batch inference job.</p>
183    pub fn output_data_config(mut self, input: crate::types::ModelInvocationJobOutputDataConfig) -> Self {
184        self.inner = self.inner.output_data_config(input);
185        self
186    }
187    /// <p>Details about the location of the output of the batch inference job.</p>
188    pub fn set_output_data_config(mut self, input: ::std::option::Option<crate::types::ModelInvocationJobOutputDataConfig>) -> Self {
189        self.inner = self.inner.set_output_data_config(input);
190        self
191    }
192    /// <p>Details about the location of the output of the batch inference job.</p>
193    pub fn get_output_data_config(&self) -> &::std::option::Option<crate::types::ModelInvocationJobOutputDataConfig> {
194        self.inner.get_output_data_config()
195    }
196    /// <p>The configuration of the Virtual Private Cloud (VPC) for the data in the batch inference job. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/batch-vpc">Protect batch inference jobs using a VPC</a>.</p>
197    pub fn vpc_config(mut self, input: crate::types::VpcConfig) -> Self {
198        self.inner = self.inner.vpc_config(input);
199        self
200    }
201    /// <p>The configuration of the Virtual Private Cloud (VPC) for the data in the batch inference job. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/batch-vpc">Protect batch inference jobs using a VPC</a>.</p>
202    pub fn set_vpc_config(mut self, input: ::std::option::Option<crate::types::VpcConfig>) -> Self {
203        self.inner = self.inner.set_vpc_config(input);
204        self
205    }
206    /// <p>The configuration of the Virtual Private Cloud (VPC) for the data in the batch inference job. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/batch-vpc">Protect batch inference jobs using a VPC</a>.</p>
207    pub fn get_vpc_config(&self) -> &::std::option::Option<crate::types::VpcConfig> {
208        self.inner.get_vpc_config()
209    }
210    /// <p>The number of hours after which to force the batch inference job to time out.</p>
211    pub fn timeout_duration_in_hours(mut self, input: i32) -> Self {
212        self.inner = self.inner.timeout_duration_in_hours(input);
213        self
214    }
215    /// <p>The number of hours after which to force the batch inference job to time out.</p>
216    pub fn set_timeout_duration_in_hours(mut self, input: ::std::option::Option<i32>) -> Self {
217        self.inner = self.inner.set_timeout_duration_in_hours(input);
218        self
219    }
220    /// <p>The number of hours after which to force the batch inference job to time out.</p>
221    pub fn get_timeout_duration_in_hours(&self) -> &::std::option::Option<i32> {
222        self.inner.get_timeout_duration_in_hours()
223    }
224    ///
225    /// Appends an item to `tags`.
226    ///
227    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
228    ///
229    /// <p>Any tags to associate with the batch inference job. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging Amazon Bedrock resources</a>.</p>
230    pub fn tags(mut self, input: crate::types::Tag) -> Self {
231        self.inner = self.inner.tags(input);
232        self
233    }
234    /// <p>Any tags to associate with the batch inference job. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging Amazon Bedrock resources</a>.</p>
235    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
236        self.inner = self.inner.set_tags(input);
237        self
238    }
239    /// <p>Any tags to associate with the batch inference job. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging Amazon Bedrock resources</a>.</p>
240    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
241        self.inner.get_tags()
242    }
243}