aws_sdk_sagemakerruntime/operation/invoke_endpoint/
_invoke_endpoint_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct InvokeEndpointOutput {
6    /// <p>Includes the inference provided by the model.</p>
7    /// <p>For information about the format of the response body, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html">Common Data Formats-Inference</a>.</p>
8    /// <p>If the explainer is activated, the body includes the explanations provided by the model. For more information, see the <b>Response section</b> under <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-online-explainability-invoke-endpoint.html#clarify-online-explainability-response">Invoke the Endpoint</a> in the Developer Guide.</p>
9    pub body: ::std::option::Option<::aws_smithy_types::Blob>,
10    /// <p>The MIME type of the inference returned from the model container.</p>
11    pub content_type: ::std::option::Option<::std::string::String>,
12    /// <p>Identifies the production variant that was invoked.</p>
13    pub invoked_production_variant: ::std::option::Option<::std::string::String>,
14    /// <p>Provides additional information in the response about the inference returned by 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 return an ID received in the <code>CustomAttributes</code> header of a request or other metadata that a service endpoint was programmed to produce. The value must consist of no more than 1024 visible US-ASCII characters as specified in <a href="https://tools.ietf.org/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> of the Hypertext Transfer Protocol (HTTP/1.1). If the customer wants the custom attribute returned, the model must set the custom attribute to be included on the way back.</p>
15    /// <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>
16    /// <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.</p>
17    pub custom_attributes: ::std::option::Option<::std::string::String>,
18    /// <p>If you created a stateful session with your request, the ID and expiration time that the model assigns to that session.</p>
19    pub new_session_id: ::std::option::Option<::std::string::String>,
20    /// <p>If you closed a stateful session with your request, the ID of that session.</p>
21    pub closed_session_id: ::std::option::Option<::std::string::String>,
22    _request_id: Option<String>,
23}
24impl InvokeEndpointOutput {
25    /// <p>Includes the inference provided by the model.</p>
26    /// <p>For information about the format of the response body, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html">Common Data Formats-Inference</a>.</p>
27    /// <p>If the explainer is activated, the body includes the explanations provided by the model. For more information, see the <b>Response section</b> under <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-online-explainability-invoke-endpoint.html#clarify-online-explainability-response">Invoke the Endpoint</a> in the Developer Guide.</p>
28    pub fn body(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
29        self.body.as_ref()
30    }
31    /// <p>The MIME type of the inference returned from the model container.</p>
32    pub fn content_type(&self) -> ::std::option::Option<&str> {
33        self.content_type.as_deref()
34    }
35    /// <p>Identifies the production variant that was invoked.</p>
36    pub fn invoked_production_variant(&self) -> ::std::option::Option<&str> {
37        self.invoked_production_variant.as_deref()
38    }
39    /// <p>Provides additional information in the response about the inference returned by 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 return an ID received in the <code>CustomAttributes</code> header of a request or other metadata that a service endpoint was programmed to produce. The value must consist of no more than 1024 visible US-ASCII characters as specified in <a href="https://tools.ietf.org/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> of the Hypertext Transfer Protocol (HTTP/1.1). If the customer wants the custom attribute returned, the model must set the custom attribute to be included on the way back.</p>
40    /// <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>
41    /// <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.</p>
42    pub fn custom_attributes(&self) -> ::std::option::Option<&str> {
43        self.custom_attributes.as_deref()
44    }
45    /// <p>If you created a stateful session with your request, the ID and expiration time that the model assigns to that session.</p>
46    pub fn new_session_id(&self) -> ::std::option::Option<&str> {
47        self.new_session_id.as_deref()
48    }
49    /// <p>If you closed a stateful session with your request, the ID of that session.</p>
50    pub fn closed_session_id(&self) -> ::std::option::Option<&str> {
51        self.closed_session_id.as_deref()
52    }
53}
54impl ::std::fmt::Debug for InvokeEndpointOutput {
55    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
56        let mut formatter = f.debug_struct("InvokeEndpointOutput");
57        formatter.field("body", &"*** Sensitive Data Redacted ***");
58        formatter.field("content_type", &self.content_type);
59        formatter.field("invoked_production_variant", &self.invoked_production_variant);
60        formatter.field("custom_attributes", &"*** Sensitive Data Redacted ***");
61        formatter.field("new_session_id", &self.new_session_id);
62        formatter.field("closed_session_id", &self.closed_session_id);
63        formatter.field("_request_id", &self._request_id);
64        formatter.finish()
65    }
66}
67impl ::aws_types::request_id::RequestId for InvokeEndpointOutput {
68    fn request_id(&self) -> Option<&str> {
69        self._request_id.as_deref()
70    }
71}
72impl InvokeEndpointOutput {
73    /// Creates a new builder-style object to manufacture [`InvokeEndpointOutput`](crate::operation::invoke_endpoint::InvokeEndpointOutput).
74    pub fn builder() -> crate::operation::invoke_endpoint::builders::InvokeEndpointOutputBuilder {
75        crate::operation::invoke_endpoint::builders::InvokeEndpointOutputBuilder::default()
76    }
77}
78
79/// A builder for [`InvokeEndpointOutput`](crate::operation::invoke_endpoint::InvokeEndpointOutput).
80#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
81#[non_exhaustive]
82pub struct InvokeEndpointOutputBuilder {
83    pub(crate) body: ::std::option::Option<::aws_smithy_types::Blob>,
84    pub(crate) content_type: ::std::option::Option<::std::string::String>,
85    pub(crate) invoked_production_variant: ::std::option::Option<::std::string::String>,
86    pub(crate) custom_attributes: ::std::option::Option<::std::string::String>,
87    pub(crate) new_session_id: ::std::option::Option<::std::string::String>,
88    pub(crate) closed_session_id: ::std::option::Option<::std::string::String>,
89    _request_id: Option<String>,
90}
91impl InvokeEndpointOutputBuilder {
92    /// <p>Includes the inference provided by the model.</p>
93    /// <p>For information about the format of the response body, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html">Common Data Formats-Inference</a>.</p>
94    /// <p>If the explainer is activated, the body includes the explanations provided by the model. For more information, see the <b>Response section</b> under <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-online-explainability-invoke-endpoint.html#clarify-online-explainability-response">Invoke the Endpoint</a> in the Developer Guide.</p>
95    /// This field is required.
96    pub fn body(mut self, input: ::aws_smithy_types::Blob) -> Self {
97        self.body = ::std::option::Option::Some(input);
98        self
99    }
100    /// <p>Includes the inference provided by the model.</p>
101    /// <p>For information about the format of the response body, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html">Common Data Formats-Inference</a>.</p>
102    /// <p>If the explainer is activated, the body includes the explanations provided by the model. For more information, see the <b>Response section</b> under <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-online-explainability-invoke-endpoint.html#clarify-online-explainability-response">Invoke the Endpoint</a> in the Developer Guide.</p>
103    pub fn set_body(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
104        self.body = input;
105        self
106    }
107    /// <p>Includes the inference provided by the model.</p>
108    /// <p>For information about the format of the response body, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html">Common Data Formats-Inference</a>.</p>
109    /// <p>If the explainer is activated, the body includes the explanations provided by the model. For more information, see the <b>Response section</b> under <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-online-explainability-invoke-endpoint.html#clarify-online-explainability-response">Invoke the Endpoint</a> in the Developer Guide.</p>
110    pub fn get_body(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
111        &self.body
112    }
113    /// <p>The MIME type of the inference returned from the model container.</p>
114    pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.content_type = ::std::option::Option::Some(input.into());
116        self
117    }
118    /// <p>The MIME type of the inference returned from the model container.</p>
119    pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.content_type = input;
121        self
122    }
123    /// <p>The MIME type of the inference returned from the model container.</p>
124    pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
125        &self.content_type
126    }
127    /// <p>Identifies the production variant that was invoked.</p>
128    pub fn invoked_production_variant(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.invoked_production_variant = ::std::option::Option::Some(input.into());
130        self
131    }
132    /// <p>Identifies the production variant that was invoked.</p>
133    pub fn set_invoked_production_variant(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.invoked_production_variant = input;
135        self
136    }
137    /// <p>Identifies the production variant that was invoked.</p>
138    pub fn get_invoked_production_variant(&self) -> &::std::option::Option<::std::string::String> {
139        &self.invoked_production_variant
140    }
141    /// <p>Provides additional information in the response about the inference returned by 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 return an ID received in the <code>CustomAttributes</code> header of a request or other metadata that a service endpoint was programmed to produce. The value must consist of no more than 1024 visible US-ASCII characters as specified in <a href="https://tools.ietf.org/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> of the Hypertext Transfer Protocol (HTTP/1.1). If the customer wants the custom attribute returned, the model must set the custom attribute to be included on the way back.</p>
142    /// <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>
143    /// <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.</p>
144    pub fn custom_attributes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.custom_attributes = ::std::option::Option::Some(input.into());
146        self
147    }
148    /// <p>Provides additional information in the response about the inference returned by 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 return an ID received in the <code>CustomAttributes</code> header of a request or other metadata that a service endpoint was programmed to produce. The value must consist of no more than 1024 visible US-ASCII characters as specified in <a href="https://tools.ietf.org/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> of the Hypertext Transfer Protocol (HTTP/1.1). If the customer wants the custom attribute returned, the model must set the custom attribute to be included on the way back.</p>
149    /// <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>
150    /// <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.</p>
151    pub fn set_custom_attributes(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.custom_attributes = input;
153        self
154    }
155    /// <p>Provides additional information in the response about the inference returned by 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 return an ID received in the <code>CustomAttributes</code> header of a request or other metadata that a service endpoint was programmed to produce. The value must consist of no more than 1024 visible US-ASCII characters as specified in <a href="https://tools.ietf.org/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> of the Hypertext Transfer Protocol (HTTP/1.1). If the customer wants the custom attribute returned, the model must set the custom attribute to be included on the way back.</p>
156    /// <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>
157    /// <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.</p>
158    pub fn get_custom_attributes(&self) -> &::std::option::Option<::std::string::String> {
159        &self.custom_attributes
160    }
161    /// <p>If you created a stateful session with your request, the ID and expiration time that the model assigns to that session.</p>
162    pub fn new_session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163        self.new_session_id = ::std::option::Option::Some(input.into());
164        self
165    }
166    /// <p>If you created a stateful session with your request, the ID and expiration time that the model assigns to that session.</p>
167    pub fn set_new_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.new_session_id = input;
169        self
170    }
171    /// <p>If you created a stateful session with your request, the ID and expiration time that the model assigns to that session.</p>
172    pub fn get_new_session_id(&self) -> &::std::option::Option<::std::string::String> {
173        &self.new_session_id
174    }
175    /// <p>If you closed a stateful session with your request, the ID of that session.</p>
176    pub fn closed_session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177        self.closed_session_id = ::std::option::Option::Some(input.into());
178        self
179    }
180    /// <p>If you closed a stateful session with your request, the ID of that session.</p>
181    pub fn set_closed_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182        self.closed_session_id = input;
183        self
184    }
185    /// <p>If you closed a stateful session with your request, the ID of that session.</p>
186    pub fn get_closed_session_id(&self) -> &::std::option::Option<::std::string::String> {
187        &self.closed_session_id
188    }
189    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
190        self._request_id = Some(request_id.into());
191        self
192    }
193
194    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
195        self._request_id = request_id;
196        self
197    }
198    /// Consumes the builder and constructs a [`InvokeEndpointOutput`](crate::operation::invoke_endpoint::InvokeEndpointOutput).
199    pub fn build(self) -> crate::operation::invoke_endpoint::InvokeEndpointOutput {
200        crate::operation::invoke_endpoint::InvokeEndpointOutput {
201            body: self.body,
202            content_type: self.content_type,
203            invoked_production_variant: self.invoked_production_variant,
204            custom_attributes: self.custom_attributes,
205            new_session_id: self.new_session_id,
206            closed_session_id: self.closed_session_id,
207            _request_id: self._request_id,
208        }
209    }
210}
211impl ::std::fmt::Debug for InvokeEndpointOutputBuilder {
212    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
213        let mut formatter = f.debug_struct("InvokeEndpointOutputBuilder");
214        formatter.field("body", &"*** Sensitive Data Redacted ***");
215        formatter.field("content_type", &self.content_type);
216        formatter.field("invoked_production_variant", &self.invoked_production_variant);
217        formatter.field("custom_attributes", &"*** Sensitive Data Redacted ***");
218        formatter.field("new_session_id", &self.new_session_id);
219        formatter.field("closed_session_id", &self.closed_session_id);
220        formatter.field("_request_id", &self._request_id);
221        formatter.finish()
222    }
223}