table_name); CreateTableRequest request = CreateTableRequest.builder() .attributeDefinitions(AttributeDefinition.builder() .attributeName("Name")
@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(billingModeAsString()); hashCode = 31 * hashCode + Objects.hashCode(provisionedThroughput()); hashCode = 31 * hashCode + Objects.hashCode(streamSpecification()); hashCode = 31 * hashCode + Objects.hashCode(sseSpecification()); return hashCode; }
@Override public CreateTableRequest build() { return new CreateTableRequest(this); }
/** * 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 String toString() { return ToString.builder("CreateTableRequest").add("AttributeDefinitions", attributeDefinitions()) .add("TableName", tableName()).add("KeySchema", keySchema()) .add("LocalSecondaryIndexes", localSecondaryIndexes()).add("GlobalSecondaryIndexes", globalSecondaryIndexes()) .add("BillingMode", billingModeAsString()).add("ProvisionedThroughput", provisionedThroughput()) .add("StreamSpecification", streamSpecification()).add("SSESpecification", sseSpecification()).build(); }
@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(billingModeAsString(), other.billingModeAsString()) && Objects.equals(provisionedThroughput(), other.provisionedThroughput()) && Objects.equals(streamSpecification(), other.streamSpecification()) && Objects.equals(sseSpecification(), other.sseSpecification()); }
System.out.format("* Greeting - sort key\n"); CreateTableRequest request = CreateTableRequest.builder() .attributeDefinitions( AttributeDefinition.builder()
public <T> Optional<T> getValueForField(String fieldName, Class<T> 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 "BillingMode": return Optional.ofNullable(clazz.cast(billingModeAsString())); 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(); } }
throws ResourceInUseException, LimitExceededException, InternalServerErrorException, AwsServiceException, SdkClientException, DynamoDbException { return createTable(CreateTableRequest.builder().applyMutation(createTableRequest).build());
return createTable(CreateTableRequest.builder().applyMutation(createTableRequest).build());
CreateTableRequest request = CreateTableRequest.builder().tableName(table).keySchema(serializer.getKeySchema()) .attributeDefinitions(serializer.getAttributeDefinitions()).provisionedThroughput(throughput).build();
final CreateTableRequest createTableRequest = CreateTableRequest.builder() .tableName(createDynamoDBTableOptions.getTableName()) .keySchema(keySchema)
CreateTableRequest request = CreateTableRequest.builder().tableName(table).keySchema(serializer.getKeySchema()) .attributeDefinitions(serializer.getAttributeDefinitions()).provisionedThroughput(throughput).build();
/** * Creates an orders table in DynamoDB. */ public void createOrdersTable() { try { dynamoDb.createTable(CreateTableRequest.builder() .tableName(tableName) .provisionedThroughput(ProvisionedThroughput.builder() .readCapacityUnits(5L) .writeCapacityUnits(5L) .build()) .keySchema(KeySchemaElement.builder() .attributeName(ORDER_ID) .keyType(KeyType.HASH) .build()) .attributeDefinitions(AttributeDefinition.builder() .attributeName(ORDER_ID) .attributeType(ScalarAttributeType.S) .build()) .build()); } catch (ResourceInUseException e) { throw new TableExistsException("Orders table already exists"); } }