Package com.amazonaws.services.dynamodb.model

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


        super(ddbClient, configuration, exchange);
    }

    @Override
    public void execute() {
        ddbClient.updateTable(new UpdateTableRequest()
                .withTableName(determineTableName())
                .withProvisionedThroughput(new ProvisionedThroughput()
                        .withReadCapacityUnits(determineReadCapacity())
                        .withWriteCapacityUnits(determineWriteCapacity())));
    }
View Full Code Here


                new ProvisionedThroughput()
                    .withReadCapacityUnits(v2ThruPut.getReadCapacityUnits())
                    .withWriteCapacityUnits(v2ThruPut.getWriteCapacityUnits())
                    ;
        }
        UpdateTableRequest request =
            new UpdateTableRequest()
                .withTableName(v2Request.getTableName())
                .withProvisionedThroughput(v1ThruPut)
                ;

        return request;
View Full Code Here

    return new UpdateTableResult().withTableDescription(table.getTableDescription());
  }

  public com.amazonaws.services.dynamodbv2.model.UpdateTableResult updateTableV2(com.amazonaws.services.dynamodbv2.model.UpdateTableRequest v2Request) throws InternalServerErrorException, ResourceNotFoundException {
        UpdateTableRequest request = AlternatorDBApiVersion2Mapper.MapV2UpdateTableRequestToV1(v2Request);
        UpdateTableResult result = updateTable(request);
        return AlternatorDBApiVersion2Mapper.MapV1UpdateTableResultToV2(result);
  }
View Full Code Here

  public Boolean supports(Class clazz) {
    return UpdateTableRequest.class.isAssignableFrom(clazz);
  }

  public List<Error> validate(Object target) {
    UpdateTableRequest instance = (UpdateTableRequest) target;
    List<Error> errors = ValidatorUtils.invokeValidator(new TableNameValidator(), instance.getTableName());
    errors.addAll(ValidatorUtils.invokeValidator(new ProvisionedThroughputValidator(), instance.getProvisionedThroughput()));
    return removeNulls(errors);
  }
View Full Code Here

import com.fasterxml.jackson.core.JsonToken;

public class UpdateTableRequestJsonUnmarshaller implements Unmarshaller<UpdateTableRequest, JsonUnmarshallerContext> {

    public UpdateTableRequest unmarshall(JsonUnmarshallerContext context) throws Exception {
        UpdateTableRequest request = new UpdateTableRequest();

        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("TableName", targetDepth)) {
                    context.nextToken();
                    request.setTableName(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
                }
              if (context.testExpression("ProvisionedThroughput", targetDepth)) {
                  request.setProvisionedThroughput(ProvisionedThroughputJsonUnmarshaller.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

  @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());
    Assert.assertEquals(Math.round(date.getTime() / 1000), Math.round(desc.getProvisionedThroughput().getLastDecreaseDateTime().getTime() / 1000));
View Full Code Here

  @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

  @Test
  public void updateTableWithoutThroughput() {
    String name = createTableName();
    createTable(name);
    UpdateTableRequest req = new UpdateTableRequest().withTableName(name);
    try {
      getClient().updateTable(req).getTableDescription();
      Assert.assertTrue(false);// Should have thrown an exception
    } catch (AmazonServiceException ase) {
    }
View Full Code Here

  @Test
  public void updateTableWithoutNameOrThroughput() {
    createTable();
    try {
      getClient().updateTable(new UpdateTableRequest()).getTableDescription();
      Assert.assertTrue(false);// Should have thrown an exception
    } catch (AmazonServiceException ase) {
    }
  }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodb.model.UpdateTableRequest

Copyright © 2018 www.massapicom. 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.