Tokenization¶
-
class
aws_cdk.core.
Tokenization
(*args, **kwargs)¶ Bases:
object
Less oft-needed functions to manipulate Tokens.
Static Methods
-
classmethod
is_resolvable
(obj)¶ 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.
- Parameters
obj (
Any
) –- Return type
bool
-
classmethod
resolve
(obj, *, resolver, scope, preparing=None)¶ 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.
- Parameters
obj (
Any
) – The object to resolve.resolver (
ITokenResolver
) – The resolver to apply to any resolvable tokens found.scope (
IConstruct
) – The scope from which resolution is performed.preparing (
Optional
[bool
]) – Whether the resolution is being executed during the prepare phase or not. Default: false
- Return type
Any
-
classmethod
reverse_list
(l)¶ Un-encode a Tokenized value from a list.
- Parameters
l (
List
[str
]) –- Return type
Optional
[IResolvable
]
-
classmethod
reverse_number
(n)¶ Un-encode a Tokenized value from a number.
- Parameters
n (
Union
[int
,float
]) –- Return type
Optional
[IResolvable
]
-
classmethod
reverse_string
(s)¶ Un-encode a string potentially containing encoded tokens.
- Parameters
s (
str
) –- Return type
-
classmethod
stringify_number
(x)¶ Stringify a number directly or lazily if it’s a Token.
If it is an object (i.e., { Ref: ‘SomeLogicalId’ }), return it as-is.
- Parameters
x (
Union
[int
,float
]) –- Return type
str
-
classmethod