/
backup.go
401 lines (355 loc) · 13.8 KB
/
backup.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
// *** 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 fsx
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a FSx Backup resource.
//
// ## Lustre Example
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/fsx"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleLustreFileSystem, err := fsx.NewLustreFileSystem(ctx, "exampleLustreFileSystem", &fsx.LustreFileSystemArgs{
// StorageCapacity: pulumi.Int(1200),
// SubnetIds: pulumi.String{
// aws_subnet.Example.Id,
// },
// DeploymentType: pulumi.String("PERSISTENT_1"),
// PerUnitStorageThroughput: pulumi.Int(50),
// })
// if err != nil {
// return err
// }
// _, err = fsx.NewBackup(ctx, "exampleBackup", &fsx.BackupArgs{
// FileSystemId: exampleLustreFileSystem.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Windows Example
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/fsx"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleWindowsFileSystem, err := fsx.NewWindowsFileSystem(ctx, "exampleWindowsFileSystem", &fsx.WindowsFileSystemArgs{
// ActiveDirectoryId: pulumi.Any(aws_directory_service_directory.Eample.Id),
// SkipFinalBackup: pulumi.Bool(true),
// StorageCapacity: pulumi.Int(32),
// SubnetIds: pulumi.StringArray{
// pulumi.Any(aws_subnet.Example1.Id),
// },
// ThroughputCapacity: pulumi.Int(8),
// })
// if err != nil {
// return err
// }
// _, err = fsx.NewBackup(ctx, "exampleBackup", &fsx.BackupArgs{
// FileSystemId: exampleWindowsFileSystem.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## ONTAP Example
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/fsx"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleOntapVolume, err := fsx.NewOntapVolume(ctx, "exampleOntapVolume", &fsx.OntapVolumeArgs{
// JunctionPath: pulumi.String("/example"),
// SizeInMegabytes: pulumi.Int(1024),
// StorageEfficiencyEnabled: pulumi.Bool(true),
// StorageVirtualMachineId: pulumi.Any(aws_fsx_ontap_storage_virtual_machine.Test.Id),
// })
// if err != nil {
// return err
// }
// _, err = fsx.NewBackup(ctx, "exampleBackup", &fsx.BackupArgs{
// VolumeId: exampleOntapVolume.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## OpenZFS Example
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/fsx"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleOpenZfsFileSystem, err := fsx.NewOpenZfsFileSystem(ctx, "exampleOpenZfsFileSystem", &fsx.OpenZfsFileSystemArgs{
// StorageCapacity: pulumi.Int(64),
// SubnetIds: pulumi.String{
// aws_subnet.Example.Id,
// },
// DeploymentType: pulumi.String("SINGLE_AZ_1"),
// ThroughputCapacity: pulumi.Int(64),
// })
// if err != nil {
// return err
// }
// _, err = fsx.NewBackup(ctx, "exampleBackup", &fsx.BackupArgs{
// FileSystemId: exampleOpenZfsFileSystem.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// FSx Backups can be imported using the `id`, e.g.,
//
// ```sh
// $ pulumi import aws:fsx/backup:Backup example fs-543ab12b1ca672f33
// ```
type Backup struct {
pulumi.CustomResourceState
// Amazon Resource Name of the backup.
Arn pulumi.StringOutput `pulumi:"arn"`
// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
FileSystemId pulumi.StringPtrOutput `pulumi:"fileSystemId"`
// The ID of the AWS Key Management Service (AWS KMS) key used to encrypt the backup of the Amazon FSx file system's data at rest.
KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"`
// AWS account identifier that created the file system.
OwnerId pulumi.StringOutput `pulumi:"ownerId"`
// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
// The type of the file system backup.
Type pulumi.StringOutput `pulumi:"type"`
// The ID of the volume to back up. Required if backing up a ONTAP Volume.
VolumeId pulumi.StringPtrOutput `pulumi:"volumeId"`
}
// NewBackup registers a new resource with the given unique name, arguments, and options.
func NewBackup(ctx *pulumi.Context,
name string, args *BackupArgs, opts ...pulumi.ResourceOption) (*Backup, error) {
if args == nil {
args = &BackupArgs{}
}
var resource Backup
err := ctx.RegisterResource("aws:fsx/backup:Backup", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBackup gets an existing Backup 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 GetBackup(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BackupState, opts ...pulumi.ResourceOption) (*Backup, error) {
var resource Backup
err := ctx.ReadResource("aws:fsx/backup:Backup", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Backup resources.
type backupState struct {
// Amazon Resource Name of the backup.
Arn *string `pulumi:"arn"`
// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
FileSystemId *string `pulumi:"fileSystemId"`
// The ID of the AWS Key Management Service (AWS KMS) key used to encrypt the backup of the Amazon FSx file system's data at rest.
KmsKeyId *string `pulumi:"kmsKeyId"`
// AWS account identifier that created the file system.
OwnerId *string `pulumi:"ownerId"`
// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
Tags map[string]string `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll map[string]string `pulumi:"tagsAll"`
// The type of the file system backup.
Type *string `pulumi:"type"`
// The ID of the volume to back up. Required if backing up a ONTAP Volume.
VolumeId *string `pulumi:"volumeId"`
}
type BackupState struct {
// Amazon Resource Name of the backup.
Arn pulumi.StringPtrInput
// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
FileSystemId pulumi.StringPtrInput
// The ID of the AWS Key Management Service (AWS KMS) key used to encrypt the backup of the Amazon FSx file system's data at rest.
KmsKeyId pulumi.StringPtrInput
// AWS account identifier that created the file system.
OwnerId pulumi.StringPtrInput
// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll pulumi.StringMapInput
// The type of the file system backup.
Type pulumi.StringPtrInput
// The ID of the volume to back up. Required if backing up a ONTAP Volume.
VolumeId pulumi.StringPtrInput
}
func (BackupState) ElementType() reflect.Type {
return reflect.TypeOf((*backupState)(nil)).Elem()
}
type backupArgs struct {
// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
FileSystemId *string `pulumi:"fileSystemId"`
// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
Tags map[string]string `pulumi:"tags"`
// The ID of the volume to back up. Required if backing up a ONTAP Volume.
VolumeId *string `pulumi:"volumeId"`
}
// The set of arguments for constructing a Backup resource.
type BackupArgs struct {
// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
FileSystemId pulumi.StringPtrInput
// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
Tags pulumi.StringMapInput
// The ID of the volume to back up. Required if backing up a ONTAP Volume.
VolumeId pulumi.StringPtrInput
}
func (BackupArgs) ElementType() reflect.Type {
return reflect.TypeOf((*backupArgs)(nil)).Elem()
}
type BackupInput interface {
pulumi.Input
ToBackupOutput() BackupOutput
ToBackupOutputWithContext(ctx context.Context) BackupOutput
}
func (*Backup) ElementType() reflect.Type {
return reflect.TypeOf((**Backup)(nil)).Elem()
}
func (i *Backup) ToBackupOutput() BackupOutput {
return i.ToBackupOutputWithContext(context.Background())
}
func (i *Backup) ToBackupOutputWithContext(ctx context.Context) BackupOutput {
return pulumi.ToOutputWithContext(ctx, i).(BackupOutput)
}
// BackupArrayInput is an input type that accepts BackupArray and BackupArrayOutput values.
// You can construct a concrete instance of `BackupArrayInput` via:
//
// BackupArray{ BackupArgs{...} }
type BackupArrayInput interface {
pulumi.Input
ToBackupArrayOutput() BackupArrayOutput
ToBackupArrayOutputWithContext(context.Context) BackupArrayOutput
}
type BackupArray []BackupInput
func (BackupArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Backup)(nil)).Elem()
}
func (i BackupArray) ToBackupArrayOutput() BackupArrayOutput {
return i.ToBackupArrayOutputWithContext(context.Background())
}
func (i BackupArray) ToBackupArrayOutputWithContext(ctx context.Context) BackupArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BackupArrayOutput)
}
// BackupMapInput is an input type that accepts BackupMap and BackupMapOutput values.
// You can construct a concrete instance of `BackupMapInput` via:
//
// BackupMap{ "key": BackupArgs{...} }
type BackupMapInput interface {
pulumi.Input
ToBackupMapOutput() BackupMapOutput
ToBackupMapOutputWithContext(context.Context) BackupMapOutput
}
type BackupMap map[string]BackupInput
func (BackupMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Backup)(nil)).Elem()
}
func (i BackupMap) ToBackupMapOutput() BackupMapOutput {
return i.ToBackupMapOutputWithContext(context.Background())
}
func (i BackupMap) ToBackupMapOutputWithContext(ctx context.Context) BackupMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BackupMapOutput)
}
type BackupOutput struct{ *pulumi.OutputState }
func (BackupOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Backup)(nil)).Elem()
}
func (o BackupOutput) ToBackupOutput() BackupOutput {
return o
}
func (o BackupOutput) ToBackupOutputWithContext(ctx context.Context) BackupOutput {
return o
}
type BackupArrayOutput struct{ *pulumi.OutputState }
func (BackupArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Backup)(nil)).Elem()
}
func (o BackupArrayOutput) ToBackupArrayOutput() BackupArrayOutput {
return o
}
func (o BackupArrayOutput) ToBackupArrayOutputWithContext(ctx context.Context) BackupArrayOutput {
return o
}
func (o BackupArrayOutput) Index(i pulumi.IntInput) BackupOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Backup {
return vs[0].([]*Backup)[vs[1].(int)]
}).(BackupOutput)
}
type BackupMapOutput struct{ *pulumi.OutputState }
func (BackupMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Backup)(nil)).Elem()
}
func (o BackupMapOutput) ToBackupMapOutput() BackupMapOutput {
return o
}
func (o BackupMapOutput) ToBackupMapOutputWithContext(ctx context.Context) BackupMapOutput {
return o
}
func (o BackupMapOutput) MapIndex(k pulumi.StringInput) BackupOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Backup {
return vs[0].(map[string]*Backup)[vs[1].(string)]
}).(BackupOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BackupInput)(nil)).Elem(), &Backup{})
pulumi.RegisterInputType(reflect.TypeOf((*BackupArrayInput)(nil)).Elem(), BackupArray{})
pulumi.RegisterInputType(reflect.TypeOf((*BackupMapInput)(nil)).Elem(), BackupMap{})
pulumi.RegisterOutputType(BackupOutput{})
pulumi.RegisterOutputType(BackupArrayOutput{})
pulumi.RegisterOutputType(BackupMapOutput{})
}