-
Notifications
You must be signed in to change notification settings - Fork 151
/
dedicatedHost.go
347 lines (287 loc) · 13.5 KB
/
dedicatedHost.go
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
// *** 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! ***
package ec2
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an EC2 host resource. This allows hosts to be created, updated,
// and deleted.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// test, err := ec2.NewDedicatedHost(ctx, "test", &ec2.DedicatedHostArgs{
// AutoPlacement: pulumi.String("on"),
// AvailabilityZone: pulumi.String("us-west-1a"),
// HostRecovery: pulumi.String("on"),
// InstanceType: pulumi.String("c5.18xlarge"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// hosts can be imported using the `host_id`, e.g.
//
// ```sh
// $ pulumi import aws:ec2/dedicatedHost:DedicatedHost host_id h-0385a99d0e4b20cbb
// ```
type DedicatedHost struct {
pulumi.CustomResourceState
// Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID.
AutoPlacement pulumi.StringOutput `pulumi:"autoPlacement"`
// The AZ to start the host in.
AvailabilityZone pulumi.StringOutput `pulumi:"availabilityZone"`
// Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default.
HostRecovery pulumi.StringOutput `pulumi:"hostRecovery"`
// Specifies the instance family for which to configure your Dedicated Host. Mutually exclusive with `instanceType`.
InstanceFamily pulumi.StringPtrOutput `pulumi:"instanceFamily"`
// Specifies the instance type for which to configure your Dedicated Host. When you specify the instance type, that is the only instance type that you can launch onto that host. Mutually exclusive with `instanceFamily`.
InstanceType pulumi.StringPtrOutput `pulumi:"instanceType"`
Tags pulumi.StringMapOutput `pulumi:"tags"`
}
// NewDedicatedHost registers a new resource with the given unique name, arguments, and options.
func NewDedicatedHost(ctx *pulumi.Context,
name string, args *DedicatedHostArgs, opts ...pulumi.ResourceOption) (*DedicatedHost, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AvailabilityZone == nil {
return nil, errors.New("invalid value for required argument 'AvailabilityZone'")
}
var resource DedicatedHost
err := ctx.RegisterResource("aws:ec2/dedicatedHost:DedicatedHost", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetDedicatedHost gets an existing DedicatedHost resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetDedicatedHost(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *DedicatedHostState, opts ...pulumi.ResourceOption) (*DedicatedHost, error) {
var resource DedicatedHost
err := ctx.ReadResource("aws:ec2/dedicatedHost:DedicatedHost", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering DedicatedHost resources.
type dedicatedHostState struct {
// Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID.
AutoPlacement *string `pulumi:"autoPlacement"`
// The AZ to start the host in.
AvailabilityZone *string `pulumi:"availabilityZone"`
// Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default.
HostRecovery *string `pulumi:"hostRecovery"`
// Specifies the instance family for which to configure your Dedicated Host. Mutually exclusive with `instanceType`.
InstanceFamily *string `pulumi:"instanceFamily"`
// Specifies the instance type for which to configure your Dedicated Host. When you specify the instance type, that is the only instance type that you can launch onto that host. Mutually exclusive with `instanceFamily`.
InstanceType *string `pulumi:"instanceType"`
Tags map[string]string `pulumi:"tags"`
}
type DedicatedHostState struct {
// Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID.
AutoPlacement pulumi.StringPtrInput
// The AZ to start the host in.
AvailabilityZone pulumi.StringPtrInput
// Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default.
HostRecovery pulumi.StringPtrInput
// Specifies the instance family for which to configure your Dedicated Host. Mutually exclusive with `instanceType`.
InstanceFamily pulumi.StringPtrInput
// Specifies the instance type for which to configure your Dedicated Host. When you specify the instance type, that is the only instance type that you can launch onto that host. Mutually exclusive with `instanceFamily`.
InstanceType pulumi.StringPtrInput
Tags pulumi.StringMapInput
}
func (DedicatedHostState) ElementType() reflect.Type {
return reflect.TypeOf((*dedicatedHostState)(nil)).Elem()
}
type dedicatedHostArgs struct {
// Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID.
AutoPlacement *string `pulumi:"autoPlacement"`
// The AZ to start the host in.
AvailabilityZone string `pulumi:"availabilityZone"`
// Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default.
HostRecovery *string `pulumi:"hostRecovery"`
// Specifies the instance family for which to configure your Dedicated Host. Mutually exclusive with `instanceType`.
InstanceFamily *string `pulumi:"instanceFamily"`
// Specifies the instance type for which to configure your Dedicated Host. When you specify the instance type, that is the only instance type that you can launch onto that host. Mutually exclusive with `instanceFamily`.
InstanceType *string `pulumi:"instanceType"`
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a DedicatedHost resource.
type DedicatedHostArgs struct {
// Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID.
AutoPlacement pulumi.StringPtrInput
// The AZ to start the host in.
AvailabilityZone pulumi.StringInput
// Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default.
HostRecovery pulumi.StringPtrInput
// Specifies the instance family for which to configure your Dedicated Host. Mutually exclusive with `instanceType`.
InstanceFamily pulumi.StringPtrInput
// Specifies the instance type for which to configure your Dedicated Host. When you specify the instance type, that is the only instance type that you can launch onto that host. Mutually exclusive with `instanceFamily`.
InstanceType pulumi.StringPtrInput
Tags pulumi.StringMapInput
}
func (DedicatedHostArgs) ElementType() reflect.Type {
return reflect.TypeOf((*dedicatedHostArgs)(nil)).Elem()
}
type DedicatedHostInput interface {
pulumi.Input
ToDedicatedHostOutput() DedicatedHostOutput
ToDedicatedHostOutputWithContext(ctx context.Context) DedicatedHostOutput
}
func (*DedicatedHost) ElementType() reflect.Type {
return reflect.TypeOf((*DedicatedHost)(nil))
}
func (i *DedicatedHost) ToDedicatedHostOutput() DedicatedHostOutput {
return i.ToDedicatedHostOutputWithContext(context.Background())
}
func (i *DedicatedHost) ToDedicatedHostOutputWithContext(ctx context.Context) DedicatedHostOutput {
return pulumi.ToOutputWithContext(ctx, i).(DedicatedHostOutput)
}
func (i *DedicatedHost) ToDedicatedHostPtrOutput() DedicatedHostPtrOutput {
return i.ToDedicatedHostPtrOutputWithContext(context.Background())
}
func (i *DedicatedHost) ToDedicatedHostPtrOutputWithContext(ctx context.Context) DedicatedHostPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(DedicatedHostPtrOutput)
}
type DedicatedHostPtrInput interface {
pulumi.Input
ToDedicatedHostPtrOutput() DedicatedHostPtrOutput
ToDedicatedHostPtrOutputWithContext(ctx context.Context) DedicatedHostPtrOutput
}
type dedicatedHostPtrType DedicatedHostArgs
func (*dedicatedHostPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**DedicatedHost)(nil))
}
func (i *dedicatedHostPtrType) ToDedicatedHostPtrOutput() DedicatedHostPtrOutput {
return i.ToDedicatedHostPtrOutputWithContext(context.Background())
}
func (i *dedicatedHostPtrType) ToDedicatedHostPtrOutputWithContext(ctx context.Context) DedicatedHostPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(DedicatedHostPtrOutput)
}
// DedicatedHostArrayInput is an input type that accepts DedicatedHostArray and DedicatedHostArrayOutput values.
// You can construct a concrete instance of `DedicatedHostArrayInput` via:
//
// DedicatedHostArray{ DedicatedHostArgs{...} }
type DedicatedHostArrayInput interface {
pulumi.Input
ToDedicatedHostArrayOutput() DedicatedHostArrayOutput
ToDedicatedHostArrayOutputWithContext(context.Context) DedicatedHostArrayOutput
}
type DedicatedHostArray []DedicatedHostInput
func (DedicatedHostArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*DedicatedHost)(nil))
}
func (i DedicatedHostArray) ToDedicatedHostArrayOutput() DedicatedHostArrayOutput {
return i.ToDedicatedHostArrayOutputWithContext(context.Background())
}
func (i DedicatedHostArray) ToDedicatedHostArrayOutputWithContext(ctx context.Context) DedicatedHostArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(DedicatedHostArrayOutput)
}
// DedicatedHostMapInput is an input type that accepts DedicatedHostMap and DedicatedHostMapOutput values.
// You can construct a concrete instance of `DedicatedHostMapInput` via:
//
// DedicatedHostMap{ "key": DedicatedHostArgs{...} }
type DedicatedHostMapInput interface {
pulumi.Input
ToDedicatedHostMapOutput() DedicatedHostMapOutput
ToDedicatedHostMapOutputWithContext(context.Context) DedicatedHostMapOutput
}
type DedicatedHostMap map[string]DedicatedHostInput
func (DedicatedHostMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*DedicatedHost)(nil))
}
func (i DedicatedHostMap) ToDedicatedHostMapOutput() DedicatedHostMapOutput {
return i.ToDedicatedHostMapOutputWithContext(context.Background())
}
func (i DedicatedHostMap) ToDedicatedHostMapOutputWithContext(ctx context.Context) DedicatedHostMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(DedicatedHostMapOutput)
}
type DedicatedHostOutput struct {
*pulumi.OutputState
}
func (DedicatedHostOutput) ElementType() reflect.Type {
return reflect.TypeOf((*DedicatedHost)(nil))
}
func (o DedicatedHostOutput) ToDedicatedHostOutput() DedicatedHostOutput {
return o
}
func (o DedicatedHostOutput) ToDedicatedHostOutputWithContext(ctx context.Context) DedicatedHostOutput {
return o
}
func (o DedicatedHostOutput) ToDedicatedHostPtrOutput() DedicatedHostPtrOutput {
return o.ToDedicatedHostPtrOutputWithContext(context.Background())
}
func (o DedicatedHostOutput) ToDedicatedHostPtrOutputWithContext(ctx context.Context) DedicatedHostPtrOutput {
return o.ApplyT(func(v DedicatedHost) *DedicatedHost {
return &v
}).(DedicatedHostPtrOutput)
}
type DedicatedHostPtrOutput struct {
*pulumi.OutputState
}
func (DedicatedHostPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**DedicatedHost)(nil))
}
func (o DedicatedHostPtrOutput) ToDedicatedHostPtrOutput() DedicatedHostPtrOutput {
return o
}
func (o DedicatedHostPtrOutput) ToDedicatedHostPtrOutputWithContext(ctx context.Context) DedicatedHostPtrOutput {
return o
}
type DedicatedHostArrayOutput struct{ *pulumi.OutputState }
func (DedicatedHostArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]DedicatedHost)(nil))
}
func (o DedicatedHostArrayOutput) ToDedicatedHostArrayOutput() DedicatedHostArrayOutput {
return o
}
func (o DedicatedHostArrayOutput) ToDedicatedHostArrayOutputWithContext(ctx context.Context) DedicatedHostArrayOutput {
return o
}
func (o DedicatedHostArrayOutput) Index(i pulumi.IntInput) DedicatedHostOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) DedicatedHost {
return vs[0].([]DedicatedHost)[vs[1].(int)]
}).(DedicatedHostOutput)
}
type DedicatedHostMapOutput struct{ *pulumi.OutputState }
func (DedicatedHostMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]DedicatedHost)(nil))
}
func (o DedicatedHostMapOutput) ToDedicatedHostMapOutput() DedicatedHostMapOutput {
return o
}
func (o DedicatedHostMapOutput) ToDedicatedHostMapOutputWithContext(ctx context.Context) DedicatedHostMapOutput {
return o
}
func (o DedicatedHostMapOutput) MapIndex(k pulumi.StringInput) DedicatedHostOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) DedicatedHost {
return vs[0].(map[string]DedicatedHost)[vs[1].(string)]
}).(DedicatedHostOutput)
}
func init() {
pulumi.RegisterOutputType(DedicatedHostOutput{})
pulumi.RegisterOutputType(DedicatedHostPtrOutput{})
pulumi.RegisterOutputType(DedicatedHostArrayOutput{})
pulumi.RegisterOutputType(DedicatedHostMapOutput{})
}