Class: AWSCDK::DynamoDB::GlobalSecondaryIndexProps

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

Overview

Properties for 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, partition_key: nil, sort_key: nil, contributor_insights_enabled: nil, contributor_insights_specification: nil, max_read_request_units: nil, max_write_request_units: nil, partition_keys: nil, read_capacity: nil, sort_keys: nil, warm_throughput: nil, write_capacity: nil) ⇒ GlobalSecondaryIndexProps

Returns a new instance of GlobalSecondaryIndexProps.

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.

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

    Partition key attribute definition.

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

    Sort key attribute definition.

  • contributor_insights_enabled (Boolean, nil) (defaults to: nil)

    Whether CloudWatch contributor insights is enabled for the specified global secondary index.

  • contributor_insights_specification (AWSCDK::DynamoDB::ContributorInsightsSpecification, nil) (defaults to: nil)

    Whether CloudWatch contributor insights is enabled and what mode is selected.

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

    The maximum read request units for the global secondary index.

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

    The maximum write request units for the global secondary index.

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

    Multi-attribute partition key.

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

    The read capacity for the global secondary index.

  • 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 (Numeric, nil) (defaults to: nil)

    The write capacity for the global secondary index.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'dynamo_db/global_secondary_index_props.rb', line 22

def initialize(index_name:, non_key_attributes: nil, projection_type: nil, partition_key: nil, sort_key: nil, contributor_insights_enabled: nil, contributor_insights_specification: nil, max_read_request_units: nil, max_write_request_units: nil, partition_keys: nil, read_capacity: 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?
  @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?
  @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?
  @contributor_insights_enabled = contributor_insights_enabled
  Jsii::Type.check_type(@contributor_insights_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "contributorInsightsEnabled") unless @contributor_insights_enabled.nil?
  @contributor_insights_specification = contributor_insights_specification.is_a?(Hash) ? ::AWSCDK::DynamoDB::ContributorInsightsSpecification.new(**contributor_insights_specification.transform_keys(&:to_sym)) : contributor_insights_specification
  Jsii::Type.check_type(@contributor_insights_specification, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQ29udHJpYnV0b3JJbnNpZ2h0c1NwZWNpZmljYXRpb24ifQ==")), "contributorInsightsSpecification") unless @contributor_insights_specification.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_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("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "readCapacity") unless @read_capacity.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("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "writeCapacity") unless @write_capacity.nil?
end

Instance Attribute Details

#contributor_insights_enabledBoolean? (readonly)

Deprecated.

use contributorInsightsSpecification instead

Note:

Default: false

Whether CloudWatch contributor insights is enabled for the specified global secondary index.

Returns:

  • (Boolean, nil)


90
91
92
# File 'dynamo_db/global_secondary_index_props.rb', line 90

def contributor_insights_enabled
  @contributor_insights_enabled
end

#contributor_insights_specificationAWSCDK::DynamoDB::ContributorInsightsSpecification? (readonly)

Note:

Default: - contributor insights is not enabled

Whether CloudWatch contributor insights is enabled and what mode is selected.



95
96
97
# File 'dynamo_db/global_secondary_index_props.rb', line 95

def contributor_insights_specification
  @contributor_insights_specification
end

#index_nameString (readonly)

The name of the secondary index.

Returns:

  • (String)


56
57
58
# File 'dynamo_db/global_secondary_index_props.rb', line 56

def index_name
  @index_name
end

#max_read_request_unitsNumeric? (readonly)

Note:

Default: - on-demand throughput is disabled

The maximum read request units for the global secondary index.

Can only be provided if table billingMode is PAY_PER_REQUEST.

Returns:

  • (Numeric, nil)


102
103
104
# File 'dynamo_db/global_secondary_index_props.rb', line 102

def max_read_request_units
  @max_read_request_units
end

#max_write_request_unitsNumeric? (readonly)

Note:

Default: - on-demand throughput is disabled

The maximum write request units for the global secondary index.

Can only be provided if table billingMode is PAY_PER_REQUEST.

Returns:

  • (Numeric, nil)


109
110
111
# File 'dynamo_db/global_secondary_index_props.rb', line 109

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)


61
62
63
# File 'dynamo_db/global_secondary_index_props.rb', line 61

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:



75
76
77
# File 'dynamo_db/global_secondary_index_props.rb', line 75

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:



127
128
129
# File 'dynamo_db/global_secondary_index_props.rb', line 127

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.



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

def projection_type
  @projection_type
end

#read_capacityNumeric? (readonly)

Note:

Default: 5

The read capacity for the global secondary index.

Can only be provided if table billingMode is Provisioned or undefined.

Returns:

  • (Numeric, nil)


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

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:



84
85
86
# File 'dynamo_db/global_secondary_index_props.rb', line 84

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:



152
153
154
# File 'dynamo_db/global_secondary_index_props.rb', line 152

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.



157
158
159
# File 'dynamo_db/global_secondary_index_props.rb', line 157

def warm_throughput
  @warm_throughput
end

#write_capacityNumeric? (readonly)

Note:

Default: 5

The write capacity for the global secondary index.

Can only be provided if table billingMode is Provisioned or undefined.

Returns:

  • (Numeric, nil)


164
165
166
# File 'dynamo_db/global_secondary_index_props.rb', line 164

def write_capacity
  @write_capacity
end

Class Method Details

.jsii_propertiesObject



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.rb', line 166

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

Instance Method Details

#to_jsiiObject



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'dynamo_db/global_secondary_index_props.rb', line 185

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