Examples of ProvisionedThroughput


Examples of com.amazonaws.services.dynamodb.model.ProvisionedThroughput


public class ExpectedJsonUnmarshaller implements Unmarshaller<Map<String, ExpectedAttributeValue>, JsonUnmarshallerContext> {

    public Map<String, ExpectedAttributeValue> unmarshall(JsonUnmarshallerContext context) throws Exception {
        ProvisionedThroughput request = new ProvisionedThroughput();

        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.currentToken;
        if (token == null) token = context.nextToken();

       while (true) {
            if (token == null) break;
            if (token == JsonToken.FIELD_NAME || token == JsonToken.START_OBJECT) {
              if (context.testExpression("ReadCapacityUnits", targetDepth)) {
                    context.nextToken();
                    request.setReadCapacityUnits(SimpleTypeJsonUnmarshallers.LongJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("WriteCapacityUnits", targetDepth)) {
                    context.nextToken();
                    request.setWriteCapacityUnits(SimpleTypeJsonUnmarshallers.LongJsonUnmarshaller.getInstance().unmarshall(context));
                }
            } else if (token == JsonToken.END_ARRAY || token == JsonToken.END_OBJECT) {
                if (context.getCurrentDepth() <= originalDepth) break;
            }
            token = context.nextToken();
View Full Code Here

Examples of com.amazonaws.services.dynamodb.model.ProvisionedThroughput

  @Test
  public void updateTable() {
    String name = createTableName();
    createTable(name);
    ProvisionedThroughput throughput = new ProvisionedThroughput().withReadCapacityUnits(50L).withWriteCapacityUnits(50L);
    UpdateTableRequest req = new UpdateTableRequest().withTableName(name).withProvisionedThroughput(throughput);
    Date date = new Date();
    TableDescription desc = getClient().updateTable(req).getTableDescription();
    Assert.assertNotNull(desc);
    Assert.assertEquals(name, desc.getTableName());
View Full Code Here

Examples of com.amazonaws.services.dynamodb.model.ProvisionedThroughput

  }

  @Test
  public void updateTableWithoutName() {
    createTable();
    ProvisionedThroughput throughput = new ProvisionedThroughput().withReadCapacityUnits(50L).withWriteCapacityUnits(50L);
    UpdateTableRequest req = new UpdateTableRequest().withProvisionedThroughput(throughput);
    try {
      getClient().updateTable(req).getTableDescription();
      Assert.assertTrue(false);// Should have thrown an exception
    } catch (AmazonServiceException ase) {
View Full Code Here

Examples of com.amazonaws.services.dynamodb.model.ProvisionedThroughput

  static protected AlternatorDB db;

  private ProvisionedThroughput provisionedThroughput;

  public AlternatorTest() {
    provisionedThroughput = new ProvisionedThroughput();
    provisionedThroughput.setReadCapacityUnits(10L);
    provisionedThroughput.setWriteCapacityUnits(10L);
  }
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput

            } else {
                // Create a table with a primary hash key named 'name', which holds a string
                CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(tableName)
                    .withKeySchema(new KeySchemaElement().withAttributeName("name").withKeyType(KeyType.HASH))
                    .withAttributeDefinitions(new AttributeDefinition().withAttributeName("name").withAttributeType(ScalarAttributeType.S))
                    .withProvisionedThroughput(new ProvisionedThroughput().withReadCapacityUnits(1L).withWriteCapacityUnits(1L));
                    TableDescription createdTableDescription = dynamoDB.createTable(createTableRequest).getTableDescription();
                System.out.println("Created Table: " + createdTableDescription);

                // Wait for it to become active
                System.out.println("Waiting for " + tableName + " to become ACTIVE...");
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput

                new CreateTableRequest(TABLE_NAME, Arrays.asList(hashKey, rangeKey))
                .withAttributeDefinitions(
                    new AttributeDefinition(HASH_KEY, ScalarAttributeType.N),
                    new AttributeDefinition(RANGE_KEY, ScalarAttributeType.S))
                .withProvisionedThroughput(
                    new ProvisionedThroughput(READ_CAPACITY, WRITE_CAPACITY));
            table = dynamo.createTable(createTableRequest);
            table.waitForActive();
        }
    }
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput

        }
        CreateTableRequest createTableRequest = new CreateTableRequest();
        createTableRequest.setTableName(tableName);
        createTableRequest.setKeySchema(Arrays.asList(new KeySchemaElement(key, KeyType.HASH)));
        createTableRequest.setProvisionedThroughput(new ProvisionedThroughput(readCapacityUnits, writeCapacityUnits));
        createTableRequest.setAttributeDefinitions(Arrays.asList(new AttributeDefinition(key, ScalarAttributeType.S)));
        try {
            client.createTable(createTableRequest);
        } catch (ResourceInUseException e) {
            throw new IllegalStateException("The table may already be getting created.", e);
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput

        CreateTableRequest request = new CreateTableRequest();
        request.setTableName(table);
        request.setKeySchema(serializer.getKeySchema());
        request.setAttributeDefinitions(serializer.getAttributeDefinitions());

        ProvisionedThroughput throughput = new ProvisionedThroughput();
        throughput.setReadCapacityUnits(readCapacity);
        throughput.setWriteCapacityUnits(writeCapacity);
        request.setProvisionedThroughput(throughput);

        try {
            dynamoDBClient.createTable(request);
        } catch (ResourceInUseException e) {
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput

   */
  public static CreateTableRequest getCreateTableRequest(GeoDataManagerConfiguration config) {
    CreateTableRequest createTableRequest = new CreateTableRequest()
        .withTableName(config.getTableName())
        .withProvisionedThroughput(
            new ProvisionedThroughput().withReadCapacityUnits(10L).withWriteCapacityUnits(5L))
        .withKeySchema(
            new KeySchemaElement().withKeyType(KeyType.HASH).withAttributeName(
                config.getHashKeyAttributeName()),
            new KeySchemaElement().withKeyType(KeyType.RANGE).withAttributeName(
                config.getRangeKeyAttributeName()))
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput

        request.withAttributeDefinitions(new AttributeDefinition()
            .withAttributeName(SessionTableAttributes.SESSION_ID_KEY)
            .withAttributeType(ScalarAttributeType.S));

        request.setProvisionedThroughput(new ProvisionedThroughput()
            .withReadCapacityUnits(readCapacityUnits)
            .withWriteCapacityUnits(writeCapacityUnits));

        dynamo.createTable(request);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.