Class: AWSCDK::DynamoDB::CfnTable::LocalSecondaryIndexProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::DynamoDB::CfnTable::LocalSecondaryIndexProperty
- Defined in:
- dynamo_db/cfn_table.rb
Overview
Represents the properties of a local secondary index.
A local secondary index can only be created when its parent table is created.
Instance Attribute Summary collapse
-
#index_name ⇒ String
readonly
The name of the local secondary index.
-
#key_schema ⇒ AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::DynamoDB::CfnTable::KeySchemaProperty>
readonly
The complete key schema for the local secondary index, consisting of one or more pairs of attribute names and key types: -
HASH- partition key -RANGE- sort key > The partition key of an item is also known as its hash attribute . -
#projection ⇒ AWSCDK::IResolvable, AWSCDK::DynamoDB::CfnTable::ProjectionProperty
readonly
Represents attributes that are copied (projected) from the table into the local secondary index.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(index_name:, key_schema:, projection:) ⇒ LocalSecondaryIndexProperty
constructor
A new instance of LocalSecondaryIndexProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(index_name:, key_schema:, projection:) ⇒ LocalSecondaryIndexProperty
Returns a new instance of LocalSecondaryIndexProperty.
1274 1275 1276 1277 1278 1279 1280 1281 |
# File 'dynamo_db/cfn_table.rb', line 1274 def initialize(index_name:, key_schema:, projection:) @index_name = index_name Jsii::Type.check_type(@index_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "indexName") @key_schema = key_schema Jsii::Type.check_type(@key_schema, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQ2ZuVGFibGUuS2V5U2NoZW1hUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "keySchema") @projection = projection.is_a?(Hash) ? ::AWSCDK::DynamoDB::CfnTable::ProjectionProperty.new(**projection.transform_keys(&:to_sym)) : projection Jsii::Type.check_type(@projection, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19keW5hbW9kYi5DZm5UYWJsZS5Qcm9qZWN0aW9uUHJvcGVydHkifV19fQ==")), "projection") end |
Instance Attribute Details
#index_name ⇒ String (readonly)
The name of the local secondary index.
The name must be unique among all other indexes on this table.
1289 1290 1291 |
# File 'dynamo_db/cfn_table.rb', line 1289 def index_name @index_name end |
#key_schema ⇒ AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::DynamoDB::CfnTable::KeySchemaProperty> (readonly)
The complete key schema for the local secondary index, consisting of one or more pairs of attribute names and key types: - HASH - partition key - RANGE - 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.
1298 1299 1300 |
# File 'dynamo_db/cfn_table.rb', line 1298 def key_schema @key_schema end |
#projection ⇒ AWSCDK::IResolvable, AWSCDK::DynamoDB::CfnTable::ProjectionProperty (readonly)
Represents attributes that are copied (projected) from the table into the local secondary index.
These are in addition to the primary key attributes and index key attributes, which are automatically projected.
1305 1306 1307 |
# File 'dynamo_db/cfn_table.rb', line 1305 def projection @projection end |
Class Method Details
.jsii_properties ⇒ Object
1307 1308 1309 1310 1311 1312 1313 |
# File 'dynamo_db/cfn_table.rb', line 1307 def self.jsii_properties { :index_name => "indexName", :key_schema => "keySchema", :projection => "projection", } end |
Instance Method Details
#to_jsii ⇒ Object
1315 1316 1317 1318 1319 1320 1321 1322 1323 |
# File 'dynamo_db/cfn_table.rb', line 1315 def to_jsii result = {} result.merge!({ "indexName" => @index_name, "keySchema" => @key_schema, "projection" => @projection, }) result.compact end |