Class: AWSCDK::CfnRefElement

Inherits:
CfnElement
  • Object
show all
Defined in:
cfn_ref_element.rb

Overview

Base class for referenceable CloudFormation constructs which are not Resources.

These constructs are things like Conditions and Parameters, can be referenced by taking the .ref attribute.

Resource constructs do not inherit from CfnRefElement because they have their own, more specific types returned from the .ref attribute. Also, some resources aren't referenceable at all (such as BucketPolicies or GatewayAttachments).

Direct Known Subclasses

CfnMapping, CfnResource, CfnRule

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id) ⇒ CfnRefElement

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)


21
22
23
24
25
# File 'cfn_ref_element.rb', line 21

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

.jsii_overridable_methodsObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'cfn_ref_element.rb', line 27

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 },
    :ref => { kind: :property, name: "ref", 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>)


48
49
50
# File 'cfn_ref_element.rb', line 48

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)


60
61
62
# File 'cfn_ref_element.rb', line 60

def logical_id()
  jsii_get_property("logicalId")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


43
44
45
# File 'cfn_ref_element.rb', line 43

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.



110
111
112
113
# File 'cfn_ref_element.rb', line 110

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

#refString

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

Returns:

  • (String)


79
80
81
# File 'cfn_ref_element.rb', line 79

def ref()
  jsii_get_property("ref")
end

#stackAWSCDK::Stack

The stack in which this element is defined.

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

Returns:



69
70
71
# File 'cfn_ref_element.rb', line 69

def stack()
  jsii_get_property("stack")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


86
87
88
# File 'cfn_ref_element.rb', line 86

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)


99
100
101
102
103
104
# File 'cfn_ref_element.rb', line 99

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