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