pub struct Builder { /* private fields */ }
Expand description

A builder for UpdateItemInput.

Implementations§

The name of the table containing the item to update.

Examples found in repository?
src/client.rs (line 7712)
7711
7712
7713
7714
        pub fn table_name(mut self, input: impl Into<std::string::String>) -> Self {
            self.inner = self.inner.table_name(input.into());
            self
        }

The name of the table containing the item to update.

Examples found in repository?
src/client.rs (line 7717)
7716
7717
7718
7719
        pub fn set_table_name(mut self, input: std::option::Option<std::string::String>) -> Self {
            self.inner = self.inner.set_table_name(input);
            self
        }

Adds a key-value pair to key.

To override the contents of this collection use set_key.

The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.

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.

Examples found in repository?
src/client.rs (line 7731)
7726
7727
7728
7729
7730
7731
7732
7733
        pub fn key(
            mut self,
            k: impl Into<std::string::String>,
            v: crate::model::AttributeValue,
        ) -> Self {
            self.inner = self.inner.key(k.into(), v);
            self
        }

The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.

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.

Examples found in repository?
src/client.rs (line 7742)
7736
7737
7738
7739
7740
7741
7742
7743
7744
        pub fn set_key(
            mut self,
            input: std::option::Option<
                std::collections::HashMap<std::string::String, crate::model::AttributeValue>,
            >,
        ) -> Self {
            self.inner = self.inner.set_key(input);
            self
        }

Adds a key-value pair to attribute_updates.

To override the contents of this collection use set_attribute_updates.

This is a legacy parameter. Use UpdateExpression instead. For more information, see AttributeUpdates in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7755)
7750
7751
7752
7753
7754
7755
7756
7757
        pub fn attribute_updates(
            mut self,
            k: impl Into<std::string::String>,
            v: crate::model::AttributeValueUpdate,
        ) -> Self {
            self.inner = self.inner.attribute_updates(k.into(), v);
            self
        }

This is a legacy parameter. Use UpdateExpression instead. For more information, see AttributeUpdates in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7765)
7759
7760
7761
7762
7763
7764
7765
7766
7767
        pub fn set_attribute_updates(
            mut self,
            input: std::option::Option<
                std::collections::HashMap<std::string::String, crate::model::AttributeValueUpdate>,
            >,
        ) -> Self {
            self.inner = self.inner.set_attribute_updates(input);
            self
        }

Adds a key-value pair to expected.

To override the contents of this collection use set_expected.

This is a legacy parameter. Use ConditionExpression instead. For more information, see Expected in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7778)
7773
7774
7775
7776
7777
7778
7779
7780
        pub fn expected(
            mut self,
            k: impl Into<std::string::String>,
            v: crate::model::ExpectedAttributeValue,
        ) -> Self {
            self.inner = self.inner.expected(k.into(), v);
            self
        }

This is a legacy parameter. Use ConditionExpression instead. For more information, see Expected in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7791)
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
        pub fn set_expected(
            mut self,
            input: std::option::Option<
                std::collections::HashMap<
                    std::string::String,
                    crate::model::ExpectedAttributeValue,
                >,
            >,
        ) -> Self {
            self.inner = self.inner.set_expected(input);
            self
        }

This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7796)
7795
7796
7797
7798
        pub fn conditional_operator(mut self, input: crate::model::ConditionalOperator) -> Self {
            self.inner = self.inner.conditional_operator(input);
            self
        }

This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7804)
7800
7801
7802
7803
7804
7805
7806
        pub fn set_conditional_operator(
            mut self,
            input: std::option::Option<crate::model::ConditionalOperator>,
        ) -> Self {
            self.inner = self.inner.set_conditional_operator(input);
            self
        }

Use ReturnValues if you want to get the item attributes as they appear before or after they are updated. For UpdateItem, the valid values are:

  • NONE - If ReturnValues is not specified, or if its value is NONE, then nothing is returned. (This setting is the default for ReturnValues.)

  • ALL_OLD - Returns all of the attributes of the item, as they appeared before the UpdateItem operation.

  • UPDATED_OLD - Returns only the updated attributes, as they appeared before the UpdateItem operation.

  • ALL_NEW - Returns all of the attributes of the item, as they appear after the UpdateItem operation.

  • UPDATED_NEW - Returns only the updated attributes, as they appear after the UpdateItem operation.

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.

The values returned are strongly consistent.

Examples found in repository?
src/client.rs (line 7818)
7817
7818
7819
7820
        pub fn return_values(mut self, input: crate::model::ReturnValue) -> Self {
            self.inner = self.inner.return_values(input);
            self
        }

Use ReturnValues if you want to get the item attributes as they appear before or after they are updated. For UpdateItem, the valid values are:

  • NONE - If ReturnValues is not specified, or if its value is NONE, then nothing is returned. (This setting is the default for ReturnValues.)

  • ALL_OLD - Returns all of the attributes of the item, as they appeared before the UpdateItem operation.

  • UPDATED_OLD - Returns only the updated attributes, as they appeared before the UpdateItem operation.

  • ALL_NEW - Returns all of the attributes of the item, as they appear after the UpdateItem operation.

  • UPDATED_NEW - Returns only the updated attributes, as they appear after the UpdateItem operation.

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.

The values returned are strongly consistent.

Examples found in repository?
src/client.rs (line 7835)
7831
7832
7833
7834
7835
7836
7837
        pub fn set_return_values(
            mut self,
            input: std::option::Option<crate::model::ReturnValue>,
        ) -> Self {
            self.inner = self.inner.set_return_values(input);
            self
        }

Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:

  • INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed.

    Note that some operations, such as GetItem and BatchGetItem, do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).

  • TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.

  • NONE - No ConsumedCapacity details are included in the response.

Examples found in repository?
src/client.rs (line 7848)
7844
7845
7846
7847
7848
7849
7850
        pub fn return_consumed_capacity(
            mut self,
            input: crate::model::ReturnConsumedCapacity,
        ) -> Self {
            self.inner = self.inner.return_consumed_capacity(input);
            self
        }

Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:

  • INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed.

    Note that some operations, such as GetItem and BatchGetItem, do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).

  • TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.

  • NONE - No ConsumedCapacity details are included in the response.

Examples found in repository?
src/client.rs (line 7861)
7857
7858
7859
7860
7861
7862
7863
        pub fn set_return_consumed_capacity(
            mut self,
            input: std::option::Option<crate::model::ReturnConsumedCapacity>,
        ) -> Self {
            self.inner = self.inner.set_return_consumed_capacity(input);
            self
        }

Determines whether item collection metrics are returned. If set to SIZE, the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to NONE (the default), no statistics are returned.

Examples found in repository?
src/client.rs (line 7869)
7865
7866
7867
7868
7869
7870
7871
        pub fn return_item_collection_metrics(
            mut self,
            input: crate::model::ReturnItemCollectionMetrics,
        ) -> Self {
            self.inner = self.inner.return_item_collection_metrics(input);
            self
        }

Determines whether item collection metrics are returned. If set to SIZE, the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to NONE (the default), no statistics are returned.

Examples found in repository?
src/client.rs (line 7877)
7873
7874
7875
7876
7877
7878
7879
        pub fn set_return_item_collection_metrics(
            mut self,
            input: std::option::Option<crate::model::ReturnItemCollectionMetrics>,
        ) -> Self {
            self.inner = self.inner.set_return_item_collection_metrics(input);
            self
        }

An expression that defines one or more attributes to be updated, the action to be performed on them, and new values for them.

The following action values are available for UpdateExpression.

  • SET - 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 SET to add or subtract from an attribute that is of type Number. For example: SET myNum = myNum + :val

    SET supports the following functions:

    • if_not_exists (path, operand) - if the item does not contain an attribute at the specified path, then if_not_exists 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.

    • list_append (operand, operand) - 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.

    These function names are case-sensitive.

  • REMOVE - Removes one or more attributes from an item.

  • ADD - Adds the specified value to the item, if the attribute does not already exist. If the attribute does exist, then the behavior of ADD depends on the data type of the attribute:

    • If the existing attribute is a number, and if Value is also a number, then Value is mathematically added to the existing attribute. If Value is a negative number, then it is subtracted from the existing attribute.

      If you use ADD to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses 0 as the initial value.

      Similarly, if you use ADD for an existing item to increment or decrement an attribute value that doesn't exist before the update, DynamoDB uses 0 as the initial value. For example, suppose that the item you want to update doesn't have an attribute named itemcount, but you decide to ADD the number 3 to this attribute anyway. DynamoDB will create the itemcount attribute, set its initial value to 0, and finally add 3 to it. The result will be a new itemcount attribute in the item, with a value of 3.

    • If the existing data type is a set and if Value is also a set, then Value is added to the existing set. For example, if the attribute value is the set [1,2], and the ADD action specified [3], then the final attribute value is [1,2,3]. An error occurs if an ADD action is specified for a set attribute and the attribute type specified does not match the existing set type.

      Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, the Value must also be a set of strings.

    The ADD action only supports Number and set data types. In addition, ADD can only be used on top-level attributes, not nested attributes.

  • DELETE - Deletes an element from a set.

    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 [a,b,c] and the DELETE action specifies [a,c], then the final attribute value is [b]. Specifying an empty set is an error.

    The DELETE action only supports set data types. In addition, DELETE can only be used on top-level attributes, not nested attributes.

You can have many actions in a single expression, such as the following: SET a=:value1, b=:value2 DELETE :value3, :value4, :value5

For more information on update expressions, see Modifying Items and Attributes in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7906)
7905
7906
7907
7908
        pub fn update_expression(mut self, input: impl Into<std::string::String>) -> Self {
            self.inner = self.inner.update_expression(input.into());
            self
        }

An expression that defines one or more attributes to be updated, the action to be performed on them, and new values for them.

The following action values are available for UpdateExpression.

  • SET - 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 SET to add or subtract from an attribute that is of type Number. For example: SET myNum = myNum + :val

    SET supports the following functions:

    • if_not_exists (path, operand) - if the item does not contain an attribute at the specified path, then if_not_exists 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.

    • list_append (operand, operand) - 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.

    These function names are case-sensitive.

  • REMOVE - Removes one or more attributes from an item.

  • ADD - Adds the specified value to the item, if the attribute does not already exist. If the attribute does exist, then the behavior of ADD depends on the data type of the attribute:

    • If the existing attribute is a number, and if Value is also a number, then Value is mathematically added to the existing attribute. If Value is a negative number, then it is subtracted from the existing attribute.

      If you use ADD to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses 0 as the initial value.

      Similarly, if you use ADD for an existing item to increment or decrement an attribute value that doesn't exist before the update, DynamoDB uses 0 as the initial value. For example, suppose that the item you want to update doesn't have an attribute named itemcount, but you decide to ADD the number 3 to this attribute anyway. DynamoDB will create the itemcount attribute, set its initial value to 0, and finally add 3 to it. The result will be a new itemcount attribute in the item, with a value of 3.

    • If the existing data type is a set and if Value is also a set, then Value is added to the existing set. For example, if the attribute value is the set [1,2], and the ADD action specified [3], then the final attribute value is [1,2,3]. An error occurs if an ADD action is specified for a set attribute and the attribute type specified does not match the existing set type.

      Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, the Value must also be a set of strings.

    The ADD action only supports Number and set data types. In addition, ADD can only be used on top-level attributes, not nested attributes.

  • DELETE - Deletes an element from a set.

    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 [a,b,c] and the DELETE action specifies [a,c], then the final attribute value is [b]. Specifying an empty set is an error.

    The DELETE action only supports set data types. In addition, DELETE can only be used on top-level attributes, not nested attributes.

You can have many actions in a single expression, such as the following: SET a=:value1, b=:value2 DELETE :value3, :value4, :value5

For more information on update expressions, see Modifying Items and Attributes in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7938)
7934
7935
7936
7937
7938
7939
7940
        pub fn set_update_expression(
            mut self,
            input: std::option::Option<std::string::String>,
        ) -> Self {
            self.inner = self.inner.set_update_expression(input);
            self
        }

A condition that must be satisfied in order for a conditional update to succeed.

An expression can contain any of the following:

  • Functions: attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size

    These function names are case-sensitive.

  • Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN

  • Logical operators: AND | OR | NOT

For more information about condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7950)
7949
7950
7951
7952
        pub fn condition_expression(mut self, input: impl Into<std::string::String>) -> Self {
            self.inner = self.inner.condition_expression(input.into());
            self
        }

A condition that must be satisfied in order for a conditional update to succeed.

An expression can contain any of the following:

  • Functions: attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size

    These function names are case-sensitive.

  • Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN

  • Logical operators: AND | OR | NOT

For more information about condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7965)
7961
7962
7963
7964
7965
7966
7967
        pub fn set_condition_expression(
            mut self,
            input: std::option::Option<std::string::String>,
        ) -> Self {
            self.inner = self.inner.set_condition_expression(input);
            self
        }

Adds a key-value pair to expression_attribute_names.

To override the contents of this collection use set_expression_attribute_names.

One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames:

  • To access an attribute whose name conflicts with a DynamoDB reserved word.

  • To create a placeholder for repeating occurrences of an attribute name in an expression.

  • To prevent special characters in an attribute name from being misinterpreted in an expression.

Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:

  • Percentile

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 Reserved Words in the Amazon DynamoDB Developer Guide.) To work around this, you could specify the following for ExpressionAttributeNames:

  • {"#P":"Percentile"}

You could then use this substitution in an expression, as in this example:

  • #P = :val

Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.

For more information about expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 7998)
7993
7994
7995
7996
7997
7998
7999
8000
        pub fn expression_attribute_names(
            mut self,
            k: impl Into<std::string::String>,
            v: impl Into<std::string::String>,
        ) -> Self {
            self.inner = self.inner.expression_attribute_names(k.into(), v.into());
            self
        }

One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames:

  • To access an attribute whose name conflicts with a DynamoDB reserved word.

  • To create a placeholder for repeating occurrences of an attribute name in an expression.

  • To prevent special characters in an attribute name from being misinterpreted in an expression.

Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:

  • Percentile

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 Reserved Words in the Amazon DynamoDB Developer Guide.) To work around this, you could specify the following for ExpressionAttributeNames:

  • {"#P":"Percentile"}

You could then use this substitution in an expression, as in this example:

  • #P = :val

Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.

For more information about expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 8028)
8022
8023
8024
8025
8026
8027
8028
8029
8030
        pub fn set_expression_attribute_names(
            mut self,
            input: std::option::Option<
                std::collections::HashMap<std::string::String, std::string::String>,
            >,
        ) -> Self {
            self.inner = self.inner.set_expression_attribute_names(input);
            self
        }

Adds a key-value pair to expression_attribute_values.

To override the contents of this collection use set_expression_attribute_values.

One or more values that can be substituted in an expression.

Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:

Available | Backordered | Discontinued

You would first need to specify ExpressionAttributeValues as follows:

{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }

You could then use these values in an expression, such as this:

ProductStatus IN (:avail, :back, :disc)

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 8048)
8043
8044
8045
8046
8047
8048
8049
8050
        pub fn expression_attribute_values(
            mut self,
            k: impl Into<std::string::String>,
            v: crate::model::AttributeValue,
        ) -> Self {
            self.inner = self.inner.expression_attribute_values(k.into(), v);
            self
        }

One or more values that can be substituted in an expression.

Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:

Available | Backordered | Discontinued

You would first need to specify ExpressionAttributeValues as follows:

{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }

You could then use these values in an expression, such as this:

ProductStatus IN (:avail, :back, :disc)

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer Guide.

Examples found in repository?
src/client.rs (line 8065)
8059
8060
8061
8062
8063
8064
8065
8066
8067
        pub fn set_expression_attribute_values(
            mut self,
            input: std::option::Option<
                std::collections::HashMap<std::string::String, crate::model::AttributeValue>,
            >,
        ) -> Self {
            self.inner = self.inner.set_expression_attribute_values(input);
            self
        }

Consumes the builder and constructs a UpdateItemInput.

Examples found in repository?
src/client.rs (line 7679)
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
        pub async fn customize(
            self,
        ) -> std::result::Result<
            crate::operation::customize::CustomizableOperation<
                crate::operation::UpdateItem,
                aws_http::retry::AwsResponseRetryClassifier,
            >,
            aws_smithy_http::result::SdkError<crate::error::UpdateItemError>,
        > {
            let handle = self.handle.clone();
            let operation = self
                .inner
                .build()
                .map_err(aws_smithy_http::result::SdkError::construction_failure)?
                .make_operation(&handle.conf)
                .await
                .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
            Ok(crate::operation::customize::CustomizableOperation { handle, operation })
        }

        /// Sends the request and returns the response.
        ///
        /// If an error occurs, an `SdkError` will be returned with additional details that
        /// can be matched against.
        ///
        /// By default, any retryable failures will be retried twice. Retry behavior
        /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
        /// set when configuring the client.
        pub async fn send(
            self,
        ) -> std::result::Result<
            crate::output::UpdateItemOutput,
            aws_smithy_http::result::SdkError<crate::error::UpdateItemError>,
        > {
            let op = self
                .inner
                .build()
                .map_err(aws_smithy_http::result::SdkError::construction_failure)?
                .make_operation(&self.handle.conf)
                .await
                .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
            self.handle.client.call(op).await
        }

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more