Skip to content

Commit 1fce981

Browse files
Added DynamoDBTable resource.
1 parent a9e0c09 commit 1fce981

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

cfn/dynamodb.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package cfn
2+
3+
// A DynamoDBTable creates a DynamoDB table.
4+
type DynamoDBTable struct {
5+
AttributeDefinitions []AttributeDefinition
6+
GlobalSecondaryIndexes []GlobalSecondaryIndex `json:",omitempty"`
7+
KeySchema []KeySchema
8+
LocalSecondaryIndexes []LocalSecondaryIndex `json:",omitempty"`
9+
ProvisionedThroughput ProvisionedThroughput
10+
TableName string `json:",omitempty"`
11+
}
12+
13+
// An AttributeDefinition defines an attribute of a DynamoDBTable.
14+
type AttributeDefinition struct {
15+
AttributeName string
16+
AttributeType string
17+
}
18+
19+
// A GlobalSecondaryIndex describes a global secondary index for the
20+
// DynamoDBTable resource.
21+
type GlobalSecondaryIndex struct {
22+
IndexName string
23+
KeySchema []KeySchema
24+
Projection Projection
25+
ProvisionedThroughput ProvisionedThroughput
26+
}
27+
28+
// LocalSecondaryIndex describes local secondary indexes for the DynamoDBTable
29+
// resource. Each index is scoped to a given hash key value. Tables with one or
30+
// more local secondary indexes are subject to an item collection size limit,
31+
// where the amount of data within a given item collection cannot exceed 10 GB.
32+
type LocalSecondaryIndex struct {
33+
IndexName string
34+
KeySchema []KeySchema
35+
Projection Projection
36+
}
37+
38+
// Possible values for KeySchema's KeyType field.
39+
const (
40+
KeyTypeHash = "HASH"
41+
KeyTypeRange = "RANGE"
42+
)
43+
44+
// KeySchema describes a primary key for the DynamoDBTable resource or a key
45+
// schema for an index.
46+
type KeySchema struct {
47+
AttributeName string
48+
KeyType string
49+
}
50+
51+
// Possible values for Projection's ProjectionType field.
52+
const (
53+
ProjectionTypeKeysOnly = "KEYS_ONLY"
54+
ProjectionTypeInclude = "INCLUDE"
55+
ProjectionTypeAll = "ALL"
56+
)
57+
58+
// A Projection defines attributes that are copied (projected) from the source
59+
// table into the index. These attributes are additions to the primary key
60+
// attributes and index key attributes, which are automatically projected.
61+
type Projection struct {
62+
NonKeyAttributes []string `json:",omitempty"`
63+
ProjectionType string
64+
}
65+
66+
// ProvisionedThroughput describes a set of provisioned throughput values for a
67+
// DynamoDBTable resource.
68+
type ProvisionedThroughput struct {
69+
ReadCapacityUnits int
70+
WriteCapacityUnits int
71+
}

0 commit comments

Comments
 (0)