use of software.amazon.awssdk.services.dynamodb.DynamoDbClient in project aws-doc-sdk-examples by awsdocs.
the class EnhancedQueryRecordsWithFilter method main.
// Query the Customer table using a filter.
public static void main(String[] args) {
Region region = Region.US_EAST_1;
DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();
DynamoDbEnhancedClient enhancedClient = DynamoDbEnhancedClient.builder().dynamoDbClient(ddb).build();
queryTableFilter(enhancedClient);
ddb.close();
}
use of software.amazon.awssdk.services.dynamodb.DynamoDbClient in project aws-doc-sdk-examples by awsdocs.
the class CreateTable method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <tableName> <key>\n\n" + "Where:\n" + " tableName - the Amazon DynamoDB table to create (for example, Music3).\n\n" + " key - the key for the Amazon DynamoDB table (for example, Artist).\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String tableName = args[0];
String key = args[1];
System.out.format("Creating an Amazon DynamoDB table \"%s\" with a simple primary key: \"Name\".\n", tableName);
Region region = Region.US_EAST_1;
DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();
String result = createTable(ddb, tableName, key);
System.out.println("New table is " + result);
ddb.close();
}
use of software.amazon.awssdk.services.dynamodb.DynamoDbClient in project aws-doc-sdk-examples by awsdocs.
the class DeleteTable method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <tableName>\n\n" + "Where:\n" + " tableName - the Amazon DynamoDB table to delete (for example, Music3).\n\n" + "**Warning** This program will delete the table that you specify!\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
// Read the command line argument
String tableName = args[0];
System.out.format("Deleting the Amazon DynamoDB table %s...\n", tableName);
// Create the DynamoDbClient object
Region region = Region.US_EAST_1;
DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();
deleteDynamoDBTable(ddb, tableName);
ddb.close();
}
use of software.amazon.awssdk.services.dynamodb.DynamoDbClient in project aws-doc-sdk-examples by awsdocs.
the class DynamoDBScanItems method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <tableName>\n\n" + "Where:\n" + " tableName - the Amazon DynamoDB table to get information from (for example, Music3).\n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String tableName = args[0];
Region region = Region.US_EAST_1;
DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();
scanItems(ddb, tableName);
ddb.close();
}
use of software.amazon.awssdk.services.dynamodb.DynamoDbClient in project aws-doc-sdk-examples by awsdocs.
the class UpdateTable method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " UpdateTable <tableName> <readCapacity> <writeCapacity>\n\n" + "Where:\n" + " tableName - the Amazon DynamoDB table to update (for example, Music3).\n" + " readCapacity - the new read capacity of the table (for example, 16).\n" + " writeCapacity - the new write capacity of the table (for example, 10).\n\n" + "Example:\n" + " UpdateTable Music3 16 10\n";
if (args.length != 3) {
System.out.println(USAGE);
System.exit(1);
}
String tableName = args[0];
Long readCapacity = Long.parseLong(args[1]);
Long writeCapacity = Long.parseLong(args[2]);
Region region = Region.US_WEST_2;
DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();
updateDynamoDBTable(ddb, tableName, readCapacity, writeCapacity);
ddb.close();
}
Aggregations