/
snapshot.go
361 lines (301 loc) · 13.5 KB
/
snapshot.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
// *** 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 ecs
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// ## Import
//
// Snapshot can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:ecs/snapshot:Snapshot snapshot s-abc1234567890000
// ```
type Snapshot struct {
pulumi.CustomResourceState
Category pulumi.StringPtrOutput `pulumi:"category"`
// Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The source disk ID.
DiskId pulumi.StringOutput `pulumi:"diskId"`
Force pulumi.BoolPtrOutput `pulumi:"force"`
InstantAccess pulumi.BoolPtrOutput `pulumi:"instantAccess"`
InstantAccessRetentionDays pulumi.IntPtrOutput `pulumi:"instantAccessRetentionDays"`
// The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).
// It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the resource group.
ResourceGroupId pulumi.StringPtrOutput `pulumi:"resourceGroupId"`
RetentionDays pulumi.IntPtrOutput `pulumi:"retentionDays"`
SnapshotName pulumi.StringOutput `pulumi:"snapshotName"`
Status pulumi.StringOutput `pulumi:"status"`
// A mapping of tags to assign to the resource.
Tags pulumi.MapOutput `pulumi:"tags"`
}
// NewSnapshot registers a new resource with the given unique name, arguments, and options.
func NewSnapshot(ctx *pulumi.Context,
name string, args *SnapshotArgs, opts ...pulumi.ResourceOption) (*Snapshot, 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'")
}
var resource Snapshot
err := ctx.RegisterResource("alicloud:ecs/snapshot:Snapshot", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSnapshot gets an existing Snapshot 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 GetSnapshot(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SnapshotState, opts ...pulumi.ResourceOption) (*Snapshot, error) {
var resource Snapshot
err := ctx.ReadResource("alicloud:ecs/snapshot:Snapshot", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Snapshot resources.
type snapshotState struct {
Category *string `pulumi:"category"`
// Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description *string `pulumi:"description"`
// The source disk ID.
DiskId *string `pulumi:"diskId"`
Force *bool `pulumi:"force"`
InstantAccess *bool `pulumi:"instantAccess"`
InstantAccessRetentionDays *int `pulumi:"instantAccessRetentionDays"`
// The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).
// It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name *string `pulumi:"name"`
// The ID of the resource group.
ResourceGroupId *string `pulumi:"resourceGroupId"`
RetentionDays *int `pulumi:"retentionDays"`
SnapshotName *string `pulumi:"snapshotName"`
Status *string `pulumi:"status"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
}
type SnapshotState struct {
Category pulumi.StringPtrInput
// Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description pulumi.StringPtrInput
// The source disk ID.
DiskId pulumi.StringPtrInput
Force pulumi.BoolPtrInput
InstantAccess pulumi.BoolPtrInput
InstantAccessRetentionDays pulumi.IntPtrInput
// The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).
// It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name pulumi.StringPtrInput
// The ID of the resource group.
ResourceGroupId pulumi.StringPtrInput
RetentionDays pulumi.IntPtrInput
SnapshotName pulumi.StringPtrInput
Status pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
}
func (SnapshotState) ElementType() reflect.Type {
return reflect.TypeOf((*snapshotState)(nil)).Elem()
}
type snapshotArgs struct {
Category *string `pulumi:"category"`
// Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description *string `pulumi:"description"`
// The source disk ID.
DiskId string `pulumi:"diskId"`
Force *bool `pulumi:"force"`
InstantAccess *bool `pulumi:"instantAccess"`
InstantAccessRetentionDays *int `pulumi:"instantAccessRetentionDays"`
// The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).
// It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name *string `pulumi:"name"`
// The ID of the resource group.
ResourceGroupId *string `pulumi:"resourceGroupId"`
RetentionDays *int `pulumi:"retentionDays"`
SnapshotName *string `pulumi:"snapshotName"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
}
// The set of arguments for constructing a Snapshot resource.
type SnapshotArgs struct {
Category pulumi.StringPtrInput
// Description of the snapshot. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description pulumi.StringPtrInput
// The source disk ID.
DiskId pulumi.StringInput
Force pulumi.BoolPtrInput
InstantAccess pulumi.BoolPtrInput
InstantAccessRetentionDays pulumi.IntPtrInput
// The name of the snapshot to be created. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).
// It cannot start with auto, because snapshot names starting with auto are recognized as automatic snapshots.
//
// Deprecated: Field 'name' has been deprecated from provider version 1.120.0. New field 'snapshot_name' instead.
Name pulumi.StringPtrInput
// The ID of the resource group.
ResourceGroupId pulumi.StringPtrInput
RetentionDays pulumi.IntPtrInput
SnapshotName pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
}
func (SnapshotArgs) ElementType() reflect.Type {
return reflect.TypeOf((*snapshotArgs)(nil)).Elem()
}
type SnapshotInput interface {
pulumi.Input
ToSnapshotOutput() SnapshotOutput
ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput
}
func (*Snapshot) ElementType() reflect.Type {
return reflect.TypeOf((*Snapshot)(nil))
}
func (i *Snapshot) ToSnapshotOutput() SnapshotOutput {
return i.ToSnapshotOutputWithContext(context.Background())
}
func (i *Snapshot) ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput {
return pulumi.ToOutputWithContext(ctx, i).(SnapshotOutput)
}
func (i *Snapshot) ToSnapshotPtrOutput() SnapshotPtrOutput {
return i.ToSnapshotPtrOutputWithContext(context.Background())
}
func (i *Snapshot) ToSnapshotPtrOutputWithContext(ctx context.Context) SnapshotPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SnapshotPtrOutput)
}
type SnapshotPtrInput interface {
pulumi.Input
ToSnapshotPtrOutput() SnapshotPtrOutput
ToSnapshotPtrOutputWithContext(ctx context.Context) SnapshotPtrOutput
}
type snapshotPtrType SnapshotArgs
func (*snapshotPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Snapshot)(nil))
}
func (i *snapshotPtrType) ToSnapshotPtrOutput() SnapshotPtrOutput {
return i.ToSnapshotPtrOutputWithContext(context.Background())
}
func (i *snapshotPtrType) ToSnapshotPtrOutputWithContext(ctx context.Context) SnapshotPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SnapshotPtrOutput)
}
// SnapshotArrayInput is an input type that accepts SnapshotArray and SnapshotArrayOutput values.
// You can construct a concrete instance of `SnapshotArrayInput` via:
//
// SnapshotArray{ SnapshotArgs{...} }
type SnapshotArrayInput interface {
pulumi.Input
ToSnapshotArrayOutput() SnapshotArrayOutput
ToSnapshotArrayOutputWithContext(context.Context) SnapshotArrayOutput
}
type SnapshotArray []SnapshotInput
func (SnapshotArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*Snapshot)(nil))
}
func (i SnapshotArray) ToSnapshotArrayOutput() SnapshotArrayOutput {
return i.ToSnapshotArrayOutputWithContext(context.Background())
}
func (i SnapshotArray) ToSnapshotArrayOutputWithContext(ctx context.Context) SnapshotArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SnapshotArrayOutput)
}
// SnapshotMapInput is an input type that accepts SnapshotMap and SnapshotMapOutput values.
// You can construct a concrete instance of `SnapshotMapInput` via:
//
// SnapshotMap{ "key": SnapshotArgs{...} }
type SnapshotMapInput interface {
pulumi.Input
ToSnapshotMapOutput() SnapshotMapOutput
ToSnapshotMapOutputWithContext(context.Context) SnapshotMapOutput
}
type SnapshotMap map[string]SnapshotInput
func (SnapshotMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*Snapshot)(nil))
}
func (i SnapshotMap) ToSnapshotMapOutput() SnapshotMapOutput {
return i.ToSnapshotMapOutputWithContext(context.Background())
}
func (i SnapshotMap) ToSnapshotMapOutputWithContext(ctx context.Context) SnapshotMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SnapshotMapOutput)
}
type SnapshotOutput struct {
*pulumi.OutputState
}
func (SnapshotOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Snapshot)(nil))
}
func (o SnapshotOutput) ToSnapshotOutput() SnapshotOutput {
return o
}
func (o SnapshotOutput) ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput {
return o
}
func (o SnapshotOutput) ToSnapshotPtrOutput() SnapshotPtrOutput {
return o.ToSnapshotPtrOutputWithContext(context.Background())
}
func (o SnapshotOutput) ToSnapshotPtrOutputWithContext(ctx context.Context) SnapshotPtrOutput {
return o.ApplyT(func(v Snapshot) *Snapshot {
return &v
}).(SnapshotPtrOutput)
}
type SnapshotPtrOutput struct {
*pulumi.OutputState
}
func (SnapshotPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Snapshot)(nil))
}
func (o SnapshotPtrOutput) ToSnapshotPtrOutput() SnapshotPtrOutput {
return o
}
func (o SnapshotPtrOutput) ToSnapshotPtrOutputWithContext(ctx context.Context) SnapshotPtrOutput {
return o
}
type SnapshotArrayOutput struct{ *pulumi.OutputState }
func (SnapshotArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Snapshot)(nil))
}
func (o SnapshotArrayOutput) ToSnapshotArrayOutput() SnapshotArrayOutput {
return o
}
func (o SnapshotArrayOutput) ToSnapshotArrayOutputWithContext(ctx context.Context) SnapshotArrayOutput {
return o
}
func (o SnapshotArrayOutput) Index(i pulumi.IntInput) SnapshotOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Snapshot {
return vs[0].([]Snapshot)[vs[1].(int)]
}).(SnapshotOutput)
}
type SnapshotMapOutput struct{ *pulumi.OutputState }
func (SnapshotMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Snapshot)(nil))
}
func (o SnapshotMapOutput) ToSnapshotMapOutput() SnapshotMapOutput {
return o
}
func (o SnapshotMapOutput) ToSnapshotMapOutputWithContext(ctx context.Context) SnapshotMapOutput {
return o
}
func (o SnapshotMapOutput) MapIndex(k pulumi.StringInput) SnapshotOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Snapshot {
return vs[0].(map[string]Snapshot)[vs[1].(string)]
}).(SnapshotOutput)
}
func init() {
pulumi.RegisterOutputType(SnapshotOutput{})
pulumi.RegisterOutputType(SnapshotPtrOutput{})
pulumi.RegisterOutputType(SnapshotArrayOutput{})
pulumi.RegisterOutputType(SnapshotMapOutput{})
}