Class: AWSCDK::CustomResourceProviderOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
custom_resource_provider_options.rb

Overview

Initialization options for custom resource providers.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description: nil, environment: nil, memory_size: nil, policy_statements: nil, timeout: nil, use_cfn_response_wrapper: nil) ⇒ CustomResourceProviderOptions

Returns a new instance of CustomResourceProviderOptions.

Parameters:

  • description (String, nil) (defaults to: nil)

    A description of the function.

  • environment (Hash{String => String}, nil) (defaults to: nil)

    Key-value pairs that are passed to Lambda as Environment.

  • memory_size (AWSCDK::Size, nil) (defaults to: nil)

    The amount of memory that your function has access to.

  • policy_statements (Array<Object>, nil) (defaults to: nil)

    A set of IAM policy statements to include in the inline policy of the provider's lambda function.

  • timeout (AWSCDK::Duration, nil) (defaults to: nil)

    AWS Lambda timeout for the provider.

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

    Whether or not the cloudformation response wrapper (nodejs-entrypoint.ts) is used. If set to true, nodejs-entrypoint.js is bundled in the same asset as the custom resource and set as the entrypoint. If set to false, the custom resource provided is the entrypoint.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'custom_resource_provider_options.rb', line 13

def initialize(description: nil, environment: nil, memory_size: nil, policy_statements: nil, timeout: nil, use_cfn_response_wrapper: nil)
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @environment = environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "environment") unless @environment.nil?
  @memory_size = memory_size
  Jsii::Type.check_type(@memory_size, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "memorySize") unless @memory_size.nil?
  @policy_statements = policy_statements
  Jsii::Type.check_type(@policy_statements, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoiYXJyYXkifX0=")), "policyStatements") unless @policy_statements.nil?
  @timeout = timeout
  Jsii::Type.check_type(@timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "timeout") unless @timeout.nil?
  @use_cfn_response_wrapper = use_cfn_response_wrapper
  Jsii::Type.check_type(@use_cfn_response_wrapper, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "useCfnResponseWrapper") unless @use_cfn_response_wrapper.nil?
end

Instance Attribute Details

#descriptionString? (readonly)

Note:

Default: - No description.

A description of the function.

Returns:

  • (String, nil)


32
33
34
# File 'custom_resource_provider_options.rb', line 32

def description
  @description
end

#environmentHash{String => String}? (readonly)

Note:

Default: - No environment variables.

Key-value pairs that are passed to Lambda as Environment.

Returns:

  • (Hash{String => String}, nil)


37
38
39
# File 'custom_resource_provider_options.rb', line 37

def environment
  @environment
end

#memory_sizeAWSCDK::Size? (readonly)

Note:

Default: Size.mebibytes(128)

The amount of memory that your function has access to.

Increasing the function's memory also increases its CPU allocation.

Returns:



45
46
47
# File 'custom_resource_provider_options.rb', line 45

def memory_size
  @memory_size
end

#policy_statementsArray<Object>? (readonly)

Note:

Default: - no additional inline policy

A set of IAM policy statements to include in the inline policy of the provider's lambda function.

Please note: these are direct IAM JSON policy blobs, not iam.PolicyStatement objects like you will see in the rest of the CDK.

Examples:

provider = AWSCDK::CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType", {
    code_directory: "#{__dirname}/my-handler",
    runtime: AWSCDK::CustomResourceProviderRuntime::NODEJS_18_X,
    policy_statements: [
        {
            Effect: "Allow",
            Action: "s3:PutObject*",
            Resource: "*",
        },
    ],
})

Returns:

  • (Array<Object>, nil)


65
66
67
# File 'custom_resource_provider_options.rb', line 65

def policy_statements
  @policy_statements
end

#timeoutAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(15)

AWS Lambda timeout for the provider.

Returns:



70
71
72
# File 'custom_resource_provider_options.rb', line 70

def timeout
  @timeout
end

#use_cfn_response_wrapperBoolean? (readonly)

Note:

Default: - true if inlineCode: false and false otherwise.

Whether or not the cloudformation response wrapper (nodejs-entrypoint.ts) is used. If set to true, nodejs-entrypoint.js is bundled in the same asset as the custom resource and set as the entrypoint. If set to false, the custom resource provided is the entrypoint.

Returns:

  • (Boolean, nil)


75
76
77
# File 'custom_resource_provider_options.rb', line 75

def use_cfn_response_wrapper
  @use_cfn_response_wrapper
end

Class Method Details

.jsii_propertiesObject



77
78
79
80
81
82
83
84
85
86
# File 'custom_resource_provider_options.rb', line 77

def self.jsii_properties
  {
    :description => "description",
    :environment => "environment",
    :memory_size => "memorySize",
    :policy_statements => "policyStatements",
    :timeout => "timeout",
    :use_cfn_response_wrapper => "useCfnResponseWrapper",
  }
end

Instance Method Details

#to_jsiiObject



88
89
90
91
92
93
94
95
96
97
98
99
# File 'custom_resource_provider_options.rb', line 88

def to_jsii
  result = {}
  result.merge!({
    "description" => @description,
    "environment" => @environment,
    "memorySize" => @memory_size,
    "policyStatements" => @policy_statements,
    "timeout" => @timeout,
    "useCfnResponseWrapper" => @use_cfn_response_wrapper,
  })
  result.compact
end