Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.dynamodb.model.DeleteItemRequest Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.dynamodb.model;
import java.beans.Transient;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents the input of a DeleteItem
operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DeleteItemRequest extends DynamoDbRequest implements
ToCopyableBuilder {
private static final SdkField TABLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TableName").getter(getter(DeleteItemRequest::tableName)).setter(setter(Builder::tableName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TableName").build()).build();
private static final SdkField> KEY_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("Key")
.getter(getter(DeleteItemRequest::key))
.setter(setter(Builder::key))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Key").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AttributeValue::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField> EXPECTED_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("Expected")
.getter(getter(DeleteItemRequest::expected))
.setter(setter(Builder::expected))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Expected").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ExpectedAttributeValue::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField CONDITIONAL_OPERATOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ConditionalOperator").getter(getter(DeleteItemRequest::conditionalOperatorAsString))
.setter(setter(Builder::conditionalOperator))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConditionalOperator").build())
.build();
private static final SdkField RETURN_VALUES_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReturnValues").getter(getter(DeleteItemRequest::returnValuesAsString))
.setter(setter(Builder::returnValues))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReturnValues").build()).build();
private static final SdkField RETURN_CONSUMED_CAPACITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReturnConsumedCapacity").getter(getter(DeleteItemRequest::returnConsumedCapacityAsString))
.setter(setter(Builder::returnConsumedCapacity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReturnConsumedCapacity").build())
.build();
private static final SdkField RETURN_ITEM_COLLECTION_METRICS_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ReturnItemCollectionMetrics")
.getter(getter(DeleteItemRequest::returnItemCollectionMetricsAsString))
.setter(setter(Builder::returnItemCollectionMetrics))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReturnItemCollectionMetrics")
.build()).build();
private static final SdkField CONDITION_EXPRESSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ConditionExpression").getter(getter(DeleteItemRequest::conditionExpression))
.setter(setter(Builder::conditionExpression))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConditionExpression").build())
.build();
private static final SdkField> EXPRESSION_ATTRIBUTE_NAMES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("ExpressionAttributeNames")
.getter(getter(DeleteItemRequest::expressionAttributeNames))
.setter(setter(Builder::expressionAttributeNames))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpressionAttributeNames").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField> EXPRESSION_ATTRIBUTE_VALUES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("ExpressionAttributeValues")
.getter(getter(DeleteItemRequest::expressionAttributeValues))
.setter(setter(Builder::expressionAttributeValues))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpressionAttributeValues").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AttributeValue::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TABLE_NAME_FIELD, KEY_FIELD,
EXPECTED_FIELD, CONDITIONAL_OPERATOR_FIELD, RETURN_VALUES_FIELD, RETURN_CONSUMED_CAPACITY_FIELD,
RETURN_ITEM_COLLECTION_METRICS_FIELD, CONDITION_EXPRESSION_FIELD, EXPRESSION_ATTRIBUTE_NAMES_FIELD,
EXPRESSION_ATTRIBUTE_VALUES_FIELD));
private final String tableName;
private final Map key;
private final Map expected;
private final String conditionalOperator;
private final String returnValues;
private final String returnConsumedCapacity;
private final String returnItemCollectionMetrics;
private final String conditionExpression;
private final Map expressionAttributeNames;
private final Map expressionAttributeValues;
private DeleteItemRequest(BuilderImpl builder) {
super(builder);
this.tableName = builder.tableName;
this.key = builder.key;
this.expected = builder.expected;
this.conditionalOperator = builder.conditionalOperator;
this.returnValues = builder.returnValues;
this.returnConsumedCapacity = builder.returnConsumedCapacity;
this.returnItemCollectionMetrics = builder.returnItemCollectionMetrics;
this.conditionExpression = builder.conditionExpression;
this.expressionAttributeNames = builder.expressionAttributeNames;
this.expressionAttributeValues = builder.expressionAttributeValues;
}
/**
*
* The name of the table from which to delete the item.
*
*
* @return The name of the table from which to delete the item.
*/
public final String tableName() {
return tableName;
}
/**
* For responses, this returns true if the service returned a value for the Key property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasKey() {
return key != null && !(key instanceof SdkAutoConstructMap);
}
/**
*
* A map of attribute names to AttributeValue
objects, representing the primary key of the item to
* delete.
*
*
* 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.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasKey} method.
*
*
* @return A map of attribute names to AttributeValue
objects, representing the primary key of the item
* to delete.
*
* 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.
*/
public final Map key() {
return key;
}
/**
* For responses, this returns true if the service returned a value for the Expected property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasExpected() {
return expected != null && !(expected instanceof SdkAutoConstructMap);
}
/**
*
* This is a legacy parameter. Use ConditionExpression
instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasExpected} method.
*
*
* @return This is a legacy parameter. Use ConditionExpression
instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
*/
public final Map expected() {
return expected;
}
/**
*
* This is a legacy parameter. Use ConditionExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #conditionalOperator} will return {@link ConditionalOperator#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #conditionalOperatorAsString}.
*
*
* @return This is a legacy parameter. Use ConditionExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
* @see ConditionalOperator
*/
public final ConditionalOperator conditionalOperator() {
return ConditionalOperator.fromValue(conditionalOperator);
}
/**
*
* This is a legacy parameter. Use ConditionExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #conditionalOperator} will return {@link ConditionalOperator#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #conditionalOperatorAsString}.
*
*
* @return This is a legacy parameter. Use ConditionExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
* @see ConditionalOperator
*/
public final String conditionalOperatorAsString() {
return conditionalOperator;
}
/**
*
* Use ReturnValues
if you want to get the item attributes as they appeared before they were deleted.
* For DeleteItem
, 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
- The content of the old item is returned.
*
*
*
*
*
* The ReturnValues
parameter is used by several DynamoDB operations; however, DeleteItem
* does not recognize any values other than NONE
or ALL_OLD
.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #returnValues} will
* return {@link ReturnValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #returnValuesAsString}.
*
*
* @return Use ReturnValues
if you want to get the item attributes as they appeared before they were
* deleted. For DeleteItem
, 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
- The content of the old item is returned.
*
*
*
*
*
* The ReturnValues
parameter is used by several DynamoDB operations; however,
* DeleteItem
does not recognize any values other than NONE
or
* ALL_OLD
.
*
* @see ReturnValue
*/
public final ReturnValue returnValues() {
return ReturnValue.fromValue(returnValues);
}
/**
*
* Use ReturnValues
if you want to get the item attributes as they appeared before they were deleted.
* For DeleteItem
, 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
- The content of the old item is returned.
*
*
*
*
*
* The ReturnValues
parameter is used by several DynamoDB operations; however, DeleteItem
* does not recognize any values other than NONE
or ALL_OLD
.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #returnValues} will
* return {@link ReturnValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #returnValuesAsString}.
*
*
* @return Use ReturnValues
if you want to get the item attributes as they appeared before they were
* deleted. For DeleteItem
, 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
- The content of the old item is returned.
*
*
*
*
*
* The ReturnValues
parameter is used by several DynamoDB operations; however,
* DeleteItem
does not recognize any values other than NONE
or
* ALL_OLD
.
*
* @see ReturnValue
*/
public final String returnValuesAsString() {
return returnValues;
}
/**
* Returns the value of the ReturnConsumedCapacity property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #returnConsumedCapacity} will return {@link ReturnConsumedCapacity#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #returnConsumedCapacityAsString}.
*
*
* @return The value of the ReturnConsumedCapacity property for this object.
* @see ReturnConsumedCapacity
*/
public final ReturnConsumedCapacity returnConsumedCapacity() {
return ReturnConsumedCapacity.fromValue(returnConsumedCapacity);
}
/**
* Returns the value of the ReturnConsumedCapacity property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #returnConsumedCapacity} will return {@link ReturnConsumedCapacity#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #returnConsumedCapacityAsString}.
*
*
* @return The value of the ReturnConsumedCapacity property for this object.
* @see ReturnConsumedCapacity
*/
public final String returnConsumedCapacityAsString() {
return returnConsumedCapacity;
}
/**
*
* 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.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #returnItemCollectionMetrics} will return {@link ReturnItemCollectionMetrics#UNKNOWN_TO_SDK_VERSION}. The
* raw value returned by the service is available from {@link #returnItemCollectionMetricsAsString}.
*
*
* @return 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.
* @see ReturnItemCollectionMetrics
*/
public final ReturnItemCollectionMetrics returnItemCollectionMetrics() {
return ReturnItemCollectionMetrics.fromValue(returnItemCollectionMetrics);
}
/**
*
* 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.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #returnItemCollectionMetrics} will return {@link ReturnItemCollectionMetrics#UNKNOWN_TO_SDK_VERSION}. The
* raw value returned by the service is available from {@link #returnItemCollectionMetricsAsString}.
*
*
* @return 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.
* @see ReturnItemCollectionMetrics
*/
public final String returnItemCollectionMetricsAsString() {
return returnItemCollectionMetrics;
}
/**
*
* A condition that must be satisfied in order for a conditional DeleteItem
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 Condition Expressions in the Amazon DynamoDB Developer Guide .
*
*
* @return A condition that must be satisfied in order for a conditional DeleteItem
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 Condition Expressions in the Amazon DynamoDB Developer Guide .
*/
public final String conditionExpression() {
return conditionExpression;
}
/**
* For responses, this returns true if the service returned a value for the ExpressionAttributeNames property. This
* DOES NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the
* property). This is useful because the SDK will never return a null collection or map, but you may need to
* differentiate between the service returning nothing (or null) and the service returning an empty collection or
* map. For requests, this returns true if a value for the property was specified in the request builder, and false
* if a value was not specified.
*/
public final boolean hasExpressionAttributeNames() {
return expressionAttributeNames != null && !(expressionAttributeNames instanceof SdkAutoConstructMap);
}
/**
*
* 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:
*
*
*
* 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:
*
*
*
*
* Tokens that begin with the : character are expression attribute values , which are placeholders for
* the actual value at runtime.
*
*
*
* For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide .
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasExpressionAttributeNames} method.
*
*
* @return 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:
*
*
*
* 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:
*
*
*
*
* Tokens that begin with the : character are expression attribute values , which are
* placeholders for the actual value at runtime.
*
*
*
* For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide .
*/
public final Map expressionAttributeNames() {
return expressionAttributeNames;
}
/**
* For responses, this returns true if the service returned a value for the ExpressionAttributeValues property. This
* DOES NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the
* property). This is useful because the SDK will never return a null collection or map, but you may need to
* differentiate between the service returning nothing (or null) and the service returning an empty collection or
* map. For requests, this returns true if a value for the property was specified in the request builder, and false
* if a value was not specified.
*/
public final boolean hasExpressionAttributeValues() {
return expressionAttributeValues != null && !(expressionAttributeValues instanceof SdkAutoConstructMap);
}
/**
*
* 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 .
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasExpressionAttributeValues} method.
*
*
* @return 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 .
*/
public final Map expressionAttributeValues() {
return expressionAttributeValues;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(tableName());
hashCode = 31 * hashCode + Objects.hashCode(hasKey() ? key() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasExpected() ? expected() : null);
hashCode = 31 * hashCode + Objects.hashCode(conditionalOperatorAsString());
hashCode = 31 * hashCode + Objects.hashCode(returnValuesAsString());
hashCode = 31 * hashCode + Objects.hashCode(returnConsumedCapacityAsString());
hashCode = 31 * hashCode + Objects.hashCode(returnItemCollectionMetricsAsString());
hashCode = 31 * hashCode + Objects.hashCode(conditionExpression());
hashCode = 31 * hashCode + Objects.hashCode(hasExpressionAttributeNames() ? expressionAttributeNames() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasExpressionAttributeValues() ? expressionAttributeValues() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DeleteItemRequest)) {
return false;
}
DeleteItemRequest other = (DeleteItemRequest) obj;
return Objects.equals(tableName(), other.tableName()) && hasKey() == other.hasKey() && Objects.equals(key(), other.key())
&& hasExpected() == other.hasExpected() && Objects.equals(expected(), other.expected())
&& Objects.equals(conditionalOperatorAsString(), other.conditionalOperatorAsString())
&& Objects.equals(returnValuesAsString(), other.returnValuesAsString())
&& Objects.equals(returnConsumedCapacityAsString(), other.returnConsumedCapacityAsString())
&& Objects.equals(returnItemCollectionMetricsAsString(), other.returnItemCollectionMetricsAsString())
&& Objects.equals(conditionExpression(), other.conditionExpression())
&& hasExpressionAttributeNames() == other.hasExpressionAttributeNames()
&& Objects.equals(expressionAttributeNames(), other.expressionAttributeNames())
&& hasExpressionAttributeValues() == other.hasExpressionAttributeValues()
&& Objects.equals(expressionAttributeValues(), other.expressionAttributeValues());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("DeleteItemRequest").add("TableName", tableName()).add("Key", hasKey() ? key() : null)
.add("Expected", hasExpected() ? expected() : null).add("ConditionalOperator", conditionalOperatorAsString())
.add("ReturnValues", returnValuesAsString()).add("ReturnConsumedCapacity", returnConsumedCapacityAsString())
.add("ReturnItemCollectionMetrics", returnItemCollectionMetricsAsString())
.add("ConditionExpression", conditionExpression())
.add("ExpressionAttributeNames", hasExpressionAttributeNames() ? expressionAttributeNames() : null)
.add("ExpressionAttributeValues", hasExpressionAttributeValues() ? expressionAttributeValues() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TableName":
return Optional.ofNullable(clazz.cast(tableName()));
case "Key":
return Optional.ofNullable(clazz.cast(key()));
case "Expected":
return Optional.ofNullable(clazz.cast(expected()));
case "ConditionalOperator":
return Optional.ofNullable(clazz.cast(conditionalOperatorAsString()));
case "ReturnValues":
return Optional.ofNullable(clazz.cast(returnValuesAsString()));
case "ReturnConsumedCapacity":
return Optional.ofNullable(clazz.cast(returnConsumedCapacityAsString()));
case "ReturnItemCollectionMetrics":
return Optional.ofNullable(clazz.cast(returnItemCollectionMetricsAsString()));
case "ConditionExpression":
return Optional.ofNullable(clazz.cast(conditionExpression()));
case "ExpressionAttributeNames":
return Optional.ofNullable(clazz.cast(expressionAttributeNames()));
case "ExpressionAttributeValues":
return Optional.ofNullable(clazz.cast(expressionAttributeValues()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((DeleteItemRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends DynamoDbRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The name of the table from which to delete the item.
*
*
* @param tableName
* The name of the table from which to delete the item.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tableName(String tableName);
/**
*
* A map of attribute names to AttributeValue
objects, representing the primary key of the item to
* delete.
*
*
* 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.
*
*
* @param key
* A map of attribute names to AttributeValue
objects, representing the primary key of the
* item to delete.
*
* 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder key(Map key);
/**
*
* This is a legacy parameter. Use ConditionExpression
instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
*
*
* @param expected
* This is a legacy parameter. Use ConditionExpression
instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder expected(Map expected);
/**
*
* This is a legacy parameter. Use ConditionExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
*
*
* @param conditionalOperator
* This is a legacy parameter. Use ConditionExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
* @see ConditionalOperator
* @return Returns a reference to this object so that method calls can be chained together.
* @see ConditionalOperator
*/
Builder conditionalOperator(String conditionalOperator);
/**
*
* This is a legacy parameter. Use ConditionExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
*
*
* @param conditionalOperator
* This is a legacy parameter. Use ConditionExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
* @see ConditionalOperator
* @return Returns a reference to this object so that method calls can be chained together.
* @see ConditionalOperator
*/
Builder conditionalOperator(ConditionalOperator conditionalOperator);
/**
*
* Use ReturnValues
if you want to get the item attributes as they appeared before they were
* deleted. For DeleteItem
, 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
- The content of the old item is returned.
*
*
*
*
*
* The ReturnValues
parameter is used by several DynamoDB operations; however,
* DeleteItem
does not recognize any values other than NONE
or ALL_OLD
.
*
*
*
* @param returnValues
* Use ReturnValues
if you want to get the item attributes as they appeared before they were
* deleted. For DeleteItem
, 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
- The content of the old item is returned.
*
*
*
*
*
* The ReturnValues
parameter is used by several DynamoDB operations; however,
* DeleteItem
does not recognize any values other than NONE
or
* ALL_OLD
.
*
* @see ReturnValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReturnValue
*/
Builder returnValues(String returnValues);
/**
*
* Use ReturnValues
if you want to get the item attributes as they appeared before they were
* deleted. For DeleteItem
, 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
- The content of the old item is returned.
*
*
*
*
*
* The ReturnValues
parameter is used by several DynamoDB operations; however,
* DeleteItem
does not recognize any values other than NONE
or ALL_OLD
.
*
*
*
* @param returnValues
* Use ReturnValues
if you want to get the item attributes as they appeared before they were
* deleted. For DeleteItem
, 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
- The content of the old item is returned.
*
*
*
*
*
* The ReturnValues
parameter is used by several DynamoDB operations; however,
* DeleteItem
does not recognize any values other than NONE
or
* ALL_OLD
.
*
* @see ReturnValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReturnValue
*/
Builder returnValues(ReturnValue returnValues);
/**
* Sets the value of the ReturnConsumedCapacity property for this object.
*
* @param returnConsumedCapacity
* The new value for the ReturnConsumedCapacity property for this object.
* @see ReturnConsumedCapacity
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReturnConsumedCapacity
*/
Builder returnConsumedCapacity(String returnConsumedCapacity);
/**
* Sets the value of the ReturnConsumedCapacity property for this object.
*
* @param returnConsumedCapacity
* The new value for the ReturnConsumedCapacity property for this object.
* @see ReturnConsumedCapacity
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReturnConsumedCapacity
*/
Builder returnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity);
/**
*
* 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.
*
*
* @param returnItemCollectionMetrics
* 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.
* @see ReturnItemCollectionMetrics
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReturnItemCollectionMetrics
*/
Builder returnItemCollectionMetrics(String returnItemCollectionMetrics);
/**
*
* 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.
*
*
* @param returnItemCollectionMetrics
* 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.
* @see ReturnItemCollectionMetrics
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReturnItemCollectionMetrics
*/
Builder returnItemCollectionMetrics(ReturnItemCollectionMetrics returnItemCollectionMetrics);
/**
*
* A condition that must be satisfied in order for a conditional DeleteItem
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 Condition Expressions in the Amazon DynamoDB Developer Guide .
*
*
* @param conditionExpression
* A condition that must be satisfied in order for a conditional DeleteItem
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 Condition Expressions in the Amazon DynamoDB Developer Guide .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder conditionExpression(String conditionExpression);
/**
*
* 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:
*
*
*
* 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:
*
*
*
*
* Tokens that begin with the : character are expression attribute values , which are placeholders
* for the actual value at runtime.
*
*
*
* For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide .
*
*
* @param expressionAttributeNames
* 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:
*
*
*
* 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:
*
*
*
*
* Tokens that begin with the : character are expression attribute values , which are
* placeholders for the actual value at runtime.
*
*
*
* For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder expressionAttributeNames(Map expressionAttributeNames);
/**
*
* 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 .
*
*
* @param expressionAttributeValues
* 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 .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder expressionAttributeValues(Map expressionAttributeValues);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends DynamoDbRequest.BuilderImpl implements Builder {
private String tableName;
private Map key = DefaultSdkAutoConstructMap.getInstance();
private Map expected = DefaultSdkAutoConstructMap.getInstance();
private String conditionalOperator;
private String returnValues;
private String returnConsumedCapacity;
private String returnItemCollectionMetrics;
private String conditionExpression;
private Map expressionAttributeNames = DefaultSdkAutoConstructMap.getInstance();
private Map expressionAttributeValues = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(DeleteItemRequest model) {
super(model);
tableName(model.tableName);
key(model.key);
expected(model.expected);
conditionalOperator(model.conditionalOperator);
returnValues(model.returnValues);
returnConsumedCapacity(model.returnConsumedCapacity);
returnItemCollectionMetrics(model.returnItemCollectionMetrics);
conditionExpression(model.conditionExpression);
expressionAttributeNames(model.expressionAttributeNames);
expressionAttributeValues(model.expressionAttributeValues);
}
public final String getTableName() {
return tableName;
}
public final void setTableName(String tableName) {
this.tableName = tableName;
}
@Override
@Transient
public final Builder tableName(String tableName) {
this.tableName = tableName;
return this;
}
public final Map getKey() {
Map result = KeyCopier.copyToBuilder(this.key);
if (result instanceof SdkAutoConstructMap) {
return null;
}
return result;
}
public final void setKey(Map key) {
this.key = KeyCopier.copyFromBuilder(key);
}
@Override
@Transient
public final Builder key(Map key) {
this.key = KeyCopier.copy(key);
return this;
}
public final Map getExpected() {
Map result = ExpectedAttributeMapCopier.copyToBuilder(this.expected);
if (result instanceof SdkAutoConstructMap) {
return null;
}
return result;
}
public final void setExpected(Map expected) {
this.expected = ExpectedAttributeMapCopier.copyFromBuilder(expected);
}
@Override
@Transient
public final Builder expected(Map expected) {
this.expected = ExpectedAttributeMapCopier.copy(expected);
return this;
}
public final String getConditionalOperator() {
return conditionalOperator;
}
public final void setConditionalOperator(String conditionalOperator) {
this.conditionalOperator = conditionalOperator;
}
@Override
@Transient
public final Builder conditionalOperator(String conditionalOperator) {
this.conditionalOperator = conditionalOperator;
return this;
}
@Override
@Transient
public final Builder conditionalOperator(ConditionalOperator conditionalOperator) {
this.conditionalOperator(conditionalOperator == null ? null : conditionalOperator.toString());
return this;
}
public final String getReturnValues() {
return returnValues;
}
public final void setReturnValues(String returnValues) {
this.returnValues = returnValues;
}
@Override
@Transient
public final Builder returnValues(String returnValues) {
this.returnValues = returnValues;
return this;
}
@Override
@Transient
public final Builder returnValues(ReturnValue returnValues) {
this.returnValues(returnValues == null ? null : returnValues.toString());
return this;
}
public final String getReturnConsumedCapacity() {
return returnConsumedCapacity;
}
public final void setReturnConsumedCapacity(String returnConsumedCapacity) {
this.returnConsumedCapacity = returnConsumedCapacity;
}
@Override
@Transient
public final Builder returnConsumedCapacity(String returnConsumedCapacity) {
this.returnConsumedCapacity = returnConsumedCapacity;
return this;
}
@Override
@Transient
public final Builder returnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity) {
this.returnConsumedCapacity(returnConsumedCapacity == null ? null : returnConsumedCapacity.toString());
return this;
}
public final String getReturnItemCollectionMetrics() {
return returnItemCollectionMetrics;
}
public final void setReturnItemCollectionMetrics(String returnItemCollectionMetrics) {
this.returnItemCollectionMetrics = returnItemCollectionMetrics;
}
@Override
@Transient
public final Builder returnItemCollectionMetrics(String returnItemCollectionMetrics) {
this.returnItemCollectionMetrics = returnItemCollectionMetrics;
return this;
}
@Override
@Transient
public final Builder returnItemCollectionMetrics(ReturnItemCollectionMetrics returnItemCollectionMetrics) {
this.returnItemCollectionMetrics(returnItemCollectionMetrics == null ? null : returnItemCollectionMetrics.toString());
return this;
}
public final String getConditionExpression() {
return conditionExpression;
}
public final void setConditionExpression(String conditionExpression) {
this.conditionExpression = conditionExpression;
}
@Override
@Transient
public final Builder conditionExpression(String conditionExpression) {
this.conditionExpression = conditionExpression;
return this;
}
public final Map getExpressionAttributeNames() {
if (expressionAttributeNames instanceof SdkAutoConstructMap) {
return null;
}
return expressionAttributeNames;
}
public final void setExpressionAttributeNames(Map expressionAttributeNames) {
this.expressionAttributeNames = ExpressionAttributeNameMapCopier.copy(expressionAttributeNames);
}
@Override
@Transient
public final Builder expressionAttributeNames(Map expressionAttributeNames) {
this.expressionAttributeNames = ExpressionAttributeNameMapCopier.copy(expressionAttributeNames);
return this;
}
public final Map getExpressionAttributeValues() {
Map result = ExpressionAttributeValueMapCopier
.copyToBuilder(this.expressionAttributeValues);
if (result instanceof SdkAutoConstructMap) {
return null;
}
return result;
}
public final void setExpressionAttributeValues(Map expressionAttributeValues) {
this.expressionAttributeValues = ExpressionAttributeValueMapCopier.copyFromBuilder(expressionAttributeValues);
}
@Override
@Transient
public final Builder expressionAttributeValues(Map expressionAttributeValues) {
this.expressionAttributeValues = ExpressionAttributeValueMapCopier.copy(expressionAttributeValues);
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public DeleteItemRequest build() {
return new DeleteItemRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}