Class: AWSCDK::DynamoDB::TableGrants

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

Overview

A set of permissions to grant on a Table.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(props) ⇒ TableGrants

Returns a new instance of TableGrants.



9
10
11
12
13
# File 'dynamo_db/table_grants.rb', line 9

def initialize(props)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::TableGrantsProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuVGFibGVHcmFudHNQcm9wcyJ9")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(props)
end

Class Method Details

.from_table(table, regions = nil, has_index = nil) ⇒ AWSCDK::DynamoDB::TableGrants

Creates a TableGrants object for a given table.

Parameters:

Returns:

  • (AWSCDK::DynamoDB::TableGrants)


33
34
35
36
37
38
# File 'dynamo_db/table_grants.rb', line 33

def self.from_table(table, regions = nil, has_index = nil)
  Jsii::Type.check_type(table, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19keW5hbW9kYi5JVGFibGVSZWYifQ==")), "table")
  Jsii::Type.check_type(regions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "regions") unless regions.nil?
  Jsii::Type.check_type(has_index, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "hasIndex") unless has_index.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_dynamodb.TableGrants", "fromTable", [table, regions, has_index])
end

.jsii_overridable_methodsObject



15
16
17
18
19
20
21
22
23
24
25
# File 'dynamo_db/table_grants.rb', line 15

def self.jsii_overridable_methods
  {
    :actions => { kind: :method, name: "actions", is_optional: false },
    :full_access => { kind: :method, name: "fullAccess", is_optional: false },
    :multi_account_replication_from => { kind: :method, name: "multiAccountReplicationFrom", is_optional: false },
    :multi_account_replication_to => { kind: :method, name: "multiAccountReplicationTo", is_optional: false },
    :read_data => { kind: :method, name: "readData", is_optional: false },
    :read_write_data => { kind: :method, name: "readWriteData", is_optional: false },
    :write_data => { kind: :method, name: "writeData", is_optional: false },
  }
end

Instance Method Details

#actions(grantee, *actions) ⇒ AWSCDK::IAM::Grant

Adds an IAM policy statement associated with this table to an IAM principal's policy.

If encryption_key is present, appropriate grants to the key needs to be added separately using the table.encryptionKey.grant* methods.

Parameters:

  • grantee (AWSCDK::IAM::IGrantable)

    The principal (no-op if undefined).

  • actions (Array<String>)

    The set of actions to allow (i.e. "dynamodb:PutItem", "dynamodb:GetItem", ...).

Returns:



48
49
50
51
52
53
54
# File 'dynamo_db/table_grants.rb', line 48

def actions(grantee, *actions)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  actions.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actions[#{index}]")
  end
  jsii_call_method("actions", [grantee, *actions])
end

#full_access(grantee) ⇒ AWSCDK::IAM::Grant

Permits all DynamoDB operations ("dynamodb:*") to an IAM principal.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

Parameters:

Returns:



63
64
65
66
# File 'dynamo_db/table_grants.rb', line 63

def full_access(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("fullAccess", [grantee])
end

#multi_account_replication_from(source_replica_arn) ⇒ void

This method returns an undefined value.

Grants permissions for this table to act as a destination for multi-account global table replication.

Parameters:

  • source_replica_arn (String)

    The ARN of the source replica table in the other account.



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

def (source_replica_arn)
  Jsii::Type.check_type(source_replica_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sourceReplicaArn")
  jsii_call_method("multiAccountReplicationFrom", [source_replica_arn])
end

#multi_account_replication_to(destination_replica_arn) ⇒ void

This method returns an undefined value.

Grants permissions for this table to act as a source for multi-account global table replication.

Parameters:

  • destination_replica_arn (String)

    The ARN of the destination replica table in the other account.



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

def (destination_replica_arn)
  Jsii::Type.check_type(destination_replica_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "destinationReplicaArn")
  jsii_call_method("multiAccountReplicationTo", [destination_replica_arn])
end

#read_data(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal all data read operations from this table: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, DescribeTable.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

Parameters:

Returns:



93
94
95
96
# File 'dynamo_db/table_grants.rb', line 93

def read_data(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("readData", [grantee])
end

#read_write_data(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal to all data read/write operations to this table.

BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

Parameters:

Returns:



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

def read_write_data(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("readWriteData", [grantee])
end

#write_data(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal all data write operations to this table: BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

Parameters:

Returns:



120
121
122
123
# File 'dynamo_db/table_grants.rb', line 120

def write_data(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("writeData", [grantee])
end