Table of Contents

Class Lazy

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll

Lazily produce a value.

public class Lazy : DeputyBase
Inheritance
Lazy

Remarks

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

Methods

Any(IStableAnyProducer, ILazyAnyValueOptions?)

Defer the one-time calculation of an arbitrarily typed value to synthesis time.

public static IResolvable Any(IStableAnyProducer producer, ILazyAnyValueOptions? options = null)

Parameters

producer IStableAnyProducer
options ILazyAnyValueOptions

Returns

IResolvable

Remarks

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.

AnyValue(IAnyProducer, ILazyAnyValueOptions?)

(deprecated) Defer the one-time calculation of an arbitrarily typed value to synthesis time.

[Obsolete("Use `Lazy.any()` or `Lazy.uncachedAny()` instead.")]
public static IResolvable AnyValue(IAnyProducer producer, ILazyAnyValueOptions? options = null)

Parameters

producer IAnyProducer
options ILazyAnyValueOptions

Returns

IResolvable

Remarks

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.

Stability: Deprecated

List(IStableListProducer, ILazyListValueOptions?)

Defer the one-time calculation of a list value to synthesis time.

public static string[] List(IStableListProducer producer, ILazyListValueOptions? options = null)

Parameters

producer IStableListProducer
options ILazyListValueOptions

Returns

string[]

Remarks

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.

ListValue(IListProducer, ILazyListValueOptions?)

(deprecated) Defer the one-time calculation of a list value to synthesis time.

[Obsolete("Use `Lazy.list()` or `Lazy.uncachedList()` instead.")]
public static string[] ListValue(IListProducer producer, ILazyListValueOptions? options = null)

Parameters

producer IListProducer
options ILazyListValueOptions

Returns

string[]

Remarks

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.

Stability: Deprecated

Number(IStableNumberProducer)

Defer the one-time calculation of a number value to synthesis time.

public static double Number(IStableNumberProducer producer)

Parameters

producer IStableNumberProducer

Returns

double

Remarks

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.

NumberValue(INumberProducer)

(deprecated) Defer the one-time calculation of a number value to synthesis time.

[Obsolete("Use `Lazy.number()` or `Lazy.uncachedNumber()` instead.")]
public static double NumberValue(INumberProducer producer)

Parameters

producer INumberProducer

Returns

double

Remarks

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.

Stability: Deprecated

String(IStableStringProducer, ILazyStringValueOptions?)

Defer the one-time calculation of a string value to synthesis time.

public static string String(IStableStringProducer producer, ILazyStringValueOptions? options = null)

Parameters

producer IStableStringProducer
options ILazyStringValueOptions

Returns

string

Remarks

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.

StringValue(IStringProducer, ILazyStringValueOptions?)

(deprecated) Defer the calculation of a string value to synthesis time.

[Obsolete("Use `Lazy.string()` or `Lazy.uncachedString()` instead.")]
public static string StringValue(IStringProducer producer, ILazyStringValueOptions? options = null)

Parameters

producer IStringProducer
options ILazyStringValueOptions

Returns

string

Remarks

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.

Stability: Deprecated

UncachedAny(IAnyProducer, ILazyAnyValueOptions?)

Defer the calculation of an untyped value to synthesis time.

public static IResolvable UncachedAny(IAnyProducer producer, ILazyAnyValueOptions? options = null)

Parameters

producer IAnyProducer
options ILazyAnyValueOptions

Returns

IResolvable

Remarks

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(IListProducer, ILazyListValueOptions?)

Defer the calculation of a list value to synthesis time.

public static string[] UncachedList(IListProducer producer, ILazyListValueOptions? options = null)

Parameters

producer IListProducer
options ILazyListValueOptions

Returns

string[]

Remarks

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(INumberProducer)

Defer the calculation of a number value to synthesis time.

public static double UncachedNumber(INumberProducer producer)

Parameters

producer INumberProducer

Returns

double

Remarks

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(IStringProducer, ILazyStringValueOptions?)

Defer the calculation of a string value to synthesis time.

public static string UncachedString(IStringProducer producer, ILazyStringValueOptions? options = null)

Parameters

producer IStringProducer
options ILazyStringValueOptions

Returns

string

Remarks

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.