Skip to main content

aws_sdk_iottwinmaker/types/
_property_value_entry.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object that specifies information about time series property values. This object is used and consumed by the <a href="https://docs.aws.amazon.com/iot-twinmaker/latest/apireference/API_BatchPutPropertyValues.html">BatchPutPropertyValues</a> action.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct PropertyValueEntry {
7    /// <p>An object that contains information about the entity that has the property.</p>
8    pub entity_property_reference: ::std::option::Option<crate::types::EntityPropertyReference>,
9    /// <p>A list of objects that specify time series property values.</p>
10    pub property_values: ::std::option::Option<::std::vec::Vec<crate::types::PropertyValue>>,
11}
12impl PropertyValueEntry {
13    /// <p>An object that contains information about the entity that has the property.</p>
14    pub fn entity_property_reference(&self) -> ::std::option::Option<&crate::types::EntityPropertyReference> {
15        self.entity_property_reference.as_ref()
16    }
17    /// <p>A list of objects that specify time series property values.</p>
18    ///
19    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.property_values.is_none()`.
20    pub fn property_values(&self) -> &[crate::types::PropertyValue] {
21        self.property_values.as_deref().unwrap_or_default()
22    }
23}
24impl PropertyValueEntry {
25    /// Creates a new builder-style object to manufacture [`PropertyValueEntry`](crate::types::PropertyValueEntry).
26    pub fn builder() -> crate::types::builders::PropertyValueEntryBuilder {
27        crate::types::builders::PropertyValueEntryBuilder::default()
28    }
29}
30
31/// A builder for [`PropertyValueEntry`](crate::types::PropertyValueEntry).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct PropertyValueEntryBuilder {
35    pub(crate) entity_property_reference: ::std::option::Option<crate::types::EntityPropertyReference>,
36    pub(crate) property_values: ::std::option::Option<::std::vec::Vec<crate::types::PropertyValue>>,
37}
38impl PropertyValueEntryBuilder {
39    /// <p>An object that contains information about the entity that has the property.</p>
40    /// This field is required.
41    pub fn entity_property_reference(mut self, input: crate::types::EntityPropertyReference) -> Self {
42        self.entity_property_reference = ::std::option::Option::Some(input);
43        self
44    }
45    /// <p>An object that contains information about the entity that has the property.</p>
46    pub fn set_entity_property_reference(mut self, input: ::std::option::Option<crate::types::EntityPropertyReference>) -> Self {
47        self.entity_property_reference = input;
48        self
49    }
50    /// <p>An object that contains information about the entity that has the property.</p>
51    pub fn get_entity_property_reference(&self) -> &::std::option::Option<crate::types::EntityPropertyReference> {
52        &self.entity_property_reference
53    }
54    /// Appends an item to `property_values`.
55    ///
56    /// To override the contents of this collection use [`set_property_values`](Self::set_property_values).
57    ///
58    /// <p>A list of objects that specify time series property values.</p>
59    pub fn property_values(mut self, input: crate::types::PropertyValue) -> Self {
60        let mut v = self.property_values.unwrap_or_default();
61        v.push(input);
62        self.property_values = ::std::option::Option::Some(v);
63        self
64    }
65    /// <p>A list of objects that specify time series property values.</p>
66    pub fn set_property_values(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PropertyValue>>) -> Self {
67        self.property_values = input;
68        self
69    }
70    /// <p>A list of objects that specify time series property values.</p>
71    pub fn get_property_values(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PropertyValue>> {
72        &self.property_values
73    }
74    /// Consumes the builder and constructs a [`PropertyValueEntry`](crate::types::PropertyValueEntry).
75    pub fn build(self) -> crate::types::PropertyValueEntry {
76        crate::types::PropertyValueEntry {
77            entity_property_reference: self.entity_property_reference,
78            property_values: self.property_values,
79        }
80    }
81}