Class: AWSCDK::DynamoDB::SecondaryIndexProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
dynamo_db/secondary_index_props.rb

Overview

Properties for a secondary index.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index_name:, non_key_attributes: nil, projection_type: nil) ⇒ SecondaryIndexProps

Returns a new instance of SecondaryIndexProps.

Parameters:

  • index_name (String)

    The name of the secondary index.

  • non_key_attributes (Array<String>, nil) (defaults to: nil)

    The non-key attributes that are projected into the secondary index.

  • projection_type (AWSCDK::DynamoDB::ProjectionType, nil) (defaults to: nil)

    The set of attributes that are projected into the secondary index.



10
11
12
13
14
15
16
17
# File 'dynamo_db/secondary_index_props.rb', line 10

def initialize(index_name:, non_key_attributes: nil, projection_type: nil)
  @index_name = index_name
  Jsii::Type.check_type(@index_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "indexName")
  @non_key_attributes = non_key_attributes
  Jsii::Type.check_type(@non_key_attributes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "nonKeyAttributes") unless @non_key_attributes.nil?
  @projection_type = projection_type
  Jsii::Type.check_type(@projection_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuUHJvamVjdGlvblR5cGUifQ==")), "projectionType") unless @projection_type.nil?
end

Instance Attribute Details

#index_nameString (readonly)

The name of the secondary index.

Returns:

  • (String)


22
23
24
# File 'dynamo_db/secondary_index_props.rb', line 22

def index_name
  @index_name
end

#non_key_attributesArray<String>? (readonly)

Note:

Default: - No additional attributes

The non-key attributes that are projected into the secondary index.

Returns:

  • (Array<String>, nil)


27
28
29
# File 'dynamo_db/secondary_index_props.rb', line 27

def non_key_attributes
  @non_key_attributes
end

#projection_typeAWSCDK::DynamoDB::ProjectionType? (readonly)

Note:

Default: ALL

The set of attributes that are projected into the secondary index.



32
33
34
# File 'dynamo_db/secondary_index_props.rb', line 32

def projection_type
  @projection_type
end

Class Method Details

.jsii_propertiesObject



34
35
36
37
38
39
40
# File 'dynamo_db/secondary_index_props.rb', line 34

def self.jsii_properties
  {
    :index_name => "indexName",
    :non_key_attributes => "nonKeyAttributes",
    :projection_type => "projectionType",
  }
end

Instance Method Details

#to_jsiiObject



42
43
44
45
46
47
48
49
50
# File 'dynamo_db/secondary_index_props.rb', line 42

def to_jsii
  result = {}
  result.merge!({
    "indexName" => @index_name,
    "nonKeyAttributes" => @non_key_attributes,
    "projectionType" => @projection_type,
  })
  result.compact
end