Skip to main content

aws_sdk_customerprofiles/types/
_found_by_key_value.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A data type pair that consists of a <code>KeyName</code> and <code>Values</code> list that were used to find a profile returned in response to a <a href="https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html">SearchProfiles</a> request.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct FoundByKeyValue {
7    /// <p>A searchable identifier of a customer profile.</p>
8    pub key_name: ::std::option::Option<::std::string::String>,
9    /// <p>A list of key values.</p>
10    pub values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
11}
12impl FoundByKeyValue {
13    /// <p>A searchable identifier of a customer profile.</p>
14    pub fn key_name(&self) -> ::std::option::Option<&str> {
15        self.key_name.as_deref()
16    }
17    /// <p>A list of key 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 `.values.is_none()`.
20    pub fn values(&self) -> &[::std::string::String] {
21        self.values.as_deref().unwrap_or_default()
22    }
23}
24impl FoundByKeyValue {
25    /// Creates a new builder-style object to manufacture [`FoundByKeyValue`](crate::types::FoundByKeyValue).
26    pub fn builder() -> crate::types::builders::FoundByKeyValueBuilder {
27        crate::types::builders::FoundByKeyValueBuilder::default()
28    }
29}
30
31/// A builder for [`FoundByKeyValue`](crate::types::FoundByKeyValue).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct FoundByKeyValueBuilder {
35    pub(crate) key_name: ::std::option::Option<::std::string::String>,
36    pub(crate) values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
37}
38impl FoundByKeyValueBuilder {
39    /// <p>A searchable identifier of a customer profile.</p>
40    pub fn key_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.key_name = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>A searchable identifier of a customer profile.</p>
45    pub fn set_key_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.key_name = input;
47        self
48    }
49    /// <p>A searchable identifier of a customer profile.</p>
50    pub fn get_key_name(&self) -> &::std::option::Option<::std::string::String> {
51        &self.key_name
52    }
53    /// Appends an item to `values`.
54    ///
55    /// To override the contents of this collection use [`set_values`](Self::set_values).
56    ///
57    /// <p>A list of key values.</p>
58    pub fn values(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
59        let mut v = self.values.unwrap_or_default();
60        v.push(input.into());
61        self.values = ::std::option::Option::Some(v);
62        self
63    }
64    /// <p>A list of key values.</p>
65    pub fn set_values(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
66        self.values = input;
67        self
68    }
69    /// <p>A list of key values.</p>
70    pub fn get_values(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
71        &self.values
72    }
73    /// Consumes the builder and constructs a [`FoundByKeyValue`](crate::types::FoundByKeyValue).
74    pub fn build(self) -> crate::types::FoundByKeyValue {
75        crate::types::FoundByKeyValue {
76            key_name: self.key_name,
77            values: self.values,
78        }
79    }
80}