Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-dynamodb/lib/table.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cloudformation as applicationautoscaling } from '@aws-cdk/aws-applicationautoscaling';
import iam = require('@aws-cdk/aws-iam');
import { Construct, TagManager, Tags } from '@aws-cdk/cdk';
import { Construct, TagManager, Tags, Token } from '@aws-cdk/cdk';
import { cloudformation as dynamodb } from './dynamodb.generated';

const HASH_KEY_TYPE = 'HASH';
Expand Down Expand Up @@ -218,8 +218,8 @@ export class Table extends Construct {
tableName: props.tableName,
keySchema: this.keySchema,
attributeDefinitions: this.attributeDefinitions,
globalSecondaryIndexes: this.globalSecondaryIndexes,
localSecondaryIndexes: this.localSecondaryIndexes,
globalSecondaryIndexes: new Token(() => this.globalSecondaryIndexes.length > 0 ? this.globalSecondaryIndexes : undefined),
localSecondaryIndexes: new Token(() => this.localSecondaryIndexes.length > 0 ? this.localSecondaryIndexes : undefined),
pointInTimeRecoverySpecification: props.pitrEnabled ? { pointInTimeRecoveryEnabled: props.pitrEnabled } : undefined,
provisionedThroughput: { readCapacityUnits: props.readCapacity || 5, writeCapacityUnits: props.writeCapacity || 5 },
sseSpecification: props.sseEnabled ? { sseEnabled: props.sseEnabled } : undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"AttributeName": "hashKey",
"AttributeType": "S"
}
],
"GlobalSecondaryIndexes": [],
"LocalSecondaryIndexes": []
]
}
},
"TableWithGlobalAndLocalSecondaryIndexBC540710": {
Expand Down Expand Up @@ -311,8 +309,7 @@
"WriteCapacityUnits": 5
}
}
],
"LocalSecondaryIndexes": []
]
}
},
"TableWithLocalSecondaryIndex4DA3D08F": {
Expand Down Expand Up @@ -346,7 +343,6 @@
"AttributeType": "N"
}
],
"GlobalSecondaryIndexes": [],
"LocalSecondaryIndexes": [
{
"IndexName": "LSI-PartitionAndSortKey",
Expand Down
69 changes: 12 additions & 57 deletions packages/@aws-cdk/aws-dynamodb/test/test.dynamodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ export = {
Properties: {
AttributeDefinitions: [{ AttributeName: 'hashKey', AttributeType: 'S' }],
KeySchema: [{ AttributeName: 'hashKey', KeyType: 'HASH' }],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: []
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
}
}
}
Expand Down Expand Up @@ -116,9 +114,7 @@ export = {
{ AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: []
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
}
}
}
Expand Down Expand Up @@ -147,9 +143,7 @@ export = {
{ AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: []
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
}
}
}
Expand Down Expand Up @@ -178,9 +172,7 @@ export = {
{ AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: []
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
}
}
}
Expand Down Expand Up @@ -209,9 +201,7 @@ export = {
{ AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: []
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
}
}
}
Expand Down Expand Up @@ -240,9 +230,7 @@ export = {
{ AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: []
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
}
}
}
Expand Down Expand Up @@ -278,8 +266,6 @@ export = {
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
TableName: 'MyTable'
}
}
Expand Down Expand Up @@ -311,8 +297,6 @@ export = {
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions: [
{ AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' }
Expand Down Expand Up @@ -349,8 +333,6 @@ export = {
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions: [
{ AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' }
Expand Down Expand Up @@ -399,8 +381,6 @@ export = {
ReadCapacityUnits: 42,
WriteCapacityUnits: 1337
},
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
PointInTimeRecoverySpecification: { PointInTimeRecoveryEnabled: true },
SSESpecification: { SSEEnabled: true },
StreamSpecification: { StreamViewType: 'KEYS_ONLY' },
Expand Down Expand Up @@ -452,8 +432,7 @@ export = {
Projection: { ProjectionType: 'ALL' },
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 }
}
],
LocalSecondaryIndexes: []
]
}
}
}
Expand Down Expand Up @@ -503,8 +482,7 @@ export = {
Projection: { ProjectionType: 'ALL' },
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 }
}
],
LocalSecondaryIndexes: []
]
}
}
}
Expand Down Expand Up @@ -552,8 +530,7 @@ export = {
Projection: { ProjectionType: 'KEYS_ONLY' },
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
}
],
LocalSecondaryIndexes: []
]
}
}
}
Expand Down Expand Up @@ -605,8 +582,7 @@ export = {
Projection: { NonKeyAttributes: ['gsiNonKey0', 'gsiNonKey1'], ProjectionType: 'INCLUDE' },
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 }
}
],
LocalSecondaryIndexes: []
]
}
}
}
Expand Down Expand Up @@ -775,8 +751,7 @@ export = {
Projection: { ProjectionType: 'ALL' },
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
},
],
LocalSecondaryIndexes: []
]
}
}
}
Expand Down Expand Up @@ -836,8 +811,7 @@ export = {
Projection: { ProjectionType: 'ALL' },
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
}
],
LocalSecondaryIndexes: []
]
}
}
}
Expand Down Expand Up @@ -872,7 +846,6 @@ export = {
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [
{
IndexName: 'MyLSI',
Expand Down Expand Up @@ -918,7 +891,6 @@ export = {
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [
{
IndexName: 'MyLSI',
Expand Down Expand Up @@ -967,7 +939,6 @@ export = {
{ AttributeName: 'sortKey', KeyType: 'RANGE' }
],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [
{
IndexName: 'MyLSI',
Expand Down Expand Up @@ -1077,8 +1048,6 @@ export = {
[ { AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' } ],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions:
[ { AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' } ],
Expand Down Expand Up @@ -1159,8 +1128,6 @@ export = {
[ { AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' } ],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions:
[ { AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' } ],
Expand Down Expand Up @@ -1269,8 +1236,6 @@ export = {
[ { AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' } ],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions:
[ { AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' } ],
Expand Down Expand Up @@ -1350,8 +1315,6 @@ export = {
[ { AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' } ],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions:
[ { AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' } ] } },
Expand Down Expand Up @@ -1554,8 +1517,6 @@ export = {
[ { AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' } ],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions:
[ { AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' } ],
Expand Down Expand Up @@ -1636,8 +1597,6 @@ export = {
[ { AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' } ],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions:
[ { AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' } ],
Expand Down Expand Up @@ -1746,8 +1705,6 @@ export = {
[ { AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' } ],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions:
[ { AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' } ],
Expand Down Expand Up @@ -1827,8 +1784,6 @@ export = {
[ { AttributeName: 'hashKey', KeyType: 'HASH' },
{ AttributeName: 'sortKey', KeyType: 'RANGE' } ],
ProvisionedThroughput: { ReadCapacityUnits: 42, WriteCapacityUnits: 1337 },
GlobalSecondaryIndexes: [],
LocalSecondaryIndexes: [],
AttributeDefinitions:
[ { AttributeName: 'hashKey', AttributeType: 'S' },
{ AttributeName: 'sortKey', AttributeType: 'N' } ] } },
Expand Down