Class: AWSCDK::EC2::CfnLaunchTemplate::TagSpecificationProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ec2/cfn_launch_template.rb

Overview

Specifies the tags to apply to resources that are created during instance launch.

TagSpecification is a property type of TagSpecifications . TagSpecifications is a property of AWS::EC2::LaunchTemplate LaunchTemplateData .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_type: nil, tags: nil) ⇒ TagSpecificationProperty

Returns a new instance of TagSpecificationProperty.

Parameters:

  • resource_type (String, nil) (defaults to: nil)

    The type of resource to tag.

  • tags (Array<AWSCDK::CfnTag>, nil) (defaults to: nil)

    The tags to apply to the resource.



3721
3722
3723
3724
3725
3726
# File 'ec2/cfn_launch_template.rb', line 3721

def initialize(resource_type: nil, tags: nil)
  @resource_type = resource_type
  Jsii::Type.check_type(@resource_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resourceType") unless @resource_type.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
end

Instance Attribute Details

#resource_typeString? (readonly)

The type of resource to tag.

You can specify tags for the following resource types only: instance | volume | network-interface | spot-instances-request . If the instance does not include the resource type that you specify, the instance launch fails. For example, not all instance types include a volume.

To tag a resource after it has been created, see CreateTags .



3736
3737
3738
# File 'ec2/cfn_launch_template.rb', line 3736

def resource_type
  @resource_type
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

The tags to apply to the resource.



3741
3742
3743
# File 'ec2/cfn_launch_template.rb', line 3741

def tags
  @tags
end

Class Method Details

.jsii_propertiesObject



3743
3744
3745
3746
3747
3748
# File 'ec2/cfn_launch_template.rb', line 3743

def self.jsii_properties
  {
    :resource_type => "resourceType",
    :tags => "tags",
  }
end

Instance Method Details

#to_jsiiObject



3750
3751
3752
3753
3754
3755
3756
3757
# File 'ec2/cfn_launch_template.rb', line 3750

def to_jsii
  result = {}
  result.merge!({
    "resourceType" => @resource_type,
    "tags" => @tags,
  })
  result.compact
end