Class: AWSCDK::Lazy

Inherits:
Jsii::Object
  • Object
show all
Defined in:
lazy.rb

Overview

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.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Lazy

Returns a new instance of Lazy.

Raises:

  • (NoMethodError)


11
12
13
# File 'lazy.rb', line 11

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.Lazy does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.any(producer, options = nil) ⇒ AWSCDK::IResolvable

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.

Parameters:

Returns:



31
32
33
34
35
36
# File 'lazy.rb', line 31

def self.any(producer, options = nil)
  Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RhYmxlQW55UHJvZHVjZXIifQ==")), "producer")
  options = options.is_a?(Hash) ? ::AWSCDK::LazyAnyValueOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5QW55VmFsdWVPcHRpb25zIn0=")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "any", [producer, options])
end

.jsii_overridable_methodsObject



15
16
17
18
# File 'lazy.rb', line 15

def self.jsii_overridable_methods
  {
  }
end

.list(producer, options = nil) ⇒ Array<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.

Parameters:

Returns:

  • (Array<String>)


52
53
54
55
56
57
# File 'lazy.rb', line 52

def self.list(producer, options = nil)
  Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RhYmxlTGlzdFByb2R1Y2VyIn0=")), "producer")
  options = options.is_a?(Hash) ? ::AWSCDK::LazyListValueOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5TGlzdFZhbHVlT3B0aW9ucyJ9")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "list", [producer, options])
end

.number(producer) ⇒ Numeric

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.

Parameters:

Returns:

  • (Numeric)


72
73
74
75
# File 'lazy.rb', line 72

def self.number(producer)
  Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RhYmxlTnVtYmVyUHJvZHVjZXIifQ==")), "producer")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "number", [producer])
end

.string(producer, options = nil) ⇒ 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.

Parameters:

Returns:

  • (String)


91
92
93
94
95
96
# File 'lazy.rb', line 91

def self.string(producer, options = nil)
  Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RhYmxlU3RyaW5nUHJvZHVjZXIifQ==")), "producer")
  options = options.is_a?(Hash) ? ::AWSCDK::LazyStringValueOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5U3RyaW5nVmFsdWVPcHRpb25zIn0=")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "string", [producer, options])
end

.uncached_any(producer, options = nil) ⇒ AWSCDK::IResolvable

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.

Parameters:

Returns:



112
113
114
115
116
117
# File 'lazy.rb', line 112

def self.uncached_any(producer, options = nil)
  Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JQW55UHJvZHVjZXIifQ==")), "producer")
  options = options.is_a?(Hash) ? ::AWSCDK::LazyAnyValueOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5QW55VmFsdWVPcHRpb25zIn0=")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "uncachedAny", [producer, options])
end

.uncached_list(producer, options = nil) ⇒ Array<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.

Parameters:

Returns:

  • (Array<String>)


133
134
135
136
137
138
# File 'lazy.rb', line 133

def self.uncached_list(producer, options = nil)
  Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JTGlzdFByb2R1Y2VyIn0=")), "producer")
  options = options.is_a?(Hash) ? ::AWSCDK::LazyListValueOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5TGlzdFZhbHVlT3B0aW9ucyJ9")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "uncachedList", [producer, options])
end

.uncached_number(producer) ⇒ Numeric

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.

Parameters:

Returns:

  • (Numeric)


153
154
155
156
# File 'lazy.rb', line 153

def self.uncached_number(producer)
  Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JTnVtYmVyUHJvZHVjZXIifQ==")), "producer")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "uncachedNumber", [producer])
end

.uncached_string(producer, options = nil) ⇒ 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.

Parameters:

Returns:

  • (String)


172
173
174
175
176
177
# File 'lazy.rb', line 172

def self.uncached_string(producer, options = nil)
  Jsii::Type.check_type(producer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3RyaW5nUHJvZHVjZXIifQ==")), "producer")
  options = options.is_a?(Hash) ? ::AWSCDK::LazyStringValueOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5MYXp5U3RyaW5nVmFsdWVPcHRpb25zIn0=")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Lazy", "uncachedString", [producer, options])
end