UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

118 lines 6.21 kB
"use strict"; // *** 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, Object.assign(Object.assign({}, 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 ? state.arn : undefined; resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined; resourceInputs["ebsOptimized"] = state ? state.ebsOptimized : undefined; resourceInputs["endDate"] = state ? state.endDate : undefined; resourceInputs["endDateType"] = state ? state.endDateType : undefined; resourceInputs["ephemeralStorage"] = state ? state.ephemeralStorage : undefined; resourceInputs["instanceCount"] = state ? state.instanceCount : undefined; resourceInputs["instanceMatchCriteria"] = state ? state.instanceMatchCriteria : undefined; resourceInputs["instancePlatform"] = state ? state.instancePlatform : undefined; resourceInputs["instanceType"] = state ? state.instanceType : undefined; resourceInputs["outpostArn"] = state ? state.outpostArn : undefined; resourceInputs["ownerId"] = state ? state.ownerId : undefined; resourceInputs["placementGroupArn"] = state ? state.placementGroupArn : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["tenancy"] = state ? state.tenancy : undefined; } else { const args = argsOrState; if ((!args || args.availabilityZone === undefined) && !opts.urn) { throw new Error("Missing required property 'availabilityZone'"); } if ((!args || args.instanceCount === undefined) && !opts.urn) { throw new Error("Missing required property 'instanceCount'"); } if ((!args || args.instancePlatform === undefined) && !opts.urn) { throw new Error("Missing required property 'instancePlatform'"); } if ((!args || args.instanceType === undefined) && !opts.urn) { throw new Error("Missing required property 'instanceType'"); } resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined; resourceInputs["ebsOptimized"] = args ? args.ebsOptimized : undefined; resourceInputs["endDate"] = args ? args.endDate : undefined; resourceInputs["endDateType"] = args ? args.endDateType : undefined; resourceInputs["ephemeralStorage"] = args ? args.ephemeralStorage : undefined; resourceInputs["instanceCount"] = args ? args.instanceCount : undefined; resourceInputs["instanceMatchCriteria"] = args ? args.instanceMatchCriteria : undefined; resourceInputs["instancePlatform"] = args ? args.instancePlatform : undefined; resourceInputs["instanceType"] = args ? args.instanceType : undefined; resourceInputs["outpostArn"] = args ? args.outpostArn : undefined; resourceInputs["placementGroupArn"] = args ? args.placementGroupArn : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["tenancy"] = args ? args.tenancy : undefined; 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