Skip to content
v2.273.0

Lazy Class ​

Lazily produce a value.

Can be used to return a string, list or numeric value whose actual value will only be calculated later, during synthesis.

Methods ​

any(producer: IStableAnyProducer, options?: LazyAnyValueOptions): IResolvable@staticmethod def any(producer: IStableAnyProducer, options: typing.Optional[LazyAnyValueOptions] = None) -> IResolvablepublic static IResolvable any(IStableAnyProducer producer, LazyAnyValueOptions options)public static IResolvable Any(IStableAnyProducer producer, LazyAnyValueOptions? options = null)func Any(Producer IStableAnyProducer, Options LazyAnyValueOptions) IResolvablestatic#
Defer the one-time calculation of an arbitrarily typed value to synthesis time.
notes

Use this if you want to render an object to a template whose actual value depends on some state mutation that may happen after the construct has been created.

The inner function will only be invoked one time and cannot depend on resolution context.

list(producer: IStableListProducer, options?: LazyListValueOptions): string[]@staticmethod def list(producer: IStableListProducer, options: typing.Optional[LazyListValueOptions] = None) -> typing.List[str]public static List<String> list(IStableListProducer producer, LazyListValueOptions options)public static string[] List(IStableListProducer producer, LazyListValueOptions? options = null)func List(Producer IStableListProducer, Options LazyListValueOptions) *[]*stringstatic#
Defer the one-time calculation of a list value to synthesis time.
notes

Use this if you want to render a list to a template whose actual value depends on some state mutation that may happen after the construct has been created.

If you are simply looking to force a value to a string[] type and don't need the calculation to be deferred, use Token.asList() instead.

The inner function will only be invoked once, and the resolved value cannot depend on the Stack the Token is used in.

number(producer: IStableNumberProducer): number@staticmethod def number(producer: IStableNumberProducer) -> int | floatpublic static Number number(IStableNumberProducer producer)public static double Number(IStableNumberProducer producer)func Number(Producer IStableNumberProducer) *float64static#
Defer the one-time calculation of a number value to synthesis time.
notes

Use this if you want to render a number to a template whose actual value depends on some state mutation that may happen after the construct has been created.

If you are simply looking to force a value to a number type and don't need the calculation to be deferred, use Token.asNumber() instead.

The inner function will only be invoked once, and the resolved value cannot depend on the Stack the Token is used in.

string(producer: IStableStringProducer, options?: LazyStringValueOptions): string@staticmethod def string(producer: IStableStringProducer, options: typing.Optional[LazyStringValueOptions] = None) -> strpublic static String string(IStableStringProducer producer, LazyStringValueOptions options)public static string String(IStableStringProducer producer, LazyStringValueOptions? options = null)func String(Producer IStableStringProducer, Options LazyStringValueOptions) *stringstatic#
Defer the one-time calculation of a string value to synthesis time.
notes

Use this if you want to render a string to a template whose actual value depends on some state mutation that may happen after the construct has been created.

If you are simply looking to force a value to a string type and don't need the calculation to be deferred, use Token.asString() instead.

The inner function will only be invoked once, and the resolved value cannot depend on the Stack the Token is used in.

uncachedAny(producer: IAnyProducer, options?: LazyAnyValueOptions): IResolvable@staticmethod def uncached_any(producer: IAnyProducer, options: typing.Optional[LazyAnyValueOptions] = None) -> IResolvablepublic static IResolvable uncachedAny(IAnyProducer producer, LazyAnyValueOptions options)public static IResolvable UncachedAny(IAnyProducer producer, LazyAnyValueOptions? options = null)func UncachedAny(Producer IAnyProducer, Options LazyAnyValueOptions) IResolvablestatic#
Defer the calculation of an untyped value to synthesis time.
notes

Use of this function is not recommended; unless you know you need it for sure, you probably don't. Use Lazy.any() instead.

The inner function may be invoked multiple times during synthesis. You should only use this method if the returned value depends on variables that may change during the Aspect application phase of synthesis, or if the value depends on the Stack the value is being used in. Both of these cases are rare, and only ever occur for AWS Construct Library authors.

uncachedList(producer: IListProducer, options?: LazyListValueOptions): string[]@staticmethod def uncached_list(producer: IListProducer, options: typing.Optional[LazyListValueOptions] = None) -> typing.List[str]public static List<String> uncachedList(IListProducer producer, LazyListValueOptions options)public static string[] UncachedList(IListProducer producer, LazyListValueOptions? options = null)func UncachedList(Producer IListProducer, Options LazyListValueOptions) *[]*stringstatic#
Defer the calculation of a list value to synthesis time.
notes

Use of this function is not recommended; unless you know you need it for sure, you probably don't. Use Lazy.list() instead.

The inner function may be invoked multiple times during synthesis. You should only use this method if the returned value depends on variables that may change during the Aspect application phase of synthesis, or if the value depends on the Stack the value is being used in. Both of these cases are rare, and only ever occur for AWS Construct Library authors.

uncachedNumber(producer: INumberProducer): number@staticmethod def uncached_number(producer: INumberProducer) -> int | floatpublic static Number uncachedNumber(INumberProducer producer)public static double UncachedNumber(INumberProducer producer)func UncachedNumber(Producer INumberProducer) *float64static#
Defer the calculation of a number value to synthesis time.
notes

Use of this function is not recommended; unless you know you need it for sure, you probably don't. Use Lazy.number() instead.

The inner function may be invoked multiple times during synthesis. You should only use this method if the returned value depends on variables that may change during the Aspect application phase of synthesis, or if the value depends on the Stack the value is being used in. Both of these cases are rare, and only ever occur for AWS Construct Library authors.

uncachedString(producer: IStringProducer, options?: LazyStringValueOptions): string@staticmethod def uncached_string(producer: IStringProducer, options: typing.Optional[LazyStringValueOptions] = None) -> strpublic static String uncachedString(IStringProducer producer, LazyStringValueOptions options)public static string UncachedString(IStringProducer producer, LazyStringValueOptions? options = null)func UncachedString(Producer IStringProducer, Options LazyStringValueOptions) *stringstatic#
Defer the calculation of a string value to synthesis time.
notes

Use of this function is not recommended; unless you know you need it for sure, you probably don't. Use Lazy.string() instead.

The inner function may be invoked multiple times during synthesis. You should only use this method if the returned value depends on variables that may change during the Aspect application phase of synthesis, or if the value depends on the Stack the value is being used in. Both of these cases are rare, and only ever occur for AWS Construct Library authors.