Class: CloudFormation::DynamoDB::Table
- Defined in:
- lib/cloud_formation/dynamo_db.rb
Instance Attribute Summary collapse
-
#attribute_definitions ⇒ Object
Returns the value of attribute attribute_definitions.
Instance Method Summary collapse
- #add_attribute(attr_name, attr_value) ⇒ Object
-
#initialize ⇒ Table
constructor
A new instance of Table.
- #serialize ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ Table
Returns a new instance of Table.
24 25 26 |
# File 'lib/cloud_formation/dynamo_db.rb', line 24 def initialize @attribute_definitions = [] end |
Instance Attribute Details
#attribute_definitions ⇒ Object
Returns the value of attribute attribute_definitions.
22 23 24 |
# File 'lib/cloud_formation/dynamo_db.rb', line 22 def attribute_definitions @attribute_definitions end |
Instance Method Details
#add_attribute(attr_name, attr_value) ⇒ Object
43 44 45 |
# File 'lib/cloud_formation/dynamo_db.rb', line 43 def add_attribute attr_name, attr_value @attribute_definitions << { "AttributeName" => attr_name.to_s, "AttributeType" => type_mapping(attr_value) } end |
#serialize ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cloud_formation/dynamo_db.rb', line 28 def serialize properties = { "Type" => "AWS::DynamoDB::Table", "Properties" => { "ProvisionedThroughput" => { "WriteCapacityUnits" => @write_capacity_units.to_s, "ReadCapacityUnits" => @read_capacity_units.to_s } } } properties["Properties"].merge! add_key_schemas properties["Properties"]["AttributeDefinitions"] = @attribute_definitions unless @attribute_definitions.empty? properties end |