aws_sdk_dynamodb/types/_projection.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <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>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Projection {
7 /// <p>The set of attributes that are projected into the index:</p>
8 /// <ul>
9 /// <li>
10 /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
11 /// <li>
12 /// <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>
13 /// <li>
14 /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
15 /// </ul>
16 /// <p>When using the DynamoDB console, <code>ALL</code> is selected by default.</p>
17 pub projection_type: ::std::option::Option<crate::types::ProjectionType>,
18 /// <p>Represents the non-key attribute names which will be projected into the index.</p>
19 /// <p>For global and local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the 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. This limit only applies when you specify the ProjectionType of <code>INCLUDE</code>. You still can specify the ProjectionType of <code>ALL</code> to project all attributes from the source table, even if the table has more than 100 attributes.</p>
20 pub non_key_attributes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
21}
22impl Projection {
23 /// <p>The set of attributes that are projected into the index:</p>
24 /// <ul>
25 /// <li>
26 /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
27 /// <li>
28 /// <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>
29 /// <li>
30 /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
31 /// </ul>
32 /// <p>When using the DynamoDB console, <code>ALL</code> is selected by default.</p>
33 pub fn projection_type(&self) -> ::std::option::Option<&crate::types::ProjectionType> {
34 self.projection_type.as_ref()
35 }
36 /// <p>Represents the non-key attribute names which will be projected into the index.</p>
37 /// <p>For global and local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the 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. This limit only applies when you specify the ProjectionType of <code>INCLUDE</code>. You still can specify the ProjectionType of <code>ALL</code> to project all attributes from the source table, even if the table has more than 100 attributes.</p>
38 ///
39 /// 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()`.
40 pub fn non_key_attributes(&self) -> &[::std::string::String] {
41 self.non_key_attributes.as_deref().unwrap_or_default()
42 }
43}
44impl Projection {
45 /// Creates a new builder-style object to manufacture [`Projection`](crate::types::Projection).
46 pub fn builder() -> crate::types::builders::ProjectionBuilder {
47 crate::types::builders::ProjectionBuilder::default()
48 }
49}
50
51/// A builder for [`Projection`](crate::types::Projection).
52#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
53#[non_exhaustive]
54pub struct ProjectionBuilder {
55 pub(crate) projection_type: ::std::option::Option<crate::types::ProjectionType>,
56 pub(crate) non_key_attributes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
57}
58impl ProjectionBuilder {
59 /// <p>The set of attributes that are projected into the index:</p>
60 /// <ul>
61 /// <li>
62 /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
63 /// <li>
64 /// <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>
65 /// <li>
66 /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
67 /// </ul>
68 /// <p>When using the DynamoDB console, <code>ALL</code> is selected by default.</p>
69 pub fn projection_type(mut self, input: crate::types::ProjectionType) -> Self {
70 self.projection_type = ::std::option::Option::Some(input);
71 self
72 }
73 /// <p>The set of attributes that are projected into the index:</p>
74 /// <ul>
75 /// <li>
76 /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
77 /// <li>
78 /// <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>
79 /// <li>
80 /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
81 /// </ul>
82 /// <p>When using the DynamoDB console, <code>ALL</code> is selected by default.</p>
83 pub fn set_projection_type(mut self, input: ::std::option::Option<crate::types::ProjectionType>) -> Self {
84 self.projection_type = input;
85 self
86 }
87 /// <p>The set of attributes that are projected into the index:</p>
88 /// <ul>
89 /// <li>
90 /// <p><code>KEYS_ONLY</code> - Only the index and primary keys are projected into the index.</p></li>
91 /// <li>
92 /// <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>
93 /// <li>
94 /// <p><code>ALL</code> - All of the table attributes are projected into the index.</p></li>
95 /// </ul>
96 /// <p>When using the DynamoDB console, <code>ALL</code> is selected by default.</p>
97 pub fn get_projection_type(&self) -> &::std::option::Option<crate::types::ProjectionType> {
98 &self.projection_type
99 }
100 /// Appends an item to `non_key_attributes`.
101 ///
102 /// To override the contents of this collection use [`set_non_key_attributes`](Self::set_non_key_attributes).
103 ///
104 /// <p>Represents the non-key attribute names which will be projected into the index.</p>
105 /// <p>For global and local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the 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. This limit only applies when you specify the ProjectionType of <code>INCLUDE</code>. You still can specify the ProjectionType of <code>ALL</code> to project all attributes from the source table, even if the table has more than 100 attributes.</p>
106 pub fn non_key_attributes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107 let mut v = self.non_key_attributes.unwrap_or_default();
108 v.push(input.into());
109 self.non_key_attributes = ::std::option::Option::Some(v);
110 self
111 }
112 /// <p>Represents the non-key attribute names which will be projected into the index.</p>
113 /// <p>For global and local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the 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. This limit only applies when you specify the ProjectionType of <code>INCLUDE</code>. You still can specify the ProjectionType of <code>ALL</code> to project all attributes from the source table, even if the table has more than 100 attributes.</p>
114 pub fn set_non_key_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
115 self.non_key_attributes = input;
116 self
117 }
118 /// <p>Represents the non-key attribute names which will be projected into the index.</p>
119 /// <p>For global and local secondary indexes, the total count of <code>NonKeyAttributes</code> summed across all of the 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. This limit only applies when you specify the ProjectionType of <code>INCLUDE</code>. You still can specify the ProjectionType of <code>ALL</code> to project all attributes from the source table, even if the table has more than 100 attributes.</p>
120 pub fn get_non_key_attributes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
121 &self.non_key_attributes
122 }
123 /// Consumes the builder and constructs a [`Projection`](crate::types::Projection).
124 pub fn build(self) -> crate::types::Projection {
125 crate::types::Projection {
126 projection_type: self.projection_type,
127 non_key_attributes: self.non_key_attributes,
128 }
129 }
130}