aws_sdk_connectparticipant/operation/get_attachment/
_get_attachment_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, ::std::fmt::Debug)]
5pub struct GetAttachmentOutput {
6    /// <p>This is the pre-signed URL that can be used for uploading the file to Amazon S3 when used in response to <a href="https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_StartAttachmentUpload.html">StartAttachmentUpload</a>.</p>
7    pub url: ::std::option::Option<::std::string::String>,
8    /// <p>The expiration time of the URL in ISO timestamp. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.</p>
9    pub url_expiry: ::std::option::Option<::std::string::String>,
10    /// <p>The size of the attachment in bytes.</p>
11    pub attachment_size_in_bytes: i64,
12    _request_id: Option<String>,
13}
14impl GetAttachmentOutput {
15    /// <p>This is the pre-signed URL that can be used for uploading the file to Amazon S3 when used in response to <a href="https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_StartAttachmentUpload.html">StartAttachmentUpload</a>.</p>
16    pub fn url(&self) -> ::std::option::Option<&str> {
17        self.url.as_deref()
18    }
19    /// <p>The expiration time of the URL in ISO timestamp. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.</p>
20    pub fn url_expiry(&self) -> ::std::option::Option<&str> {
21        self.url_expiry.as_deref()
22    }
23    /// <p>The size of the attachment in bytes.</p>
24    pub fn attachment_size_in_bytes(&self) -> i64 {
25        self.attachment_size_in_bytes
26    }
27}
28impl ::aws_types::request_id::RequestId for GetAttachmentOutput {
29    fn request_id(&self) -> Option<&str> {
30        self._request_id.as_deref()
31    }
32}
33impl GetAttachmentOutput {
34    /// Creates a new builder-style object to manufacture [`GetAttachmentOutput`](crate::operation::get_attachment::GetAttachmentOutput).
35    pub fn builder() -> crate::operation::get_attachment::builders::GetAttachmentOutputBuilder {
36        crate::operation::get_attachment::builders::GetAttachmentOutputBuilder::default()
37    }
38}
39
40/// A builder for [`GetAttachmentOutput`](crate::operation::get_attachment::GetAttachmentOutput).
41#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
42#[non_exhaustive]
43pub struct GetAttachmentOutputBuilder {
44    pub(crate) url: ::std::option::Option<::std::string::String>,
45    pub(crate) url_expiry: ::std::option::Option<::std::string::String>,
46    pub(crate) attachment_size_in_bytes: ::std::option::Option<i64>,
47    _request_id: Option<String>,
48}
49impl GetAttachmentOutputBuilder {
50    /// <p>This is the pre-signed URL that can be used for uploading the file to Amazon S3 when used in response to <a href="https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_StartAttachmentUpload.html">StartAttachmentUpload</a>.</p>
51    pub fn url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
52        self.url = ::std::option::Option::Some(input.into());
53        self
54    }
55    /// <p>This is the pre-signed URL that can be used for uploading the file to Amazon S3 when used in response to <a href="https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_StartAttachmentUpload.html">StartAttachmentUpload</a>.</p>
56    pub fn set_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
57        self.url = input;
58        self
59    }
60    /// <p>This is the pre-signed URL that can be used for uploading the file to Amazon S3 when used in response to <a href="https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_StartAttachmentUpload.html">StartAttachmentUpload</a>.</p>
61    pub fn get_url(&self) -> &::std::option::Option<::std::string::String> {
62        &self.url
63    }
64    /// <p>The expiration time of the URL in ISO timestamp. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.</p>
65    pub fn url_expiry(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.url_expiry = ::std::option::Option::Some(input.into());
67        self
68    }
69    /// <p>The expiration time of the URL in ISO timestamp. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.</p>
70    pub fn set_url_expiry(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
71        self.url_expiry = input;
72        self
73    }
74    /// <p>The expiration time of the URL in ISO timestamp. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.</p>
75    pub fn get_url_expiry(&self) -> &::std::option::Option<::std::string::String> {
76        &self.url_expiry
77    }
78    /// <p>The size of the attachment in bytes.</p>
79    /// This field is required.
80    pub fn attachment_size_in_bytes(mut self, input: i64) -> Self {
81        self.attachment_size_in_bytes = ::std::option::Option::Some(input);
82        self
83    }
84    /// <p>The size of the attachment in bytes.</p>
85    pub fn set_attachment_size_in_bytes(mut self, input: ::std::option::Option<i64>) -> Self {
86        self.attachment_size_in_bytes = input;
87        self
88    }
89    /// <p>The size of the attachment in bytes.</p>
90    pub fn get_attachment_size_in_bytes(&self) -> &::std::option::Option<i64> {
91        &self.attachment_size_in_bytes
92    }
93    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
94        self._request_id = Some(request_id.into());
95        self
96    }
97
98    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
99        self._request_id = request_id;
100        self
101    }
102    /// Consumes the builder and constructs a [`GetAttachmentOutput`](crate::operation::get_attachment::GetAttachmentOutput).
103    /// This method will fail if any of the following fields are not set:
104    /// - [`attachment_size_in_bytes`](crate::operation::get_attachment::builders::GetAttachmentOutputBuilder::attachment_size_in_bytes)
105    pub fn build(
106        self,
107    ) -> ::std::result::Result<crate::operation::get_attachment::GetAttachmentOutput, ::aws_smithy_types::error::operation::BuildError> {
108        ::std::result::Result::Ok(crate::operation::get_attachment::GetAttachmentOutput {
109            url: self.url,
110            url_expiry: self.url_expiry,
111            attachment_size_in_bytes: self.attachment_size_in_bytes.ok_or_else(|| {
112                ::aws_smithy_types::error::operation::BuildError::missing_field(
113                    "attachment_size_in_bytes",
114                    "attachment_size_in_bytes was not specified but it is required when building GetAttachmentOutput",
115                )
116            })?,
117            _request_id: self._request_id,
118        })
119    }
120}