Class: AWSCDK::EC2::LookupMachineImage
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::EC2::LookupMachineImage
- Includes:
- IMachineImage
- Defined in:
- ec2/lookup_machine_image.rb
Overview
A machine image whose AMI ID will be searched using DescribeImages.
The most recent, available, launchable image matching the given filter criteria will be used. Looking up AMIs may take a long time; specify as many filter criteria as possible to narrow down the search.
The AMI selected will be cached in cdk.context.json and the same value
will be used on future runs. To refresh the AMI lookup, you will have to
evict the value from the cache using the cdk context command. See
https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information.
If props.additionalCacheKey is set, the context key uses that value as a discriminator
rather than the cached value being global across all lookups.
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#get_image(scope) ⇒ AWSCDK::EC2::MachineImageConfig
Return the correct image.
-
#initialize(props) ⇒ LookupMachineImage
constructor
A new instance of LookupMachineImage.
Constructor Details
#initialize(props) ⇒ LookupMachineImage
Returns a new instance of LookupMachineImage.
21 22 23 24 25 |
# File 'ec2/lookup_machine_image.rb', line 21 def initialize(props) props = props.is_a?(Hash) ? ::AWSCDK::EC2::LookupMachineImageProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkxvb2t1cE1hY2hpbmVJbWFnZVByb3BzIn0=")), "props") Jsii::Object.instance_method(:initialize).bind(self).call(props) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
27 28 29 30 31 |
# File 'ec2/lookup_machine_image.rb', line 27 def self.jsii_overridable_methods { :get_image => { kind: :method, name: "getImage", is_optional: false }, } end |
Instance Method Details
#get_image(scope) ⇒ AWSCDK::EC2::MachineImageConfig
Return the correct image.
37 38 39 40 |
# File 'ec2/lookup_machine_image.rb', line 37 def get_image(scope) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") jsii_call_method("getImage", [scope]) end |