in samtranslator/model/sam_resources.py [0:0]
def _construct_dynamodb_table(self) -> DynamoDBTable:
dynamodb_table = DynamoDBTable(self.logical_id, depends_on=self.depends_on, attributes=self.resource_attributes)
if self.PrimaryKey:
primary_key_name = sam_expect(
self.PrimaryKey.get("Name"), self.logical_id, "PrimaryKey.Name"
).to_not_be_none()
primary_key_type = sam_expect(
self.PrimaryKey.get("Type"), self.logical_id, "PrimaryKey.Type"
).to_not_be_none()
primary_key = {
"AttributeName": primary_key_name,
"AttributeType": self._convert_attribute_type(primary_key_type),
}
else:
primary_key = {"AttributeName": "id", "AttributeType": "S"}
dynamodb_table.AttributeDefinitions = [primary_key]
dynamodb_table.KeySchema = [{"AttributeName": primary_key["AttributeName"], "KeyType": "HASH"}]
if self.PointInTimeRecoverySpecification:
dynamodb_table.PointInTimeRecoverySpecification = self.PointInTimeRecoverySpecification
if self.ProvisionedThroughput:
dynamodb_table.ProvisionedThroughput = self.ProvisionedThroughput
else:
dynamodb_table.BillingMode = "PAY_PER_REQUEST"
if self.SSESpecification:
dynamodb_table.SSESpecification = self.SSESpecification
if self.TableName:
dynamodb_table.TableName = self.TableName
if bool(self.Tags):
dynamodb_table.Tags = get_tag_list(self.Tags)
return dynamodb_table