Class: AWSCDK::CustomResources::AWSCustomResourcePolicy

Inherits:
Jsii::Object
  • Object
show all
Defined in:
custom_resources/aws_custom_resource_policy.rb

Overview

The IAM Policy that will be applied to the different calls.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AWSCustomResourcePolicy

Returns a new instance of AWSCustomResourcePolicy.

Raises:

  • (NoMethodError)


8
9
10
# File 'custom_resources/aws_custom_resource_policy.rb', line 8

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

Class Method Details

.ANY_RESOURCEArray<String>

Use this constant to configure access to any resource.

Returns:

  • (Array<String>)


50
51
52
# File 'custom_resources/aws_custom_resource_policy.rb', line 50

def self.ANY_RESOURCE()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.custom_resources.AwsCustomResourcePolicy", "ANY_RESOURCE")
end

.from_sdk_calls(options) ⇒ AWSCDK::CustomResources::AWSCustomResourcePolicy

Generate IAM Policy Statements from the configured SDK calls.

Each SDK call with be translated to an IAM Policy Statement in the form of: call.service:call.action (e.g s3:PutObject).

This policy generator assumes the IAM policy name has the same name as the API call. This is true in 99% of cases, but there are exceptions (for example, S3's PutBucketLifecycleConfiguration requires s3:PutLifecycleConfiguration permissions, Lambda's Invoke requires lambda:InvokeFunction permissions). Use from_statements if you want to do a call that requires different IAM action names.

Parameters:

Returns:

  • (AWSCDK::CustomResources::AWSCustomResourcePolicy)


32
33
34
35
36
# File 'custom_resources/aws_custom_resource_policy.rb', line 32

def self.from_sdk_calls(options)
  options = options.is_a?(Hash) ? ::AWSCDK::CustomResources::SdkCallsPolicyOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jdXN0b21fcmVzb3VyY2VzLlNka0NhbGxzUG9saWN5T3B0aW9ucyJ9")), "options")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.custom_resources.AwsCustomResourcePolicy", "fromSdkCalls", [options])
end

.from_statements(statements) ⇒ AWSCDK::CustomResources::AWSCustomResourcePolicy

Explicit IAM Policy Statements.

Parameters:

Returns:

  • (AWSCDK::CustomResources::AWSCustomResourcePolicy)


42
43
44
45
# File 'custom_resources/aws_custom_resource_policy.rb', line 42

def self.from_statements(statements)
  Jsii::Type.check_type(statements, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uUG9saWN5U3RhdGVtZW50In0sImtpbmQiOiJhcnJheSJ9fQ==")), "statements")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.custom_resources.AwsCustomResourcePolicy", "fromStatements", [statements])
end

.jsii_overridable_methodsObject



12
13
14
15
16
17
# File 'custom_resources/aws_custom_resource_policy.rb', line 12

def self.jsii_overridable_methods
  {
    :statements => { kind: :property, name: "statements", is_optional: false },
    :resources => { kind: :property, name: "resources", is_optional: true },
  }
end

Instance Method Details

#resourcesArray<String>?

resources for auto-generated from SDK calls.

Returns:

  • (Array<String>, nil)


64
65
66
# File 'custom_resources/aws_custom_resource_policy.rb', line 64

def resources()
  jsii_get_property("resources")
end

#statementsArray<AWSCDK::IAM::PolicyStatement>

statements for explicit policy.

Returns:



57
58
59
# File 'custom_resources/aws_custom_resource_policy.rb', line 57

def statements()
  jsii_get_property("statements")
end