Class: AWSCDK::DynamoDB::CfnTable::KeySchemaProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::DynamoDB::CfnTable::KeySchemaProperty
- Defined in:
- dynamo_db/cfn_table.rb
Overview
Represents a single element of a key schema.
A key schema specifies the attributes that make up the primary key of a table, or the key attributes of an index.
A KeySchemaElement represents exactly one attribute of the primary key. For example, a simple primary key would be represented by one KeySchemaElement (for the partition key). A composite primary key would require one KeySchemaElement for the partition key, and another KeySchemaElement for the sort key.
A KeySchemaElement must be a scalar, top-level attribute (not a nested attribute). The data type must be one of String, Number, or Binary. The attribute cannot be nested within a List or a Map.
Instance Attribute Summary collapse
-
#attribute_name ⇒ String
readonly
The name of a key attribute.
-
#key_type ⇒ String
readonly
The role that this key attribute will assume:.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attribute_name:, key_type:) ⇒ KeySchemaProperty
constructor
A new instance of KeySchemaProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(attribute_name:, key_type:) ⇒ KeySchemaProperty
Returns a new instance of KeySchemaProperty.
1176 1177 1178 1179 1180 1181 |
# File 'dynamo_db/cfn_table.rb', line 1176 def initialize(attribute_name:, key_type:) @attribute_name = attribute_name Jsii::Type.check_type(@attribute_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "attributeName") @key_type = key_type Jsii::Type.check_type(@key_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyType") end |
Instance Attribute Details
#attribute_name ⇒ String (readonly)
The name of a key attribute.
1187 1188 1189 |
# File 'dynamo_db/cfn_table.rb', line 1187 def attribute_name @attribute_name end |
#key_type ⇒ String (readonly)
The role that this key attribute will assume:.
HASH- partition keyRANGE- sort key
The partition key of an item is also known as its hash attribute . The term "hash attribute" derives from DynamoDB's usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values.
The sort key of an item is also known as its range attribute . The term "range attribute" derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
1199 1200 1201 |
# File 'dynamo_db/cfn_table.rb', line 1199 def key_type @key_type end |
Class Method Details
.jsii_properties ⇒ Object
1201 1202 1203 1204 1205 1206 |
# File 'dynamo_db/cfn_table.rb', line 1201 def self.jsii_properties { :attribute_name => "attributeName", :key_type => "keyType", } end |
Instance Method Details
#to_jsii ⇒ Object
1208 1209 1210 1211 1212 1213 1214 1215 |
# File 'dynamo_db/cfn_table.rb', line 1208 def to_jsii result = {} result.merge!({ "attributeName" => @attribute_name, "keyType" => @key_type, }) result.compact end |