/
fileSystem.go
452 lines (392 loc) · 19.9 KB
/
fileSystem.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
442
443
444
445
446
447
448
449
450
451
452
// *** 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 efs
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Provides an Elastic File System (EFS) File System resource.
//
// ## Example Usage
// ### EFS File System w/ tags
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v3/go/aws/efs"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := efs.NewFileSystem(ctx, "foo", &efs.FileSystemArgs{
// Tags: pulumi.StringMap{
// "Name": pulumi.String("MyProduct"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// ### Using lifecycle policy
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v3/go/aws/efs"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := efs.NewFileSystem(ctx, "fooWithLifecylePolicy", &efs.FileSystemArgs{
// LifecyclePolicy: &efs.FileSystemLifecyclePolicyArgs{
// TransitionToIa: pulumi.String("AFTER_30_DAYS"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// The EFS file systems can be imported using the `id`, e.g.
//
// ```sh
// $ pulumi import aws:efs/fileSystem:FileSystem foo fs-6fa144c6
// ```
type FileSystem struct {
pulumi.CustomResourceState
// Amazon Resource Name of the file system.
Arn pulumi.StringOutput `pulumi:"arn"`
// The identifier of the Availability Zone in which the file system's One Zone storage classes exist.
AvailabilityZoneId pulumi.StringOutput `pulumi:"availabilityZoneId"`
// the AWS Availability Zone in which to create the file system. Used to create a file system that uses One Zone storage classes. See [user guide](https://docs.aws.amazon.com/efs/latest/ug/storage-classes.html) for more information.
AvailabilityZoneName pulumi.StringOutput `pulumi:"availabilityZoneName"`
// A unique name (a maximum of 64 characters are allowed)
// used as reference when creating the Elastic File System to ensure idempotent file
// system creation. By default generated by this provider. See [Elastic File System]
// (http://docs.aws.amazon.com/efs/latest/ug/) user guide for more information.
CreationToken pulumi.StringOutput `pulumi:"creationToken"`
// The DNS name for the filesystem per [documented convention](http://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html).
DnsName pulumi.StringOutput `pulumi:"dnsName"`
// If true, the disk will be encrypted.
Encrypted pulumi.BoolOutput `pulumi:"encrypted"`
// The ARN for the KMS encryption key. When specifying kms_key_id, encrypted needs to be set to true.
KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"`
// A file system [lifecycle policy](https://docs.aws.amazon.com/efs/latest/ug/API_LifecyclePolicy.html) object (documented below).
LifecyclePolicy FileSystemLifecyclePolicyPtrOutput `pulumi:"lifecyclePolicy"`
// The current number of mount targets that the file system has.
NumberOfMountTargets pulumi.IntOutput `pulumi:"numberOfMountTargets"`
// The AWS account that created the file system. If the file system was createdby an IAM user, the parent account to which the user belongs is the owner.
OwnerId pulumi.StringOutput `pulumi:"ownerId"`
// The file system performance mode. Can be either `"generalPurpose"` or `"maxIO"` (Default: `"generalPurpose"`).
PerformanceMode pulumi.StringOutput `pulumi:"performanceMode"`
// The throughput, measured in MiB/s, that you want to provision for the file system. Only applicable with `throughputMode` set to `provisioned`.
ProvisionedThroughputInMibps pulumi.Float64PtrOutput `pulumi:"provisionedThroughputInMibps"`
// The latest known metered size (in bytes) of data stored in the file system, the value is not the exact size that the file system was at any point in time. See Size In Bytes.
SizeInBytes FileSystemSizeInByteArrayOutput `pulumi:"sizeInBytes"`
// A map of tags to assign to the file system.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// Throughput mode for the file system. Defaults to `bursting`. Valid values: `bursting`, `provisioned`. When using `provisioned`, also set `provisionedThroughputInMibps`.
ThroughputMode pulumi.StringPtrOutput `pulumi:"throughputMode"`
}
// NewFileSystem registers a new resource with the given unique name, arguments, and options.
func NewFileSystem(ctx *pulumi.Context,
name string, args *FileSystemArgs, opts ...pulumi.ResourceOption) (*FileSystem, error) {
if args == nil {
args = &FileSystemArgs{}
}
var resource FileSystem
err := ctx.RegisterResource("aws:efs/fileSystem:FileSystem", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetFileSystem gets an existing FileSystem 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 GetFileSystem(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *FileSystemState, opts ...pulumi.ResourceOption) (*FileSystem, error) {
var resource FileSystem
err := ctx.ReadResource("aws:efs/fileSystem:FileSystem", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering FileSystem resources.
type fileSystemState struct {
// Amazon Resource Name of the file system.
Arn *string `pulumi:"arn"`
// The identifier of the Availability Zone in which the file system's One Zone storage classes exist.
AvailabilityZoneId *string `pulumi:"availabilityZoneId"`
// the AWS Availability Zone in which to create the file system. Used to create a file system that uses One Zone storage classes. See [user guide](https://docs.aws.amazon.com/efs/latest/ug/storage-classes.html) for more information.
AvailabilityZoneName *string `pulumi:"availabilityZoneName"`
// A unique name (a maximum of 64 characters are allowed)
// used as reference when creating the Elastic File System to ensure idempotent file
// system creation. By default generated by this provider. See [Elastic File System]
// (http://docs.aws.amazon.com/efs/latest/ug/) user guide for more information.
CreationToken *string `pulumi:"creationToken"`
// The DNS name for the filesystem per [documented convention](http://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html).
DnsName *string `pulumi:"dnsName"`
// If true, the disk will be encrypted.
Encrypted *bool `pulumi:"encrypted"`
// The ARN for the KMS encryption key. When specifying kms_key_id, encrypted needs to be set to true.
KmsKeyId *string `pulumi:"kmsKeyId"`
// A file system [lifecycle policy](https://docs.aws.amazon.com/efs/latest/ug/API_LifecyclePolicy.html) object (documented below).
LifecyclePolicy *FileSystemLifecyclePolicy `pulumi:"lifecyclePolicy"`
// The current number of mount targets that the file system has.
NumberOfMountTargets *int `pulumi:"numberOfMountTargets"`
// The AWS account that created the file system. If the file system was createdby an IAM user, the parent account to which the user belongs is the owner.
OwnerId *string `pulumi:"ownerId"`
// The file system performance mode. Can be either `"generalPurpose"` or `"maxIO"` (Default: `"generalPurpose"`).
PerformanceMode *string `pulumi:"performanceMode"`
// The throughput, measured in MiB/s, that you want to provision for the file system. Only applicable with `throughputMode` set to `provisioned`.
ProvisionedThroughputInMibps *float64 `pulumi:"provisionedThroughputInMibps"`
// The latest known metered size (in bytes) of data stored in the file system, the value is not the exact size that the file system was at any point in time. See Size In Bytes.
SizeInBytes []FileSystemSizeInByte `pulumi:"sizeInBytes"`
// A map of tags to assign to the file system.
Tags map[string]string `pulumi:"tags"`
// Throughput mode for the file system. Defaults to `bursting`. Valid values: `bursting`, `provisioned`. When using `provisioned`, also set `provisionedThroughputInMibps`.
ThroughputMode *string `pulumi:"throughputMode"`
}
type FileSystemState struct {
// Amazon Resource Name of the file system.
Arn pulumi.StringPtrInput
// The identifier of the Availability Zone in which the file system's One Zone storage classes exist.
AvailabilityZoneId pulumi.StringPtrInput
// the AWS Availability Zone in which to create the file system. Used to create a file system that uses One Zone storage classes. See [user guide](https://docs.aws.amazon.com/efs/latest/ug/storage-classes.html) for more information.
AvailabilityZoneName pulumi.StringPtrInput
// A unique name (a maximum of 64 characters are allowed)
// used as reference when creating the Elastic File System to ensure idempotent file
// system creation. By default generated by this provider. See [Elastic File System]
// (http://docs.aws.amazon.com/efs/latest/ug/) user guide for more information.
CreationToken pulumi.StringPtrInput
// The DNS name for the filesystem per [documented convention](http://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html).
DnsName pulumi.StringPtrInput
// If true, the disk will be encrypted.
Encrypted pulumi.BoolPtrInput
// The ARN for the KMS encryption key. When specifying kms_key_id, encrypted needs to be set to true.
KmsKeyId pulumi.StringPtrInput
// A file system [lifecycle policy](https://docs.aws.amazon.com/efs/latest/ug/API_LifecyclePolicy.html) object (documented below).
LifecyclePolicy FileSystemLifecyclePolicyPtrInput
// The current number of mount targets that the file system has.
NumberOfMountTargets pulumi.IntPtrInput
// The AWS account that created the file system. If the file system was createdby an IAM user, the parent account to which the user belongs is the owner.
OwnerId pulumi.StringPtrInput
// The file system performance mode. Can be either `"generalPurpose"` or `"maxIO"` (Default: `"generalPurpose"`).
PerformanceMode pulumi.StringPtrInput
// The throughput, measured in MiB/s, that you want to provision for the file system. Only applicable with `throughputMode` set to `provisioned`.
ProvisionedThroughputInMibps pulumi.Float64PtrInput
// The latest known metered size (in bytes) of data stored in the file system, the value is not the exact size that the file system was at any point in time. See Size In Bytes.
SizeInBytes FileSystemSizeInByteArrayInput
// A map of tags to assign to the file system.
Tags pulumi.StringMapInput
// Throughput mode for the file system. Defaults to `bursting`. Valid values: `bursting`, `provisioned`. When using `provisioned`, also set `provisionedThroughputInMibps`.
ThroughputMode pulumi.StringPtrInput
}
func (FileSystemState) ElementType() reflect.Type {
return reflect.TypeOf((*fileSystemState)(nil)).Elem()
}
type fileSystemArgs struct {
// the AWS Availability Zone in which to create the file system. Used to create a file system that uses One Zone storage classes. See [user guide](https://docs.aws.amazon.com/efs/latest/ug/storage-classes.html) for more information.
AvailabilityZoneName *string `pulumi:"availabilityZoneName"`
// A unique name (a maximum of 64 characters are allowed)
// used as reference when creating the Elastic File System to ensure idempotent file
// system creation. By default generated by this provider. See [Elastic File System]
// (http://docs.aws.amazon.com/efs/latest/ug/) user guide for more information.
CreationToken *string `pulumi:"creationToken"`
// If true, the disk will be encrypted.
Encrypted *bool `pulumi:"encrypted"`
// The ARN for the KMS encryption key. When specifying kms_key_id, encrypted needs to be set to true.
KmsKeyId *string `pulumi:"kmsKeyId"`
// A file system [lifecycle policy](https://docs.aws.amazon.com/efs/latest/ug/API_LifecyclePolicy.html) object (documented below).
LifecyclePolicy *FileSystemLifecyclePolicy `pulumi:"lifecyclePolicy"`
// The file system performance mode. Can be either `"generalPurpose"` or `"maxIO"` (Default: `"generalPurpose"`).
PerformanceMode *string `pulumi:"performanceMode"`
// The throughput, measured in MiB/s, that you want to provision for the file system. Only applicable with `throughputMode` set to `provisioned`.
ProvisionedThroughputInMibps *float64 `pulumi:"provisionedThroughputInMibps"`
// A map of tags to assign to the file system.
Tags map[string]string `pulumi:"tags"`
// Throughput mode for the file system. Defaults to `bursting`. Valid values: `bursting`, `provisioned`. When using `provisioned`, also set `provisionedThroughputInMibps`.
ThroughputMode *string `pulumi:"throughputMode"`
}
// The set of arguments for constructing a FileSystem resource.
type FileSystemArgs struct {
// the AWS Availability Zone in which to create the file system. Used to create a file system that uses One Zone storage classes. See [user guide](https://docs.aws.amazon.com/efs/latest/ug/storage-classes.html) for more information.
AvailabilityZoneName pulumi.StringPtrInput
// A unique name (a maximum of 64 characters are allowed)
// used as reference when creating the Elastic File System to ensure idempotent file
// system creation. By default generated by this provider. See [Elastic File System]
// (http://docs.aws.amazon.com/efs/latest/ug/) user guide for more information.
CreationToken pulumi.StringPtrInput
// If true, the disk will be encrypted.
Encrypted pulumi.BoolPtrInput
// The ARN for the KMS encryption key. When specifying kms_key_id, encrypted needs to be set to true.
KmsKeyId pulumi.StringPtrInput
// A file system [lifecycle policy](https://docs.aws.amazon.com/efs/latest/ug/API_LifecyclePolicy.html) object (documented below).
LifecyclePolicy FileSystemLifecyclePolicyPtrInput
// The file system performance mode. Can be either `"generalPurpose"` or `"maxIO"` (Default: `"generalPurpose"`).
PerformanceMode pulumi.StringPtrInput
// The throughput, measured in MiB/s, that you want to provision for the file system. Only applicable with `throughputMode` set to `provisioned`.
ProvisionedThroughputInMibps pulumi.Float64PtrInput
// A map of tags to assign to the file system.
Tags pulumi.StringMapInput
// Throughput mode for the file system. Defaults to `bursting`. Valid values: `bursting`, `provisioned`. When using `provisioned`, also set `provisionedThroughputInMibps`.
ThroughputMode pulumi.StringPtrInput
}
func (FileSystemArgs) ElementType() reflect.Type {
return reflect.TypeOf((*fileSystemArgs)(nil)).Elem()
}
type FileSystemInput interface {
pulumi.Input
ToFileSystemOutput() FileSystemOutput
ToFileSystemOutputWithContext(ctx context.Context) FileSystemOutput
}
func (*FileSystem) ElementType() reflect.Type {
return reflect.TypeOf((*FileSystem)(nil))
}
func (i *FileSystem) ToFileSystemOutput() FileSystemOutput {
return i.ToFileSystemOutputWithContext(context.Background())
}
func (i *FileSystem) ToFileSystemOutputWithContext(ctx context.Context) FileSystemOutput {
return pulumi.ToOutputWithContext(ctx, i).(FileSystemOutput)
}
func (i *FileSystem) ToFileSystemPtrOutput() FileSystemPtrOutput {
return i.ToFileSystemPtrOutputWithContext(context.Background())
}
func (i *FileSystem) ToFileSystemPtrOutputWithContext(ctx context.Context) FileSystemPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(FileSystemPtrOutput)
}
type FileSystemPtrInput interface {
pulumi.Input
ToFileSystemPtrOutput() FileSystemPtrOutput
ToFileSystemPtrOutputWithContext(ctx context.Context) FileSystemPtrOutput
}
type fileSystemPtrType FileSystemArgs
func (*fileSystemPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**FileSystem)(nil))
}
func (i *fileSystemPtrType) ToFileSystemPtrOutput() FileSystemPtrOutput {
return i.ToFileSystemPtrOutputWithContext(context.Background())
}
func (i *fileSystemPtrType) ToFileSystemPtrOutputWithContext(ctx context.Context) FileSystemPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(FileSystemPtrOutput)
}
// FileSystemArrayInput is an input type that accepts FileSystemArray and FileSystemArrayOutput values.
// You can construct a concrete instance of `FileSystemArrayInput` via:
//
// FileSystemArray{ FileSystemArgs{...} }
type FileSystemArrayInput interface {
pulumi.Input
ToFileSystemArrayOutput() FileSystemArrayOutput
ToFileSystemArrayOutputWithContext(context.Context) FileSystemArrayOutput
}
type FileSystemArray []FileSystemInput
func (FileSystemArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*FileSystem)(nil))
}
func (i FileSystemArray) ToFileSystemArrayOutput() FileSystemArrayOutput {
return i.ToFileSystemArrayOutputWithContext(context.Background())
}
func (i FileSystemArray) ToFileSystemArrayOutputWithContext(ctx context.Context) FileSystemArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(FileSystemArrayOutput)
}
// FileSystemMapInput is an input type that accepts FileSystemMap and FileSystemMapOutput values.
// You can construct a concrete instance of `FileSystemMapInput` via:
//
// FileSystemMap{ "key": FileSystemArgs{...} }
type FileSystemMapInput interface {
pulumi.Input
ToFileSystemMapOutput() FileSystemMapOutput
ToFileSystemMapOutputWithContext(context.Context) FileSystemMapOutput
}
type FileSystemMap map[string]FileSystemInput
func (FileSystemMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*FileSystem)(nil))
}
func (i FileSystemMap) ToFileSystemMapOutput() FileSystemMapOutput {
return i.ToFileSystemMapOutputWithContext(context.Background())
}
func (i FileSystemMap) ToFileSystemMapOutputWithContext(ctx context.Context) FileSystemMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(FileSystemMapOutput)
}
type FileSystemOutput struct {
*pulumi.OutputState
}
func (FileSystemOutput) ElementType() reflect.Type {
return reflect.TypeOf((*FileSystem)(nil))
}
func (o FileSystemOutput) ToFileSystemOutput() FileSystemOutput {
return o
}
func (o FileSystemOutput) ToFileSystemOutputWithContext(ctx context.Context) FileSystemOutput {
return o
}
func (o FileSystemOutput) ToFileSystemPtrOutput() FileSystemPtrOutput {
return o.ToFileSystemPtrOutputWithContext(context.Background())
}
func (o FileSystemOutput) ToFileSystemPtrOutputWithContext(ctx context.Context) FileSystemPtrOutput {
return o.ApplyT(func(v FileSystem) *FileSystem {
return &v
}).(FileSystemPtrOutput)
}
type FileSystemPtrOutput struct {
*pulumi.OutputState
}
func (FileSystemPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**FileSystem)(nil))
}
func (o FileSystemPtrOutput) ToFileSystemPtrOutput() FileSystemPtrOutput {
return o
}
func (o FileSystemPtrOutput) ToFileSystemPtrOutputWithContext(ctx context.Context) FileSystemPtrOutput {
return o
}
type FileSystemArrayOutput struct{ *pulumi.OutputState }
func (FileSystemArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]FileSystem)(nil))
}
func (o FileSystemArrayOutput) ToFileSystemArrayOutput() FileSystemArrayOutput {
return o
}
func (o FileSystemArrayOutput) ToFileSystemArrayOutputWithContext(ctx context.Context) FileSystemArrayOutput {
return o
}
func (o FileSystemArrayOutput) Index(i pulumi.IntInput) FileSystemOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) FileSystem {
return vs[0].([]FileSystem)[vs[1].(int)]
}).(FileSystemOutput)
}
type FileSystemMapOutput struct{ *pulumi.OutputState }
func (FileSystemMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]FileSystem)(nil))
}
func (o FileSystemMapOutput) ToFileSystemMapOutput() FileSystemMapOutput {
return o
}
func (o FileSystemMapOutput) ToFileSystemMapOutputWithContext(ctx context.Context) FileSystemMapOutput {
return o
}
func (o FileSystemMapOutput) MapIndex(k pulumi.StringInput) FileSystemOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) FileSystem {
return vs[0].(map[string]FileSystem)[vs[1].(string)]
}).(FileSystemOutput)
}
func init() {
pulumi.RegisterOutputType(FileSystemOutput{})
pulumi.RegisterOutputType(FileSystemPtrOutput{})
pulumi.RegisterOutputType(FileSystemArrayOutput{})
pulumi.RegisterOutputType(FileSystemMapOutput{})
}