Class: AWSCDK::DynamoDB::GlobalSecondaryIndexPropsV2

Inherits:
SecondaryIndexProps
  • Object
show all
Defined in:
dynamo_db/global_secondary_index_props_v2.rb

Overview

Properties used to configure a global 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, max_read_request_units: nil, max_write_request_units: nil, partition_key: nil, partition_keys: nil, read_capacity: nil, sort_key: nil, sort_keys: nil, warm_throughput: nil, write_capacity: nil) ⇒ GlobalSecondaryIndexPropsV2

Returns a new instance of GlobalSecondaryIndexPropsV2.

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.

  • max_read_request_units (Numeric, nil) (defaults to: nil)

    The maximum read request units.

  • max_write_request_units (Numeric, nil) (defaults to: nil)

    The maximum write request units.

  • partition_key (AWSCDK::DynamoDB::Attribute, nil) (defaults to: nil)

    Partition key attribute definition.

  • partition_keys (Array<AWSCDK::DynamoDB::Attribute>, nil) (defaults to: nil)

    Multi-attribute partition key.

  • read_capacity (AWSCDK::DynamoDB::Capacity, nil) (defaults to: nil)

    The read capacity.

  • sort_key (AWSCDK::DynamoDB::Attribute, nil) (defaults to: nil)

    Sort key attribute definition.

  • sort_keys (Array<AWSCDK::DynamoDB::Attribute>, nil) (defaults to: nil)

    Multi-attribute sort key.

  • warm_throughput (AWSCDK::DynamoDB::WarmThroughput, nil) (defaults to: nil)

    The warm throughput configuration for the global secondary index.

  • write_capacity (AWSCDK::DynamoDB::Capacity, nil) (defaults to: nil)

    The write capacity.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 19

def initialize(index_name:, non_key_attributes: nil, projection_type: nil, max_read_request_units: nil, max_write_request_units: nil, partition_key: nil, partition_keys: nil, read_capacity: nil, sort_key: nil, sort_keys: nil, warm_throughput: nil, write_capacity: 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?
  @max_read_request_units = max_read_request_units
  Jsii::Type.check_type(@max_read_request_units, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxReadRequestUnits") unless @max_read_request_units.nil?
  @max_write_request_units = max_write_request_units
  Jsii::Type.check_type(@max_write_request_units, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxWriteRequestUnits") unless @max_write_request_units.nil?
  @partition_key = partition_key.is_a?(Hash) ? ::AWSCDK::DynamoDB::Attribute.new(**partition_key.transform_keys(&:to_sym)) : partition_key
  Jsii::Type.check_type(@partition_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQXR0cmlidXRlIn0=")), "partitionKey") unless @partition_key.nil?
  @partition_keys = partition_keys.is_a?(Array) ? partition_keys.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::DynamoDB::Attribute.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : partition_keys
  Jsii::Type.check_type(@partition_keys, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19keW5hbW9kYi5BdHRyaWJ1dGUifSwia2luZCI6ImFycmF5In19")), "partitionKeys") unless @partition_keys.nil?
  @read_capacity = read_capacity
  Jsii::Type.check_type(@read_capacity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQ2FwYWNpdHkifQ==")), "readCapacity") unless @read_capacity.nil?
  @sort_key = sort_key.is_a?(Hash) ? ::AWSCDK::DynamoDB::Attribute.new(**sort_key.transform_keys(&:to_sym)) : sort_key
  Jsii::Type.check_type(@sort_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQXR0cmlidXRlIn0=")), "sortKey") unless @sort_key.nil?
  @sort_keys = sort_keys.is_a?(Array) ? sort_keys.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::DynamoDB::Attribute.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : sort_keys
  Jsii::Type.check_type(@sort_keys, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19keW5hbW9kYi5BdHRyaWJ1dGUifSwia2luZCI6ImFycmF5In19")), "sortKeys") unless @sort_keys.nil?
  @warm_throughput = warm_throughput.is_a?(Hash) ? ::AWSCDK::DynamoDB::WarmThroughput.new(**warm_throughput.transform_keys(&:to_sym)) : warm_throughput
  Jsii::Type.check_type(@warm_throughput, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuV2FybVRocm91Z2hwdXQifQ==")), "warmThroughput") unless @warm_throughput.nil?
  @write_capacity = write_capacity
  Jsii::Type.check_type(@write_capacity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQ2FwYWNpdHkifQ==")), "writeCapacity") unless @write_capacity.nil?
end

Instance Attribute Details

#index_nameString (readonly)

The name of the secondary index.

Returns:

  • (String)


49
50
51
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 49

def index_name
  @index_name
end

#max_read_request_unitsNumeric? (readonly)

Note:

Default: - inherited from the primary table.

The maximum read request units.

Note: This can only be configured if the primary table billing is PAY_PER_REQUEST.

Returns:

  • (Numeric, nil)


66
67
68
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 66

def max_read_request_units
  @max_read_request_units
end

#max_write_request_unitsNumeric? (readonly)

Note:

Default: - inherited from the primary table.

The maximum write request units.

Note: This can only be configured if the primary table billing is PAY_PER_REQUEST.

Returns:

  • (Numeric, nil)


73
74
75
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 73

def max_write_request_units
  @max_write_request_units
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)


54
55
56
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 54

def non_key_attributes
  @non_key_attributes
end

#partition_keyAWSCDK::DynamoDB::Attribute? (readonly)

Note:

Default: - exactly one of partitionKey and partitionKeys must be specified.

Partition key attribute definition.

If a single field forms the partition key, you can use this field. Use the partition_keys field if the partition key is a multi-attribute key (consists of multiple fields).

Returns:



82
83
84
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 82

def partition_key
  @partition_key
end

#partition_keysArray<AWSCDK::DynamoDB::Attribute>? (readonly)

Note:

Default: - exactly one of partitionKey and partitionKeys must be specified.

Multi-attribute partition key.

If a single field forms the partition key, you can use either partition_key or partition_keys to specify the partition key. Exactly one of these must be specified.

You must use partition_keys field if the partition key is a multi-attribute key (consists of multiple fields).

NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields.

The order of fields is not important.

Returns:



100
101
102
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 100

def partition_keys
  @partition_keys
end

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

Note:

Default: ALL

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



59
60
61
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 59

def projection_type
  @projection_type
end

#read_capacityAWSCDK::DynamoDB::Capacity? (readonly)

Note:

Default: - inherited from the primary table.

The read capacity.

Note: This can only be configured if the primary table billing is provisioned.

Returns:



107
108
109
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 107

def read_capacity
  @read_capacity
end

#sort_keyAWSCDK::DynamoDB::Attribute? (readonly)

Note:

Default: - no sort key

Sort key attribute definition.

If a single field forms the sort key, you can use this field. Use the sort_keys field if the sort key is a multi-attribute key (consists of multiple fields).

Returns:



116
117
118
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 116

def sort_key
  @sort_key
end

#sort_keysArray<AWSCDK::DynamoDB::Attribute>? (readonly)

Note:

Default: - no sort key

Multi-attribute sort key.

If a single field forms the sort key, you can use either sort_key or sort_keys to specify the sort key. At most one of these may be specified.

You must use sort_keys field if the sort key is a multi-attribute key (consists of multiple fields).

NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields at the same time.

NOTE: The order of fields is important!

Returns:



134
135
136
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 134

def sort_keys
  @sort_keys
end

#warm_throughputAWSCDK::DynamoDB::WarmThroughput? (readonly)

Note:

Default: - no warm throughput is configured

The warm throughput configuration for the global secondary index.



139
140
141
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 139

def warm_throughput
  @warm_throughput
end

#write_capacityAWSCDK::DynamoDB::Capacity? (readonly)

Note:

Default: - inherited from the primary table.

The write capacity.

Note: This can only be configured if the primary table billing is provisioned.

Returns:



146
147
148
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 146

def write_capacity
  @write_capacity
end

Class Method Details

.jsii_propertiesObject



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 148

def self.jsii_properties
  {
    :index_name => "indexName",
    :non_key_attributes => "nonKeyAttributes",
    :projection_type => "projectionType",
    :max_read_request_units => "maxReadRequestUnits",
    :max_write_request_units => "maxWriteRequestUnits",
    :partition_key => "partitionKey",
    :partition_keys => "partitionKeys",
    :read_capacity => "readCapacity",
    :sort_key => "sortKey",
    :sort_keys => "sortKeys",
    :warm_throughput => "warmThroughput",
    :write_capacity => "writeCapacity",
  }
end

Instance Method Details

#to_jsiiObject



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'dynamo_db/global_secondary_index_props_v2.rb', line 165

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "indexName" => @index_name,
    "nonKeyAttributes" => @non_key_attributes,
    "projectionType" => @projection_type,
    "maxReadRequestUnits" => @max_read_request_units,
    "maxWriteRequestUnits" => @max_write_request_units,
    "partitionKey" => @partition_key,
    "partitionKeys" => @partition_keys,
    "readCapacity" => @read_capacity,
    "sortKey" => @sort_key,
    "sortKeys" => @sort_keys,
    "warmThroughput" => @warm_throughput,
    "writeCapacity" => @write_capacity,
  })
  result.compact
end