/
capacityReservation.ts
253 lines (244 loc) · 12 KB
/
capacityReservation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as utilities from "../utilities";
import {InstancePlatform} from "./instancePlatform";
import {InstanceType} from "./instanceType";
import {Tenancy} from "./tenancy";
/**
* 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 defaultCapacityReservation = new aws.ec2.CapacityReservation("default", {
* availabilityZone: "eu-west-1a",
* instanceCount: 1,
* instancePlatform: "Linux/UNIX",
* instanceType: "t2.micro",
* });
* ```
*
* > This content is derived from https://github.com/terraform-providers/terraform-provider-aws/blob/master/website/docs/r/ec2_capacity_reservation.html.markdown.
*/
export 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.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: CapacityReservationState, opts?: pulumi.CustomResourceOptions): CapacityReservation {
return new CapacityReservation(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'aws:ec2/capacityReservation:CapacityReservation';
/**
* 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.
*/
public static isInstance(obj: any): obj is CapacityReservation {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === CapacityReservation.__pulumiType;
}
/**
* The Availability Zone in which to create the Capacity Reservation.
*/
public readonly availabilityZone!: pulumi.Output<string>;
/**
* Indicates whether the Capacity Reservation supports EBS-optimized instances.
*/
public readonly ebsOptimized!: pulumi.Output<boolean | undefined>;
/**
* The date and time at which the Capacity Reservation expires. When a Capacity Reservation expires, the reserved capacity is released and you can no longer launch instances into it. Valid values: [RFC3339 time string](https://tools.ietf.org/html/rfc3339#section-5.8) (`YYYY-MM-DDTHH:MM:SSZ`)
*/
public readonly endDate!: pulumi.Output<string | undefined>;
/**
* Indicates the way in which the Capacity Reservation ends. Specify either `unlimited` or `limited`.
*/
public readonly endDateType!: pulumi.Output<string | undefined>;
/**
* Indicates whether the Capacity Reservation supports instances with temporary, block-level storage.
*/
public readonly ephemeralStorage!: pulumi.Output<boolean | undefined>;
/**
* The number of instances for which to reserve capacity.
*/
public readonly instanceCount!: pulumi.Output<number>;
/**
* Indicates the type of instance launches that the Capacity Reservation accepts. Specify either `open` or `targeted`.
*/
public readonly instanceMatchCriteria!: pulumi.Output<string | undefined>;
/**
* The type of operating system for which to reserve capacity. Valid options are `Linux/UNIX`, `Red Hat Enterprise Linux`, `SUSE Linux`, `Windows`, `Windows with SQL Server`, `Windows with SQL Server Enterprise`, `Windows with SQL Server Standard` or `Windows with SQL Server Web`.
*/
public readonly instancePlatform!: pulumi.Output<InstancePlatform>;
/**
* The instance type for which to reserve capacity.
*/
public readonly instanceType!: pulumi.Output<InstanceType>;
/**
* A mapping of tags to assign to the resource.
*/
public readonly tags!: pulumi.Output<{[key: string]: any} | undefined>;
/**
* Indicates the tenancy of the Capacity Reservation. Specify either `default` or `dedicated`.
*/
public readonly tenancy!: pulumi.Output<Tenancy | undefined>;
/**
* Create a CapacityReservation resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: CapacityReservationArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: CapacityReservationArgs | CapacityReservationState, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
if (opts && opts.id) {
const state = argsOrState as CapacityReservationState | undefined;
inputs["availabilityZone"] = state ? state.availabilityZone : undefined;
inputs["ebsOptimized"] = state ? state.ebsOptimized : undefined;
inputs["endDate"] = state ? state.endDate : undefined;
inputs["endDateType"] = state ? state.endDateType : undefined;
inputs["ephemeralStorage"] = state ? state.ephemeralStorage : undefined;
inputs["instanceCount"] = state ? state.instanceCount : undefined;
inputs["instanceMatchCriteria"] = state ? state.instanceMatchCriteria : undefined;
inputs["instancePlatform"] = state ? state.instancePlatform : undefined;
inputs["instanceType"] = state ? state.instanceType : undefined;
inputs["tags"] = state ? state.tags : undefined;
inputs["tenancy"] = state ? state.tenancy : undefined;
} else {
const args = argsOrState as CapacityReservationArgs | undefined;
if (!args || args.availabilityZone === undefined) {
throw new Error("Missing required property 'availabilityZone'");
}
if (!args || args.instanceCount === undefined) {
throw new Error("Missing required property 'instanceCount'");
}
if (!args || args.instancePlatform === undefined) {
throw new Error("Missing required property 'instancePlatform'");
}
if (!args || args.instanceType === undefined) {
throw new Error("Missing required property 'instanceType'");
}
inputs["availabilityZone"] = args ? args.availabilityZone : undefined;
inputs["ebsOptimized"] = args ? args.ebsOptimized : undefined;
inputs["endDate"] = args ? args.endDate : undefined;
inputs["endDateType"] = args ? args.endDateType : undefined;
inputs["ephemeralStorage"] = args ? args.ephemeralStorage : undefined;
inputs["instanceCount"] = args ? args.instanceCount : undefined;
inputs["instanceMatchCriteria"] = args ? args.instanceMatchCriteria : undefined;
inputs["instancePlatform"] = args ? args.instancePlatform : undefined;
inputs["instanceType"] = args ? args.instanceType : undefined;
inputs["tags"] = args ? args.tags : undefined;
inputs["tenancy"] = args ? args.tenancy : undefined;
}
super(CapacityReservation.__pulumiType, name, inputs, opts);
}
}
/**
* Input properties used for looking up and filtering CapacityReservation resources.
*/
export interface CapacityReservationState {
/**
* The Availability Zone in which to create the Capacity Reservation.
*/
readonly availabilityZone?: pulumi.Input<string>;
/**
* Indicates whether the Capacity Reservation supports EBS-optimized instances.
*/
readonly ebsOptimized?: pulumi.Input<boolean>;
/**
* The date and time at which the Capacity Reservation expires. When a Capacity Reservation expires, the reserved capacity is released and you can no longer launch instances into it. Valid values: [RFC3339 time string](https://tools.ietf.org/html/rfc3339#section-5.8) (`YYYY-MM-DDTHH:MM:SSZ`)
*/
readonly endDate?: pulumi.Input<string>;
/**
* Indicates the way in which the Capacity Reservation ends. Specify either `unlimited` or `limited`.
*/
readonly endDateType?: pulumi.Input<string>;
/**
* Indicates whether the Capacity Reservation supports instances with temporary, block-level storage.
*/
readonly ephemeralStorage?: pulumi.Input<boolean>;
/**
* The number of instances for which to reserve capacity.
*/
readonly instanceCount?: pulumi.Input<number>;
/**
* Indicates the type of instance launches that the Capacity Reservation accepts. Specify either `open` or `targeted`.
*/
readonly instanceMatchCriteria?: pulumi.Input<string>;
/**
* The type of operating system for which to reserve capacity. Valid options are `Linux/UNIX`, `Red Hat Enterprise Linux`, `SUSE Linux`, `Windows`, `Windows with SQL Server`, `Windows with SQL Server Enterprise`, `Windows with SQL Server Standard` or `Windows with SQL Server Web`.
*/
readonly instancePlatform?: pulumi.Input<InstancePlatform>;
/**
* The instance type for which to reserve capacity.
*/
readonly instanceType?: pulumi.Input<InstanceType>;
/**
* A mapping of tags to assign to the resource.
*/
readonly tags?: pulumi.Input<{[key: string]: any}>;
/**
* Indicates the tenancy of the Capacity Reservation. Specify either `default` or `dedicated`.
*/
readonly tenancy?: pulumi.Input<Tenancy>;
}
/**
* The set of arguments for constructing a CapacityReservation resource.
*/
export interface CapacityReservationArgs {
/**
* The Availability Zone in which to create the Capacity Reservation.
*/
readonly availabilityZone: pulumi.Input<string>;
/**
* Indicates whether the Capacity Reservation supports EBS-optimized instances.
*/
readonly ebsOptimized?: pulumi.Input<boolean>;
/**
* The date and time at which the Capacity Reservation expires. When a Capacity Reservation expires, the reserved capacity is released and you can no longer launch instances into it. Valid values: [RFC3339 time string](https://tools.ietf.org/html/rfc3339#section-5.8) (`YYYY-MM-DDTHH:MM:SSZ`)
*/
readonly endDate?: pulumi.Input<string>;
/**
* Indicates the way in which the Capacity Reservation ends. Specify either `unlimited` or `limited`.
*/
readonly endDateType?: pulumi.Input<string>;
/**
* Indicates whether the Capacity Reservation supports instances with temporary, block-level storage.
*/
readonly ephemeralStorage?: pulumi.Input<boolean>;
/**
* The number of instances for which to reserve capacity.
*/
readonly instanceCount: pulumi.Input<number>;
/**
* Indicates the type of instance launches that the Capacity Reservation accepts. Specify either `open` or `targeted`.
*/
readonly instanceMatchCriteria?: pulumi.Input<string>;
/**
* The type of operating system for which to reserve capacity. Valid options are `Linux/UNIX`, `Red Hat Enterprise Linux`, `SUSE Linux`, `Windows`, `Windows with SQL Server`, `Windows with SQL Server Enterprise`, `Windows with SQL Server Standard` or `Windows with SQL Server Web`.
*/
readonly instancePlatform: pulumi.Input<InstancePlatform>;
/**
* The instance type for which to reserve capacity.
*/
readonly instanceType: pulumi.Input<InstanceType>;
/**
* A mapping of tags to assign to the resource.
*/
readonly tags?: pulumi.Input<{[key: string]: any}>;
/**
* Indicates the tenancy of the Capacity Reservation. Specify either `default` or `dedicated`.
*/
readonly tenancy?: pulumi.Input<Tenancy>;
}