class Tokenization
Language | Type name |
---|---|
.NET | Amazon.CDK.Tokenization |
Go | github.com/aws/aws-cdk-go/awscdk/v2#Tokenization |
Java | software.amazon.awscdk.Tokenization |
Python | aws_cdk.Tokenization |
TypeScript (source) | aws-cdk-lib » Tokenization |
Less oft-needed functions to manipulate Tokens.
Methods
Name | Description |
---|---|
static is | Return whether the given object is an IResolvable object. |
static resolve(obj, options) | Resolves an object by evaluating all tokens and removing any undefined or empty objects or arrays. |
static reverse(x, options?) | Reverse any value into a Resolvable, if possible. |
static reverse | Un-encode a string which is either a complete encoded token, or doesn't contain tokens at all. |
static reverse | Un-encode a Tokenized value from a list. |
static reverse | Un-encode a Tokenized value from a number. |
static reverse | Un-encode a string potentially containing encoded tokens. |
static stringify | Stringify a number directly or lazily if it's a Token. |
static isResolvable(obj)
public static isResolvable(obj: any): boolean
Parameters
- obj
any
Returns
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.
static resolve(obj, options)
public static resolve(obj: any, options: ResolveOptions): any
Parameters
- obj
any
— The object to resolve. - options
Resolve
— Prefix key path components for diagnostics.Options
Returns
any
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.
static reverse(x, options?)
public static reverse(x: any, options?: ReverseOptions): IResolvable
Parameters
- x
any
- options
Reverse
Options
Returns
Reverse any value into a Resolvable, if possible.
In case of a string, the string must not be a concatenation.
static reverseCompleteString(s)
public static reverseCompleteString(s: string): IResolvable
Parameters
- s
string
Returns
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.
static reverseList(l)
public static reverseList(l: string[]): IResolvable
Parameters
- l
string[]
Returns
Un-encode a Tokenized value from a list.
static reverseNumber(n)
public static reverseNumber(n: number): IResolvable
Parameters
- n
number
Returns
Un-encode a Tokenized value from a number.
static reverseString(s)
public static reverseString(s: string): TokenizedStringFragments
Parameters
- s
string
Returns
Un-encode a string potentially containing encoded tokens.
static stringifyNumber(x)
public static stringifyNumber(x: number): string
Parameters
- x
number
Returns
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.