aws_sdk_sagemakerruntime/operation/invoke_endpoint_async/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::invoke_endpoint_async::_invoke_endpoint_async_output::InvokeEndpointAsyncOutputBuilder;
3
4pub use crate::operation::invoke_endpoint_async::_invoke_endpoint_async_input::InvokeEndpointAsyncInputBuilder;
5
6impl crate::operation::invoke_endpoint_async::builders::InvokeEndpointAsyncInputBuilder {
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::invoke_endpoint_async::InvokeEndpointAsyncOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::invoke_endpoint_async::InvokeEndpointAsyncError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.invoke_endpoint_async();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `InvokeEndpointAsync`.
24///
25/// <p>After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint in an asynchronous manner.</p>
26/// <p>Inference requests sent to this API are enqueued for asynchronous processing. The processing of the inference request may or may not complete before you receive a response from this API. The response from this API will not contain the result of the inference request but contain information about where you can locate it.</p>
27/// <p>Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax.</p>
28/// <p>Calls to <code>InvokeEndpointAsync</code> are authenticated by using Amazon Web Services Signature Version 4. For information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html">Authenticating Requests (Amazon Web Services Signature Version 4)</a> in the <i>Amazon S3 API Reference</i>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct InvokeEndpointAsyncFluentBuilder {
31 handle: ::std::sync::Arc<crate::client::Handle>,
32 inner: crate::operation::invoke_endpoint_async::builders::InvokeEndpointAsyncInputBuilder,
33 config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36 crate::client::customize::internal::CustomizableSend<
37 crate::operation::invoke_endpoint_async::InvokeEndpointAsyncOutput,
38 crate::operation::invoke_endpoint_async::InvokeEndpointAsyncError,
39 > for InvokeEndpointAsyncFluentBuilder
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::invoke_endpoint_async::InvokeEndpointAsyncOutput,
47 crate::operation::invoke_endpoint_async::InvokeEndpointAsyncError,
48 >,
49 > {
50 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51 }
52}
53impl InvokeEndpointAsyncFluentBuilder {
54 /// Creates a new `InvokeEndpointAsyncFluentBuilder`.
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 InvokeEndpointAsync as a reference.
63 pub fn as_input(&self) -> &crate::operation::invoke_endpoint_async::builders::InvokeEndpointAsyncInputBuilder {
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::invoke_endpoint_async::InvokeEndpointAsyncOutput,
78 ::aws_smithy_runtime_api::client::result::SdkError<
79 crate::operation::invoke_endpoint_async::InvokeEndpointAsyncError,
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::invoke_endpoint_async::InvokeEndpointAsync::operation_runtime_plugins(
88 self.handle.runtime_plugins.clone(),
89 &self.handle.conf,
90 self.config_override,
91 );
92 crate::operation::invoke_endpoint_async::InvokeEndpointAsync::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::invoke_endpoint_async::InvokeEndpointAsyncOutput,
100 crate::operation::invoke_endpoint_async::InvokeEndpointAsyncError,
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 of the endpoint that you specified when you created the endpoint using the <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html">CreateEndpoint</a> API.</p>
115 pub fn endpoint_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116 self.inner = self.inner.endpoint_name(input.into());
117 self
118 }
119 /// <p>The name of the endpoint that you specified when you created the endpoint using the <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html">CreateEndpoint</a> API.</p>
120 pub fn set_endpoint_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121 self.inner = self.inner.set_endpoint_name(input);
122 self
123 }
124 /// <p>The name of the endpoint that you specified when you created the endpoint using the <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html">CreateEndpoint</a> API.</p>
125 pub fn get_endpoint_name(&self) -> &::std::option::Option<::std::string::String> {
126 self.inner.get_endpoint_name()
127 }
128 /// <p>The MIME type of the input data in the request body.</p>
129 pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130 self.inner = self.inner.content_type(input.into());
131 self
132 }
133 /// <p>The MIME type of the input data in the request body.</p>
134 pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135 self.inner = self.inner.set_content_type(input);
136 self
137 }
138 /// <p>The MIME type of the input data in the request body.</p>
139 pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
140 self.inner.get_content_type()
141 }
142 /// <p>The desired MIME type of the inference response from the model container.</p>
143 pub fn accept(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144 self.inner = self.inner.accept(input.into());
145 self
146 }
147 /// <p>The desired MIME type of the inference response from the model container.</p>
148 pub fn set_accept(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149 self.inner = self.inner.set_accept(input);
150 self
151 }
152 /// <p>The desired MIME type of the inference response from the model container.</p>
153 pub fn get_accept(&self) -> &::std::option::Option<::std::string::String> {
154 self.inner.get_accept()
155 }
156 /// <p>Provides additional information about a request for an inference submitted to a model hosted at an Amazon SageMaker endpoint. The information is an opaque value that is forwarded verbatim. You could use this value, for example, to provide an ID that you can use to track a request or to provide other metadata that a service endpoint was programmed to process. The value must consist of no more than 1024 visible US-ASCII characters as specified in <a href="https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> of the Hypertext Transfer Protocol (HTTP/1.1).</p>
157 /// <p>The code in your model is responsible for setting or updating any custom attributes in the response. If your code does not set this value in the response, an empty value is returned. For example, if a custom attribute represents the trace ID, your model can prepend the custom attribute with <code>Trace ID:</code> in your post-processing function.</p>
158 /// <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.</p>
159 pub fn custom_attributes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160 self.inner = self.inner.custom_attributes(input.into());
161 self
162 }
163 /// <p>Provides additional information about a request for an inference submitted to a model hosted at an Amazon SageMaker endpoint. The information is an opaque value that is forwarded verbatim. You could use this value, for example, to provide an ID that you can use to track a request or to provide other metadata that a service endpoint was programmed to process. The value must consist of no more than 1024 visible US-ASCII characters as specified in <a href="https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> of the Hypertext Transfer Protocol (HTTP/1.1).</p>
164 /// <p>The code in your model is responsible for setting or updating any custom attributes in the response. If your code does not set this value in the response, an empty value is returned. For example, if a custom attribute represents the trace ID, your model can prepend the custom attribute with <code>Trace ID:</code> in your post-processing function.</p>
165 /// <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.</p>
166 pub fn set_custom_attributes(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167 self.inner = self.inner.set_custom_attributes(input);
168 self
169 }
170 /// <p>Provides additional information about a request for an inference submitted to a model hosted at an Amazon SageMaker endpoint. The information is an opaque value that is forwarded verbatim. You could use this value, for example, to provide an ID that you can use to track a request or to provide other metadata that a service endpoint was programmed to process. The value must consist of no more than 1024 visible US-ASCII characters as specified in <a href="https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> of the Hypertext Transfer Protocol (HTTP/1.1).</p>
171 /// <p>The code in your model is responsible for setting or updating any custom attributes in the response. If your code does not set this value in the response, an empty value is returned. For example, if a custom attribute represents the trace ID, your model can prepend the custom attribute with <code>Trace ID:</code> in your post-processing function.</p>
172 /// <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.</p>
173 pub fn get_custom_attributes(&self) -> &::std::option::Option<::std::string::String> {
174 self.inner.get_custom_attributes()
175 }
176 /// <p>The identifier for the inference request. Amazon SageMaker will generate an identifier for you if none is specified.</p>
177 pub fn inference_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
178 self.inner = self.inner.inference_id(input.into());
179 self
180 }
181 /// <p>The identifier for the inference request. Amazon SageMaker will generate an identifier for you if none is specified.</p>
182 pub fn set_inference_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183 self.inner = self.inner.set_inference_id(input);
184 self
185 }
186 /// <p>The identifier for the inference request. Amazon SageMaker will generate an identifier for you if none is specified.</p>
187 pub fn get_inference_id(&self) -> &::std::option::Option<::std::string::String> {
188 self.inner.get_inference_id()
189 }
190 /// <p>The Amazon S3 URI where the inference request payload is stored.</p>
191 pub fn input_location(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
192 self.inner = self.inner.input_location(input.into());
193 self
194 }
195 /// <p>The Amazon S3 URI where the inference request payload is stored.</p>
196 pub fn set_input_location(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
197 self.inner = self.inner.set_input_location(input);
198 self
199 }
200 /// <p>The Amazon S3 URI where the inference request payload is stored.</p>
201 pub fn get_input_location(&self) -> &::std::option::Option<::std::string::String> {
202 self.inner.get_input_location()
203 }
204 /// <p>Maximum age in seconds a request can be in the queue before it is marked as expired. The default is 6 hours, or 21,600 seconds.</p>
205 pub fn request_ttl_seconds(mut self, input: i32) -> Self {
206 self.inner = self.inner.request_ttl_seconds(input);
207 self
208 }
209 /// <p>Maximum age in seconds a request can be in the queue before it is marked as expired. The default is 6 hours, or 21,600 seconds.</p>
210 pub fn set_request_ttl_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
211 self.inner = self.inner.set_request_ttl_seconds(input);
212 self
213 }
214 /// <p>Maximum age in seconds a request can be in the queue before it is marked as expired. The default is 6 hours, or 21,600 seconds.</p>
215 pub fn get_request_ttl_seconds(&self) -> &::std::option::Option<i32> {
216 self.inner.get_request_ttl_seconds()
217 }
218 /// <p>Maximum amount of time in seconds a request can be processed before it is marked as expired. The default is 15 minutes, or 900 seconds.</p>
219 pub fn invocation_timeout_seconds(mut self, input: i32) -> Self {
220 self.inner = self.inner.invocation_timeout_seconds(input);
221 self
222 }
223 /// <p>Maximum amount of time in seconds a request can be processed before it is marked as expired. The default is 15 minutes, or 900 seconds.</p>
224 pub fn set_invocation_timeout_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
225 self.inner = self.inner.set_invocation_timeout_seconds(input);
226 self
227 }
228 /// <p>Maximum amount of time in seconds a request can be processed before it is marked as expired. The default is 15 minutes, or 900 seconds.</p>
229 pub fn get_invocation_timeout_seconds(&self) -> &::std::option::Option<i32> {
230 self.inner.get_invocation_timeout_seconds()
231 }
232}