use of software.amazon.awssdk.enhanced.dynamodb.model.DeleteItemEnhancedRequest in project aws-sdk-java-v2 by aws.
the class DeleteItemOperation method generateRequest.
@Override
public DeleteItemRequest generateRequest(TableSchema<T> tableSchema, OperationContext operationContext, DynamoDbEnhancedClientExtension extension) {
if (!TableMetadata.primaryIndexName().equals(operationContext.indexName())) {
throw new IllegalArgumentException("DeleteItem cannot be executed against a secondary index.");
}
Key key = request.map(DeleteItemEnhancedRequest::key, TransactDeleteItemEnhancedRequest::key);
DeleteItemRequest.Builder requestBuilder = DeleteItemRequest.builder().tableName(operationContext.tableName()).key(key.keyMap(tableSchema, operationContext.indexName())).returnValues(ReturnValue.ALL_OLD);
if (request.left().isPresent()) {
requestBuilder = addPlainDeleteItemParameters(requestBuilder, request.left().get());
}
requestBuilder = addExpressionsIfExist(requestBuilder);
return requestBuilder.build();
}
Aggregations