/** * <p> * An array of attributes that describe the key schema for the table and indexes. * </p> * * @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. */ public CreateTableRequest withAttributeDefinitions(java.util.Collection<AttributeDefinition> attributeDefinitions) { setAttributeDefinitions(attributeDefinitions); return this; }
/** * <p> * An array of attributes that describe the key schema for the table and indexes. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setAttributeDefinitions(java.util.Collection)} or {@link #withAttributeDefinitions(java.util.Collection)} * if you want to override the existing values. * </p> * * @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. */ public CreateTableRequest withAttributeDefinitions(AttributeDefinition... attributeDefinitions) { if (this.attributeDefinitions == null) { setAttributeDefinitions(new java.util.ArrayList<AttributeDefinition>(attributeDefinitions.length)); } for (AttributeDefinition ele : attributeDefinitions) { this.attributeDefinitions.add(ele); } return this; }
setAttributeDefinitions(attributeDefinitions); setTableName(tableName); setKeySchema(keySchema);
/** * <p> * An array of attributes that describe the key schema for the table and * indexes. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param attributeDefinitions <p> * An array of attributes that describe the key schema for the * table and indexes. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public CreateTableRequest withAttributeDefinitions( java.util.Collection<AttributeDefinition> attributeDefinitions) { setAttributeDefinitions(attributeDefinitions); return this; }
String tableName, java.util.List<KeySchemaElement> keySchema, ProvisionedThroughput provisionedThroughput) { setAttributeDefinitions(attributeDefinitions); setTableName(tableName); setKeySchema(keySchema);
/** * <p> * An array of attributes that describe the key schema for the table and indexes. * </p> * * @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. */ public CreateTableRequest withAttributeDefinitions(java.util.Collection<AttributeDefinition> attributeDefinitions) { setAttributeDefinitions(attributeDefinitions); return this; }
throws AmazonServiceException, AmazonClientException { CreateTableRequest createTableRequest = new CreateTableRequest(); createTableRequest.setAttributeDefinitions(attributeDefinitions); createTableRequest.setTableName(tableName); createTableRequest.setKeySchema(keySchema);
putAfterCheckConflict(attrDefinitions, indexKeyAttrDefinition); createTableRequest.setAttributeDefinitions(attrDefinitions.values());
/** * <p> * An array of attributes that describe the key schema for the table and indexes. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setAttributeDefinitions(java.util.Collection)} or {@link #withAttributeDefinitions(java.util.Collection)} * if you want to override the existing values. * </p> * * @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. */ public CreateTableRequest withAttributeDefinitions(AttributeDefinition... attributeDefinitions) { if (this.attributeDefinitions == null) { setAttributeDefinitions(new java.util.ArrayList<AttributeDefinition>(attributeDefinitions.length)); } for (AttributeDefinition ele : attributeDefinitions) { this.attributeDefinitions.add(ele); } return this; }
/** * Builds the necessary requests to create tables * * @param tableName * @param keySchema * @param proThrou * @param attrs * @return */ public static CreateTableRequest buildCreateTableRequest(String tableName, ArrayList<KeySchemaElement> keySchema, ProvisionedThroughput proThrou, Map<String, String> attrs) { CreateTableRequest createTableRequest = new CreateTableRequest(); createTableRequest.setTableName(tableName); createTableRequest.setKeySchema(keySchema); ArrayList<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>(); for (KeySchemaElement kEle : keySchema) { AttributeDefinition attrDef = new AttributeDefinition(); attrDef.setAttributeName(kEle.getAttributeName()); attrDef.setAttributeType(attrs.get(kEle.getAttributeName())); attributeDefinitions.add(attrDef); } createTableRequest.setAttributeDefinitions(attributeDefinitions); createTableRequest.setProvisionedThroughput(proThrou); return createTableRequest; }
setAttributeDefinitions(attributeDefinitions); setTableName(tableName); setKeySchema(keySchema);
static void createExampleTable() { // Provide the initial provisioned throughput values as Java long data types ProvisionedThroughput provisionedThroughput = new ProvisionedThroughput() .withReadCapacityUnits(5L) .withWriteCapacityUnits(6L); CreateTableRequest request = new CreateTableRequest() .withTableName(tableName) .withProvisionedThroughput(provisionedThroughput); ArrayList<AttributeDefinition> attributeDefinitions= new ArrayList<AttributeDefinition>(); attributeDefinitions.add(new AttributeDefinition().withAttributeName("Id").withAttributeType("N")); request.setAttributeDefinitions(attributeDefinitions); ArrayList<KeySchemaElement> tableKeySchema = new ArrayList<KeySchemaElement>(); tableKeySchema.add(new KeySchemaElement().withAttributeName("Id").withKeyType(KeyType.HASH)); request.setKeySchema(tableKeySchema); client.createTable(request); waitForTableToBecomeAvailable(tableName); getTableInformation(); }
createTableRequest.setAttributeDefinitions(attributes); createTableRequest.setGlobalSecondaryIndexes(globalSecondaryIndices); createTableRequest.setKeySchema(keySchema);
request.setAttributeDefinitions(attributeDefinitions);
.withAttributeType("N")); createTableRequest.setAttributeDefinitions(attributeDefinitions);
.withAttributeType("N")); createTableRequest.setAttributeDefinitions(attributeDefinitions);
request.setTableName(table); request.setKeySchema(serializer.getKeySchema()); request.setAttributeDefinitions(serializer.getAttributeDefinitions());
request.setAttributeDefinitions(attrs);