Class: AWSCDK::EC2::InstanceRequireImdsv2Aspect

Inherits:
Jsii::Object
  • Object
show all
Includes:
IAspect
Defined in:
ec2/instance_require_imdsv2_aspect.rb

Overview

Aspect that applies IMDS configuration on EC2 Instance constructs.

This aspect configures IMDS on an EC2 instance by creating a Launch Template with the IMDS configuration and associating that Launch Template with the instance. If an Instance is already associated with a Launch Template, a warning will (optionally) be added to the construct node and it will be skipped.

To cover Instances already associated with Launch Templates, use LaunchTemplateImdsAspect.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(props = nil) ⇒ InstanceRequireImdsv2Aspect

Returns a new instance of InstanceRequireImdsv2Aspect.

Parameters:



17
18
19
20
21
# File 'ec2/instance_require_imdsv2_aspect.rb', line 17

def initialize(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::EC2::InstanceRequireImdsv2AspectProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkluc3RhbmNlUmVxdWlyZUltZHN2MkFzcGVjdFByb3BzIn0=")), "props") unless props.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(props)
end

Class Method Details

.jsii_overridable_methodsObject



23
24
25
26
27
28
29
# File 'ec2/instance_require_imdsv2_aspect.rb', line 23

def self.jsii_overridable_methods
  {
    :suppress_warnings => { kind: :property, name: "suppressWarnings", is_optional: false },
    :visit => { kind: :method, name: "visit", is_optional: false },
    :warn => { kind: :method, name: "warn", is_optional: false },
  }
end

Instance Method Details

#suppress_warningsBoolean

Returns:

  • (Boolean)


32
33
34
# File 'ec2/instance_require_imdsv2_aspect.rb', line 32

def suppress_warnings()
  jsii_get_property("suppressWarnings")
end

#visit(node) ⇒ void

This method returns an undefined value.

All aspects can visit an IConstruct.

Parameters:

  • node (Constructs::IConstruct)


40
41
42
43
# File 'ec2/instance_require_imdsv2_aspect.rb', line 40

def visit(node)
  Jsii::Type.check_type(node, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklDb25zdHJ1Y3QifQ==")), "node")
  jsii_call_method("visit", [node])
end

#warn(node, message) ⇒ void

This method returns an undefined value.

Adds a warning annotation to a node, unless suppressWarnings is true.

Parameters:

  • node (Constructs::IConstruct)
  • message (String)


50
51
52
53
54
# File 'ec2/instance_require_imdsv2_aspect.rb', line 50

def warn(node, message)
  Jsii::Type.check_type(node, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklDb25zdHJ1Y3QifQ==")), "node")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message")
  jsii_call_method("warn", [node, message])
end