<s> from troposphere import Template , Ref , Output , Parameter <EOL> from troposphere . dynamodb2 import ( <EOL> KeySchema , <EOL> AttributeDefinition , <EOL> ProvisionedThroughput , <EOL> Projection , <EOL> Table , <EOL> GlobalSecondaryIndex <EOL> ) <EOL> template = Template ( ) <EOL> template . add_description ( "<STR_LIT>" <EOL> "<STR_LIT:index>" ) <EOL> readunits = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT>" , <EOL> MinValue = "<STR_LIT:5>" , <EOL> MaxValue = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> writeunits = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:5>" , <EOL> MinValue = "<STR_LIT:5>" , <EOL> MaxValue = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> tableIndexName = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:id>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> tableIndexDataType = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:S>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT:1>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) ) <EOL> secondaryIndexHashName = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> secondaryIndexHashDataType = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:S>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT:1>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) ) <EOL> secondaryIndexRangeName = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> ) ) <EOL> secondaryIndexRangeDataType = template . add_parameter ( Parameter ( <EOL> "<STR_LIT>" , <EOL> Description = "<STR_LIT>" , <EOL> Type = "<STR_LIT>" , <EOL> Default = "<STR_LIT:S>" , <EOL> AllowedPattern = "<STR_LIT>" , <EOL> MinLength = "<STR_LIT:1>" , <EOL> MaxLength = "<STR_LIT:1>" , <EOL> ConstraintDescription = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) ) <EOL> GSITable = template . add_resource ( Table ( <EOL> "<STR_LIT>" , <EOL> AttributeDefinitions = [ <EOL> AttributeDefinition ( <EOL> AttributeName = Ref ( tableIndexName ) , <EOL> AttributeType = Ref ( tableIndexDataType ) <EOL> ) , <EOL> AttributeDefinition ( <EOL> AttributeName = Ref ( secondaryIndexHashName ) , <EOL> AttributeType = Ref ( secondaryIndexHashDataType ) <EOL> ) , <EOL> AttributeDefinition ( <EOL> AttributeName = Ref ( secondaryIndexRangeName ) , <EOL> AttributeType = Ref ( secondaryIndexRangeDataType ) <EOL> ) , <EOL> AttributeDefinition ( <EOL> AttributeName = "<STR_LIT>" , <EOL> AttributeType = "<STR_LIT:S>" <EOL> ) , <EOL> AttributeDefinition ( <EOL> AttributeName = "<STR_LIT>" , <EOL> AttributeType = "<STR_LIT:S>" <EOL> ) <EOL> ] , <EOL> KeySchema = [ <EOL> KeySchema ( <EOL> AttributeName = Ref ( tableIndexName ) , <EOL> KeyType = "<STR_LIT>" <EOL> ) <EOL> ] , <EOL> ProvisionedThroughput = ProvisionedThroughput ( <EOL> ReadCapacityUnits = Ref ( readunits ) , <EOL> WriteCapacityUnits = Ref ( writeunits ) <EOL> ) , <EOL> GlobalSecondaryIndexes = [ <EOL> GlobalSecondaryIndex ( <EOL> IndexName = "<STR_LIT>" , <EOL> KeySchema = [ <EOL> KeySchema ( <EOL> AttributeName = Ref ( secondaryIndexHashName ) , <EOL> KeyType = "<STR_LIT>" <EOL> ) , <EOL> KeySchema ( <EOL> AttributeName = Ref ( secondaryIndexRangeName ) , <EOL> KeyType = "<STR_LIT>" <EOL> ) <EOL> ] , <EOL> Projection = Projection ( <EOL> ProjectionType = "<STR_LIT>" , <EOL> NonKeyAttributes = [ "<STR_LIT>" ] <EOL> ) , <EOL> ProvisionedThroughput = ProvisionedThroughput ( <EOL> ReadCapacityUnits = Ref ( readunits ) , <EOL> WriteCapacityUnits = Ref ( writeunits ) <EOL> ) <EOL> ) <EOL> ] <EOL> ) ) <EOL> template . add_output ( Output ( <EOL> "<STR_LIT>" , <EOL> Value = Ref ( GSITable ) , <EOL> Description = "<STR_LIT>" , <EOL> ) ) <EOL> print ( template . to_json ( ) ) </s>
