class Lazy
Language | Type name |
---|---|
.NET | Amazon.CDK.Lazy |
Java | software.amazon.awscdk.core.Lazy |
Python | aws_cdk.core.Lazy |
TypeScript (source) | @aws-cdk/core » Lazy |
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
Name | Description |
---|---|
static any(producer, options?) | Defer the one-time calculation of an arbitrarily typed value to synthesis time. |
static any | Defer the one-time calculation of an arbitrarily typed value to synthesis time. |
static list(producer, options?) | Defer the one-time calculation of a list value to synthesis time. |
static list | Defer the one-time calculation of a list value to synthesis time. |
static number(producer) | Defer the one-time calculation of a number value to synthesis time. |
static number | Defer the one-time calculation of a number value to synthesis time. |
static string(producer, options?) | Defer the one-time calculation of a string value to synthesis time. |
static string | Defer the calculation of a string value to synthesis time. |
static uncached | Defer the calculation of an untyped value to synthesis time. |
static uncached | Defer the calculation of a list value to synthesis time. |
static uncached | Defer the calculation of a number value to synthesis time. |
static uncached | Defer the calculation of a string value to synthesis time. |
static any(producer, options?)
public static any(producer: IStableAnyProducer, options?: LazyAnyValueOptions): IResolvable
Parameters
- producer
IStable
Any Producer - options
Lazy
Any Value Options
Returns
Defer the one-time calculation of an arbitrarily typed value to synthesis time.
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.
Value(producer, options?)
static anypublic static anyValue(producer: IAnyProducer, options?: LazyAnyValueOptions): IResolvable
⚠️ Deprecated: Use Lazy.any()
or Lazy.uncachedAny()
instead.
Parameters
- producer
IAny
Producer - options
Lazy
Any Value Options
Returns
Defer the one-time calculation of an arbitrarily typed value to synthesis time.
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.
static list(producer, options?)
public static list(producer: IStableListProducer, options?: LazyListValueOptions): string[]
Parameters
- producer
IStable
List Producer - options
Lazy
List Value Options
Returns
string[]
Defer the one-time calculation of a list value to synthesis time.
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.
Value(producer, options?)
static listpublic static listValue(producer: IListProducer, options?: LazyListValueOptions): string[]
⚠️ Deprecated: Use Lazy.list()
or Lazy.uncachedList()
instead.
Parameters
- producer
IList
Producer - options
Lazy
List Value Options
Returns
string[]
Defer the one-time calculation of a list value to synthesis time.
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.
static number(producer)
public static number(producer: IStableNumberProducer): number
Parameters
- producer
IStable
Number Producer
Returns
number
Defer the one-time calculation of a number value to synthesis time.
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.
Value(producer)
static numberpublic static numberValue(producer: INumberProducer): number
⚠️ Deprecated: Use Lazy.number()
or Lazy.uncachedNumber()
instead.
Parameters
- producer
INumber
Producer
Returns
number
Defer the one-time calculation of a number value to synthesis time.
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.
static string(producer, options?)
public static string(producer: IStableStringProducer, options?: LazyStringValueOptions): string
Parameters
- producer
IStable
String Producer - options
Lazy
String Value Options
Returns
string
Defer the one-time calculation of a string value to synthesis time.
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.
Value(producer, options?)
static stringpublic static stringValue(producer: IStringProducer, options?: LazyStringValueOptions): string
⚠️ Deprecated: Use Lazy.string()
or Lazy.uncachedString()
instead.
Parameters
- producer
IString
Producer - options
Lazy
String Value Options
Returns
string
Defer the calculation of a string value to synthesis time.
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.
Any(producer, options?)
static uncachedpublic static uncachedAny(producer: IAnyProducer, options?: LazyAnyValueOptions): IResolvable
Parameters
- producer
IAny
Producer - options
Lazy
Any Value Options
Returns
Defer the calculation of an untyped value to synthesis time.
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.
List(producer, options?)
static uncachedpublic static uncachedList(producer: IListProducer, options?: LazyListValueOptions): string[]
Parameters
- producer
IList
Producer - options
Lazy
List Value Options
Returns
string[]
Defer the calculation of a list value to synthesis time.
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.
Number(producer)
static uncachedpublic static uncachedNumber(producer: INumberProducer): number
Parameters
- producer
INumber
Producer
Returns
number
Defer the calculation of a number value to synthesis time.
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.
String(producer, options?)
static uncachedpublic static uncachedString(producer: IStringProducer, options?: LazyStringValueOptions): string
Parameters
- producer
IString
Producer - options
Lazy
String Value Options
Returns
string
Defer the calculation of a string value to synthesis time.
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.