Example usage for com.amazonaws.services.dynamodbv2.model TableDescription getTableArn

List of usage examples for com.amazonaws.services.dynamodbv2.model TableDescription getTableArn

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model TableDescription getTableArn.

Prototype


public String getTableArn() 

Source Link

Document

The Amazon Resource Name (ARN) that uniquely identifies the table.

Usage

From source file:aws.example.dynamodb.DescribeTable.java

License:Open Source License

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    DescribeTable <table>\n\n" + "Where:\n"
            + "    table - the table to get information about.\n\n" + "Example:\n"
            + "    DescribeTable HelloTable\n";

    if (args.length < 1) {
        System.out.println(USAGE);
        System.exit(1);/*from ww  w .  j a v  a2  s.  c  o  m*/
    }

    String table_name = args[0];
    System.out.format("Getting description for %s\n\n", table_name);

    final AmazonDynamoDBClient ddb = new AmazonDynamoDBClient();

    try {
        TableDescription table_info = ddb.describeTable(table_name).getTable();

        if (table_info != null) {
            System.out.format("Table name  : %s\n", table_info.getTableName());
            System.out.format("Table ARN   : %s\n", table_info.getTableArn());
            System.out.format("Status      : %s\n", table_info.getTableStatus());
            System.out.format("Item count  : %d\n", table_info.getItemCount().longValue());
            System.out.format("Size (bytes): %d\n", table_info.getTableSizeBytes().longValue());

            ProvisionedThroughputDescription throughput_info = table_info.getProvisionedThroughput();
            System.out.println("Throughput");
            System.out.format("  Read Capacity : %d\n", throughput_info.getReadCapacityUnits().longValue());
            System.out.format("  Write Capacity: %d\n", throughput_info.getWriteCapacityUnits().longValue());

            List<AttributeDefinition> attributes = table_info.getAttributeDefinitions();
            System.out.println("Attributes");
            for (AttributeDefinition a : attributes) {
                System.out.format("  %s (%s)\n", a.getAttributeName(), a.getAttributeType());
            }
        }
    } catch (AmazonServiceException e) {
        System.err.println(e.getErrorMessage());
        System.exit(1);
    }
    System.out.println("\nDone!");
}

From source file:com.haskins.cloudtrailviewer.dialog.resourcedetail.detailpanels.DbTableDetail.java

License:Open Source License

private void buildUI(DescribeTableResult detail) {

    this.add(primaryScrollPane, BorderLayout.CENTER);

    if (detail.getTable() != null) {

        TableDescription table = detail.getTable();

        if (table.getCreationDateTime() != null) {
            primaryTableModel.addRow(new Object[] { "Created", getDateString(table.getCreationDateTime()) });
        }//from w w  w.  ja  va  2s. c  om
        if (table.getItemCount() != null) {
            primaryTableModel.addRow(new Object[] { "Item Count", table.getItemCount() });
        }
        if (table.getLatestStreamArn() != null) {
            primaryTableModel.addRow(new Object[] { "Latest Stream Arn", table.getLatestStreamArn() });
        }
        if (table.getLatestStreamLabel() != null) {
            primaryTableModel.addRow(new Object[] { "Latest Stream Label", table.getLatestStreamLabel() });
        }
        if (table.getTableArn() != null) {
            primaryTableModel.addRow(new Object[] { "Arn", table.getTableArn() });
        }
        if (table.getTableName() != null) {
            primaryTableModel.addRow(new Object[] { "Name", table.getTableName() });
        }
        if (table.getTableSizeBytes() != null) {
            primaryTableModel.addRow(new Object[] { "Size (bytes)", table.getTableSizeBytes() });
        }
        if (table.getTableStatus() != null) {
            primaryTableModel.addRow(new Object[] { "Status", table.getTableStatus() });
        }
    }
}

From source file:org.apache.beam.sdk.io.aws.dynamodb.DynamoDBIOTestHelper.java

License:Apache License

static void createTestTable(String tableName) {
    CreateTableResult res = createDynamoTable(tableName);

    TableDescription tableDesc = res.getTableDescription();

    Assert.assertEquals(tableName, tableDesc.getTableName());
    Assert.assertTrue(tableDesc.getKeySchema().toString().contains(ATTR_NAME_1));
    Assert.assertTrue(tableDesc.getKeySchema().toString().contains(ATTR_NAME_2));

    Assert.assertEquals(tableDesc.getProvisionedThroughput().getReadCapacityUnits(), Long.valueOf(1000));
    Assert.assertEquals(tableDesc.getProvisionedThroughput().getWriteCapacityUnits(), Long.valueOf(1000));
    Assert.assertEquals("ACTIVE", tableDesc.getTableStatus());
    Assert.assertEquals("arn:aws:dynamodb:us-east-1:000000000000:table/" + tableName, tableDesc.getTableArn());

    ListTablesResult tables = dynamoDBClient.listTables();
    Assert.assertEquals(1, tables.getTableNames().size());
}