Class: AWSCDK::Reference

Inherits:
Intrinsic
  • Object
show all
Defined in:
reference.rb

Overview

An intrinsic Token that represents a reference to a construct.

References are recorded.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, target, display_name = nil, type_hint = nil) ⇒ Reference

Returns a new instance of Reference.

Parameters:

  • value (Object)
  • target (Constructs::IConstruct)
  • display_name (String, nil) (defaults to: nil)
  • type_hint (AWSCDK::ResolutionTypeHint, nil) (defaults to: nil)

    Type that the Intrinsic is expected to evaluate to.



14
15
16
17
18
19
20
# File 'reference.rb', line 14

def initialize(value, target, display_name = nil, type_hint = nil)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklDb25zdHJ1Y3QifQ==")), "target")
  Jsii::Type.check_type(display_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "displayName") unless display_name.nil?
  Jsii::Type.check_type(type_hint, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZXNvbHV0aW9uVHlwZUhpbnQifQ==")), "typeHint") unless type_hint.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(value, target, display_name, type_hint)
end

Class Method Details

.is_reference(x) ⇒ Boolean

Check whether this is actually a Reference.

Parameters:

  • x (Object)

Returns:

  • (Boolean)


40
41
42
43
# File 'reference.rb', line 40

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

.jsii_overridable_methodsObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'reference.rb', line 22

def self.jsii_overridable_methods
  {
    :creation_stack => { kind: :property, name: "creationStack", is_optional: false },
    :type_hint => { kind: :property, name: "typeHint", is_optional: true },
    :display_name => { kind: :property, name: "displayName", is_optional: false },
    :target => { kind: :property, name: "target", is_optional: false },
    :new_error => { kind: :method, name: "newError", is_optional: false },
    :resolve => { kind: :method, name: "resolve", is_optional: false },
    :to_json => { kind: :method, name: "toJSON", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :to_string_list => { kind: :method, name: "toStringList", is_optional: false },
  }
end

Instance Method Details

#creation_stackArray<String>

The captured stack trace which represents the location in which this token was created.

Returns:

  • (Array<String>)


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

def creation_stack()
  jsii_get_property("creationStack")
end

#display_nameString

Returns:

  • (String)


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

def display_name()
  jsii_get_property("displayName")
end

#new_error(message) ⇒ Object

Creates a throwable Error object that contains the token creation stack trace.

Parameters:

  • message (String)

    Error message.

Returns:

  • (Object)


73
74
75
76
# File 'reference.rb', line 73

def new_error(message)
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message")
  jsii_call_method("newError", [message])
end

#resolve(_context) ⇒ Object

Produce the Token's value at resolution time.

Parameters:

Returns:

  • (Object)


82
83
84
85
# File 'reference.rb', line 82

def resolve(_context)
  Jsii::Type.check_type(_context, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JUmVzb2x2ZUNvbnRleHQifQ==")), "_context")
  jsii_call_method("resolve", [_context])
end

#targetConstructs::IConstruct

Returns:

  • (Constructs::IConstruct)


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

def target()
  jsii_get_property("target")
end

#to_jsonObject

Turn this Token into JSON.

Called automatically when JSON.stringify() is called on a Token.

Returns:

  • (Object)


92
93
94
# File 'reference.rb', line 92

def to_json()
  jsii_call_method("toJSON", [])
end

#to_stringString

Convert an instance of this Token to a string.

This method will be called implicitly by language runtimes if the object is embedded into a string. We treat it the same as an explicit stringification.

Returns:

  • (String)


103
104
105
# File 'reference.rb', line 103

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

#to_string_listArray<String>

Convert an instance of this Token to a string list.

This method will be called implicitly by language runtimes if the object is embedded into a list. We treat it the same as an explicit stringification.

Returns:

  • (Array<String>)


114
115
116
# File 'reference.rb', line 114

def to_string_list()
  jsii_call_method("toStringList", [])
end

#type_hintAWSCDK::ResolutionTypeHint?

Type that the Intrinsic is expected to evaluate to.

Returns:



55
56
57
# File 'reference.rb', line 55

def type_hint()
  jsii_get_property("typeHint")
end