Class: AWSCDK::DynamoDB::CfnGlobalTable::LocalSecondaryIndexProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
dynamo_db/cfn_global_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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index_name:, key_schema:, projection:) ⇒ LocalSecondaryIndexProperty

Returns a new instance of LocalSecondaryIndexProperty.

Parameters:



1254
1255
1256
1257
1258
1259
1260
1261
# File 'dynamo_db/cfn_global_table.rb', line 1254

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("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQ2ZuR2xvYmFsVGFibGUuS2V5U2NoZW1hUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "keySchema")
  @projection = projection.is_a?(Hash) ? ::AWSCDK::DynamoDB::CfnGlobalTable::ProjectionProperty.new(**projection.transform_keys(&:to_sym)) : projection
  Jsii::Type.check_type(@projection, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19keW5hbW9kYi5DZm5HbG9iYWxUYWJsZS5Qcm9qZWN0aW9uUHJvcGVydHkifV19fQ==")), "projection")
end

Instance Attribute Details

#index_nameString (readonly)

The name of the local secondary index.

The name must be unique among all other indexes on this table.



1269
1270
1271
# File 'dynamo_db/cfn_global_table.rb', line 1269

def index_name
  @index_name
end

#key_schemaAWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::DynamoDB::CfnGlobalTable::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.



1278
1279
1280
# File 'dynamo_db/cfn_global_table.rb', line 1278

def key_schema
  @key_schema
end

#projectionAWSCDK::IResolvable, AWSCDK::DynamoDB::CfnGlobalTable::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.



1285
1286
1287
# File 'dynamo_db/cfn_global_table.rb', line 1285

def projection
  @projection
end

Class Method Details

.jsii_propertiesObject



1287
1288
1289
1290
1291
1292
1293
# File 'dynamo_db/cfn_global_table.rb', line 1287

def self.jsii_properties
  {
    :index_name => "indexName",
    :key_schema => "keySchema",
    :projection => "projection",
  }
end

Instance Method Details

#to_jsiiObject



1295
1296
1297
1298
1299
1300
1301
1302
1303
# File 'dynamo_db/cfn_global_table.rb', line 1295

def to_jsii
  result = {}
  result.merge!({
    "indexName" => @index_name,
    "keySchema" => @key_schema,
    "projection" => @projection,
  })
  result.compact
end