Class: AWSCDK::CustomResourceProviderBase

Inherits:
Constructs::Construct
  • Object
show all
Defined in:
custom_resource_provider_base.rb

Overview

Base class for creating a custom resource provider.

Direct Known Subclasses

CustomResourceProvider

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ CustomResourceProviderBase

Returns a new instance of CustomResourceProviderBase.

Parameters:



11
12
13
14
15
16
17
# File 'custom_resource_provider_base.rb', line 11

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::CustomResourceProviderBaseProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DdXN0b21SZXNvdXJjZVByb3ZpZGVyQmFzZVByb3BzIn0=")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.jsii_overridable_methodsObject



19
20
21
22
23
24
25
26
27
28
29
# File 'custom_resource_provider_base.rb', line 19

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :code_hash => { kind: :property, name: "codeHash", is_optional: false },
    :role_arn => { kind: :property, name: "roleArn", is_optional: false },
    :service_token => { kind: :property, name: "serviceToken", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :add_to_role_policy => { kind: :method, name: "addToRolePolicy", is_optional: false },
  }
end

Instance Method Details

#add_to_role_policy(statement) ⇒ void

This method returns an undefined value.

Add an IAM policy statement to the inline policy of the provider's lambda function's role.

Please note: this is a direct IAM JSON policy blob, not a iam.PolicyStatement object like you will see in the rest of the CDK.

Examples:

my_provider = nil # AWSCDK::CustomResourceProvider

my_provider.add_to_role_policy({
    Effect: "Allow",
    Action: "s3:GetObject",
    Resource: "*",
})

Parameters:

  • statement (Object)


101
102
103
104
# File 'custom_resource_provider_base.rb', line 101

def add_to_role_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "statement")
  jsii_call_method("addToRolePolicy", [statement])
end

#code_hashString

The hash of the lambda code backing this provider.

Can be used to trigger updates on code changes, even when the properties of a custom resource remain unchanged.

Returns:

  • (String)


44
45
46
# File 'custom_resource_provider_base.rb', line 44

def code_hash()
  jsii_get_property("codeHash")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


34
35
36
# File 'custom_resource_provider_base.rb', line 34

def node()
  jsii_get_property("node")
end

#role_arnString

The ARN of the provider's AWS Lambda function role.

Returns:

  • (String)


51
52
53
# File 'custom_resource_provider_base.rb', line 51

def role_arn()
  jsii_get_property("roleArn")
end

#service_tokenString

The ARN of the provider's AWS Lambda function which should be used as the serviceToken when defining a custom resource.

Returns:

  • (String)


58
59
60
# File 'custom_resource_provider_base.rb', line 58

def service_token()
  jsii_get_property("serviceToken")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


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

def to_string()
  jsii_call_method("toString", [])
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



78
79
80
81
82
83
# File 'custom_resource_provider_base.rb', line 78

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end