aws_sdk_dynamodb/operation/update_item/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_item::_update_item_output::UpdateItemOutputBuilder;
3
4pub use crate::operation::update_item::_update_item_input::UpdateItemInputBuilder;
5
6impl crate::operation::update_item::builders::UpdateItemInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result<
9 crate::operation::update_item::UpdateItemOutput,
10 ::aws_smithy_runtime_api::client::result::SdkError<
11 crate::operation::update_item::UpdateItemError,
12 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13 >
14 > {
15 let mut fluent_builder = client.update_item();
16 fluent_builder.inner = self;
17 fluent_builder.send().await
18 }
19 }
20/// Fluent builder constructing a request to `UpdateItem`.
21///
22/// <p>Edits an existing item's attributes, or adds a new item to the table if it does not already exist. You can put, delete, or add attribute values. You can also perform a conditional update on an existing item (insert a new attribute name-value pair if it doesn't exist, or replace an existing name-value pair if it has certain expected attribute values).</p>
23/// <p>You can also return the item's attribute values in the same <code>UpdateItem</code> operation using the <code>ReturnValues</code> parameter.</p>
24#[derive(::std::clone::Clone, ::std::fmt::Debug)]
25pub struct UpdateItemFluentBuilder {
26 handle: ::std::sync::Arc<crate::client::Handle>,
27 inner: crate::operation::update_item::builders::UpdateItemInputBuilder,
28config_override: ::std::option::Option<crate::config::Builder>,
29 }
30impl
31 crate::client::customize::internal::CustomizableSend<
32 crate::operation::update_item::UpdateItemOutput,
33 crate::operation::update_item::UpdateItemError,
34 > for UpdateItemFluentBuilder
35 {
36 fn send(
37 self,
38 config_override: crate::config::Builder,
39 ) -> crate::client::customize::internal::BoxFuture<
40 crate::client::customize::internal::SendResult<
41 crate::operation::update_item::UpdateItemOutput,
42 crate::operation::update_item::UpdateItemError,
43 >,
44 > {
45 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
46 }
47 }
48impl UpdateItemFluentBuilder {
49 /// Creates a new `UpdateItemFluentBuilder`.
50 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
51 Self {
52 handle,
53 inner: ::std::default::Default::default(),
54 config_override: ::std::option::Option::None,
55 }
56 }
57 /// Access the UpdateItem as a reference.
58 pub fn as_input(&self) -> &crate::operation::update_item::builders::UpdateItemInputBuilder {
59 &self.inner
60 }
61 /// Sends the request and returns the response.
62 ///
63 /// If an error occurs, an `SdkError` will be returned with additional details that
64 /// can be matched against.
65 ///
66 /// By default, any retryable failures will be retried twice. Retry behavior
67 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
68 /// set when configuring the client.
69 pub async fn send(self) -> ::std::result::Result<crate::operation::update_item::UpdateItemOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_item::UpdateItemError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
70 let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
71 let runtime_plugins = crate::operation::update_item::UpdateItem::operation_runtime_plugins(
72 self.handle.runtime_plugins.clone(),
73 &self.handle.conf,
74 self.config_override,
75 );
76 crate::operation::update_item::UpdateItem::orchestrate(&runtime_plugins, input).await
77 }
78
79 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
80 pub fn customize(
81 self,
82 ) -> crate::client::customize::CustomizableOperation<crate::operation::update_item::UpdateItemOutput, crate::operation::update_item::UpdateItemError, Self> {
83 crate::client::customize::CustomizableOperation::new(self)
84 }
85 pub(crate) fn config_override(
86 mut self,
87 config_override: impl ::std::convert::Into<crate::config::Builder>,
88 ) -> Self {
89 self.set_config_override(::std::option::Option::Some(config_override.into()));
90 self
91 }
92
93 pub(crate) fn set_config_override(
94 &mut self,
95 config_override: ::std::option::Option<crate::config::Builder>,
96 ) -> &mut Self {
97 self.config_override = config_override;
98 self
99 }
100 /// <p>The name of the table containing the item to update. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
101 pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102 self.inner = self.inner.table_name(input.into());
103 self
104 }
105 /// <p>The name of the table containing the item to update. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
106 pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
107 self.inner = self.inner.set_table_name(input);
108 self
109 }
110 /// <p>The name of the table containing the item to update. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
111 pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
112 self.inner.get_table_name()
113 }
114 ///
115 /// Adds a key-value pair to `Key`.
116 ///
117 /// To override the contents of this collection use [`set_key`](Self::set_key).
118 ///
119 /// <p>The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.</p>
120 /// <p>For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.</p>
121 pub fn key(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
122 self.inner = self.inner.key(k.into(), v);
123 self
124 }
125 /// <p>The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.</p>
126 /// <p>For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.</p>
127 pub fn set_key(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
128 self.inner = self.inner.set_key(input);
129 self
130 }
131 /// <p>The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.</p>
132 /// <p>For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.</p>
133 pub fn get_key(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
134 self.inner.get_key()
135 }
136 ///
137 /// Adds a key-value pair to `AttributeUpdates`.
138 ///
139 /// To override the contents of this collection use [`set_attribute_updates`](Self::set_attribute_updates).
140 ///
141 /// <p>This is a legacy parameter. Use <code>UpdateExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html">AttributeUpdates</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
142 pub fn attribute_updates(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValueUpdate) -> Self {
143 self.inner = self.inner.attribute_updates(k.into(), v);
144 self
145 }
146 /// <p>This is a legacy parameter. Use <code>UpdateExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html">AttributeUpdates</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
147 pub fn set_attribute_updates(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValueUpdate>>) -> Self {
148 self.inner = self.inner.set_attribute_updates(input);
149 self
150 }
151 /// <p>This is a legacy parameter. Use <code>UpdateExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html">AttributeUpdates</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
152 pub fn get_attribute_updates(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValueUpdate>> {
153 self.inner.get_attribute_updates()
154 }
155 ///
156 /// Adds a key-value pair to `Expected`.
157 ///
158 /// To override the contents of this collection use [`set_expected`](Self::set_expected).
159 ///
160 /// <p>This is a legacy parameter. Use <code>ConditionExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html">Expected</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
161 pub fn expected(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::ExpectedAttributeValue) -> Self {
162 self.inner = self.inner.expected(k.into(), v);
163 self
164 }
165 /// <p>This is a legacy parameter. Use <code>ConditionExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html">Expected</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
166 pub fn set_expected(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::ExpectedAttributeValue>>) -> Self {
167 self.inner = self.inner.set_expected(input);
168 self
169 }
170 /// <p>This is a legacy parameter. Use <code>ConditionExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html">Expected</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
171 pub fn get_expected(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::ExpectedAttributeValue>> {
172 self.inner.get_expected()
173 }
174 /// <p>This is a legacy parameter. Use <code>ConditionExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html">ConditionalOperator</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
175 pub fn conditional_operator(mut self, input: crate::types::ConditionalOperator) -> Self {
176 self.inner = self.inner.conditional_operator(input);
177 self
178 }
179 /// <p>This is a legacy parameter. Use <code>ConditionExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html">ConditionalOperator</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
180 pub fn set_conditional_operator(mut self, input: ::std::option::Option<crate::types::ConditionalOperator>) -> Self {
181 self.inner = self.inner.set_conditional_operator(input);
182 self
183 }
184 /// <p>This is a legacy parameter. Use <code>ConditionExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html">ConditionalOperator</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
185 pub fn get_conditional_operator(&self) -> &::std::option::Option<crate::types::ConditionalOperator> {
186 self.inner.get_conditional_operator()
187 }
188 /// <p>Use <code>ReturnValues</code> if you want to get the item attributes as they appear before or after they are successfully updated. For <code>UpdateItem</code>, the valid values are:</p>
189 /// <ul>
190 /// <li>
191 /// <p><code>NONE</code> - If <code>ReturnValues</code> is not specified, or if its value is <code>NONE</code>, then nothing is returned. (This setting is the default for <code>ReturnValues</code>.)</p></li>
192 /// <li>
193 /// <p><code>ALL_OLD</code> - Returns all of the attributes of the item, as they appeared before the UpdateItem operation.</p></li>
194 /// <li>
195 /// <p><code>UPDATED_OLD</code> - Returns only the updated attributes, as they appeared before the UpdateItem operation.</p></li>
196 /// <li>
197 /// <p><code>ALL_NEW</code> - Returns all of the attributes of the item, as they appear after the UpdateItem operation.</p></li>
198 /// <li>
199 /// <p><code>UPDATED_NEW</code> - Returns only the updated attributes, as they appear after the UpdateItem operation.</p></li>
200 /// </ul>
201 /// <p>There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.</p>
202 /// <p>The values returned are strongly consistent.</p>
203 pub fn return_values(mut self, input: crate::types::ReturnValue) -> Self {
204 self.inner = self.inner.return_values(input);
205 self
206 }
207 /// <p>Use <code>ReturnValues</code> if you want to get the item attributes as they appear before or after they are successfully updated. For <code>UpdateItem</code>, the valid values are:</p>
208 /// <ul>
209 /// <li>
210 /// <p><code>NONE</code> - If <code>ReturnValues</code> is not specified, or if its value is <code>NONE</code>, then nothing is returned. (This setting is the default for <code>ReturnValues</code>.)</p></li>
211 /// <li>
212 /// <p><code>ALL_OLD</code> - Returns all of the attributes of the item, as they appeared before the UpdateItem operation.</p></li>
213 /// <li>
214 /// <p><code>UPDATED_OLD</code> - Returns only the updated attributes, as they appeared before the UpdateItem operation.</p></li>
215 /// <li>
216 /// <p><code>ALL_NEW</code> - Returns all of the attributes of the item, as they appear after the UpdateItem operation.</p></li>
217 /// <li>
218 /// <p><code>UPDATED_NEW</code> - Returns only the updated attributes, as they appear after the UpdateItem operation.</p></li>
219 /// </ul>
220 /// <p>There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.</p>
221 /// <p>The values returned are strongly consistent.</p>
222 pub fn set_return_values(mut self, input: ::std::option::Option<crate::types::ReturnValue>) -> Self {
223 self.inner = self.inner.set_return_values(input);
224 self
225 }
226 /// <p>Use <code>ReturnValues</code> if you want to get the item attributes as they appear before or after they are successfully updated. For <code>UpdateItem</code>, the valid values are:</p>
227 /// <ul>
228 /// <li>
229 /// <p><code>NONE</code> - If <code>ReturnValues</code> is not specified, or if its value is <code>NONE</code>, then nothing is returned. (This setting is the default for <code>ReturnValues</code>.)</p></li>
230 /// <li>
231 /// <p><code>ALL_OLD</code> - Returns all of the attributes of the item, as they appeared before the UpdateItem operation.</p></li>
232 /// <li>
233 /// <p><code>UPDATED_OLD</code> - Returns only the updated attributes, as they appeared before the UpdateItem operation.</p></li>
234 /// <li>
235 /// <p><code>ALL_NEW</code> - Returns all of the attributes of the item, as they appear after the UpdateItem operation.</p></li>
236 /// <li>
237 /// <p><code>UPDATED_NEW</code> - Returns only the updated attributes, as they appear after the UpdateItem operation.</p></li>
238 /// </ul>
239 /// <p>There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.</p>
240 /// <p>The values returned are strongly consistent.</p>
241 pub fn get_return_values(&self) -> &::std::option::Option<crate::types::ReturnValue> {
242 self.inner.get_return_values()
243 }
244 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
245 /// <ul>
246 /// <li>
247 /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
248 /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
249 /// <li>
250 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
251 /// <li>
252 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
253 /// </ul>
254 pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
255 self.inner = self.inner.return_consumed_capacity(input);
256 self
257 }
258 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
259 /// <ul>
260 /// <li>
261 /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
262 /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
263 /// <li>
264 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
265 /// <li>
266 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
267 /// </ul>
268 pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
269 self.inner = self.inner.set_return_consumed_capacity(input);
270 self
271 }
272 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
273 /// <ul>
274 /// <li>
275 /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
276 /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
277 /// <li>
278 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
279 /// <li>
280 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
281 /// </ul>
282 pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
283 self.inner.get_return_consumed_capacity()
284 }
285 /// <p>Determines whether item collection metrics are returned. If set to <code>SIZE</code>, the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to <code>NONE</code> (the default), no statistics are returned.</p>
286 pub fn return_item_collection_metrics(mut self, input: crate::types::ReturnItemCollectionMetrics) -> Self {
287 self.inner = self.inner.return_item_collection_metrics(input);
288 self
289 }
290 /// <p>Determines whether item collection metrics are returned. If set to <code>SIZE</code>, the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to <code>NONE</code> (the default), no statistics are returned.</p>
291 pub fn set_return_item_collection_metrics(mut self, input: ::std::option::Option<crate::types::ReturnItemCollectionMetrics>) -> Self {
292 self.inner = self.inner.set_return_item_collection_metrics(input);
293 self
294 }
295 /// <p>Determines whether item collection metrics are returned. If set to <code>SIZE</code>, the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to <code>NONE</code> (the default), no statistics are returned.</p>
296 pub fn get_return_item_collection_metrics(&self) -> &::std::option::Option<crate::types::ReturnItemCollectionMetrics> {
297 self.inner.get_return_item_collection_metrics()
298 }
299 /// <p>An expression that defines one or more attributes to be updated, the action to be performed on them, and new values for them.</p>
300 /// <p>The following action values are available for <code>UpdateExpression</code>.</p>
301 /// <ul>
302 /// <li>
303 /// <p><code>SET</code> - Adds one or more attributes and values to an item. If any of these attributes already exist, they are replaced by the new values. You can also use <code>SET</code> to add or subtract from an attribute that is of type Number. For example: <code>SET myNum = myNum + :val</code></p>
304 /// <p><code>SET</code> supports the following functions:</p>
305 /// <ul>
306 /// <li>
307 /// <p><code>if_not_exists (path, operand)</code> - if the item does not contain an attribute at the specified path, then <code>if_not_exists</code> evaluates to operand; otherwise, it evaluates to path. You can use this function to avoid overwriting an attribute that may already be present in the item.</p></li>
308 /// <li>
309 /// <p><code>list_append (operand, operand)</code> - evaluates to a list with a new element added to it. You can append the new element to the start or the end of the list by reversing the order of the operands.</p></li>
310 /// </ul>
311 /// <p>These function names are case-sensitive.</p></li>
312 /// <li>
313 /// <p><code>REMOVE</code> - Removes one or more attributes from an item.</p></li>
314 /// <li>
315 /// <p><code>ADD</code> - Adds the specified value to the item, if the attribute does not already exist. If the attribute does exist, then the behavior of <code>ADD</code> depends on the data type of the attribute:</p>
316 /// <ul>
317 /// <li>
318 /// <p>If the existing attribute is a number, and if <code>Value</code> is also a number, then <code>Value</code> is mathematically added to the existing attribute. If <code>Value</code> is a negative number, then it is subtracted from the existing attribute.</p><note>
319 /// <p>If you use <code>ADD</code> to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses <code>0</code> as the initial value.</p>
320 /// <p>Similarly, if you use <code>ADD</code> for an existing item to increment or decrement an attribute value that doesn't exist before the update, DynamoDB uses <code>0</code> as the initial value. For example, suppose that the item you want to update doesn't have an attribute named <code>itemcount</code>, but you decide to <code>ADD</code> the number <code>3</code> to this attribute anyway. DynamoDB will create the <code>itemcount</code> attribute, set its initial value to <code>0</code>, and finally add <code>3</code> to it. The result will be a new <code>itemcount</code> attribute in the item, with a value of <code>3</code>.</p>
321 /// </note></li>
322 /// <li>
323 /// <p>If the existing data type is a set and if <code>Value</code> is also a set, then <code>Value</code> is added to the existing set. For example, if the attribute value is the set <code>\[1,2\]</code>, and the <code>ADD</code> action specified <code>\[3\]</code>, then the final attribute value is <code>\[1,2,3\]</code>. An error occurs if an <code>ADD</code> action is specified for a set attribute and the attribute type specified does not match the existing set type.</p>
324 /// <p>Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, the <code>Value</code> must also be a set of strings.</p></li>
325 /// </ul><important>
326 /// <p>The <code>ADD</code> action only supports Number and set data types. In addition, <code>ADD</code> can only be used on top-level attributes, not nested attributes.</p>
327 /// </important></li>
328 /// <li>
329 /// <p><code>DELETE</code> - Deletes an element from a set.</p>
330 /// <p>If a set of values is specified, then those values are subtracted from the old set. For example, if the attribute value was the set <code>\[a,b,c\]</code> and the <code>DELETE</code> action specifies <code>\[a,c\]</code>, then the final attribute value is <code>\[b\]</code>. Specifying an empty set is an error.</p><important>
331 /// <p>The <code>DELETE</code> action only supports set data types. In addition, <code>DELETE</code> can only be used on top-level attributes, not nested attributes.</p>
332 /// </important></li>
333 /// </ul>
334 /// <p>You can have many actions in a single expression, such as the following: <code>SET a=:value1, b=:value2 DELETE :value3, :value4, :value5</code></p>
335 /// <p>For more information on update expressions, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html">Modifying Items and Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
336 pub fn update_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
337 self.inner = self.inner.update_expression(input.into());
338 self
339 }
340 /// <p>An expression that defines one or more attributes to be updated, the action to be performed on them, and new values for them.</p>
341 /// <p>The following action values are available for <code>UpdateExpression</code>.</p>
342 /// <ul>
343 /// <li>
344 /// <p><code>SET</code> - Adds one or more attributes and values to an item. If any of these attributes already exist, they are replaced by the new values. You can also use <code>SET</code> to add or subtract from an attribute that is of type Number. For example: <code>SET myNum = myNum + :val</code></p>
345 /// <p><code>SET</code> supports the following functions:</p>
346 /// <ul>
347 /// <li>
348 /// <p><code>if_not_exists (path, operand)</code> - if the item does not contain an attribute at the specified path, then <code>if_not_exists</code> evaluates to operand; otherwise, it evaluates to path. You can use this function to avoid overwriting an attribute that may already be present in the item.</p></li>
349 /// <li>
350 /// <p><code>list_append (operand, operand)</code> - evaluates to a list with a new element added to it. You can append the new element to the start or the end of the list by reversing the order of the operands.</p></li>
351 /// </ul>
352 /// <p>These function names are case-sensitive.</p></li>
353 /// <li>
354 /// <p><code>REMOVE</code> - Removes one or more attributes from an item.</p></li>
355 /// <li>
356 /// <p><code>ADD</code> - Adds the specified value to the item, if the attribute does not already exist. If the attribute does exist, then the behavior of <code>ADD</code> depends on the data type of the attribute:</p>
357 /// <ul>
358 /// <li>
359 /// <p>If the existing attribute is a number, and if <code>Value</code> is also a number, then <code>Value</code> is mathematically added to the existing attribute. If <code>Value</code> is a negative number, then it is subtracted from the existing attribute.</p><note>
360 /// <p>If you use <code>ADD</code> to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses <code>0</code> as the initial value.</p>
361 /// <p>Similarly, if you use <code>ADD</code> for an existing item to increment or decrement an attribute value that doesn't exist before the update, DynamoDB uses <code>0</code> as the initial value. For example, suppose that the item you want to update doesn't have an attribute named <code>itemcount</code>, but you decide to <code>ADD</code> the number <code>3</code> to this attribute anyway. DynamoDB will create the <code>itemcount</code> attribute, set its initial value to <code>0</code>, and finally add <code>3</code> to it. The result will be a new <code>itemcount</code> attribute in the item, with a value of <code>3</code>.</p>
362 /// </note></li>
363 /// <li>
364 /// <p>If the existing data type is a set and if <code>Value</code> is also a set, then <code>Value</code> is added to the existing set. For example, if the attribute value is the set <code>\[1,2\]</code>, and the <code>ADD</code> action specified <code>\[3\]</code>, then the final attribute value is <code>\[1,2,3\]</code>. An error occurs if an <code>ADD</code> action is specified for a set attribute and the attribute type specified does not match the existing set type.</p>
365 /// <p>Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, the <code>Value</code> must also be a set of strings.</p></li>
366 /// </ul><important>
367 /// <p>The <code>ADD</code> action only supports Number and set data types. In addition, <code>ADD</code> can only be used on top-level attributes, not nested attributes.</p>
368 /// </important></li>
369 /// <li>
370 /// <p><code>DELETE</code> - Deletes an element from a set.</p>
371 /// <p>If a set of values is specified, then those values are subtracted from the old set. For example, if the attribute value was the set <code>\[a,b,c\]</code> and the <code>DELETE</code> action specifies <code>\[a,c\]</code>, then the final attribute value is <code>\[b\]</code>. Specifying an empty set is an error.</p><important>
372 /// <p>The <code>DELETE</code> action only supports set data types. In addition, <code>DELETE</code> can only be used on top-level attributes, not nested attributes.</p>
373 /// </important></li>
374 /// </ul>
375 /// <p>You can have many actions in a single expression, such as the following: <code>SET a=:value1, b=:value2 DELETE :value3, :value4, :value5</code></p>
376 /// <p>For more information on update expressions, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html">Modifying Items and Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
377 pub fn set_update_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
378 self.inner = self.inner.set_update_expression(input);
379 self
380 }
381 /// <p>An expression that defines one or more attributes to be updated, the action to be performed on them, and new values for them.</p>
382 /// <p>The following action values are available for <code>UpdateExpression</code>.</p>
383 /// <ul>
384 /// <li>
385 /// <p><code>SET</code> - Adds one or more attributes and values to an item. If any of these attributes already exist, they are replaced by the new values. You can also use <code>SET</code> to add or subtract from an attribute that is of type Number. For example: <code>SET myNum = myNum + :val</code></p>
386 /// <p><code>SET</code> supports the following functions:</p>
387 /// <ul>
388 /// <li>
389 /// <p><code>if_not_exists (path, operand)</code> - if the item does not contain an attribute at the specified path, then <code>if_not_exists</code> evaluates to operand; otherwise, it evaluates to path. You can use this function to avoid overwriting an attribute that may already be present in the item.</p></li>
390 /// <li>
391 /// <p><code>list_append (operand, operand)</code> - evaluates to a list with a new element added to it. You can append the new element to the start or the end of the list by reversing the order of the operands.</p></li>
392 /// </ul>
393 /// <p>These function names are case-sensitive.</p></li>
394 /// <li>
395 /// <p><code>REMOVE</code> - Removes one or more attributes from an item.</p></li>
396 /// <li>
397 /// <p><code>ADD</code> - Adds the specified value to the item, if the attribute does not already exist. If the attribute does exist, then the behavior of <code>ADD</code> depends on the data type of the attribute:</p>
398 /// <ul>
399 /// <li>
400 /// <p>If the existing attribute is a number, and if <code>Value</code> is also a number, then <code>Value</code> is mathematically added to the existing attribute. If <code>Value</code> is a negative number, then it is subtracted from the existing attribute.</p><note>
401 /// <p>If you use <code>ADD</code> to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses <code>0</code> as the initial value.</p>
402 /// <p>Similarly, if you use <code>ADD</code> for an existing item to increment or decrement an attribute value that doesn't exist before the update, DynamoDB uses <code>0</code> as the initial value. For example, suppose that the item you want to update doesn't have an attribute named <code>itemcount</code>, but you decide to <code>ADD</code> the number <code>3</code> to this attribute anyway. DynamoDB will create the <code>itemcount</code> attribute, set its initial value to <code>0</code>, and finally add <code>3</code> to it. The result will be a new <code>itemcount</code> attribute in the item, with a value of <code>3</code>.</p>
403 /// </note></li>
404 /// <li>
405 /// <p>If the existing data type is a set and if <code>Value</code> is also a set, then <code>Value</code> is added to the existing set. For example, if the attribute value is the set <code>\[1,2\]</code>, and the <code>ADD</code> action specified <code>\[3\]</code>, then the final attribute value is <code>\[1,2,3\]</code>. An error occurs if an <code>ADD</code> action is specified for a set attribute and the attribute type specified does not match the existing set type.</p>
406 /// <p>Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, the <code>Value</code> must also be a set of strings.</p></li>
407 /// </ul><important>
408 /// <p>The <code>ADD</code> action only supports Number and set data types. In addition, <code>ADD</code> can only be used on top-level attributes, not nested attributes.</p>
409 /// </important></li>
410 /// <li>
411 /// <p><code>DELETE</code> - Deletes an element from a set.</p>
412 /// <p>If a set of values is specified, then those values are subtracted from the old set. For example, if the attribute value was the set <code>\[a,b,c\]</code> and the <code>DELETE</code> action specifies <code>\[a,c\]</code>, then the final attribute value is <code>\[b\]</code>. Specifying an empty set is an error.</p><important>
413 /// <p>The <code>DELETE</code> action only supports set data types. In addition, <code>DELETE</code> can only be used on top-level attributes, not nested attributes.</p>
414 /// </important></li>
415 /// </ul>
416 /// <p>You can have many actions in a single expression, such as the following: <code>SET a=:value1, b=:value2 DELETE :value3, :value4, :value5</code></p>
417 /// <p>For more information on update expressions, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html">Modifying Items and Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
418 pub fn get_update_expression(&self) -> &::std::option::Option<::std::string::String> {
419 self.inner.get_update_expression()
420 }
421 /// <p>A condition that must be satisfied in order for a conditional update to succeed.</p>
422 /// <p>An expression can contain any of the following:</p>
423 /// <ul>
424 /// <li>
425 /// <p>Functions: <code>attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size</code></p>
426 /// <p>These function names are case-sensitive.</p></li>
427 /// <li>
428 /// <p>Comparison operators: <code>= | <> | < | > | <= | >= | BETWEEN | IN </code></p></li>
429 /// <li>
430 /// <p>Logical operators: <code>AND | OR | NOT</code></p></li>
431 /// </ul>
432 /// <p>For more information about condition expressions, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html">Specifying Conditions</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
433 pub fn condition_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
434 self.inner = self.inner.condition_expression(input.into());
435 self
436 }
437 /// <p>A condition that must be satisfied in order for a conditional update to succeed.</p>
438 /// <p>An expression can contain any of the following:</p>
439 /// <ul>
440 /// <li>
441 /// <p>Functions: <code>attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size</code></p>
442 /// <p>These function names are case-sensitive.</p></li>
443 /// <li>
444 /// <p>Comparison operators: <code>= | <> | < | > | <= | >= | BETWEEN | IN </code></p></li>
445 /// <li>
446 /// <p>Logical operators: <code>AND | OR | NOT</code></p></li>
447 /// </ul>
448 /// <p>For more information about condition expressions, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html">Specifying Conditions</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
449 pub fn set_condition_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
450 self.inner = self.inner.set_condition_expression(input);
451 self
452 }
453 /// <p>A condition that must be satisfied in order for a conditional update to succeed.</p>
454 /// <p>An expression can contain any of the following:</p>
455 /// <ul>
456 /// <li>
457 /// <p>Functions: <code>attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size</code></p>
458 /// <p>These function names are case-sensitive.</p></li>
459 /// <li>
460 /// <p>Comparison operators: <code>= | <> | < | > | <= | >= | BETWEEN | IN </code></p></li>
461 /// <li>
462 /// <p>Logical operators: <code>AND | OR | NOT</code></p></li>
463 /// </ul>
464 /// <p>For more information about condition expressions, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html">Specifying Conditions</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
465 pub fn get_condition_expression(&self) -> &::std::option::Option<::std::string::String> {
466 self.inner.get_condition_expression()
467 }
468 ///
469 /// Adds a key-value pair to `ExpressionAttributeNames`.
470 ///
471 /// To override the contents of this collection use [`set_expression_attribute_names`](Self::set_expression_attribute_names).
472 ///
473 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
474 /// <ul>
475 /// <li>
476 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
477 /// <li>
478 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
479 /// <li>
480 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
481 /// </ul>
482 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
483 /// <ul>
484 /// <li>
485 /// <p><code>Percentile</code></p></li>
486 /// </ul>
487 /// <p>The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html">Reserved Words</a> in the <i>Amazon DynamoDB Developer Guide</i>.) To work around this, you could specify the following for <code>ExpressionAttributeNames</code>:</p>
488 /// <ul>
489 /// <li>
490 /// <p><code>{"#P":"Percentile"}</code></p></li>
491 /// </ul>
492 /// <p>You could then use this substitution in an expression, as in this example:</p>
493 /// <ul>
494 /// <li>
495 /// <p><code>#P = :val</code></p></li>
496 /// </ul><note>
497 /// <p>Tokens that begin with the <b>:</b> character are <i>expression attribute values</i>, which are placeholders for the actual value at runtime.</p>
498 /// </note>
499 /// <p>For more information about expression attribute names, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html">Specifying Item Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
500 pub fn expression_attribute_names(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
501 self.inner = self.inner.expression_attribute_names(k.into(), v.into());
502 self
503 }
504 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
505 /// <ul>
506 /// <li>
507 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
508 /// <li>
509 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
510 /// <li>
511 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
512 /// </ul>
513 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
514 /// <ul>
515 /// <li>
516 /// <p><code>Percentile</code></p></li>
517 /// </ul>
518 /// <p>The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html">Reserved Words</a> in the <i>Amazon DynamoDB Developer Guide</i>.) To work around this, you could specify the following for <code>ExpressionAttributeNames</code>:</p>
519 /// <ul>
520 /// <li>
521 /// <p><code>{"#P":"Percentile"}</code></p></li>
522 /// </ul>
523 /// <p>You could then use this substitution in an expression, as in this example:</p>
524 /// <ul>
525 /// <li>
526 /// <p><code>#P = :val</code></p></li>
527 /// </ul><note>
528 /// <p>Tokens that begin with the <b>:</b> character are <i>expression attribute values</i>, which are placeholders for the actual value at runtime.</p>
529 /// </note>
530 /// <p>For more information about expression attribute names, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html">Specifying Item Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
531 pub fn set_expression_attribute_names(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, ::std::string::String>>) -> Self {
532 self.inner = self.inner.set_expression_attribute_names(input);
533 self
534 }
535 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
536 /// <ul>
537 /// <li>
538 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
539 /// <li>
540 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
541 /// <li>
542 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
543 /// </ul>
544 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
545 /// <ul>
546 /// <li>
547 /// <p><code>Percentile</code></p></li>
548 /// </ul>
549 /// <p>The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html">Reserved Words</a> in the <i>Amazon DynamoDB Developer Guide</i>.) To work around this, you could specify the following for <code>ExpressionAttributeNames</code>:</p>
550 /// <ul>
551 /// <li>
552 /// <p><code>{"#P":"Percentile"}</code></p></li>
553 /// </ul>
554 /// <p>You could then use this substitution in an expression, as in this example:</p>
555 /// <ul>
556 /// <li>
557 /// <p><code>#P = :val</code></p></li>
558 /// </ul><note>
559 /// <p>Tokens that begin with the <b>:</b> character are <i>expression attribute values</i>, which are placeholders for the actual value at runtime.</p>
560 /// </note>
561 /// <p>For more information about expression attribute names, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html">Specifying Item Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
562 pub fn get_expression_attribute_names(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, ::std::string::String>> {
563 self.inner.get_expression_attribute_names()
564 }
565 ///
566 /// Adds a key-value pair to `ExpressionAttributeValues`.
567 ///
568 /// To override the contents of this collection use [`set_expression_attribute_values`](Self::set_expression_attribute_values).
569 ///
570 /// <p>One or more values that can be substituted in an expression.</p>
571 /// <p>Use the <b>:</b> (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the <code>ProductStatus</code> attribute was one of the following:</p>
572 /// <p><code>Available | Backordered | Discontinued</code></p>
573 /// <p>You would first need to specify <code>ExpressionAttributeValues</code> as follows:</p>
574 /// <p><code>{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }</code></p>
575 /// <p>You could then use these values in an expression, such as this:</p>
576 /// <p><code>ProductStatus IN (:avail, :back, :disc)</code></p>
577 /// <p>For more information on expression attribute values, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html">Condition Expressions</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
578 pub fn expression_attribute_values(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
579 self.inner = self.inner.expression_attribute_values(k.into(), v);
580 self
581 }
582 /// <p>One or more values that can be substituted in an expression.</p>
583 /// <p>Use the <b>:</b> (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the <code>ProductStatus</code> attribute was one of the following:</p>
584 /// <p><code>Available | Backordered | Discontinued</code></p>
585 /// <p>You would first need to specify <code>ExpressionAttributeValues</code> as follows:</p>
586 /// <p><code>{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }</code></p>
587 /// <p>You could then use these values in an expression, such as this:</p>
588 /// <p><code>ProductStatus IN (:avail, :back, :disc)</code></p>
589 /// <p>For more information on expression attribute values, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html">Condition Expressions</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
590 pub fn set_expression_attribute_values(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
591 self.inner = self.inner.set_expression_attribute_values(input);
592 self
593 }
594 /// <p>One or more values that can be substituted in an expression.</p>
595 /// <p>Use the <b>:</b> (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the <code>ProductStatus</code> attribute was one of the following:</p>
596 /// <p><code>Available | Backordered | Discontinued</code></p>
597 /// <p>You would first need to specify <code>ExpressionAttributeValues</code> as follows:</p>
598 /// <p><code>{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }</code></p>
599 /// <p>You could then use these values in an expression, such as this:</p>
600 /// <p><code>ProductStatus IN (:avail, :back, :disc)</code></p>
601 /// <p>For more information on expression attribute values, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html">Condition Expressions</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
602 pub fn get_expression_attribute_values(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
603 self.inner.get_expression_attribute_values()
604 }
605 /// <p>An optional parameter that returns the item attributes for an <code>UpdateItem</code> operation that failed a condition check.</p>
606 /// <p>There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.</p>
607 pub fn return_values_on_condition_check_failure(mut self, input: crate::types::ReturnValuesOnConditionCheckFailure) -> Self {
608 self.inner = self.inner.return_values_on_condition_check_failure(input);
609 self
610 }
611 /// <p>An optional parameter that returns the item attributes for an <code>UpdateItem</code> operation that failed a condition check.</p>
612 /// <p>There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.</p>
613 pub fn set_return_values_on_condition_check_failure(mut self, input: ::std::option::Option<crate::types::ReturnValuesOnConditionCheckFailure>) -> Self {
614 self.inner = self.inner.set_return_values_on_condition_check_failure(input);
615 self
616 }
617 /// <p>An optional parameter that returns the item attributes for an <code>UpdateItem</code> operation that failed a condition check.</p>
618 /// <p>There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.</p>
619 pub fn get_return_values_on_condition_check_failure(&self) -> &::std::option::Option<crate::types::ReturnValuesOnConditionCheckFailure> {
620 self.inner.get_return_values_on_condition_check_failure()
621 }
622}
623