1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + |
|
3 + | /// <p>The inventory result item.</p>
|
4 + | #[non_exhaustive]
|
5 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6 + | pub struct InventoryResultItem {
|
7 + | /// <p>The name of the inventory result item type.</p>
|
8 + | pub type_name: ::std::string::String,
|
9 + | /// <p>The schema version for the inventory result item/</p>
|
10 + | pub schema_version: ::std::string::String,
|
11 + | /// <p>The time inventory item data was captured.</p>
|
12 + | pub capture_time: ::std::option::Option<::std::string::String>,
|
13 + | /// <p>MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API doesn't update the inventory item type contents if the MD5 hash hasn't changed since last update.</p>
|
14 + | pub content_hash: ::std::option::Option<::std::string::String>,
|
15 + | /// <p>Contains all the inventory data of the item type. Results include attribute names and values.</p>
|
16 + | pub content: ::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
|
17 + | }
|
18 + | impl InventoryResultItem {
|
19 + | /// <p>The name of the inventory result item type.</p>
|
20 + | pub fn type_name(&self) -> &str {
|
21 + | use std::ops::Deref;
|
22 + | self.type_name.deref()
|
23 + | }
|
24 + | /// <p>The schema version for the inventory result item/</p>
|
25 + | pub fn schema_version(&self) -> &str {
|
26 + | use std::ops::Deref;
|
27 + | self.schema_version.deref()
|
28 + | }
|
29 + | /// <p>The time inventory item data was captured.</p>
|
30 + | pub fn capture_time(&self) -> ::std::option::Option<&str> {
|
31 + | self.capture_time.as_deref()
|
32 + | }
|
33 + | /// <p>MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API doesn't update the inventory item type contents if the MD5 hash hasn't changed since last update.</p>
|
34 + | pub fn content_hash(&self) -> ::std::option::Option<&str> {
|
35 + | self.content_hash.as_deref()
|
36 + | }
|
37 + | /// <p>Contains all the inventory data of the item type. Results include attribute names and values.</p>
|
38 + | pub fn content(&self) -> &[::std::collections::HashMap<::std::string::String, ::std::string::String>] {
|
39 + | use std::ops::Deref;
|
40 + | self.content.deref()
|
41 + | }
|
42 + | }
|
43 + | static INVENTORYRESULTITEM_MEMBER_TYPE_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
44 + | ::aws_smithy_schema::ShapeId::from_parts(
|
45 + | "com.amazonaws.ssm#InventoryResultItem$TypeName",
|
46 + | "com.amazonaws.ssm",
|
47 + | "InventoryResultItem",
|
48 + | ),
|
49 + | ::aws_smithy_schema::ShapeType::String,
|
50 + | "TypeName",
|
51 + | 0,
|
52 + | );
|
53 + | static INVENTORYRESULTITEM_MEMBER_SCHEMA_VERSION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
54 + | ::aws_smithy_schema::ShapeId::from_parts(
|
55 + | "com.amazonaws.ssm#InventoryResultItem$SchemaVersion",
|
56 + | "com.amazonaws.ssm",
|
57 + | "InventoryResultItem",
|
58 + | ),
|
59 + | ::aws_smithy_schema::ShapeType::String,
|
60 + | "SchemaVersion",
|
61 + | 1,
|
62 + | );
|
63 + | static INVENTORYRESULTITEM_MEMBER_CAPTURE_TIME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
64 + | ::aws_smithy_schema::ShapeId::from_parts(
|
65 + | "com.amazonaws.ssm#InventoryResultItem$CaptureTime",
|
66 + | "com.amazonaws.ssm",
|
67 + | "InventoryResultItem",
|
68 + | ),
|
69 + | ::aws_smithy_schema::ShapeType::String,
|
70 + | "CaptureTime",
|
71 + | 2,
|
72 + | );
|
73 + | static INVENTORYRESULTITEM_MEMBER_CONTENT_HASH: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
74 + | ::aws_smithy_schema::ShapeId::from_parts(
|
75 + | "com.amazonaws.ssm#InventoryResultItem$ContentHash",
|
76 + | "com.amazonaws.ssm",
|
77 + | "InventoryResultItem",
|
78 + | ),
|
79 + | ::aws_smithy_schema::ShapeType::String,
|
80 + | "ContentHash",
|
81 + | 3,
|
82 + | );
|
83 + | static INVENTORYRESULTITEM_MEMBER_CONTENT_MEMBER_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
84 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#InventoryItemEntry$key", "com.amazonaws.ssm", "InventoryItemEntry"),
|
85 + | ::aws_smithy_schema::ShapeType::String,
|
86 + | "key",
|
87 + | 0,
|
88 + | );
|
89 + | static INVENTORYRESULTITEM_MEMBER_CONTENT_MEMBER_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
90 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#InventoryItemEntry$value", "com.amazonaws.ssm", "InventoryItemEntry"),
|
91 + | ::aws_smithy_schema::ShapeType::String,
|
92 + | "value",
|
93 + | 1,
|
94 + | );
|
95 + | static INVENTORYRESULTITEM_MEMBER_CONTENT_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
96 + | ::aws_smithy_schema::ShapeId::from_parts(
|
97 + | "com.amazonaws.ssm#InventoryItemEntryList$member",
|
98 + | "com.amazonaws.ssm",
|
99 + | "InventoryItemEntryList",
|
100 + | ),
|
101 + | ::aws_smithy_schema::ShapeType::Map,
|
102 + | "member",
|
103 + | 0,
|
104 + | )
|
105 + | .with_map_members(
|
106 + | &INVENTORYRESULTITEM_MEMBER_CONTENT_MEMBER_KEY,
|
107 + | &INVENTORYRESULTITEM_MEMBER_CONTENT_MEMBER_VALUE,
|
108 + | );
|
109 + | static INVENTORYRESULTITEM_MEMBER_CONTENT: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
110 + | ::aws_smithy_schema::ShapeId::from_parts(
|
111 + | "com.amazonaws.ssm#InventoryResultItem$Content",
|
112 + | "com.amazonaws.ssm",
|
113 + | "InventoryResultItem",
|
114 + | ),
|
115 + | ::aws_smithy_schema::ShapeType::List,
|
116 + | "Content",
|
117 + | 4,
|
118 + | )
|
119 + | .with_list_member(&INVENTORYRESULTITEM_MEMBER_CONTENT_MEMBER);
|
120 + | static INVENTORYRESULTITEM_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
|
121 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#InventoryResultItem", "com.amazonaws.ssm", "InventoryResultItem"),
|
122 + | ::aws_smithy_schema::ShapeType::Structure,
|
123 + | &[
|
124 + | &INVENTORYRESULTITEM_MEMBER_TYPE_NAME,
|
125 + | &INVENTORYRESULTITEM_MEMBER_SCHEMA_VERSION,
|
126 + | &INVENTORYRESULTITEM_MEMBER_CAPTURE_TIME,
|
127 + | &INVENTORYRESULTITEM_MEMBER_CONTENT_HASH,
|
128 + | &INVENTORYRESULTITEM_MEMBER_CONTENT,
|
129 + | ],
|
130 + | );
|
131 + | impl InventoryResultItem {
|
132 + | /// The schema for this shape.
|
133 + | pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &INVENTORYRESULTITEM_SCHEMA;
|
134 + | }
|
135 + | impl ::aws_smithy_schema::serde::SerializableStruct for InventoryResultItem {
|
136 + | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
137 + | fn serialize_members(
|
138 + | &self,
|
139 + | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
140 + | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
141 + | {
|
142 + | let val = &self.type_name;
|
143 + | ser.write_string(&INVENTORYRESULTITEM_MEMBER_TYPE_NAME, val)?;
|
144 + | }
|
145 + | {
|
146 + | let val = &self.schema_version;
|
147 + | ser.write_string(&INVENTORYRESULTITEM_MEMBER_SCHEMA_VERSION, val)?;
|
148 + | }
|
149 + | if let Some(ref val) = self.capture_time {
|
150 + | ser.write_string(&INVENTORYRESULTITEM_MEMBER_CAPTURE_TIME, val)?;
|
151 + | }
|
152 + | if let Some(ref val) = self.content_hash {
|
153 + | ser.write_string(&INVENTORYRESULTITEM_MEMBER_CONTENT_HASH, val)?;
|
154 + | }
|
155 + | {
|
156 + | let val = &self.content;
|
157 + |
|
158 + | ser.write_list(
|
159 + | &INVENTORYRESULTITEM_MEMBER_CONTENT,
|
160 + | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
161 + | for item in val {
|
162 + | ser.write_map(
|
163 + | &INVENTORYRESULTITEM_MEMBER_CONTENT_MEMBER,
|
164 + | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
165 + | for (key, value) in item {
|
166 + | ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
|
167 + | ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
|
168 + | }
|
169 + | Ok(())
|
170 + | },
|
171 + | )?;
|
172 + | }
|
173 + | Ok(())
|
174 + | },
|
175 + | )?;
|
176 + | }
|
177 + | Ok(())
|
178 + | }
|
179 + | }
|
180 + | impl InventoryResultItem {
|
181 + | /// Deserializes this structure from a [`ShapeDeserializer`].
|
182 + | pub fn deserialize(
|
183 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
184 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
185 + | #[allow(unused_variables, unused_mut)]
|
186 + | let mut builder = Self::builder();
|
187 + | #[allow(
|
188 + | unused_variables,
|
189 + | unreachable_code,
|
190 + | clippy::single_match,
|
191 + | clippy::match_single_binding,
|
192 + | clippy::diverging_sub_expression
|
193 + | )]
|
194 + | deserializer.read_struct(&INVENTORYRESULTITEM_SCHEMA, &mut |member, deser| {
|
195 + | match member.member_index() {
|
196 + | Some(0) => {
|
197 + | builder.type_name = Some(deser.read_string(member)?);
|
198 + | }
|
199 + | Some(1) => {
|
200 + | builder.schema_version = Some(deser.read_string(member)?);
|
201 + | }
|
202 + | Some(2) => {
|
203 + | if deser.is_null() {
|
204 + | deser.read_null()?;
|
205 + | } else {
|
206 + | builder.capture_time = Some(deser.read_string(member)?);
|
207 + | }
|
208 + | }
|
209 + | Some(3) => {
|
210 + | if deser.is_null() {
|
211 + | deser.read_null()?;
|
212 + | } else {
|
213 + | builder.content_hash = Some(deser.read_string(member)?);
|
214 + | }
|
215 + | }
|
216 + | Some(4) => {
|
217 + | builder.content = Some({
|
218 + | let mut container = Vec::new();
|
219 + | deser.read_list(member, &mut |deser| {
|
220 + | container.push({
|
221 + | let mut map = ::std::collections::HashMap::new();
|
222 + | deser.read_map(&INVENTORYRESULTITEM_MEMBER_CONTENT_MEMBER, &mut |key, deser| {
|
223 + | let value = deser.read_string(&::aws_smithy_schema::prelude::STRING)?;
|
224 + | map.insert(key, value);
|
225 + | Ok(())
|
226 + | })?;
|
227 + | map
|
228 + | });
|
229 + | Ok(())
|
230 + | })?;
|
231 + | container
|
232 + | });
|
233 + | }
|
234 + | _ => {}
|
235 + | }
|
236 + | Ok(())
|
237 + | })?;
|
238 + | builder.type_name = builder.type_name.or(Some(String::new()));
|
239 + | builder.schema_version = builder.schema_version.or(Some(String::new()));
|
240 + | builder.content = builder.content.or(Some(Vec::new()));
|
241 + | builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
|
242 + | }
|
243 + | }
|
244 + | impl InventoryResultItem {
|
245 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
246 + | pub fn deserialize_with_response(
|
247 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
248 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
249 + | _status: u16,
|
250 + | _body: &[u8],
|
251 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
252 + | Self::deserialize(deserializer)
|
253 + | }
|
254 + | }
|
255 + | impl InventoryResultItem {
|
256 + | /// Creates a new builder-style object to manufacture [`InventoryResultItem`](crate::types::InventoryResultItem).
|
257 + | pub fn builder() -> crate::types::builders::InventoryResultItemBuilder {
|
258 + | crate::types::builders::InventoryResultItemBuilder::default()
|
259 + | }
|
260 + | }
|
261 + |
|
262 + | /// A builder for [`InventoryResultItem`](crate::types::InventoryResultItem).
|
263 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
264 + | #[non_exhaustive]
|
265 + | pub struct InventoryResultItemBuilder {
|
266 + | pub(crate) type_name: ::std::option::Option<::std::string::String>,
|
267 + | pub(crate) schema_version: ::std::option::Option<::std::string::String>,
|
268 + | pub(crate) capture_time: ::std::option::Option<::std::string::String>,
|
269 + | pub(crate) content_hash: ::std::option::Option<::std::string::String>,
|
270 + | pub(crate) content: ::std::option::Option<::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>>,
|
271 + | }
|
272 + | impl InventoryResultItemBuilder {
|
273 + | /// <p>The name of the inventory result item type.</p>
|
274 + | /// This field is required.
|
275 + | pub fn type_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
276 + | self.type_name = ::std::option::Option::Some(input.into());
|
277 + | self
|
278 + | }
|
279 + | /// <p>The name of the inventory result item type.</p>
|
280 + | pub fn set_type_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
281 + | self.type_name = input;
|
282 + | self
|
283 + | }
|
284 + | /// <p>The name of the inventory result item type.</p>
|
285 + | pub fn get_type_name(&self) -> &::std::option::Option<::std::string::String> {
|
286 + | &self.type_name
|
287 + | }
|
288 + | /// <p>The schema version for the inventory result item/</p>
|
289 + | /// This field is required.
|
290 + | pub fn schema_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
291 + | self.schema_version = ::std::option::Option::Some(input.into());
|
292 + | self
|
293 + | }
|
294 + | /// <p>The schema version for the inventory result item/</p>
|
295 + | pub fn set_schema_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
296 + | self.schema_version = input;
|
297 + | self
|
298 + | }
|
299 + | /// <p>The schema version for the inventory result item/</p>
|
300 + | pub fn get_schema_version(&self) -> &::std::option::Option<::std::string::String> {
|
301 + | &self.schema_version
|
302 + | }
|
303 + | /// <p>The time inventory item data was captured.</p>
|
304 + | pub fn capture_time(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
305 + | self.capture_time = ::std::option::Option::Some(input.into());
|
306 + | self
|
307 + | }
|
308 + | /// <p>The time inventory item data was captured.</p>
|
309 + | pub fn set_capture_time(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
310 + | self.capture_time = input;
|
311 + | self
|
312 + | }
|
313 + | /// <p>The time inventory item data was captured.</p>
|
314 + | pub fn get_capture_time(&self) -> &::std::option::Option<::std::string::String> {
|
315 + | &self.capture_time
|
316 + | }
|
317 + | /// <p>MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API doesn't update the inventory item type contents if the MD5 hash hasn't changed since last update.</p>
|
318 + | pub fn content_hash(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
319 + | self.content_hash = ::std::option::Option::Some(input.into());
|
320 + | self
|
321 + | }
|
322 + | /// <p>MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API doesn't update the inventory item type contents if the MD5 hash hasn't changed since last update.</p>
|
323 + | pub fn set_content_hash(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
324 + | self.content_hash = input;
|
325 + | self
|
326 + | }
|
327 + | /// <p>MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API doesn't update the inventory item type contents if the MD5 hash hasn't changed since last update.</p>
|
328 + | pub fn get_content_hash(&self) -> &::std::option::Option<::std::string::String> {
|
329 + | &self.content_hash
|
330 + | }
|
331 + | /// Appends an item to `content`.
|
332 + | ///
|
333 + | /// To override the contents of this collection use [`set_content`](Self::set_content).
|
334 + | ///
|
335 + | /// <p>Contains all the inventory data of the item type. Results include attribute names and values.</p>
|
336 + | pub fn content(mut self, input: ::std::collections::HashMap<::std::string::String, ::std::string::String>) -> Self {
|
337 + | let mut v = self.content.unwrap_or_default();
|
338 + | v.push(input);
|
339 + | self.content = ::std::option::Option::Some(v);
|
340 + | self
|
341 + | }
|
342 + | /// <p>Contains all the inventory data of the item type. Results include attribute names and values.</p>
|
343 + | pub fn set_content(
|
344 + | mut self,
|
345 + | input: ::std::option::Option<::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>>,
|
346 + | ) -> Self {
|
347 + | self.content = input;
|
348 + | self
|
349 + | }
|
350 + | /// <p>Contains all the inventory data of the item type. Results include attribute names and values.</p>
|
351 + | pub fn get_content(&self) -> &::std::option::Option<::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>> {
|
352 + | &self.content
|
353 + | }
|
354 + | /// Consumes the builder and constructs a [`InventoryResultItem`](crate::types::InventoryResultItem).
|
355 + | /// This method will fail if any of the following fields are not set:
|
356 + | /// - [`type_name`](crate::types::builders::InventoryResultItemBuilder::type_name)
|
357 + | /// - [`schema_version`](crate::types::builders::InventoryResultItemBuilder::schema_version)
|
358 + | /// - [`content`](crate::types::builders::InventoryResultItemBuilder::content)
|
359 + | pub fn build(self) -> ::std::result::Result<crate::types::InventoryResultItem, ::aws_smithy_types::error::operation::BuildError> {
|
360 + | ::std::result::Result::Ok(crate::types::InventoryResultItem {
|
361 + | type_name: self.type_name.ok_or_else(|| {
|
362 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
363 + | "type_name",
|
364 + | "type_name was not specified but it is required when building InventoryResultItem",
|
365 + | )
|
366 + | })?,
|
367 + | schema_version: self.schema_version.ok_or_else(|| {
|
368 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
369 + | "schema_version",
|
370 + | "schema_version was not specified but it is required when building InventoryResultItem",
|
371 + | )
|
372 + | })?,
|
373 + | capture_time: self.capture_time,
|
374 + | content_hash: self.content_hash,
|
375 + | content: self.content.ok_or_else(|| {
|
376 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
377 + | "content",
|
378 + | "content was not specified but it is required when building InventoryResultItem",
|
379 + | )
|
380 + | })?,
|
381 + | })
|
382 + | }
|
383 + | }
|