Class: AWSCDK::CfnElement

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

Overview

An element of a CloudFormation stack.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id) ⇒ CfnElement

Creates an entity and binds it to a tree.

Note that the root of the tree must be a Stack object (not just any Root).

Parameters:

  • scope (Constructs::Construct)

    The parent construct.

  • id (String)


14
15
16
17
18
# File 'cfn_element.rb', line 14

def initialize(scope, id)
  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::Object.instance_method(:initialize).bind(self).call(scope, id)
end

Class Method Details

.is_cfn_element(x) ⇒ Boolean

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters:

  • x (Object)

Returns:

  • (Boolean)

    The construct as a stack element or undefined if it is not a stack element.



39
40
41
42
# File 'cfn_element.rb', line 39

def self.is_cfn_element(x)
  Jsii::Type.check_type(x, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "x")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.CfnElement", "isCfnElement", [x])
end

.jsii_overridable_methodsObject



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

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :creation_stack => { kind: :property, name: "creationStack", is_optional: false },
    :logical_id => { kind: :property, name: "logicalId", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :override_logical_id => { kind: :method, name: "overrideLogicalId", is_optional: false },
  }
end

Instance Method Details

#creation_stackArray<String>

Returns:

  • (Array<String>)


52
53
54
# File 'cfn_element.rb', line 52

def creation_stack()
  jsii_get_property("creationStack")
end

#logical_idString

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use override_logical_id(new_logical_id).

Returns:

  • (String)


64
65
66
# File 'cfn_element.rb', line 64

def logical_id()
  jsii_get_property("logicalId")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


47
48
49
# File 'cfn_element.rb', line 47

def node()
  jsii_get_property("node")
end

#override_logical_id(new_logical_id) ⇒ void

This method returns an undefined value.

Overrides the auto-generated logical ID with a specific ID.

Parameters:

  • new_logical_id (String)

    The new logical ID to use for this stack element.



104
105
106
107
# File 'cfn_element.rb', line 104

def override_logical_id(new_logical_id)
  Jsii::Type.check_type(new_logical_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "newLogicalId")
  jsii_call_method("overrideLogicalId", [new_logical_id])
end

#stackAWSCDK::Stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Returns:



73
74
75
# File 'cfn_element.rb', line 73

def stack()
  jsii_get_property("stack")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


80
81
82
# File 'cfn_element.rb', line 80

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>)

Returns:

  • (Constructs::IConstruct)


93
94
95
96
97
98
# File 'cfn_element.rb', line 93

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