forked from hailocab/goamz
/
describe_table.go
35 lines (26 loc) · 1.04 KB
/
describe_table.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package dynamodb
import (
simplejson "github.com/bitly/go-simplejson"
)
func (t *Table) DescribeTable() (*TableDescriptionT, error) {
q := NewQuery(t)
jsonResponse, err := t.Server.queryServer(target("DescribeTable"), q)
if err != nil {
return nil, err
}
json, err := simplejson.NewJson(jsonResponse)
if err != nil {
return nil, err
}
var tableDescription TableDescriptionT
// TODO: Populate tableDescription.AttributeDefinitions.
tableDescription.CreationDateTime, _ = json.Get("Table").Get("CreationDateTime").Float64()
tableDescription.ItemCount, _ = json.Get("Table").Get("ItemCount").Int64()
// TODO: Populate tableDescription.KeySchema.
// TODO: Populate tableDescription.LocalSecondaryIndexes.
// TODO: Populate tableDescription.ProvisionedThroughPut.
tableDescription.TableName, _ = json.Get("Table").Get("TableName").String()
tableDescription.TableSizeBytes, _ = json.Get("Table").Get("TableSizeBytes").Int64()
tableDescription.TableStatus, _ = json.Get("Table").Get("TableStatus").String()
return &tableDescription, nil
}