Package com.amazonaws.services.dynamodbv2.model

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


    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);
      jsonWriter.object();

      TableDescription table = deleteTableResult.getTableDescription();
      if (table != null) {
        jsonWriter.key("TableDescription").object();
        jsonWriter.key("TableName").value(table.getTableName());
        jsonWriter.key("TableStatus").value(table.getTableStatus());
        jsonWriter.key("CreationDateTime").value(table.getCreationDateTime());

        List<KeySchemaElement> keySchema = table.getKeySchema();
        if (keySchema != null) {
          jsonWriter.key("KeySchema").array();
                    for (KeySchemaElement element : keySchema) {
            jsonWriter.object();
            if (element.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(element.getAttributeName());
            }
            if (element.getKeyType() != null) {
              jsonWriter.key("KeyType").value(element.getKeyType());
            }
                        jsonWriter.endObject(); // element
                    }
                    jsonWriter.endArray(); // KeySchema
        }

        ProvisionedThroughputDescription provisionedThroughput = table.getProvisionedThroughput();
        if (provisionedThroughput != null) {
          jsonWriter.key("ProvisionedThroughput").object();
          if (provisionedThroughput.getReadCapacityUnits() != null) {
            jsonWriter.key("ReadCapacityUnits").value(provisionedThroughput.getReadCapacityUnits());
          }
View Full Code Here


        try {
            StringWriter stringWriter = new StringWriter();
            JSONWriter jsonWriter = new JSONWriter(stringWriter);
            jsonWriter.object();

            TableDescription table = createTableResult.getTableDescription();
            if (table != null) {
                jsonWriter.key("TableDescription").object();
                if (table.getCreationDateTime() != null) {
                    jsonWriter.key("CreationDateTime").value(table.getCreationDateTime());
                }
                if (table.getTableName() != null) {
                    jsonWriter.key("TableName").value(table.getTableName());
                }
                if (table.getTableStatus() != null) {
                    jsonWriter.key("TableStatus").value(table.getTableStatus());
                }
                List<AttributeDefinition> attributes = table.getAttributeDefinitions();
                if (attributes != null) {
                    jsonWriter.key("AttributeDefinitions").array();
                    for (AttributeDefinition attr : attributes) {
                        jsonWriter.object();
                        if (attr.getAttributeName() != null) {
                            jsonWriter.key("AttributeName").value(attr.getAttributeName());
                        }
                        if (attr.getAttributeType() != null) {
                            jsonWriter.key("AttributeType").value(attr.getAttributeType());
                        }
                        jsonWriter.endObject(); // AttributeDefinition
                    }
                    jsonWriter.endArray(); // AttributeDefinitions
                }
                List<KeySchemaElement> keySchema = table.getKeySchema();
                if (keySchema != null) {
                    jsonWriter.key("KeySchema").array();
                    for (KeySchemaElement element : keySchema) {
                        jsonWriter.object();
                        if (element.getAttributeName() != null) {
                            jsonWriter.key("AttributeName").value(element.getAttributeName());
                        }
                        if (element.getKeyType() != null) {
                            jsonWriter.key("KeyType").value(element.getKeyType());
                        }
                        jsonWriter.endObject(); // KeySchemaElement
                    }
                    jsonWriter.endArray(); //KeySchema
                }
                ProvisionedThroughputDescription provisionedThroughput = table.getProvisionedThroughput();
                if (provisionedThroughput != null) {
                    jsonWriter.key("ProvisionedThroughput").object();
                    if (provisionedThroughput.getReadCapacityUnits() != null) {
                        jsonWriter.key("ReadCapacityUnits").value(provisionedThroughput.getReadCapacityUnits());
                    }
View Full Code Here

    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);
      jsonWriter.object();

      TableDescription table = describeTableResult.getTable();
      if (table != null) {
        jsonWriter.key("Table").object();
        jsonWriter.key("ItemCount").value(table.getItemCount());
        jsonWriter.key("TableName").value(table.getTableName());
        jsonWriter.key("TableSizeBytes").value(table.getTableSizeBytes());
        jsonWriter.key("TableStatus").value(table.getTableStatus());
        jsonWriter.key("CreationDateTime").value(table.getCreationDateTime());
        List<AttributeDefinition> attributes = table.getAttributeDefinitions();
        if (attributes != null) {
          jsonWriter.key("AttributeDefinitions").array();
                    for (AttributeDefinition attr : attributes) {
            jsonWriter.object();
            if (attr.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(attr.getAttributeName());
            }
            if (attr.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(attr.getAttributeType());
            }
            jsonWriter.endObject(); // AttributeDefinition
                    }
                    jsonWriter.endArray(); // AttributeDefinitions
        }

        List<KeySchemaElement> keySchema = table.getKeySchema();
        if (keySchema != null) {
          jsonWriter.key("KeySchema").array();
                    for (KeySchemaElement element : keySchema) {
            jsonWriter.object();
            if (element.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(element.getAttributeName());
            }
            if (element.getKeyType() != null) {
              jsonWriter.key("KeyType").value(element.getKeyType());
            }
            jsonWriter.endObject(); // KeySchemaElement
                    }
                    jsonWriter.endArray(); // KeySchema
        }

        ProvisionedThroughputDescription provisionedThroughput = table.getProvisionedThroughput();
        if (provisionedThroughput != null) {
          jsonWriter.key("ProvisionedThroughput").object();
          if (provisionedThroughput.getReadCapacityUnits() != null) {
            jsonWriter.key("ReadCapacityUnits").value(provisionedThroughput.getReadCapacityUnits());
          }
View Full Code Here

    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);
      jsonWriter.object();

      TableDescription table = describeTableResult.getTableDescription();
      if (table != null) {
        jsonWriter.key("TableDescription").object();
        jsonWriter.key("TableName").value(table.getTableName());
        jsonWriter.key("TableStatus").value(table.getTableStatus());
        jsonWriter.key("CreationDateTime").value(table.getCreationDateTime());
        List<AttributeDefinition> attributes = table.getAttributeDefinitions();
        if (attributes != null) {
          jsonWriter.key("AttributeDefinitions").array();
                    for (AttributeDefinition attr : attributes) {
            jsonWriter.object();
            if (attr.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(attr.getAttributeName());
            }
            if (attr.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(attr.getAttributeType());
            }
            jsonWriter.endObject(); // AttributeDefinition
                    }
                    jsonWriter.endArray(); // AttributeDefinitions
        }
        List<KeySchemaElement> keySchema = table.getKeySchema();
        if (keySchema != null) {
          jsonWriter.key("KeySchema").array();
                    for (KeySchemaElement element : keySchema) {
            jsonWriter.object();
            if (element.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(element.getAttributeName());
            }
            if (element.getKeyType() != null) {
              jsonWriter.key("KeyType").value(element.getKeyType());
            }
            jsonWriter.endObject(); // KeySchemaElement
                    }
                    jsonWriter.endArray(); // KeySchema
        }
        ProvisionedThroughputDescription provisionedThroughput = table.getProvisionedThroughput();
        if (provisionedThroughput != null) {
          jsonWriter.key("ProvisionedThroughput").object();
          if (provisionedThroughput.getReadCapacityUnits() != null) {
            jsonWriter.key("ReadCapacityUnits").value(provisionedThroughput.getReadCapacityUnits());
          }
View Full Code Here

                .withKeySchema(createKeySchema(hashAttr, rangeAttr))
                .withAttributeDefinitions(createKeyAttributes(hashAttr, rangeAttr))
                .withProvisionedThroughput(throughput)
                ;
        CreateTableResult result = getClient().createTable(request);
        TableDescription tableDesc = result.getTableDescription();
        return tableDesc;
  }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        tableName1 = createTableName();
        AttributeDefinition hashAttr1 = createNumberAttributeDefinition();
        TableDescription tableDescription1 = createTable(tableName1, hashAttr1);
        hashKeyName1 = getHashKeyElement(tableDescription1.getKeySchema()).getAttributeName();

        tableName2 = createTableName();
        AttributeDefinition hashAttr2 = createNumberAttributeDefinition();
        TableDescription tableDescription2 = createTable(tableName2, hashAttr2);
        hashKeyName2 = getHashKeyElement(tableDescription2.getKeySchema()).getAttributeName();
    }
View Full Code Here

  }

  @Test
  public void createTableWithStringHashKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createStringAttributeDefinition());
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here

  }

  @Test
  public void createTableWithNumberHashKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createNumberAttributeDefinition());
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here

  }

  @Test
  public void createTableWithStringHashKeyAndStringRangeKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createStringAttributeDefinition(), createStringAttributeDefinition());
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here


  @Test
  public void createTableWithStringHashKeyAndNumberRangeKey() {
    String name = createTableName();
    TableDescription res = createTable(name, createStringAttributeDefinition(), createNumberAttributeDefinition());
    Assert.assertNotNull(res);
    Assert.assertEquals(res.getTableName(), name);
  }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.model.TableDescription

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.