aws_sdk_dynamodb/operation/scan/
_scan_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents the output of a <code>Scan</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ScanOutput  {
7    /// <p>An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute.</p>
8    pub items: ::std::option::Option<::std::vec::Vec::<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>>,
9    /// <p>The number of items in the response.</p>
10    /// <p>If you set <code>ScanFilter</code> in the request, then <code>Count</code> is the number of items returned after the filter was applied, and <code>ScannedCount</code> is the number of matching items before the filter was applied.</p>
11    /// <p>If you did not use a filter in the request, then <code>Count</code> is the same as <code>ScannedCount</code>.</p>
12    pub count: i32,
13    /// <p>The number of items evaluated, before any <code>ScanFilter</code> is applied. A high <code>ScannedCount</code> value with few, or no, <code>Count</code> results indicates an inefficient <code>Scan</code> operation. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#Count">Count and ScannedCount</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
14    /// <p>If you did not use a filter in the request, then <code>ScannedCount</code> is the same as <code>Count</code>.</p>
15    pub scanned_count: i32,
16    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request.</p>
17    /// <p>If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved.</p>
18    /// <p>If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
19    pub last_evaluated_key: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
20    /// <p>The capacity units consumed by the <code>Scan</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
21    pub consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
22    _request_id: Option<String>,
23}
24impl  ScanOutput  {
25    /// <p>An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute.</p>
26    /// 
27    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.items.is_none()`.
28    pub fn items(&self) -> &[::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>] {
29        self.items.as_deref()
30        .unwrap_or_default()
31    }
32    /// <p>The number of items in the response.</p>
33    /// <p>If you set <code>ScanFilter</code> in the request, then <code>Count</code> is the number of items returned after the filter was applied, and <code>ScannedCount</code> is the number of matching items before the filter was applied.</p>
34    /// <p>If you did not use a filter in the request, then <code>Count</code> is the same as <code>ScannedCount</code>.</p>
35    pub fn count(&self) -> i32 {
36        self.count
37    }
38    /// <p>The number of items evaluated, before any <code>ScanFilter</code> is applied. A high <code>ScannedCount</code> value with few, or no, <code>Count</code> results indicates an inefficient <code>Scan</code> operation. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#Count">Count and ScannedCount</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
39    /// <p>If you did not use a filter in the request, then <code>ScannedCount</code> is the same as <code>Count</code>.</p>
40    pub fn scanned_count(&self) -> i32 {
41        self.scanned_count
42    }
43    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request.</p>
44    /// <p>If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved.</p>
45    /// <p>If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
46    pub fn last_evaluated_key(&self) -> ::std::option::Option<&::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
47        self.last_evaluated_key.as_ref()
48    }
49    /// <p>The capacity units consumed by the <code>Scan</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
50    pub fn consumed_capacity(&self) -> ::std::option::Option<&crate::types::ConsumedCapacity> {
51        self.consumed_capacity.as_ref()
52    }
53}
54impl ::aws_types::request_id::RequestId for ScanOutput {
55                                    fn request_id(&self) -> Option<&str> {
56                                        self._request_id.as_deref()
57                                    }
58                                }
59impl ScanOutput {
60    /// Creates a new builder-style object to manufacture [`ScanOutput`](crate::operation::scan::ScanOutput).
61    pub fn builder() -> crate::operation::scan::builders::ScanOutputBuilder {
62        crate::operation::scan::builders::ScanOutputBuilder::default()
63    }
64}
65
66/// A builder for [`ScanOutput`](crate::operation::scan::ScanOutput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct ScanOutputBuilder {
70    pub(crate) items: ::std::option::Option<::std::vec::Vec::<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>>,
71    pub(crate) count: ::std::option::Option<i32>,
72    pub(crate) scanned_count: ::std::option::Option<i32>,
73    pub(crate) last_evaluated_key: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
74    pub(crate) consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
75    _request_id: Option<String>,
76}
77impl ScanOutputBuilder {
78    /// Appends an item to `items`.
79    ///
80    /// To override the contents of this collection use [`set_items`](Self::set_items).
81    ///
82    /// <p>An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute.</p>
83    pub fn items(mut self, input: ::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>) -> Self {
84        let mut v = self.items.unwrap_or_default();
85                        v.push(input);
86                        self.items = ::std::option::Option::Some(v);
87                        self
88    }
89    /// <p>An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute.</p>
90    pub fn set_items(mut self, input: ::std::option::Option<::std::vec::Vec::<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>>) -> Self {
91        self.items = input; self
92    }
93    /// <p>An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute.</p>
94    pub fn get_items(&self) -> &::std::option::Option<::std::vec::Vec::<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>> {
95        &self.items
96    }
97    /// <p>The number of items in the response.</p>
98    /// <p>If you set <code>ScanFilter</code> in the request, then <code>Count</code> is the number of items returned after the filter was applied, and <code>ScannedCount</code> is the number of matching items before the filter was applied.</p>
99    /// <p>If you did not use a filter in the request, then <code>Count</code> is the same as <code>ScannedCount</code>.</p>
100    pub fn count(mut self, input: i32) -> Self {
101        self.count = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>The number of items in the response.</p>
105    /// <p>If you set <code>ScanFilter</code> in the request, then <code>Count</code> is the number of items returned after the filter was applied, and <code>ScannedCount</code> is the number of matching items before the filter was applied.</p>
106    /// <p>If you did not use a filter in the request, then <code>Count</code> is the same as <code>ScannedCount</code>.</p>
107    pub fn set_count(mut self, input: ::std::option::Option<i32>) -> Self {
108        self.count = input; self
109    }
110    /// <p>The number of items in the response.</p>
111    /// <p>If you set <code>ScanFilter</code> in the request, then <code>Count</code> is the number of items returned after the filter was applied, and <code>ScannedCount</code> is the number of matching items before the filter was applied.</p>
112    /// <p>If you did not use a filter in the request, then <code>Count</code> is the same as <code>ScannedCount</code>.</p>
113    pub fn get_count(&self) -> &::std::option::Option<i32> {
114        &self.count
115    }
116    /// <p>The number of items evaluated, before any <code>ScanFilter</code> is applied. A high <code>ScannedCount</code> value with few, or no, <code>Count</code> results indicates an inefficient <code>Scan</code> operation. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#Count">Count and ScannedCount</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
117    /// <p>If you did not use a filter in the request, then <code>ScannedCount</code> is the same as <code>Count</code>.</p>
118    pub fn scanned_count(mut self, input: i32) -> Self {
119        self.scanned_count = ::std::option::Option::Some(input);
120        self
121    }
122    /// <p>The number of items evaluated, before any <code>ScanFilter</code> is applied. A high <code>ScannedCount</code> value with few, or no, <code>Count</code> results indicates an inefficient <code>Scan</code> operation. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#Count">Count and ScannedCount</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
123    /// <p>If you did not use a filter in the request, then <code>ScannedCount</code> is the same as <code>Count</code>.</p>
124    pub fn set_scanned_count(mut self, input: ::std::option::Option<i32>) -> Self {
125        self.scanned_count = input; self
126    }
127    /// <p>The number of items evaluated, before any <code>ScanFilter</code> is applied. A high <code>ScannedCount</code> value with few, or no, <code>Count</code> results indicates an inefficient <code>Scan</code> operation. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#Count">Count and ScannedCount</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
128    /// <p>If you did not use a filter in the request, then <code>ScannedCount</code> is the same as <code>Count</code>.</p>
129    pub fn get_scanned_count(&self) -> &::std::option::Option<i32> {
130        &self.scanned_count
131    }
132    /// Adds a key-value pair to `last_evaluated_key`.
133    ///
134    /// To override the contents of this collection use [`set_last_evaluated_key`](Self::set_last_evaluated_key).
135    ///
136    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request.</p>
137    /// <p>If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved.</p>
138    /// <p>If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
139    pub fn last_evaluated_key(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
140        let mut hash_map = self.last_evaluated_key.unwrap_or_default();
141                        hash_map.insert(k.into(), v);
142                        self.last_evaluated_key = ::std::option::Option::Some(hash_map);
143                        self
144    }
145    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request.</p>
146    /// <p>If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved.</p>
147    /// <p>If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
148    pub fn set_last_evaluated_key(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
149        self.last_evaluated_key = input; self
150    }
151    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request.</p>
152    /// <p>If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved.</p>
153    /// <p>If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
154    pub fn get_last_evaluated_key(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
155        &self.last_evaluated_key
156    }
157    /// <p>The capacity units consumed by the <code>Scan</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
158    pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
159        self.consumed_capacity = ::std::option::Option::Some(input);
160        self
161    }
162    /// <p>The capacity units consumed by the <code>Scan</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
163    pub fn set_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ConsumedCapacity>) -> Self {
164        self.consumed_capacity = input; self
165    }
166    /// <p>The capacity units consumed by the <code>Scan</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
167    pub fn get_consumed_capacity(&self) -> &::std::option::Option<crate::types::ConsumedCapacity> {
168        &self.consumed_capacity
169    }
170    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
171                                        self._request_id = Some(request_id.into());
172                                        self
173                                    }
174    
175                                    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
176                                        self._request_id = request_id;
177                                        self
178                                    }
179    /// Consumes the builder and constructs a [`ScanOutput`](crate::operation::scan::ScanOutput).
180    pub fn build(self) -> crate::operation::scan::ScanOutput {
181        crate::operation::scan::ScanOutput {
182            items: self.items
183            ,
184            count: self.count
185                .unwrap_or_default()
186            ,
187            scanned_count: self.scanned_count
188                .unwrap_or_default()
189            ,
190            last_evaluated_key: self.last_evaluated_key
191            ,
192            consumed_capacity: self.consumed_capacity
193            ,
194            _request_id: self._request_id,
195        }
196    }
197}
198