Skip to main content

aws_sdk_sagemakerjobruntime/operation/sample/
_sample_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 SampleOutput {
6    /// MIME type of the inference result.
7    pub content_type: ::std::option::Option<::std::string::String>,
8    /// The raw inference response body from the model.
9    pub body: ::aws_smithy_types::Blob,
10    _request_id: Option<String>,
11}
12impl SampleOutput {
13    /// MIME type of the inference result.
14    pub fn content_type(&self) -> ::std::option::Option<&str> {
15        self.content_type.as_deref()
16    }
17    /// The raw inference response body from the model.
18    pub fn body(&self) -> &::aws_smithy_types::Blob {
19        &self.body
20    }
21}
22impl ::std::fmt::Debug for SampleOutput {
23    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
24        let mut formatter = f.debug_struct("SampleOutput");
25        formatter.field("content_type", &self.content_type);
26        formatter.field("body", &"*** Sensitive Data Redacted ***");
27        formatter.field("_request_id", &self._request_id);
28        formatter.finish()
29    }
30}
31impl ::aws_types::request_id::RequestId for SampleOutput {
32    fn request_id(&self) -> Option<&str> {
33        self._request_id.as_deref()
34    }
35}
36impl SampleOutput {
37    /// Creates a new builder-style object to manufacture [`SampleOutput`](crate::operation::sample::SampleOutput).
38    pub fn builder() -> crate::operation::sample::builders::SampleOutputBuilder {
39        crate::operation::sample::builders::SampleOutputBuilder::default()
40    }
41}
42
43/// A builder for [`SampleOutput`](crate::operation::sample::SampleOutput).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
45#[non_exhaustive]
46pub struct SampleOutputBuilder {
47    pub(crate) content_type: ::std::option::Option<::std::string::String>,
48    pub(crate) body: ::std::option::Option<::aws_smithy_types::Blob>,
49    _request_id: Option<String>,
50}
51impl SampleOutputBuilder {
52    /// MIME type of the inference result.
53    pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
54        self.content_type = ::std::option::Option::Some(input.into());
55        self
56    }
57    /// MIME type of the inference result.
58    pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
59        self.content_type = input;
60        self
61    }
62    /// MIME type of the inference result.
63    pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
64        &self.content_type
65    }
66    /// The raw inference response body from the model.
67    /// This field is required.
68    pub fn body(mut self, input: ::aws_smithy_types::Blob) -> Self {
69        self.body = ::std::option::Option::Some(input);
70        self
71    }
72    /// The raw inference response body from the model.
73    pub fn set_body(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
74        self.body = input;
75        self
76    }
77    /// The raw inference response body from the model.
78    pub fn get_body(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
79        &self.body
80    }
81    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
82        self._request_id = Some(request_id.into());
83        self
84    }
85
86    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
87        self._request_id = request_id;
88        self
89    }
90    /// Consumes the builder and constructs a [`SampleOutput`](crate::operation::sample::SampleOutput).
91    /// This method will fail if any of the following fields are not set:
92    /// - [`body`](crate::operation::sample::builders::SampleOutputBuilder::body)
93    pub fn build(self) -> ::std::result::Result<crate::operation::sample::SampleOutput, ::aws_smithy_types::error::operation::BuildError> {
94        ::std::result::Result::Ok(crate::operation::sample::SampleOutput {
95            content_type: self.content_type,
96            body: self.body.ok_or_else(|| {
97                ::aws_smithy_types::error::operation::BuildError::missing_field(
98                    "body",
99                    "body was not specified but it is required when building SampleOutput",
100                )
101            })?,
102            _request_id: self._request_id,
103        })
104    }
105}
106impl ::std::fmt::Debug for SampleOutputBuilder {
107    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
108        let mut formatter = f.debug_struct("SampleOutputBuilder");
109        formatter.field("content_type", &self.content_type);
110        formatter.field("body", &"*** Sensitive Data Redacted ***");
111        formatter.field("_request_id", &self._request_id);
112        formatter.finish()
113    }
114}