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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The capacity units consumed by an 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 request asked for it. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ProvisionedThroughputIntro.html">Provisioned Throughput</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct ConsumedCapacity {
    /// <p>The name of the table that was affected by the operation.</p>
    #[doc(hidden)]
    pub table_name: ::std::option::Option<::std::string::String>,
    /// <p>The total number of capacity units consumed by the operation.</p>
    #[doc(hidden)]
    pub capacity_units: ::std::option::Option<f64>,
    /// <p>The total number of read capacity units consumed by the operation.</p>
    #[doc(hidden)]
    pub read_capacity_units: ::std::option::Option<f64>,
    /// <p>The total number of write capacity units consumed by the operation.</p>
    #[doc(hidden)]
    pub write_capacity_units: ::std::option::Option<f64>,
    /// <p>The amount of throughput consumed on the table affected by the operation.</p>
    #[doc(hidden)]
    pub table: ::std::option::Option<crate::types::Capacity>,
    /// <p>The amount of throughput consumed on each local index affected by the operation.</p>
    #[doc(hidden)]
    pub local_secondary_indexes: ::std::option::Option<
        ::std::collections::HashMap<::std::string::String, crate::types::Capacity>,
    >,
    /// <p>The amount of throughput consumed on each global index affected by the operation.</p>
    #[doc(hidden)]
    pub global_secondary_indexes: ::std::option::Option<
        ::std::collections::HashMap<::std::string::String, crate::types::Capacity>,
    >,
}
impl ConsumedCapacity {
    /// <p>The name of the table that was affected by the operation.</p>
    pub fn table_name(&self) -> ::std::option::Option<&str> {
        self.table_name.as_deref()
    }
    /// <p>The total number of capacity units consumed by the operation.</p>
    pub fn capacity_units(&self) -> ::std::option::Option<f64> {
        self.capacity_units
    }
    /// <p>The total number of read capacity units consumed by the operation.</p>
    pub fn read_capacity_units(&self) -> ::std::option::Option<f64> {
        self.read_capacity_units
    }
    /// <p>The total number of write capacity units consumed by the operation.</p>
    pub fn write_capacity_units(&self) -> ::std::option::Option<f64> {
        self.write_capacity_units
    }
    /// <p>The amount of throughput consumed on the table affected by the operation.</p>
    pub fn table(&self) -> ::std::option::Option<&crate::types::Capacity> {
        self.table.as_ref()
    }
    /// <p>The amount of throughput consumed on each local index affected by the operation.</p>
    pub fn local_secondary_indexes(
        &self,
    ) -> ::std::option::Option<
        &::std::collections::HashMap<::std::string::String, crate::types::Capacity>,
    > {
        self.local_secondary_indexes.as_ref()
    }
    /// <p>The amount of throughput consumed on each global index affected by the operation.</p>
    pub fn global_secondary_indexes(
        &self,
    ) -> ::std::option::Option<
        &::std::collections::HashMap<::std::string::String, crate::types::Capacity>,
    > {
        self.global_secondary_indexes.as_ref()
    }
}
impl ConsumedCapacity {
    /// Creates a new builder-style object to manufacture [`ConsumedCapacity`](crate::types::ConsumedCapacity).
    pub fn builder() -> crate::types::builders::ConsumedCapacityBuilder {
        crate::types::builders::ConsumedCapacityBuilder::default()
    }
}

/// A builder for [`ConsumedCapacity`](crate::types::ConsumedCapacity).
#[non_exhaustive]
#[derive(
    ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug,
)]
pub struct ConsumedCapacityBuilder {
    pub(crate) table_name: ::std::option::Option<::std::string::String>,
    pub(crate) capacity_units: ::std::option::Option<f64>,
    pub(crate) read_capacity_units: ::std::option::Option<f64>,
    pub(crate) write_capacity_units: ::std::option::Option<f64>,
    pub(crate) table: ::std::option::Option<crate::types::Capacity>,
    pub(crate) local_secondary_indexes: ::std::option::Option<
        ::std::collections::HashMap<::std::string::String, crate::types::Capacity>,
    >,
    pub(crate) global_secondary_indexes: ::std::option::Option<
        ::std::collections::HashMap<::std::string::String, crate::types::Capacity>,
    >,
}
impl ConsumedCapacityBuilder {
    /// <p>The name of the table that was affected by the operation.</p>
    pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.table_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the table that was affected by the operation.</p>
    pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.table_name = input;
        self
    }
    /// <p>The total number of capacity units consumed by the operation.</p>
    pub fn capacity_units(mut self, input: f64) -> Self {
        self.capacity_units = ::std::option::Option::Some(input);
        self
    }
    /// <p>The total number of capacity units consumed by the operation.</p>
    pub fn set_capacity_units(mut self, input: ::std::option::Option<f64>) -> Self {
        self.capacity_units = input;
        self
    }
    /// <p>The total number of read capacity units consumed by the operation.</p>
    pub fn read_capacity_units(mut self, input: f64) -> Self {
        self.read_capacity_units = ::std::option::Option::Some(input);
        self
    }
    /// <p>The total number of read capacity units consumed by the operation.</p>
    pub fn set_read_capacity_units(mut self, input: ::std::option::Option<f64>) -> Self {
        self.read_capacity_units = input;
        self
    }
    /// <p>The total number of write capacity units consumed by the operation.</p>
    pub fn write_capacity_units(mut self, input: f64) -> Self {
        self.write_capacity_units = ::std::option::Option::Some(input);
        self
    }
    /// <p>The total number of write capacity units consumed by the operation.</p>
    pub fn set_write_capacity_units(mut self, input: ::std::option::Option<f64>) -> Self {
        self.write_capacity_units = input;
        self
    }
    /// <p>The amount of throughput consumed on the table affected by the operation.</p>
    pub fn table(mut self, input: crate::types::Capacity) -> Self {
        self.table = ::std::option::Option::Some(input);
        self
    }
    /// <p>The amount of throughput consumed on the table affected by the operation.</p>
    pub fn set_table(mut self, input: ::std::option::Option<crate::types::Capacity>) -> Self {
        self.table = input;
        self
    }
    /// Adds a key-value pair to `local_secondary_indexes`.
    ///
    /// To override the contents of this collection use [`set_local_secondary_indexes`](Self::set_local_secondary_indexes).
    ///
    /// <p>The amount of throughput consumed on each local index affected by the operation.</p>
    pub fn local_secondary_indexes(
        mut self,
        k: impl ::std::convert::Into<::std::string::String>,
        v: crate::types::Capacity,
    ) -> Self {
        let mut hash_map = self.local_secondary_indexes.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.local_secondary_indexes = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The amount of throughput consumed on each local index affected by the operation.</p>
    pub fn set_local_secondary_indexes(
        mut self,
        input: ::std::option::Option<
            ::std::collections::HashMap<::std::string::String, crate::types::Capacity>,
        >,
    ) -> Self {
        self.local_secondary_indexes = input;
        self
    }
    /// Adds a key-value pair to `global_secondary_indexes`.
    ///
    /// To override the contents of this collection use [`set_global_secondary_indexes`](Self::set_global_secondary_indexes).
    ///
    /// <p>The amount of throughput consumed on each global index affected by the operation.</p>
    pub fn global_secondary_indexes(
        mut self,
        k: impl ::std::convert::Into<::std::string::String>,
        v: crate::types::Capacity,
    ) -> Self {
        let mut hash_map = self.global_secondary_indexes.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.global_secondary_indexes = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The amount of throughput consumed on each global index affected by the operation.</p>
    pub fn set_global_secondary_indexes(
        mut self,
        input: ::std::option::Option<
            ::std::collections::HashMap<::std::string::String, crate::types::Capacity>,
        >,
    ) -> Self {
        self.global_secondary_indexes = input;
        self
    }
    /// Consumes the builder and constructs a [`ConsumedCapacity`](crate::types::ConsumedCapacity).
    pub fn build(self) -> crate::types::ConsumedCapacity {
        crate::types::ConsumedCapacity {
            table_name: self.table_name,
            capacity_units: self.capacity_units,
            read_capacity_units: self.read_capacity_units,
            write_capacity_units: self.write_capacity_units,
            table: self.table,
            local_secondary_indexes: self.local_secondary_indexes,
            global_secondary_indexes: self.global_secondary_indexes,
        }
    }
}