Skip to main content

aws_sdk_glue/operation/put_asset/
_put_asset_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 PutAssetOutput {
6    /// <p>The unique identifier of the asset.</p>
7    pub id: ::std::string::String,
8    /// <p>The name of the asset.</p>
9    pub name: ::std::string::String,
10    /// <p>The description of the asset.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>The timestamp at which the asset was created.</p>
13    pub created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
14    /// <p>The forms attached to the asset, keyed by form name.</p>
15    pub forms: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssetFormEntry>>,
16    _request_id: Option<String>,
17}
18impl PutAssetOutput {
19    /// <p>The unique identifier of the asset.</p>
20    pub fn id(&self) -> &str {
21        use std::ops::Deref;
22        self.id.deref()
23    }
24    /// <p>The name of the asset.</p>
25    pub fn name(&self) -> &str {
26        use std::ops::Deref;
27        self.name.deref()
28    }
29    /// <p>The description of the asset.</p>
30    pub fn description(&self) -> ::std::option::Option<&str> {
31        self.description.as_deref()
32    }
33    /// <p>The timestamp at which the asset was created.</p>
34    pub fn created_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
35        self.created_at.as_ref()
36    }
37    /// <p>The forms attached to the asset, keyed by form name.</p>
38    pub fn forms(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::AssetFormEntry>> {
39        self.forms.as_ref()
40    }
41}
42impl ::aws_types::request_id::RequestId for PutAssetOutput {
43    fn request_id(&self) -> Option<&str> {
44        self._request_id.as_deref()
45    }
46}
47impl PutAssetOutput {
48    /// Creates a new builder-style object to manufacture [`PutAssetOutput`](crate::operation::put_asset::PutAssetOutput).
49    pub fn builder() -> crate::operation::put_asset::builders::PutAssetOutputBuilder {
50        crate::operation::put_asset::builders::PutAssetOutputBuilder::default()
51    }
52}
53
54/// A builder for [`PutAssetOutput`](crate::operation::put_asset::PutAssetOutput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct PutAssetOutputBuilder {
58    pub(crate) id: ::std::option::Option<::std::string::String>,
59    pub(crate) name: ::std::option::Option<::std::string::String>,
60    pub(crate) description: ::std::option::Option<::std::string::String>,
61    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
62    pub(crate) forms: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssetFormEntry>>,
63    _request_id: Option<String>,
64}
65impl PutAssetOutputBuilder {
66    /// <p>The unique identifier of the asset.</p>
67    /// This field is required.
68    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.id = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>The unique identifier of the asset.</p>
73    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.id = input;
75        self
76    }
77    /// <p>The unique identifier of the asset.</p>
78    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
79        &self.id
80    }
81    /// <p>The name of the asset.</p>
82    /// This field is required.
83    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.name = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>The name of the asset.</p>
88    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.name = input;
90        self
91    }
92    /// <p>The name of the asset.</p>
93    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
94        &self.name
95    }
96    /// <p>The description of the asset.</p>
97    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98        self.description = ::std::option::Option::Some(input.into());
99        self
100    }
101    /// <p>The description of the asset.</p>
102    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
103        self.description = input;
104        self
105    }
106    /// <p>The description of the asset.</p>
107    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
108        &self.description
109    }
110    /// <p>The timestamp at which the asset was created.</p>
111    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
112        self.created_at = ::std::option::Option::Some(input);
113        self
114    }
115    /// <p>The timestamp at which the asset was created.</p>
116    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
117        self.created_at = input;
118        self
119    }
120    /// <p>The timestamp at which the asset was created.</p>
121    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
122        &self.created_at
123    }
124    /// Adds a key-value pair to `forms`.
125    ///
126    /// To override the contents of this collection use [`set_forms`](Self::set_forms).
127    ///
128    /// <p>The forms attached to the asset, keyed by form name.</p>
129    pub fn forms(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AssetFormEntry) -> Self {
130        let mut hash_map = self.forms.unwrap_or_default();
131        hash_map.insert(k.into(), v);
132        self.forms = ::std::option::Option::Some(hash_map);
133        self
134    }
135    /// <p>The forms attached to the asset, keyed by form name.</p>
136    pub fn set_forms(
137        mut self,
138        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssetFormEntry>>,
139    ) -> Self {
140        self.forms = input;
141        self
142    }
143    /// <p>The forms attached to the asset, keyed by form name.</p>
144    pub fn get_forms(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AssetFormEntry>> {
145        &self.forms
146    }
147    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
148        self._request_id = Some(request_id.into());
149        self
150    }
151
152    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
153        self._request_id = request_id;
154        self
155    }
156    /// Consumes the builder and constructs a [`PutAssetOutput`](crate::operation::put_asset::PutAssetOutput).
157    /// This method will fail if any of the following fields are not set:
158    /// - [`id`](crate::operation::put_asset::builders::PutAssetOutputBuilder::id)
159    /// - [`name`](crate::operation::put_asset::builders::PutAssetOutputBuilder::name)
160    pub fn build(self) -> ::std::result::Result<crate::operation::put_asset::PutAssetOutput, ::aws_smithy_types::error::operation::BuildError> {
161        ::std::result::Result::Ok(crate::operation::put_asset::PutAssetOutput {
162            id: self.id.ok_or_else(|| {
163                ::aws_smithy_types::error::operation::BuildError::missing_field(
164                    "id",
165                    "id was not specified but it is required when building PutAssetOutput",
166                )
167            })?,
168            name: self.name.ok_or_else(|| {
169                ::aws_smithy_types::error::operation::BuildError::missing_field(
170                    "name",
171                    "name was not specified but it is required when building PutAssetOutput",
172                )
173            })?,
174            description: self.description,
175            created_at: self.created_at,
176            forms: self.forms,
177            _request_id: self._request_id,
178        })
179    }
180}