Class Lazy
Lazily produce a value.
Inheritance
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Lazy : DeputyBase
Syntax (vb)
Public Class Lazy
Inherits DeputyBase
Remarks
Can be used to return a string, list or numeric value whose actual value will only be calculated later, during synthesis.
Synopsis
Constructors
Lazy(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Lazy(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
Any(IStableAnyProducer, ILazyAnyValueOptions) | Defer the one-time calculation of an arbitrarily typed value to synthesis time. |
List(IStableListProducer, ILazyListValueOptions) | Defer the one-time calculation of a list value to synthesis time. |
Number(IStableNumberProducer) | Defer the one-time calculation of a number value to synthesis time. |
String(IStableStringProducer, ILazyStringValueOptions) | Defer the one-time calculation of a string value to synthesis time. |
UncachedAny(IAnyProducer, ILazyAnyValueOptions) | Defer the calculation of an untyped value to synthesis time. |
UncachedList(IListProducer, ILazyListValueOptions) | Defer the calculation of a list value to synthesis time. |
UncachedNumber(INumberProducer) | Defer the calculation of a number value to synthesis time. |
UncachedString(IStringProducer, ILazyStringValueOptions) | Defer the calculation of a string value to synthesis time. |
Constructors
Lazy(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Lazy(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Lazy(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Lazy(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
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
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.
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
System.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.
Number(IStableNumberProducer)
Defer the one-time calculation of a number value to synthesis time.
public static double Number(IStableNumberProducer producer)
Parameters
- producer IStableNumberProducer
Returns
System.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.
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
System.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.
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
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
System.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
System.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
System.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.