
software.amazon.awssdk.services.dynamodb.model.CreateTableRequest Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
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 CreateTable
operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateTableRequest extends DynamoDbRequest implements
ToCopyableBuilder {
private final List attributeDefinitions;
private final String tableName;
private final List keySchema;
private final List localSecondaryIndexes;
private final List globalSecondaryIndexes;
private final ProvisionedThroughput provisionedThroughput;
private final StreamSpecification streamSpecification;
private final SSESpecification sseSpecification;
private CreateTableRequest(BuilderImpl builder) {
super(builder);
this.attributeDefinitions = builder.attributeDefinitions;
this.tableName = builder.tableName;
this.keySchema = builder.keySchema;
this.localSecondaryIndexes = builder.localSecondaryIndexes;
this.globalSecondaryIndexes = builder.globalSecondaryIndexes;
this.provisionedThroughput = builder.provisionedThroughput;
this.streamSpecification = builder.streamSpecification;
this.sseSpecification = builder.sseSpecification;
}
/**
*
* An array of attributes that describe the key schema for the table and indexes.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return An array of attributes that describe the key schema for the table and indexes.
*/
public List attributeDefinitions() {
return attributeDefinitions;
}
/**
*
* The name of the table to create.
*
*
* @return The name of the table to create.
*/
public String tableName() {
return tableName;
}
/**
*
* Specifies the attributes that make up the primary key for a table or an index. The attributes in
* KeySchema
must also be defined in the AttributeDefinitions
array. For more information,
* see Data Model in
* the Amazon DynamoDB Developer Guide.
*
*
* Each KeySchemaElement
in the array is composed of:
*
*
* -
*
* AttributeName
- The name of this key attribute.
*
*
* -
*
* KeyType
- The role that the key attribute will assume:
*
*
* -
*
* HASH
- partition key
*
*
* -
*
* RANGE
- sort key
*
*
*
*
*
*
*
* The partition key of an item is also known as its hash attribute. The term "hash attribute" derives from
* DynamoDB' usage of an internal hash function to evenly distribute data items across partitions, based on their
* partition key values.
*
*
* The sort key of an item is also known as its range attribute. The term "range attribute" derives from the
* way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key
* value.
*
*
*
* For a simple primary key (partition key), you must provide exactly one element with a KeyType
of
* HASH
.
*
*
* For a composite primary key (partition key and sort key), you must provide exactly two elements, in this order:
* The first element must have a KeyType
of HASH
, and the second element must have a
* KeyType
of RANGE
.
*
*
* For more information, see Specifying the Primary Key in the Amazon DynamoDB Developer Guide.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return Specifies the attributes that make up the primary key for a table or an index. The attributes in
* KeySchema
must also be defined in the AttributeDefinitions
array. For more
* information, see Data Model in
* the Amazon DynamoDB Developer Guide.
*
* Each KeySchemaElement
in the array is composed of:
*
*
* -
*
* AttributeName
- The name of this key attribute.
*
*
* -
*
* KeyType
- The role that the key attribute will assume:
*
*
* -
*
* HASH
- partition key
*
*
* -
*
* RANGE
- sort key
*
*
*
*
*
*
*
* The partition key of an item is also known as its hash attribute. The term "hash attribute"
* derives from DynamoDB' usage of an internal hash function to evenly distribute data items across
* partitions, based on their partition key values.
*
*
* The sort key of an item is also known as its range attribute. The term "range attribute" derives
* from the way DynamoDB stores items with the same partition key physically close together, in sorted order
* by the sort key value.
*
*
*
* For a simple primary key (partition key), you must provide exactly one element with a
* KeyType
of HASH
.
*
*
* For a composite primary key (partition key and sort key), you must provide exactly two elements, in this
* order: The first element must have a KeyType
of HASH
, and the second element
* must have a KeyType
of RANGE
.
*
*
* For more information, see Specifying the Primary Key in the Amazon DynamoDB Developer Guide.
*/
public List keySchema() {
return keySchema;
}
/**
*
* One or more local secondary indexes (the maximum is five) to be created on the table. Each index is scoped to a
* given partition key value. There is a 10 GB size limit per partition key value; otherwise, the size of a local
* secondary index is unconstrained.
*
*
* Each local secondary index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the local secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the local secondary index. The key schema must begin with
* the same partition key as the table.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index. These
* are in addition to the primary key attributes and index key attributes, which are automatically projected. Each
* attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of projected
* attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across all of
* the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes, this
* counts as two distinct attributes when determining the total.
*
*
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return One or more local secondary indexes (the maximum is five) to be created on the table. Each index is
* scoped to a given partition key value. There is a 10 GB size limit per partition key value; otherwise,
* the size of a local secondary index is unconstrained.
*
* Each local secondary index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the local secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the local secondary index. The key schema must
* begin with the same partition key as the table.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index.
* These are in addition to the primary key attributes and index key attributes, which are automatically
* projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across
* all of the secondary indexes, must not exceed 20. If you project the same attribute into two different
* indexes, this counts as two distinct attributes when determining the total.
*
*
*
*
*/
public List localSecondaryIndexes() {
return localSecondaryIndexes;
}
/**
*
* One or more global secondary indexes (the maximum is five) to be created on the table. Each global secondary
* index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the global secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the global secondary index.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index. These
* are in addition to the primary key attributes and index key attributes, which are automatically projected. Each
* attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of projected
* attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across all of
* the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes, this
* counts as two distinct attributes when determining the total.
*
*
*
*
* -
*
* ProvisionedThroughput
- The provisioned throughput settings for the global secondary index,
* consisting of read and write capacity units.
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return One or more global secondary indexes (the maximum is five) to be created on the table. Each global
* secondary index in the array includes the following:
*
* -
*
* IndexName
- The name of the global secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the global secondary index.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index.
* These are in addition to the primary key attributes and index key attributes, which are automatically
* projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across
* all of the secondary indexes, must not exceed 20. If you project the same attribute into two different
* indexes, this counts as two distinct attributes when determining the total.
*
*
*
*
* -
*
* ProvisionedThroughput
- The provisioned throughput settings for the global secondary index,
* consisting of read and write capacity units.
*
*
*/
public List globalSecondaryIndexes() {
return globalSecondaryIndexes;
}
/**
*
* Represents the provisioned throughput settings for a specified table or index. The settings can be modified using
* the UpdateTable
operation.
*
*
* For current minimum and maximum provisioned throughput values, see Limits in the Amazon
* DynamoDB Developer Guide.
*
*
* @return Represents the provisioned throughput settings for a specified table or index. The settings can be
* modified using the UpdateTable
operation.
*
* For current minimum and maximum provisioned throughput values, see Limits in the
* Amazon DynamoDB Developer Guide.
*/
public ProvisionedThroughput provisionedThroughput() {
return provisionedThroughput;
}
/**
*
* The settings for DynamoDB Streams on the table. These settings consist of:
*
*
* -
*
* StreamEnabled
- Indicates whether Streams is to be enabled (true) or disabled (false).
*
*
* -
*
* StreamViewType
- When an item in the table is modified, StreamViewType
determines what
* information is written to the table's stream. Valid values for StreamViewType
are:
*
*
* -
*
* KEYS_ONLY
- Only the key attributes of the modified item are written to the stream.
*
*
* -
*
* NEW_IMAGE
- The entire item, as it appears after it was modified, is written to the stream.
*
*
* -
*
* OLD_IMAGE
- The entire item, as it appeared before it was modified, is written to the stream.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- Both the new and the old item images of the item are written to the stream.
*
*
*
*
*
*
* @return The settings for DynamoDB Streams on the table. These settings consist of:
*
* -
*
* StreamEnabled
- Indicates whether Streams is to be enabled (true) or disabled (false).
*
*
* -
*
* StreamViewType
- When an item in the table is modified, StreamViewType
* determines what information is written to the table's stream. Valid values for
* StreamViewType
are:
*
*
* -
*
* KEYS_ONLY
- Only the key attributes of the modified item are written to the stream.
*
*
* -
*
* NEW_IMAGE
- The entire item, as it appears after it was modified, is written to the stream.
*
*
* -
*
* OLD_IMAGE
- The entire item, as it appeared before it was modified, is written to the
* stream.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- Both the new and the old item images of the item are written to the
* stream.
*
*
*
*
*/
public StreamSpecification streamSpecification() {
return streamSpecification;
}
/**
*
* Represents the settings used to enable server-side encryption.
*
*
* @return Represents the settings used to enable server-side encryption.
*/
public SSESpecification sseSpecification() {
return sseSpecification;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(attributeDefinitions());
hashCode = 31 * hashCode + Objects.hashCode(tableName());
hashCode = 31 * hashCode + Objects.hashCode(keySchema());
hashCode = 31 * hashCode + Objects.hashCode(localSecondaryIndexes());
hashCode = 31 * hashCode + Objects.hashCode(globalSecondaryIndexes());
hashCode = 31 * hashCode + Objects.hashCode(provisionedThroughput());
hashCode = 31 * hashCode + Objects.hashCode(streamSpecification());
hashCode = 31 * hashCode + Objects.hashCode(sseSpecification());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateTableRequest)) {
return false;
}
CreateTableRequest other = (CreateTableRequest) obj;
return Objects.equals(attributeDefinitions(), other.attributeDefinitions())
&& Objects.equals(tableName(), other.tableName()) && Objects.equals(keySchema(), other.keySchema())
&& Objects.equals(localSecondaryIndexes(), other.localSecondaryIndexes())
&& Objects.equals(globalSecondaryIndexes(), other.globalSecondaryIndexes())
&& Objects.equals(provisionedThroughput(), other.provisionedThroughput())
&& Objects.equals(streamSpecification(), other.streamSpecification())
&& Objects.equals(sseSpecification(), other.sseSpecification());
}
@Override
public String toString() {
return ToString.builder("CreateTableRequest").add("AttributeDefinitions", attributeDefinitions())
.add("TableName", tableName()).add("KeySchema", keySchema())
.add("LocalSecondaryIndexes", localSecondaryIndexes()).add("GlobalSecondaryIndexes", globalSecondaryIndexes())
.add("ProvisionedThroughput", provisionedThroughput()).add("StreamSpecification", streamSpecification())
.add("SSESpecification", sseSpecification()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AttributeDefinitions":
return Optional.ofNullable(clazz.cast(attributeDefinitions()));
case "TableName":
return Optional.ofNullable(clazz.cast(tableName()));
case "KeySchema":
return Optional.ofNullable(clazz.cast(keySchema()));
case "LocalSecondaryIndexes":
return Optional.ofNullable(clazz.cast(localSecondaryIndexes()));
case "GlobalSecondaryIndexes":
return Optional.ofNullable(clazz.cast(globalSecondaryIndexes()));
case "ProvisionedThroughput":
return Optional.ofNullable(clazz.cast(provisionedThroughput()));
case "StreamSpecification":
return Optional.ofNullable(clazz.cast(streamSpecification()));
case "SSESpecification":
return Optional.ofNullable(clazz.cast(sseSpecification()));
default:
return Optional.empty();
}
}
public interface Builder extends DynamoDbRequest.Builder, CopyableBuilder {
/**
*
* An array of attributes that describe the key schema for the table and indexes.
*
*
* @param attributeDefinitions
* An array of attributes that describe the key schema for the table and indexes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder attributeDefinitions(Collection attributeDefinitions);
/**
*
* An array of attributes that describe the key schema for the table and indexes.
*
*
* @param attributeDefinitions
* An array of attributes that describe the key schema for the table and indexes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder attributeDefinitions(AttributeDefinition... attributeDefinitions);
/**
*
* An array of attributes that describe the key schema for the table and indexes.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately
* and its result is passed to {@link #attributeDefinitions(List)}.
*
* @param attributeDefinitions
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #attributeDefinitions(List)
*/
Builder attributeDefinitions(Consumer... attributeDefinitions);
/**
*
* The name of the table to create.
*
*
* @param tableName
* The name of the table to create.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tableName(String tableName);
/**
*
* Specifies the attributes that make up the primary key for a table or an index. The attributes in
* KeySchema
must also be defined in the AttributeDefinitions
array. For more
* information, see Data Model in the
* Amazon DynamoDB Developer Guide.
*
*
* Each KeySchemaElement
in the array is composed of:
*
*
* -
*
* AttributeName
- The name of this key attribute.
*
*
* -
*
* KeyType
- The role that the key attribute will assume:
*
*
* -
*
* HASH
- partition key
*
*
* -
*
* RANGE
- sort key
*
*
*
*
*
*
*
* The partition key of an item is also known as its hash attribute. The term "hash attribute" derives
* from DynamoDB' usage of an internal hash function to evenly distribute data items across partitions, based on
* their partition key values.
*
*
* The sort key of an item is also known as its range attribute. The term "range attribute" derives from
* the way DynamoDB stores items with the same partition key physically close together, in sorted order by the
* sort key value.
*
*
*
* For a simple primary key (partition key), you must provide exactly one element with a KeyType
of
* HASH
.
*
*
* For a composite primary key (partition key and sort key), you must provide exactly two elements, in this
* order: The first element must have a KeyType
of HASH
, and the second element must
* have a KeyType
of RANGE
.
*
*
* For more information, see Specifying the Primary Key in the Amazon DynamoDB Developer Guide.
*
*
* @param keySchema
* Specifies the attributes that make up the primary key for a table or an index. The attributes in
* KeySchema
must also be defined in the AttributeDefinitions
array. For more
* information, see Data Model
* in the Amazon DynamoDB Developer Guide.
*
* Each KeySchemaElement
in the array is composed of:
*
*
* -
*
* AttributeName
- The name of this key attribute.
*
*
* -
*
* KeyType
- The role that the key attribute will assume:
*
*
* -
*
* HASH
- partition key
*
*
* -
*
* RANGE
- sort key
*
*
*
*
*
*
*
* The partition key of an item is also known as its hash attribute. The term "hash attribute"
* derives from DynamoDB' usage of an internal hash function to evenly distribute data items across
* partitions, based on their partition key values.
*
*
* The sort key of an item is also known as its range attribute. The term "range attribute"
* derives from the way DynamoDB stores items with the same partition key physically close together, in
* sorted order by the sort key value.
*
*
*
* For a simple primary key (partition key), you must provide exactly one element with a
* KeyType
of HASH
.
*
*
* For a composite primary key (partition key and sort key), you must provide exactly two elements, in
* this order: The first element must have a KeyType
of HASH
, and the second
* element must have a KeyType
of RANGE
.
*
*
* For more information, see Specifying the Primary Key in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder keySchema(Collection keySchema);
/**
*
* Specifies the attributes that make up the primary key for a table or an index. The attributes in
* KeySchema
must also be defined in the AttributeDefinitions
array. For more
* information, see Data Model in the
* Amazon DynamoDB Developer Guide.
*
*
* Each KeySchemaElement
in the array is composed of:
*
*
* -
*
* AttributeName
- The name of this key attribute.
*
*
* -
*
* KeyType
- The role that the key attribute will assume:
*
*
* -
*
* HASH
- partition key
*
*
* -
*
* RANGE
- sort key
*
*
*
*
*
*
*
* The partition key of an item is also known as its hash attribute. The term "hash attribute" derives
* from DynamoDB' usage of an internal hash function to evenly distribute data items across partitions, based on
* their partition key values.
*
*
* The sort key of an item is also known as its range attribute. The term "range attribute" derives from
* the way DynamoDB stores items with the same partition key physically close together, in sorted order by the
* sort key value.
*
*
*
* For a simple primary key (partition key), you must provide exactly one element with a KeyType
of
* HASH
.
*
*
* For a composite primary key (partition key and sort key), you must provide exactly two elements, in this
* order: The first element must have a KeyType
of HASH
, and the second element must
* have a KeyType
of RANGE
.
*
*
* For more information, see Specifying the Primary Key in the Amazon DynamoDB Developer Guide.
*
*
* @param keySchema
* Specifies the attributes that make up the primary key for a table or an index. The attributes in
* KeySchema
must also be defined in the AttributeDefinitions
array. For more
* information, see Data Model
* in the Amazon DynamoDB Developer Guide.
*
* Each KeySchemaElement
in the array is composed of:
*
*
* -
*
* AttributeName
- The name of this key attribute.
*
*
* -
*
* KeyType
- The role that the key attribute will assume:
*
*
* -
*
* HASH
- partition key
*
*
* -
*
* RANGE
- sort key
*
*
*
*
*
*
*
* The partition key of an item is also known as its hash attribute. The term "hash attribute"
* derives from DynamoDB' usage of an internal hash function to evenly distribute data items across
* partitions, based on their partition key values.
*
*
* The sort key of an item is also known as its range attribute. The term "range attribute"
* derives from the way DynamoDB stores items with the same partition key physically close together, in
* sorted order by the sort key value.
*
*
*
* For a simple primary key (partition key), you must provide exactly one element with a
* KeyType
of HASH
.
*
*
* For a composite primary key (partition key and sort key), you must provide exactly two elements, in
* this order: The first element must have a KeyType
of HASH
, and the second
* element must have a KeyType
of RANGE
.
*
*
* For more information, see Specifying the Primary Key in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder keySchema(KeySchemaElement... keySchema);
/**
*
* Specifies the attributes that make up the primary key for a table or an index. The attributes in
* KeySchema
must also be defined in the AttributeDefinitions
array. For more
* information, see Data Model in the
* Amazon DynamoDB Developer Guide.
*
*
* Each KeySchemaElement
in the array is composed of:
*
*
* -
*
* AttributeName
- The name of this key attribute.
*
*
* -
*
* KeyType
- The role that the key attribute will assume:
*
*
* -
*
* HASH
- partition key
*
*
* -
*
* RANGE
- sort key
*
*
*
*
*
*
*
* The partition key of an item is also known as its hash attribute. The term "hash attribute" derives
* from DynamoDB' usage of an internal hash function to evenly distribute data items across partitions, based on
* their partition key values.
*
*
* The sort key of an item is also known as its range attribute. The term "range attribute" derives from
* the way DynamoDB stores items with the same partition key physically close together, in sorted order by the
* sort key value.
*
*
*
* For a simple primary key (partition key), you must provide exactly one element with a KeyType
of
* HASH
.
*
*
* For a composite primary key (partition key and sort key), you must provide exactly two elements, in this
* order: The first element must have a KeyType
of HASH
, and the second element must
* have a KeyType
of RANGE
.
*
*
* For more information, see Specifying the Primary Key in the Amazon DynamoDB Developer Guide.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and
* its result is passed to {@link #keySchema(List)}.
*
* @param keySchema
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #keySchema(List)
*/
Builder keySchema(Consumer... keySchema);
/**
*
* One or more local secondary indexes (the maximum is five) to be created on the table. Each index is scoped to
* a given partition key value. There is a 10 GB size limit per partition key value; otherwise, the size of a
* local secondary index is unconstrained.
*
*
* Each local secondary index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the local secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the local secondary index. The key schema must begin
* with the same partition key as the table.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index.
* These are in addition to the primary key attributes and index key attributes, which are automatically
* projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across all
* of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes,
* this counts as two distinct attributes when determining the total.
*
*
*
*
*
*
* @param localSecondaryIndexes
* One or more local secondary indexes (the maximum is five) to be created on the table. Each index is
* scoped to a given partition key value. There is a 10 GB size limit per partition key value; otherwise,
* the size of a local secondary index is unconstrained.
*
* Each local secondary index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the local secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the local secondary index. The key schema must
* begin with the same partition key as the table.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the
* index. These are in addition to the primary key attributes and index key attributes, which are
* automatically projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into
* the secondary index. The total count of attributes provided in NonKeyAttributes
, summed
* across all of the secondary indexes, must not exceed 20. If you project the same attribute into two
* different indexes, this counts as two distinct attributes when determining the total.
*
*
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder localSecondaryIndexes(Collection localSecondaryIndexes);
/**
*
* One or more local secondary indexes (the maximum is five) to be created on the table. Each index is scoped to
* a given partition key value. There is a 10 GB size limit per partition key value; otherwise, the size of a
* local secondary index is unconstrained.
*
*
* Each local secondary index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the local secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the local secondary index. The key schema must begin
* with the same partition key as the table.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index.
* These are in addition to the primary key attributes and index key attributes, which are automatically
* projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across all
* of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes,
* this counts as two distinct attributes when determining the total.
*
*
*
*
*
*
* @param localSecondaryIndexes
* One or more local secondary indexes (the maximum is five) to be created on the table. Each index is
* scoped to a given partition key value. There is a 10 GB size limit per partition key value; otherwise,
* the size of a local secondary index is unconstrained.
*
* Each local secondary index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the local secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the local secondary index. The key schema must
* begin with the same partition key as the table.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the
* index. These are in addition to the primary key attributes and index key attributes, which are
* automatically projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into
* the secondary index. The total count of attributes provided in NonKeyAttributes
, summed
* across all of the secondary indexes, must not exceed 20. If you project the same attribute into two
* different indexes, this counts as two distinct attributes when determining the total.
*
*
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder localSecondaryIndexes(LocalSecondaryIndex... localSecondaryIndexes);
/**
*
* One or more local secondary indexes (the maximum is five) to be created on the table. Each index is scoped to
* a given partition key value. There is a 10 GB size limit per partition key value; otherwise, the size of a
* local secondary index is unconstrained.
*
*
* Each local secondary index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the local secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the local secondary index. The key schema must begin
* with the same partition key as the table.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index.
* These are in addition to the primary key attributes and index key attributes, which are automatically
* projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across all
* of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes,
* this counts as two distinct attributes when determining the total.
*
*
*
*
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately
* and its result is passed to {@link #localSecondaryIndexes(List)}.
*
* @param localSecondaryIndexes
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #localSecondaryIndexes(List)
*/
Builder localSecondaryIndexes(Consumer... localSecondaryIndexes);
/**
*
* One or more global secondary indexes (the maximum is five) to be created on the table. Each global secondary
* index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the global secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the global secondary index.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index.
* These are in addition to the primary key attributes and index key attributes, which are automatically
* projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across all
* of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes,
* this counts as two distinct attributes when determining the total.
*
*
*
*
* -
*
* ProvisionedThroughput
- The provisioned throughput settings for the global secondary index,
* consisting of read and write capacity units.
*
*
*
*
* @param globalSecondaryIndexes
* One or more global secondary indexes (the maximum is five) to be created on the table. Each global
* secondary index in the array includes the following:
*
* -
*
* IndexName
- The name of the global secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the global secondary index.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the
* index. These are in addition to the primary key attributes and index key attributes, which are
* automatically projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into
* the secondary index. The total count of attributes provided in NonKeyAttributes
, summed
* across all of the secondary indexes, must not exceed 20. If you project the same attribute into two
* different indexes, this counts as two distinct attributes when determining the total.
*
*
*
*
* -
*
* ProvisionedThroughput
- The provisioned throughput settings for the global secondary
* index, consisting of read and write capacity units.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder globalSecondaryIndexes(Collection globalSecondaryIndexes);
/**
*
* One or more global secondary indexes (the maximum is five) to be created on the table. Each global secondary
* index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the global secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the global secondary index.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index.
* These are in addition to the primary key attributes and index key attributes, which are automatically
* projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across all
* of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes,
* this counts as two distinct attributes when determining the total.
*
*
*
*
* -
*
* ProvisionedThroughput
- The provisioned throughput settings for the global secondary index,
* consisting of read and write capacity units.
*
*
*
*
* @param globalSecondaryIndexes
* One or more global secondary indexes (the maximum is five) to be created on the table. Each global
* secondary index in the array includes the following:
*
* -
*
* IndexName
- The name of the global secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the global secondary index.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the
* index. These are in addition to the primary key attributes and index key attributes, which are
* automatically projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into
* the secondary index. The total count of attributes provided in NonKeyAttributes
, summed
* across all of the secondary indexes, must not exceed 20. If you project the same attribute into two
* different indexes, this counts as two distinct attributes when determining the total.
*
*
*
*
* -
*
* ProvisionedThroughput
- The provisioned throughput settings for the global secondary
* index, consisting of read and write capacity units.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder globalSecondaryIndexes(GlobalSecondaryIndex... globalSecondaryIndexes);
/**
*
* One or more global secondary indexes (the maximum is five) to be created on the table. Each global secondary
* index in the array includes the following:
*
*
* -
*
* IndexName
- The name of the global secondary index. Must be unique only for this table.
*
*
* -
*
* KeySchema
- Specifies the key schema for the global secondary index.
*
*
* -
*
* Projection
- Specifies attributes that are copied (projected) from the table into the index.
* These are in addition to the primary key attributes and index key attributes, which are automatically
* projected. Each attribute specification is composed of:
*
*
* -
*
* ProjectionType
- One of the following:
*
*
* -
*
* KEYS_ONLY
- Only the index and primary keys are projected into the index.
*
*
* -
*
* INCLUDE
- Only the specified table attributes are projected into the index. The list of
* projected attributes are in NonKeyAttributes
.
*
*
* -
*
* ALL
- All of the table attributes are projected into the index.
*
*
*
*
* -
*
* NonKeyAttributes
- A list of one or more non-key attribute names that are projected into the
* secondary index. The total count of attributes provided in NonKeyAttributes
, summed across all
* of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes,
* this counts as two distinct attributes when determining the total.
*
*
*
*
* -
*
* ProvisionedThroughput
- The provisioned throughput settings for the global secondary index,
* consisting of read and write capacity units.
*
*
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately
* and its result is passed to {@link #globalSecondaryIndexes(List)}.
*
* @param globalSecondaryIndexes
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #globalSecondaryIndexes(List)
*/
Builder globalSecondaryIndexes(Consumer... globalSecondaryIndexes);
/**
*
* Represents the provisioned throughput settings for a specified table or index. The settings can be modified
* using the UpdateTable
operation.
*
*
* For current minimum and maximum provisioned throughput values, see Limits in the
* Amazon DynamoDB Developer Guide.
*
*
* @param provisionedThroughput
* Represents the provisioned throughput settings for a specified table or index. The settings can be
* modified using the UpdateTable
operation.
*
* For current minimum and maximum provisioned throughput values, see Limits in the
* Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder provisionedThroughput(ProvisionedThroughput provisionedThroughput);
/**
*
* Represents the provisioned throughput settings for a specified table or index. The settings can be modified
* using the UpdateTable
operation.
*
*
* For current minimum and maximum provisioned throughput values, see Limits in the
* Amazon DynamoDB Developer Guide.
*
* This is a convenience that creates an instance of the {@link ProvisionedThroughput.Builder} avoiding the need
* to create one manually via {@link ProvisionedThroughput#builder()}.
*
* When the {@link Consumer} completes, {@link ProvisionedThroughput.Builder#build()} is called immediately and
* its result is passed to {@link #provisionedThroughput(ProvisionedThroughput)}.
*
* @param provisionedThroughput
* a consumer that will call methods on {@link ProvisionedThroughput.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #provisionedThroughput(ProvisionedThroughput)
*/
default Builder provisionedThroughput(Consumer provisionedThroughput) {
return provisionedThroughput(ProvisionedThroughput.builder().applyMutation(provisionedThroughput).build());
}
/**
*
* The settings for DynamoDB Streams on the table. These settings consist of:
*
*
* -
*
* StreamEnabled
- Indicates whether Streams is to be enabled (true) or disabled (false).
*
*
* -
*
* StreamViewType
- When an item in the table is modified, StreamViewType
determines
* what information is written to the table's stream. Valid values for StreamViewType
are:
*
*
* -
*
* KEYS_ONLY
- Only the key attributes of the modified item are written to the stream.
*
*
* -
*
* NEW_IMAGE
- The entire item, as it appears after it was modified, is written to the stream.
*
*
* -
*
* OLD_IMAGE
- The entire item, as it appeared before it was modified, is written to the stream.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- Both the new and the old item images of the item are written to the stream.
*
*
*
*
*
*
* @param streamSpecification
* The settings for DynamoDB Streams on the table. These settings consist of:
*
* -
*
* StreamEnabled
- Indicates whether Streams is to be enabled (true) or disabled (false).
*
*
* -
*
* StreamViewType
- When an item in the table is modified, StreamViewType
* determines what information is written to the table's stream. Valid values for
* StreamViewType
are:
*
*
* -
*
* KEYS_ONLY
- Only the key attributes of the modified item are written to the stream.
*
*
* -
*
* NEW_IMAGE
- The entire item, as it appears after it was modified, is written to the
* stream.
*
*
* -
*
* OLD_IMAGE
- The entire item, as it appeared before it was modified, is written to the
* stream.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- Both the new and the old item images of the item are written to the
* stream.
*
*
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder streamSpecification(StreamSpecification streamSpecification);
/**
*
* The settings for DynamoDB Streams on the table. These settings consist of:
*
*
* -
*
* StreamEnabled
- Indicates whether Streams is to be enabled (true) or disabled (false).
*
*
* -
*
* StreamViewType
- When an item in the table is modified, StreamViewType
determines
* what information is written to the table's stream. Valid values for StreamViewType
are:
*
*
* -
*
* KEYS_ONLY
- Only the key attributes of the modified item are written to the stream.
*
*
* -
*
* NEW_IMAGE
- The entire item, as it appears after it was modified, is written to the stream.
*
*
* -
*
* OLD_IMAGE
- The entire item, as it appeared before it was modified, is written to the stream.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- Both the new and the old item images of the item are written to the stream.
*
*
*
*
*
* This is a convenience that creates an instance of the {@link StreamSpecification.Builder} avoiding the need
* to create one manually via {@link StreamSpecification#builder()}.
*
* When the {@link Consumer} completes, {@link StreamSpecification.Builder#build()} is called immediately and
* its result is passed to {@link #streamSpecification(StreamSpecification)}.
*
* @param streamSpecification
* a consumer that will call methods on {@link StreamSpecification.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #streamSpecification(StreamSpecification)
*/
default Builder streamSpecification(Consumer streamSpecification) {
return streamSpecification(StreamSpecification.builder().applyMutation(streamSpecification).build());
}
/**
*
* Represents the settings used to enable server-side encryption.
*
*
* @param sseSpecification
* Represents the settings used to enable server-side encryption.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sseSpecification(SSESpecification sseSpecification);
/**
*
* Represents the settings used to enable server-side encryption.
*
* This is a convenience that creates an instance of the {@link SSESpecification.Builder} avoiding the need to
* create one manually via {@link SSESpecification#builder()}.
*
* When the {@link Consumer} completes, {@link SSESpecification.Builder#build()} is called immediately and its
* result is passed to {@link #sseSpecification(SSESpecification)}.
*
* @param sseSpecification
* a consumer that will call methods on {@link SSESpecification.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #sseSpecification(SSESpecification)
*/
default Builder sseSpecification(Consumer sseSpecification) {
return sseSpecification(SSESpecification.builder().applyMutation(sseSpecification).build());
}
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends DynamoDbRequest.BuilderImpl implements Builder {
private List attributeDefinitions = DefaultSdkAutoConstructList.getInstance();
private String tableName;
private List keySchema = DefaultSdkAutoConstructList.getInstance();
private List localSecondaryIndexes = DefaultSdkAutoConstructList.getInstance();
private List globalSecondaryIndexes = DefaultSdkAutoConstructList.getInstance();
private ProvisionedThroughput provisionedThroughput;
private StreamSpecification streamSpecification;
private SSESpecification sseSpecification;
private BuilderImpl() {
}
private BuilderImpl(CreateTableRequest model) {
super(model);
attributeDefinitions(model.attributeDefinitions);
tableName(model.tableName);
keySchema(model.keySchema);
localSecondaryIndexes(model.localSecondaryIndexes);
globalSecondaryIndexes(model.globalSecondaryIndexes);
provisionedThroughput(model.provisionedThroughput);
streamSpecification(model.streamSpecification);
sseSpecification(model.sseSpecification);
}
public final Collection getAttributeDefinitions() {
return attributeDefinitions != null ? attributeDefinitions.stream().map(AttributeDefinition::toBuilder)
.collect(Collectors.toList()) : null;
}
@Override
public final Builder attributeDefinitions(Collection attributeDefinitions) {
this.attributeDefinitions = AttributeDefinitionsCopier.copy(attributeDefinitions);
return this;
}
@Override
@SafeVarargs
public final Builder attributeDefinitions(AttributeDefinition... attributeDefinitions) {
attributeDefinitions(Arrays.asList(attributeDefinitions));
return this;
}
@Override
@SafeVarargs
public final Builder attributeDefinitions(Consumer... attributeDefinitions) {
attributeDefinitions(Stream.of(attributeDefinitions).map(c -> AttributeDefinition.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setAttributeDefinitions(Collection attributeDefinitions) {
this.attributeDefinitions = AttributeDefinitionsCopier.copyFromBuilder(attributeDefinitions);
}
public final String getTableName() {
return tableName;
}
@Override
public final Builder tableName(String tableName) {
this.tableName = tableName;
return this;
}
public final void setTableName(String tableName) {
this.tableName = tableName;
}
public final Collection getKeySchema() {
return keySchema != null ? keySchema.stream().map(KeySchemaElement::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder keySchema(Collection keySchema) {
this.keySchema = KeySchemaCopier.copy(keySchema);
return this;
}
@Override
@SafeVarargs
public final Builder keySchema(KeySchemaElement... keySchema) {
keySchema(Arrays.asList(keySchema));
return this;
}
@Override
@SafeVarargs
public final Builder keySchema(Consumer... keySchema) {
keySchema(Stream.of(keySchema).map(c -> KeySchemaElement.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setKeySchema(Collection keySchema) {
this.keySchema = KeySchemaCopier.copyFromBuilder(keySchema);
}
public final Collection getLocalSecondaryIndexes() {
return localSecondaryIndexes != null ? localSecondaryIndexes.stream().map(LocalSecondaryIndex::toBuilder)
.collect(Collectors.toList()) : null;
}
@Override
public final Builder localSecondaryIndexes(Collection localSecondaryIndexes) {
this.localSecondaryIndexes = LocalSecondaryIndexListCopier.copy(localSecondaryIndexes);
return this;
}
@Override
@SafeVarargs
public final Builder localSecondaryIndexes(LocalSecondaryIndex... localSecondaryIndexes) {
localSecondaryIndexes(Arrays.asList(localSecondaryIndexes));
return this;
}
@Override
@SafeVarargs
public final Builder localSecondaryIndexes(Consumer... localSecondaryIndexes) {
localSecondaryIndexes(Stream.of(localSecondaryIndexes)
.map(c -> LocalSecondaryIndex.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setLocalSecondaryIndexes(Collection localSecondaryIndexes) {
this.localSecondaryIndexes = LocalSecondaryIndexListCopier.copyFromBuilder(localSecondaryIndexes);
}
public final Collection getGlobalSecondaryIndexes() {
return globalSecondaryIndexes != null ? globalSecondaryIndexes.stream().map(GlobalSecondaryIndex::toBuilder)
.collect(Collectors.toList()) : null;
}
@Override
public final Builder globalSecondaryIndexes(Collection globalSecondaryIndexes) {
this.globalSecondaryIndexes = GlobalSecondaryIndexListCopier.copy(globalSecondaryIndexes);
return this;
}
@Override
@SafeVarargs
public final Builder globalSecondaryIndexes(GlobalSecondaryIndex... globalSecondaryIndexes) {
globalSecondaryIndexes(Arrays.asList(globalSecondaryIndexes));
return this;
}
@Override
@SafeVarargs
public final Builder globalSecondaryIndexes(Consumer... globalSecondaryIndexes) {
globalSecondaryIndexes(Stream.of(globalSecondaryIndexes)
.map(c -> GlobalSecondaryIndex.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setGlobalSecondaryIndexes(Collection globalSecondaryIndexes) {
this.globalSecondaryIndexes = GlobalSecondaryIndexListCopier.copyFromBuilder(globalSecondaryIndexes);
}
public final ProvisionedThroughput.Builder getProvisionedThroughput() {
return provisionedThroughput != null ? provisionedThroughput.toBuilder() : null;
}
@Override
public final Builder provisionedThroughput(ProvisionedThroughput provisionedThroughput) {
this.provisionedThroughput = provisionedThroughput;
return this;
}
public final void setProvisionedThroughput(ProvisionedThroughput.BuilderImpl provisionedThroughput) {
this.provisionedThroughput = provisionedThroughput != null ? provisionedThroughput.build() : null;
}
public final StreamSpecification.Builder getStreamSpecification() {
return streamSpecification != null ? streamSpecification.toBuilder() : null;
}
@Override
public final Builder streamSpecification(StreamSpecification streamSpecification) {
this.streamSpecification = streamSpecification;
return this;
}
public final void setStreamSpecification(StreamSpecification.BuilderImpl streamSpecification) {
this.streamSpecification = streamSpecification != null ? streamSpecification.build() : null;
}
public final SSESpecification.Builder getSSESpecification() {
return sseSpecification != null ? sseSpecification.toBuilder() : null;
}
@Override
public final Builder sseSpecification(SSESpecification sseSpecification) {
this.sseSpecification = sseSpecification;
return this;
}
public final void setSSESpecification(SSESpecification.BuilderImpl sseSpecification) {
this.sseSpecification = sseSpecification != null ? sseSpecification.build() : null;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public CreateTableRequest build() {
return new CreateTableRequest(this);
}
}
}