Class CfnCapacityReservation

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-07-22T22:42:50.267Z") @Stability(Stable) public class CfnCapacityReservation extends CfnResource implements IInspectable
Creates a new Capacity Reservation with the specified attributes.

For more information, see Capacity Reservations in the Amazon EC2 User Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.ec2.*;
 CfnCapacityReservation cfnCapacityReservation = CfnCapacityReservation.Builder.create(this, "MyCfnCapacityReservation")
         .availabilityZone("availabilityZone")
         .instanceCount(123)
         .instancePlatform("instancePlatform")
         .instanceType("instanceType")
         // the properties below are optional
         .ebsOptimized(false)
         .endDate("endDate")
         .endDateType("endDateType")
         .ephemeralStorage(false)
         .instanceMatchCriteria("instanceMatchCriteria")
         .outPostArn("outPostArn")
         .placementGroupArn("placementGroupArn")
         .tagSpecifications(List.of(TagSpecificationProperty.builder()
                 .resourceType("resourceType")
                 .tags(List.of(CfnTag.builder()
                         .key("key")
                         .value("value")
                         .build()))
                 .build()))
         .tenancy("tenancy")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnCapacityReservation

      protected CfnCapacityReservation(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnCapacityReservation

      protected CfnCapacityReservation(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnCapacityReservation

      @Stability(Stable) public CfnCapacityReservation(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnCapacityReservationProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrAvailabilityZone

      @Stability(Stable) @NotNull public String getAttrAvailabilityZone()
      Returns the Availability Zone in which the capacity is reserved.

      For example: us-east-1a .

    • getAttrAvailableInstanceCount

      @Stability(Stable) @NotNull public Number getAttrAvailableInstanceCount()
      Returns the remaining capacity, which indicates the number of instances that can be launched in the Capacity Reservation.

      For example: 9 .

    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
      The ID of the Capacity Reservation.
    • getAttrInstanceType

      @Stability(Stable) @NotNull public String getAttrInstanceType()
      Returns the type of instance for which the capacity is reserved.

      For example: m4.large .

    • getAttrTenancy

      @Stability(Stable) @NotNull public String getAttrTenancy()
      Returns the tenancy of the Capacity Reservation.

      For example: dedicated .

    • getAttrTotalInstanceCount

      @Stability(Stable) @NotNull public Number getAttrTotalInstanceCount()
      Returns the total number of instances for which the Capacity Reservation reserves capacity.

      For example: 15 .

    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getAvailabilityZone

      @Stability(Stable) @NotNull public String getAvailabilityZone()
      The Availability Zone in which to create the Capacity Reservation.
    • setAvailabilityZone

      @Stability(Stable) public void setAvailabilityZone(@NotNull String value)
      The Availability Zone in which to create the Capacity Reservation.
    • getInstanceCount

      @Stability(Stable) @NotNull public Number getInstanceCount()
      The number of instances for which to reserve capacity.
    • setInstanceCount

      @Stability(Stable) public void setInstanceCount(@NotNull Number value)
      The number of instances for which to reserve capacity.
    • getInstancePlatform

      @Stability(Stable) @NotNull public String getInstancePlatform()
      The type of operating system for which to reserve capacity.
    • setInstancePlatform

      @Stability(Stable) public void setInstancePlatform(@NotNull String value)
      The type of operating system for which to reserve capacity.
    • getInstanceType

      @Stability(Stable) @NotNull public String getInstanceType()
      The instance type for which to reserve capacity.
    • setInstanceType

      @Stability(Stable) public void setInstanceType(@NotNull String value)
      The instance type for which to reserve capacity.
    • getEbsOptimized

      @Stability(Stable) @Nullable public Object getEbsOptimized()
      Indicates whether the Capacity Reservation supports EBS-optimized instances.
    • setEbsOptimized

      @Stability(Stable) public void setEbsOptimized(@Nullable Boolean value)
      Indicates whether the Capacity Reservation supports EBS-optimized instances.
    • setEbsOptimized

      @Stability(Stable) public void setEbsOptimized(@Nullable IResolvable value)
      Indicates whether the Capacity Reservation supports EBS-optimized instances.
    • getEndDate

      @Stability(Stable) @Nullable public String getEndDate()
      The date and time at which the Capacity Reservation expires.
    • setEndDate

      @Stability(Stable) public void setEndDate(@Nullable String value)
      The date and time at which the Capacity Reservation expires.
    • getEndDateType

      @Stability(Stable) @Nullable public String getEndDateType()
      Indicates the way in which the Capacity Reservation ends.
    • setEndDateType

      @Stability(Stable) public void setEndDateType(@Nullable String value)
      Indicates the way in which the Capacity Reservation ends.
    • getEphemeralStorage

      @Stability(Stable) @Nullable public Object getEphemeralStorage()
      Deprecated..
    • setEphemeralStorage

      @Stability(Stable) public void setEphemeralStorage(@Nullable Boolean value)
      Deprecated..
    • setEphemeralStorage

      @Stability(Stable) public void setEphemeralStorage(@Nullable IResolvable value)
      Deprecated..
    • getInstanceMatchCriteria

      @Stability(Stable) @Nullable public String getInstanceMatchCriteria()
      Indicates the type of instance launches that the Capacity Reservation accepts.

      The options include:.

    • setInstanceMatchCriteria

      @Stability(Stable) public void setInstanceMatchCriteria(@Nullable String value)
      Indicates the type of instance launches that the Capacity Reservation accepts.

      The options include:.

    • getOutPostArn

      @Stability(Stable) @Nullable public String getOutPostArn()
      The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.
    • setOutPostArn

      @Stability(Stable) public void setOutPostArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.
    • getPlacementGroupArn

      @Stability(Stable) @Nullable public String getPlacementGroupArn()
      The Amazon Resource Name (ARN) of the cluster placement group in which to create the Capacity Reservation.
    • setPlacementGroupArn

      @Stability(Stable) public void setPlacementGroupArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the cluster placement group in which to create the Capacity Reservation.
    • getTagSpecifications

      @Stability(Stable) @Nullable public Object getTagSpecifications()
      The tags to apply to the Capacity Reservation during launch.
    • setTagSpecifications

      @Stability(Stable) public void setTagSpecifications(@Nullable IResolvable value)
      The tags to apply to the Capacity Reservation during launch.
    • setTagSpecifications

      @Stability(Stable) public void setTagSpecifications(@Nullable List<Object> value)
      The tags to apply to the Capacity Reservation during launch.
    • getTenancy

      @Stability(Stable) @Nullable public String getTenancy()
      Indicates the tenancy of the Capacity Reservation.

      A Capacity Reservation can have one of the following tenancy settings:.

    • setTenancy

      @Stability(Stable) public void setTenancy(@Nullable String value)
      Indicates the tenancy of the Capacity Reservation.

      A Capacity Reservation can have one of the following tenancy settings:.