1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Represents attributes that are copied (projected) from the table into an index. These are in addition to the primary key attributes and index key attributes, which are automatically projected.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Projection {
    /// <p>The set of attributes that are projected into the index:</p>
    /// <ul>
    /// <li>
    /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
    /// <li>
    /// <p><code>INCLUDE</code> - In addition to the attributes described in <code>KEYS_ONLY</code>, the secondary index will include other non-key attributes that you specify.</p></li>
    /// <li>
    /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
    /// </ul>
    pub projection_type: ::std::option::Option<crate::types::ProjectionType>,
    /// <p>Represents the non-key attribute names which will be projected into the index.</p>
    /// <p>For local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.</p>
    pub non_key_attributes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl Projection {
    /// <p>The set of attributes that are projected into the index:</p>
    /// <ul>
    /// <li>
    /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
    /// <li>
    /// <p><code>INCLUDE</code> - In addition to the attributes described in <code>KEYS_ONLY</code>, the secondary index will include other non-key attributes that you specify.</p></li>
    /// <li>
    /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
    /// </ul>
    pub fn projection_type(&self) -> ::std::option::Option<&crate::types::ProjectionType> {
        self.projection_type.as_ref()
    }
    /// <p>Represents the non-key attribute names which will be projected into the index.</p>
    /// <p>For local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.non_key_attributes.is_none()`.
    pub fn non_key_attributes(&self) -> &[::std::string::String] {
        self.non_key_attributes.as_deref().unwrap_or_default()
    }
}
impl Projection {
    /// Creates a new builder-style object to manufacture [`Projection`](crate::types::Projection).
    pub fn builder() -> crate::types::builders::ProjectionBuilder {
        crate::types::builders::ProjectionBuilder::default()
    }
}

/// A builder for [`Projection`](crate::types::Projection).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct ProjectionBuilder {
    pub(crate) projection_type: ::std::option::Option<crate::types::ProjectionType>,
    pub(crate) non_key_attributes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl ProjectionBuilder {
    /// <p>The set of attributes that are projected into the index:</p>
    /// <ul>
    /// <li>
    /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
    /// <li>
    /// <p><code>INCLUDE</code> - In addition to the attributes described in <code>KEYS_ONLY</code>, the secondary index will include other non-key attributes that you specify.</p></li>
    /// <li>
    /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
    /// </ul>
    pub fn projection_type(mut self, input: crate::types::ProjectionType) -> Self {
        self.projection_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The set of attributes that are projected into the index:</p>
    /// <ul>
    /// <li>
    /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
    /// <li>
    /// <p><code>INCLUDE</code> - In addition to the attributes described in <code>KEYS_ONLY</code>, the secondary index will include other non-key attributes that you specify.</p></li>
    /// <li>
    /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
    /// </ul>
    pub fn set_projection_type(mut self, input: ::std::option::Option<crate::types::ProjectionType>) -> Self {
        self.projection_type = input;
        self
    }
    /// <p>The set of attributes that are projected into the index:</p>
    /// <ul>
    /// <li>
    /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
    /// <li>
    /// <p><code>INCLUDE</code> - In addition to the attributes described in <code>KEYS_ONLY</code>, the secondary index will include other non-key attributes that you specify.</p></li>
    /// <li>
    /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
    /// </ul>
    pub fn get_projection_type(&self) -> &::std::option::Option<crate::types::ProjectionType> {
        &self.projection_type
    }
    /// Appends an item to `non_key_attributes`.
    ///
    /// To override the contents of this collection use [`set_non_key_attributes`](Self::set_non_key_attributes).
    ///
    /// <p>Represents the non-key attribute names which will be projected into the index.</p>
    /// <p>For local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.</p>
    pub fn non_key_attributes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.non_key_attributes.unwrap_or_default();
        v.push(input.into());
        self.non_key_attributes = ::std::option::Option::Some(v);
        self
    }
    /// <p>Represents the non-key attribute names which will be projected into the index.</p>
    /// <p>For local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.</p>
    pub fn set_non_key_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.non_key_attributes = input;
        self
    }
    /// <p>Represents the non-key attribute names which will be projected into the index.</p>
    /// <p>For local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.</p>
    pub fn get_non_key_attributes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.non_key_attributes
    }
    /// Consumes the builder and constructs a [`Projection`](crate::types::Projection).
    pub fn build(self) -> crate::types::Projection {
        crate::types::Projection {
            projection_type: self.projection_type,
            non_key_attributes: self.non_key_attributes,
        }
    }
}