Class: AWSCDK::SQS::QueueGrants

Inherits:
Jsii::Object
  • Object
show all
Defined in:
sqs/queue_grants.rb

Overview

Collection of grant methods for a IQueueRef.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ QueueGrants

Returns a new instance of QueueGrants.

Raises:

  • (NoMethodError)


8
9
10
# File 'sqs/queue_grants.rb', line 8

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.aws_sqs.QueueGrants does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.from_queue(resource) ⇒ AWSCDK::SQS::QueueGrants

Creates grants for QueueGrants.

Parameters:

Returns:

  • (AWSCDK::SQS::QueueGrants)


28
29
30
31
# File 'sqs/queue_grants.rb', line 28

def self.from_queue(resource)
  Jsii::Type.check_type(resource, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19zcXMuSVF1ZXVlUmVmIn0=")), "resource")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_sqs.QueueGrants", "fromQueue", [resource])
end

.jsii_overridable_methodsObject



12
13
14
15
16
17
18
19
20
21
22
# File 'sqs/queue_grants.rb', line 12

def self.jsii_overridable_methods
  {
    :resource => { kind: :property, name: "resource", is_optional: false },
    :encrypted_resource => { kind: :property, name: "encryptedResource", is_optional: true },
    :policy_resource => { kind: :property, name: "policyResource", is_optional: true },
    :actions => { kind: :method, name: "actions", is_optional: false },
    :consume_messages => { kind: :method, name: "consumeMessages", is_optional: false },
    :purge => { kind: :method, name: "purge", is_optional: false },
    :send_messages => { kind: :method, name: "sendMessages", is_optional: false },
  }
end

Instance Method Details

#actions(grantee, actions, options = nil) ⇒ AWSCDK::IAM::Grant

Grant the given identity custom permissions.

Parameters:

Returns:



54
55
56
57
58
59
60
# File 'sqs/queue_grants.rb', line 54

def actions(grantee, actions, options = nil)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  Jsii::Type.check_type(actions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "actions")
  options = options.is_a?(Hash) ? ::AWSCDK::EncryptedPermissionsOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5FbmNyeXB0ZWRQZXJtaXNzaW9uc09wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("actions", [grantee, actions, options])
end

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

Grant permissions to consume messages from a queue.

This will grant the following permissions:

  • sqs:ChangeMessageVisibility
  • sqs:DeleteMessage
  • sqs:ReceiveMessage
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl

If encryption is used, permission to use the key to decrypt the contents of the queue will also be granted to the same principal.

This will grant the following KMS permissions:

  • kms:Decrypt

Parameters:

Returns:



80
81
82
83
# File 'sqs/queue_grants.rb', line 80

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

#encrypted_resourceAWSCDK::IAM::IEncryptedResource?



39
40
41
# File 'sqs/queue_grants.rb', line 39

def encrypted_resource()
  jsii_get_property("encryptedResource")
end

#policy_resourceAWSCDK::IAM::IResourceWithPolicyV2?



44
45
46
# File 'sqs/queue_grants.rb', line 44

def policy_resource()
  jsii_get_property("policyResource")
end

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

Grants purge permissions.

Parameters:

Returns:



89
90
91
92
# File 'sqs/queue_grants.rb', line 89

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

#resourceAWSCDK::Interfaces::AWSSQS::IQueueRef



34
35
36
# File 'sqs/queue_grants.rb', line 34

def resource()
  jsii_get_property("resource")
end

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

Grant access to send messages to a queue to the given identity.

This will grant the following permissions:

  • sqs:SendMessage
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl

If encryption is used, permission to use the key to encrypt/decrypt the contents of the queue will also be granted to the same principal.

This will grant the following KMS permissions:

  • kms:Decrypt
  • kms:Encrypt
  • kms:ReEncrypt*
  • kms:GenerateDataKey*

Parameters:

Returns:



113
114
115
116
# File 'sqs/queue_grants.rb', line 113

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