@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
118 lines • 5.56 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.CapacityReservation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an EC2 Capacity Reservation. This allows you to reserve capacity for your Amazon EC2 instances in a specific Availability Zone for any duration.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const _default = new aws.ec2.CapacityReservation("default", {
* instanceType: aws.ec2.InstanceType.T2_Micro,
* instancePlatform: aws.ec2.InstancePlatform.LinuxUnix,
* availabilityZone: "eu-west-1a",
* instanceCount: 1,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Capacity Reservations using the `id`. For example:
*
* ```sh
* $ pulumi import aws:ec2/capacityReservation:CapacityReservation web cr-0123456789abcdef0
* ```
*/
class CapacityReservation extends pulumi.CustomResource {
/**
* Get an existing CapacityReservation resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new CapacityReservation(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of CapacityReservation. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === CapacityReservation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["availabilityZone"] = state?.availabilityZone;
resourceInputs["ebsOptimized"] = state?.ebsOptimized;
resourceInputs["endDate"] = state?.endDate;
resourceInputs["endDateType"] = state?.endDateType;
resourceInputs["ephemeralStorage"] = state?.ephemeralStorage;
resourceInputs["instanceCount"] = state?.instanceCount;
resourceInputs["instanceMatchCriteria"] = state?.instanceMatchCriteria;
resourceInputs["instancePlatform"] = state?.instancePlatform;
resourceInputs["instanceType"] = state?.instanceType;
resourceInputs["outpostArn"] = state?.outpostArn;
resourceInputs["ownerId"] = state?.ownerId;
resourceInputs["placementGroupArn"] = state?.placementGroupArn;
resourceInputs["region"] = state?.region;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["tenancy"] = state?.tenancy;
}
else {
const args = argsOrState;
if (args?.availabilityZone === undefined && !opts.urn) {
throw new Error("Missing required property 'availabilityZone'");
}
if (args?.instanceCount === undefined && !opts.urn) {
throw new Error("Missing required property 'instanceCount'");
}
if (args?.instancePlatform === undefined && !opts.urn) {
throw new Error("Missing required property 'instancePlatform'");
}
if (args?.instanceType === undefined && !opts.urn) {
throw new Error("Missing required property 'instanceType'");
}
resourceInputs["availabilityZone"] = args?.availabilityZone;
resourceInputs["ebsOptimized"] = args?.ebsOptimized;
resourceInputs["endDate"] = args?.endDate;
resourceInputs["endDateType"] = args?.endDateType;
resourceInputs["ephemeralStorage"] = args?.ephemeralStorage;
resourceInputs["instanceCount"] = args?.instanceCount;
resourceInputs["instanceMatchCriteria"] = args?.instanceMatchCriteria;
resourceInputs["instancePlatform"] = args?.instancePlatform;
resourceInputs["instanceType"] = args?.instanceType;
resourceInputs["outpostArn"] = args?.outpostArn;
resourceInputs["placementGroupArn"] = args?.placementGroupArn;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["tenancy"] = args?.tenancy;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["ownerId"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CapacityReservation.__pulumiType, name, resourceInputs, opts);
}
}
exports.CapacityReservation = CapacityReservation;
/** @internal */
CapacityReservation.__pulumiType = 'aws:ec2/capacityReservation:CapacityReservation';
//# sourceMappingURL=capacityReservation.js.map