generated from pulumi/pulumi-tf-provider-boilerplate
/
ecsSnapshot.go
441 lines (383 loc) · 16.5 KB
/
ecsSnapshot.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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package ecs
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a ECS Snapshot resource.
//
// For information about ECS Snapshot and how to use it, see [What is Snapshot](https://www.alibabacloud.com/help/en/doc-detail/25524.htm).
//
// > **NOTE:** Available in v1.120.0+.
//
// ## Example Usage
//
// # Basic Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/rhysmdnz/pulumi-alicloud/sdk/go/alicloud/ecs"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ecs.NewEcsSnapshot(ctx, "default", &ecs.EcsSnapshotArgs{
// Category: pulumi.String("standard"),
// Description: pulumi.String("Test For Terraform"),
// DiskId: pulumi.String("d-gw8csgxxxxxxxxx"),
// RetentionDays: pulumi.Int(20),
// SnapshotName: pulumi.String("tf-test"),
// Tags: pulumi.AnyMap{
// "Created": pulumi.Any("TF"),
// "For": pulumi.Any("Acceptance-test"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// ECS Snapshot can be imported using the id, e.g.
//
// ```sh
//
// $ pulumi import alicloud:ecs/ecsSnapshot:EcsSnapshot example <id>
//
// ```
type EcsSnapshot struct {
pulumi.CustomResourceState
// The category of the snapshot. Valid Values: `standard` and `flash`.
Category pulumi.StringPtrOutput `pulumi:"category"`
// The description of the snapshot.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The ID of the disk.
DiskId pulumi.StringOutput `pulumi:"diskId"`
// Specifies whether to forcibly delete the snapshot that has been used to create disks.
Force pulumi.BoolPtrOutput `pulumi:"force"`
// Specifies whether to enable the instant access feature.
InstantAccess pulumi.BoolPtrOutput `pulumi:"instantAccess"`
// Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
InstantAccessRetentionDays pulumi.IntPtrOutput `pulumi:"instantAccessRetentionDays"`
// Field `name` has been deprecated from provider version 1.120.0. New field `snapshotName` instead.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name pulumi.StringOutput `pulumi:"name"`
// The resource group id.
ResourceGroupId pulumi.StringPtrOutput `pulumi:"resourceGroupId"`
// The retention period of the snapshot.
RetentionDays pulumi.IntPtrOutput `pulumi:"retentionDays"`
// The name of the snapshot.
SnapshotName pulumi.StringOutput `pulumi:"snapshotName"`
// The status of snapshot.
Status pulumi.StringOutput `pulumi:"status"`
// A mapping of tags to assign to the snapshot.
Tags pulumi.MapOutput `pulumi:"tags"`
}
// NewEcsSnapshot registers a new resource with the given unique name, arguments, and options.
func NewEcsSnapshot(ctx *pulumi.Context,
name string, args *EcsSnapshotArgs, opts ...pulumi.ResourceOption) (*EcsSnapshot, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DiskId == nil {
return nil, errors.New("invalid value for required argument 'DiskId'")
}
opts = pkgResourceDefaultOpts(opts)
var resource EcsSnapshot
err := ctx.RegisterResource("alicloud:ecs/ecsSnapshot:EcsSnapshot", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEcsSnapshot gets an existing EcsSnapshot 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 GetEcsSnapshot(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EcsSnapshotState, opts ...pulumi.ResourceOption) (*EcsSnapshot, error) {
var resource EcsSnapshot
err := ctx.ReadResource("alicloud:ecs/ecsSnapshot:EcsSnapshot", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering EcsSnapshot resources.
type ecsSnapshotState struct {
// The category of the snapshot. Valid Values: `standard` and `flash`.
Category *string `pulumi:"category"`
// The description of the snapshot.
Description *string `pulumi:"description"`
// The ID of the disk.
DiskId *string `pulumi:"diskId"`
// Specifies whether to forcibly delete the snapshot that has been used to create disks.
Force *bool `pulumi:"force"`
// Specifies whether to enable the instant access feature.
InstantAccess *bool `pulumi:"instantAccess"`
// Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
InstantAccessRetentionDays *int `pulumi:"instantAccessRetentionDays"`
// Field `name` has been deprecated from provider version 1.120.0. New field `snapshotName` instead.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name *string `pulumi:"name"`
// The resource group id.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// The retention period of the snapshot.
RetentionDays *int `pulumi:"retentionDays"`
// The name of the snapshot.
SnapshotName *string `pulumi:"snapshotName"`
// The status of snapshot.
Status *string `pulumi:"status"`
// A mapping of tags to assign to the snapshot.
Tags map[string]interface{} `pulumi:"tags"`
}
type EcsSnapshotState struct {
// The category of the snapshot. Valid Values: `standard` and `flash`.
Category pulumi.StringPtrInput
// The description of the snapshot.
Description pulumi.StringPtrInput
// The ID of the disk.
DiskId pulumi.StringPtrInput
// Specifies whether to forcibly delete the snapshot that has been used to create disks.
Force pulumi.BoolPtrInput
// Specifies whether to enable the instant access feature.
InstantAccess pulumi.BoolPtrInput
// Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
InstantAccessRetentionDays pulumi.IntPtrInput
// Field `name` has been deprecated from provider version 1.120.0. New field `snapshotName` instead.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name pulumi.StringPtrInput
// The resource group id.
ResourceGroupId pulumi.StringPtrInput
// The retention period of the snapshot.
RetentionDays pulumi.IntPtrInput
// The name of the snapshot.
SnapshotName pulumi.StringPtrInput
// The status of snapshot.
Status pulumi.StringPtrInput
// A mapping of tags to assign to the snapshot.
Tags pulumi.MapInput
}
func (EcsSnapshotState) ElementType() reflect.Type {
return reflect.TypeOf((*ecsSnapshotState)(nil)).Elem()
}
type ecsSnapshotArgs struct {
// The category of the snapshot. Valid Values: `standard` and `flash`.
Category *string `pulumi:"category"`
// The description of the snapshot.
Description *string `pulumi:"description"`
// The ID of the disk.
DiskId string `pulumi:"diskId"`
// Specifies whether to forcibly delete the snapshot that has been used to create disks.
Force *bool `pulumi:"force"`
// Specifies whether to enable the instant access feature.
InstantAccess *bool `pulumi:"instantAccess"`
// Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
InstantAccessRetentionDays *int `pulumi:"instantAccessRetentionDays"`
// Field `name` has been deprecated from provider version 1.120.0. New field `snapshotName` instead.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name *string `pulumi:"name"`
// The resource group id.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// The retention period of the snapshot.
RetentionDays *int `pulumi:"retentionDays"`
// The name of the snapshot.
SnapshotName *string `pulumi:"snapshotName"`
// A mapping of tags to assign to the snapshot.
Tags map[string]interface{} `pulumi:"tags"`
}
// The set of arguments for constructing a EcsSnapshot resource.
type EcsSnapshotArgs struct {
// The category of the snapshot. Valid Values: `standard` and `flash`.
Category pulumi.StringPtrInput
// The description of the snapshot.
Description pulumi.StringPtrInput
// The ID of the disk.
DiskId pulumi.StringInput
// Specifies whether to forcibly delete the snapshot that has been used to create disks.
Force pulumi.BoolPtrInput
// Specifies whether to enable the instant access feature.
InstantAccess pulumi.BoolPtrInput
// Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
InstantAccessRetentionDays pulumi.IntPtrInput
// Field `name` has been deprecated from provider version 1.120.0. New field `snapshotName` instead.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name pulumi.StringPtrInput
// The resource group id.
ResourceGroupId pulumi.StringPtrInput
// The retention period of the snapshot.
RetentionDays pulumi.IntPtrInput
// The name of the snapshot.
SnapshotName pulumi.StringPtrInput
// A mapping of tags to assign to the snapshot.
Tags pulumi.MapInput
}
func (EcsSnapshotArgs) ElementType() reflect.Type {
return reflect.TypeOf((*ecsSnapshotArgs)(nil)).Elem()
}
type EcsSnapshotInput interface {
pulumi.Input
ToEcsSnapshotOutput() EcsSnapshotOutput
ToEcsSnapshotOutputWithContext(ctx context.Context) EcsSnapshotOutput
}
func (*EcsSnapshot) ElementType() reflect.Type {
return reflect.TypeOf((**EcsSnapshot)(nil)).Elem()
}
func (i *EcsSnapshot) ToEcsSnapshotOutput() EcsSnapshotOutput {
return i.ToEcsSnapshotOutputWithContext(context.Background())
}
func (i *EcsSnapshot) ToEcsSnapshotOutputWithContext(ctx context.Context) EcsSnapshotOutput {
return pulumi.ToOutputWithContext(ctx, i).(EcsSnapshotOutput)
}
// EcsSnapshotArrayInput is an input type that accepts EcsSnapshotArray and EcsSnapshotArrayOutput values.
// You can construct a concrete instance of `EcsSnapshotArrayInput` via:
//
// EcsSnapshotArray{ EcsSnapshotArgs{...} }
type EcsSnapshotArrayInput interface {
pulumi.Input
ToEcsSnapshotArrayOutput() EcsSnapshotArrayOutput
ToEcsSnapshotArrayOutputWithContext(context.Context) EcsSnapshotArrayOutput
}
type EcsSnapshotArray []EcsSnapshotInput
func (EcsSnapshotArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EcsSnapshot)(nil)).Elem()
}
func (i EcsSnapshotArray) ToEcsSnapshotArrayOutput() EcsSnapshotArrayOutput {
return i.ToEcsSnapshotArrayOutputWithContext(context.Background())
}
func (i EcsSnapshotArray) ToEcsSnapshotArrayOutputWithContext(ctx context.Context) EcsSnapshotArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(EcsSnapshotArrayOutput)
}
// EcsSnapshotMapInput is an input type that accepts EcsSnapshotMap and EcsSnapshotMapOutput values.
// You can construct a concrete instance of `EcsSnapshotMapInput` via:
//
// EcsSnapshotMap{ "key": EcsSnapshotArgs{...} }
type EcsSnapshotMapInput interface {
pulumi.Input
ToEcsSnapshotMapOutput() EcsSnapshotMapOutput
ToEcsSnapshotMapOutputWithContext(context.Context) EcsSnapshotMapOutput
}
type EcsSnapshotMap map[string]EcsSnapshotInput
func (EcsSnapshotMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EcsSnapshot)(nil)).Elem()
}
func (i EcsSnapshotMap) ToEcsSnapshotMapOutput() EcsSnapshotMapOutput {
return i.ToEcsSnapshotMapOutputWithContext(context.Background())
}
func (i EcsSnapshotMap) ToEcsSnapshotMapOutputWithContext(ctx context.Context) EcsSnapshotMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(EcsSnapshotMapOutput)
}
type EcsSnapshotOutput struct{ *pulumi.OutputState }
func (EcsSnapshotOutput) ElementType() reflect.Type {
return reflect.TypeOf((**EcsSnapshot)(nil)).Elem()
}
func (o EcsSnapshotOutput) ToEcsSnapshotOutput() EcsSnapshotOutput {
return o
}
func (o EcsSnapshotOutput) ToEcsSnapshotOutputWithContext(ctx context.Context) EcsSnapshotOutput {
return o
}
// The category of the snapshot. Valid Values: `standard` and `flash`.
func (o EcsSnapshotOutput) Category() pulumi.StringPtrOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.StringPtrOutput { return v.Category }).(pulumi.StringPtrOutput)
}
// The description of the snapshot.
func (o EcsSnapshotOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// The ID of the disk.
func (o EcsSnapshotOutput) DiskId() pulumi.StringOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.StringOutput { return v.DiskId }).(pulumi.StringOutput)
}
// Specifies whether to forcibly delete the snapshot that has been used to create disks.
func (o EcsSnapshotOutput) Force() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.BoolPtrOutput { return v.Force }).(pulumi.BoolPtrOutput)
}
// Specifies whether to enable the instant access feature.
func (o EcsSnapshotOutput) InstantAccess() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.BoolPtrOutput { return v.InstantAccess }).(pulumi.BoolPtrOutput)
}
// Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.
func (o EcsSnapshotOutput) InstantAccessRetentionDays() pulumi.IntPtrOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.IntPtrOutput { return v.InstantAccessRetentionDays }).(pulumi.IntPtrOutput)
}
// Field `name` has been deprecated from provider version 1.120.0. New field `snapshotName` instead.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
func (o EcsSnapshotOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The resource group id.
func (o EcsSnapshotOutput) ResourceGroupId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.StringPtrOutput { return v.ResourceGroupId }).(pulumi.StringPtrOutput)
}
// The retention period of the snapshot.
func (o EcsSnapshotOutput) RetentionDays() pulumi.IntPtrOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.IntPtrOutput { return v.RetentionDays }).(pulumi.IntPtrOutput)
}
// The name of the snapshot.
func (o EcsSnapshotOutput) SnapshotName() pulumi.StringOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.StringOutput { return v.SnapshotName }).(pulumi.StringOutput)
}
// The status of snapshot.
func (o EcsSnapshotOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// A mapping of tags to assign to the snapshot.
func (o EcsSnapshotOutput) Tags() pulumi.MapOutput {
return o.ApplyT(func(v *EcsSnapshot) pulumi.MapOutput { return v.Tags }).(pulumi.MapOutput)
}
type EcsSnapshotArrayOutput struct{ *pulumi.OutputState }
func (EcsSnapshotArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EcsSnapshot)(nil)).Elem()
}
func (o EcsSnapshotArrayOutput) ToEcsSnapshotArrayOutput() EcsSnapshotArrayOutput {
return o
}
func (o EcsSnapshotArrayOutput) ToEcsSnapshotArrayOutputWithContext(ctx context.Context) EcsSnapshotArrayOutput {
return o
}
func (o EcsSnapshotArrayOutput) Index(i pulumi.IntInput) EcsSnapshotOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EcsSnapshot {
return vs[0].([]*EcsSnapshot)[vs[1].(int)]
}).(EcsSnapshotOutput)
}
type EcsSnapshotMapOutput struct{ *pulumi.OutputState }
func (EcsSnapshotMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EcsSnapshot)(nil)).Elem()
}
func (o EcsSnapshotMapOutput) ToEcsSnapshotMapOutput() EcsSnapshotMapOutput {
return o
}
func (o EcsSnapshotMapOutput) ToEcsSnapshotMapOutputWithContext(ctx context.Context) EcsSnapshotMapOutput {
return o
}
func (o EcsSnapshotMapOutput) MapIndex(k pulumi.StringInput) EcsSnapshotOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EcsSnapshot {
return vs[0].(map[string]*EcsSnapshot)[vs[1].(string)]
}).(EcsSnapshotOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*EcsSnapshotInput)(nil)).Elem(), &EcsSnapshot{})
pulumi.RegisterInputType(reflect.TypeOf((*EcsSnapshotArrayInput)(nil)).Elem(), EcsSnapshotArray{})
pulumi.RegisterInputType(reflect.TypeOf((*EcsSnapshotMapInput)(nil)).Elem(), EcsSnapshotMap{})
pulumi.RegisterOutputType(EcsSnapshotOutput{})
pulumi.RegisterOutputType(EcsSnapshotArrayOutput{})
pulumi.RegisterOutputType(EcsSnapshotMapOutput{})
}