Class: AWSCDK::Token

Inherits:
Jsii::Object
  • Object
show all
Defined in:
token.rb

Overview

Represents a special or lazily-evaluated value.

Can be used to delay evaluation of a certain value in case, for example, that it requires some context or late-bound data. Can also be used to mark values that need special processing at document rendering time.

Tokens can be embedded into strings while retaining their original semantics.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Token

Returns a new instance of Token.

Raises:

  • (NoMethodError)


15
16
17
# File 'token.rb', line 15

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.Token does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.as_any(value) ⇒ AWSCDK::IResolvable

Return a resolvable representation of the given value.

Parameters:

  • value (Object)

Returns:



28
29
30
31
# File 'token.rb', line 28

def self.as_any(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "asAny", [value])
end

.as_list(value, options = nil) ⇒ Array<String>

Return a reversible list representation of this token.

Parameters:

Returns:

  • (Array<String>)


38
39
40
41
42
43
# File 'token.rb', line 38

def self.as_list(value, options = nil)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  options = options.is_a?(Hash) ? ::AWSCDK::EncodingOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5FbmNvZGluZ09wdGlvbnMifQ==")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "asList", [value, options])
end

.as_number(value) ⇒ Numeric

Return a reversible number representation of this token.

Parameters:

  • value (Object)

Returns:

  • (Numeric)


49
50
51
52
# File 'token.rb', line 49

def self.as_number(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "asNumber", [value])
end

.as_string(value, options = nil) ⇒ String

Return a reversible string representation of this token.

If the Token is initialized with a literal, the stringified value of the literal is returned. Otherwise, a special quoted string representation of the Token is returned that can be embedded into other strings.

Strings with quoted Tokens in them can be restored back into complex values with the Tokens restored by calling resolve() on the string.

Parameters:

Returns:

  • (String)


67
68
69
70
71
72
# File 'token.rb', line 67

def self.as_string(value, options = nil)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  options = options.is_a?(Hash) ? ::AWSCDK::EncodingOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5FbmNvZGluZ09wdGlvbnMifQ==")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "asString", [value, options])
end

.compare_strings(possible_token1, possible_token2) ⇒ AWSCDK::TokenComparison

Compare two strings that might contain Tokens with each other.

Parameters:

  • possible_token1 (String)
  • possible_token2 (String)

Returns:



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

def self.compare_strings(possible_token1, possible_token2)
  Jsii::Type.check_type(possible_token1, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "possibleToken1")
  Jsii::Type.check_type(possible_token2, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "possibleToken2")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "compareStrings", [possible_token1, possible_token2])
end

.is_resolved(obj) ⇒ Boolean

The negation of Token.isUnresolved(). In TypeScript, narrows the type to exclude IResolvable.

Parameters:

  • obj (Object)

    The object to test.

Returns:

  • (Boolean)


89
90
91
92
# File 'token.rb', line 89

def self.is_resolved(obj)
  Jsii::Type.check_type(obj, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "obj")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "isResolved", [obj])
end

.is_unresolved(obj) ⇒ Boolean

Returns true if obj represents an unresolved value.

One of these must be true:

  • obj is an IResolvable
  • obj is a string containing at least one encoded IResolvable
  • obj is either an encoded number or list

This does NOT recurse into lists or objects to see if they contain resolvables.

Parameters:

  • obj (Object)

    The object to test.

Returns:

  • (Boolean)


107
108
109
110
# File 'token.rb', line 107

def self.is_unresolved(obj)
  Jsii::Type.check_type(obj, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "obj")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Token", "isUnresolved", [obj])
end

.jsii_overridable_methodsObject



19
20
21
22
# File 'token.rb', line 19

def self.jsii_overridable_methods
  {
  }
end