Class: AWSCDK::EC2::CfnCapacityReservationFleet::TagSpecificationProperty

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

Overview

The tags to apply to a resource when the resource is being created.

When you specify a tag, you must specify the resource type to tag, otherwise the request will fail.

The Valid Values lists all the resource types that can be tagged. However, the action you're using might not support tagging all of these resource types. If you try to tag a resource type that is unsupported for the action you're using, you'll get an error.

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 on creation. Specify capacity-reservation-fleet .

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

    The tags to apply to the resource.



738
739
740
741
742
743
# File 'ec2/cfn_capacity_reservation_fleet.rb', line 738

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 on creation. Specify capacity-reservation-fleet .

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



751
752
753
# File 'ec2/cfn_capacity_reservation_fleet.rb', line 751

def resource_type
  @resource_type
end

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

The tags to apply to the resource.



756
757
758
# File 'ec2/cfn_capacity_reservation_fleet.rb', line 756

def tags
  @tags
end

Class Method Details

.jsii_propertiesObject



758
759
760
761
762
763
# File 'ec2/cfn_capacity_reservation_fleet.rb', line 758

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

Instance Method Details

#to_jsiiObject



765
766
767
768
769
770
771
772
# File 'ec2/cfn_capacity_reservation_fleet.rb', line 765

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