Class: AWSCDK::DynamoDB::CfnTable::StreamSpecificationProperty

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

Overview

Represents the DynamoDB Streams configuration for a table in DynamoDB.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream_view_type:, resource_policy: nil) ⇒ StreamSpecificationProperty

Returns a new instance of StreamSpecificationProperty.

Parameters:

  • stream_view_type (String)

    When an item in the table is modified, StreamViewType determines what information is written to the stream for this table.

  • resource_policy (AWSCDK::IResolvable, AWSCDK::DynamoDB::CfnTable::ResourcePolicyProperty, nil) (defaults to: nil)

    Creates or updates a resource-based policy document that contains the permissions for DynamoDB resources, such as a table's streams.



1699
1700
1701
1702
1703
1704
# File 'dynamo_db/cfn_table.rb', line 1699

def initialize(stream_view_type:, resource_policy: nil)
  @stream_view_type = stream_view_type
  Jsii::Type.check_type(@stream_view_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "streamViewType")
  @resource_policy = resource_policy.is_a?(Hash) ? ::AWSCDK::DynamoDB::CfnTable::ResourcePolicyProperty.new(**resource_policy.transform_keys(&:to_sym)) : resource_policy
  Jsii::Type.check_type(@resource_policy, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19keW5hbW9kYi5DZm5UYWJsZS5SZXNvdXJjZVBvbGljeVByb3BlcnR5In1dfX0=")), "resourcePolicy") unless @resource_policy.nil?
end

Instance Attribute Details

#resource_policyAWSCDK::IResolvable, ... (readonly)

Creates or updates a resource-based policy document that contains the permissions for DynamoDB resources, such as a table's streams.

Resource-based policies let you define access permissions by specifying who has access to each resource, and the actions they are allowed to perform on each resource.

When you remove the StreamSpecification property from the template, DynamoDB disables the stream but retains any attached resource policy until the stream is deleted after 24 hours. When you modify the StreamViewType property, DynamoDB creates a new stream and retains the old stream's resource policy. The old stream and its resource policy are deleted after the 24-hour retention period.

In a CloudFormation template, you can provide the policy in JSON or YAML format because CloudFormation converts YAML to JSON before submitting it to DynamoDB . For more information about resource-based policies, see Using resource-based policies for DynamoDB and Resource-based policy examples .



1728
1729
1730
# File 'dynamo_db/cfn_table.rb', line 1728

def resource_policy
  @resource_policy
end

#stream_view_typeString (readonly)

When an item in the table is modified, StreamViewType determines what information is written to the stream for this table.

Valid values for StreamViewType are:

  • KEYS_ONLY - Only the key attributes of the modified item are written to the stream.
  • NEW_IMAGE - The entire item, as it appears after it was modified, is written to the stream.
  • OLD_IMAGE - The entire item, as it appeared before it was modified, is written to the stream.
  • NEW_AND_OLD_IMAGES - Both the new and the old item images of the item are written to the stream.


1717
1718
1719
# File 'dynamo_db/cfn_table.rb', line 1717

def stream_view_type
  @stream_view_type
end

Class Method Details

.jsii_propertiesObject



1730
1731
1732
1733
1734
1735
# File 'dynamo_db/cfn_table.rb', line 1730

def self.jsii_properties
  {
    :stream_view_type => "streamViewType",
    :resource_policy => "resourcePolicy",
  }
end

Instance Method Details

#to_jsiiObject



1737
1738
1739
1740
1741
1742
1743
1744
# File 'dynamo_db/cfn_table.rb', line 1737

def to_jsii
  result = {}
  result.merge!({
    "streamViewType" => @stream_view_type,
    "resourcePolicy" => @resource_policy,
  })
  result.compact
end