Class: AWSCDK::Tokenization
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::Tokenization
- Defined in:
- tokenization.rb
Overview
Less oft-needed functions to manipulate Tokens.
Class Method Summary collapse
-
.is_resolvable(obj) ⇒ Boolean
Return whether the given object is an IResolvable object.
- .jsii_overridable_methods ⇒ Object
-
.resolve(obj, options) ⇒ Object
Resolves an object by evaluating all tokens and removing any undefined or empty objects or arrays.
-
.reverse(x, options = nil) ⇒ AWSCDK::IResolvable?
Reverse any value into a Resolvable, if possible.
-
.reverse_complete_string(s) ⇒ AWSCDK::IResolvable?
Un-encode a string which is either a complete encoded token, or doesn't contain tokens at all.
-
.reverse_list(l) ⇒ AWSCDK::IResolvable?
Un-encode a Tokenized value from a list.
-
.reverse_number(n) ⇒ AWSCDK::IResolvable?
Un-encode a Tokenized value from a number.
-
.reverse_string(s) ⇒ AWSCDK::TokenizedStringFragments
Un-encode a string potentially containing encoded tokens.
-
.stringify_number(x) ⇒ String
Stringify a number directly or lazily if it's a Token.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Tokenization
constructor
A new instance of Tokenization.
Constructor Details
#initialize(*args) ⇒ Tokenization
Returns a new instance of Tokenization.
8 9 10 |
# File 'tokenization.rb', line 8 def initialize(*args) raise NoMethodError, "aws-cdk-lib.Tokenization does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.is_resolvable(obj) ⇒ Boolean
Return whether the given object is an IResolvable object.
This is different from Token.isUnresolved() which will also check for encoded Tokens, whereas this method will only do a type check on the given object.
25 26 27 28 |
# File 'tokenization.rb', line 25 def self.is_resolvable(obj) Jsii::Type.check_type(obj, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "obj") Jsii::Kernel.instance.call_static("aws-cdk-lib.Tokenization", "isResolvable", [obj]) end |
.jsii_overridable_methods ⇒ Object
12 13 14 15 |
# File 'tokenization.rb', line 12 def self.jsii_overridable_methods { } end |
.resolve(obj, options) ⇒ Object
Resolves an object by evaluating all tokens and removing any undefined or empty objects or arrays.
Values can only be primitives, arrays or tokens. Other objects (i.e. with methods) will be rejected.
37 38 39 40 41 42 |
# File 'tokenization.rb', line 37 def self.resolve(obj, ) Jsii::Type.check_type(obj, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "obj") = .is_a?(Hash) ? ::AWSCDK::ResolveOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZXNvbHZlT3B0aW9ucyJ9")), "options") Jsii::Kernel.instance.call_static("aws-cdk-lib.Tokenization", "resolve", [obj, ]) end |
.reverse(x, options = nil) ⇒ AWSCDK::IResolvable?
Reverse any value into a Resolvable, if possible.
In case of a string, the string must not be a concatenation.
51 52 53 54 55 56 |
# File 'tokenization.rb', line 51 def self.reverse(x, = nil) Jsii::Type.check_type(x, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "x") = .is_a?(Hash) ? ::AWSCDK::ReverseOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZXZlcnNlT3B0aW9ucyJ9")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.Tokenization", "reverse", [x, ]) end |
.reverse_complete_string(s) ⇒ AWSCDK::IResolvable?
Un-encode a string which is either a complete encoded token, or doesn't contain tokens at all.
It's illegal for the string to be a concatenation of an encoded token and something else.
64 65 66 67 |
# File 'tokenization.rb', line 64 def self.reverse_complete_string(s) Jsii::Type.check_type(s, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s") Jsii::Kernel.instance.call_static("aws-cdk-lib.Tokenization", "reverseCompleteString", [s]) end |
.reverse_list(l) ⇒ AWSCDK::IResolvable?
Un-encode a Tokenized value from a list.
73 74 75 76 |
# File 'tokenization.rb', line 73 def self.reverse_list(l) Jsii::Type.check_type(l, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "l") Jsii::Kernel.instance.call_static("aws-cdk-lib.Tokenization", "reverseList", [l]) end |
.reverse_number(n) ⇒ AWSCDK::IResolvable?
Un-encode a Tokenized value from a number.
82 83 84 85 |
# File 'tokenization.rb', line 82 def self.reverse_number(n) Jsii::Type.check_type(n, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "n") Jsii::Kernel.instance.call_static("aws-cdk-lib.Tokenization", "reverseNumber", [n]) end |
.reverse_string(s) ⇒ AWSCDK::TokenizedStringFragments
Un-encode a string potentially containing encoded tokens.
91 92 93 94 |
# File 'tokenization.rb', line 91 def self.reverse_string(s) Jsii::Type.check_type(s, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s") Jsii::Kernel.instance.call_static("aws-cdk-lib.Tokenization", "reverseString", [s]) end |
.stringify_number(x) ⇒ String
Stringify a number directly or lazily if it's a Token.
If it is an object (i.e., { Ref: 'SomeLogicalId' }), return it as-is.
102 103 104 105 |
# File 'tokenization.rb', line 102 def self.stringify_number(x) Jsii::Type.check_type(x, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "x") Jsii::Kernel.instance.call_static("aws-cdk-lib.Tokenization", "stringifyNumber", [x]) end |