/
bucket.go
729 lines (656 loc) · 34.9 KB
/
bucket.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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
// 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 storage
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// Creates a new bucket in Google cloud storage service (GCS).
// Once a bucket has been created, its location can't be changed.
//
// For more information see
// [the official documentation](https://cloud.google.com/storage/docs/overview)
// and
// [API](https://cloud.google.com/storage/docs/json_api/v1/buckets).
//
// **Note**: If the project id is not set on the resource or in the provider block it will be dynamically
// determined which will require enabling the compute api.
//
// ## Example Usage
// ### Creating A Private Bucket In Standard Storage, In The EU Region. Bucket Configured As Static Website And CORS Configurations
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/storage"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := storage.NewBucket(ctx, "static-site", &storage.BucketArgs{
// Cors: storage.BucketCorArray{
// &storage.BucketCorArgs{
// MaxAgeSeconds: pulumi.Int(3600),
// Methods: pulumi.StringArray{
// pulumi.String("GET"),
// pulumi.String("HEAD"),
// pulumi.String("PUT"),
// pulumi.String("POST"),
// pulumi.String("DELETE"),
// },
// Origins: pulumi.StringArray{
// pulumi.String("http://image-store.com"),
// },
// ResponseHeaders: pulumi.StringArray{
// pulumi.String("*"),
// },
// },
// },
// ForceDestroy: pulumi.Bool(true),
// Location: pulumi.String("EU"),
// UniformBucketLevelAccess: pulumi.Bool(true),
// Website: &storage.BucketWebsiteArgs{
// MainPageSuffix: pulumi.String("index.html"),
// NotFoundPage: pulumi.String("404.html"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Life Cycle Settings For Storage Bucket Objects
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/storage"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := storage.NewBucket(ctx, "auto-expire", &storage.BucketArgs{
// ForceDestroy: pulumi.Bool(true),
// LifecycleRules: storage.BucketLifecycleRuleArray{
// &storage.BucketLifecycleRuleArgs{
// Action: &storage.BucketLifecycleRuleActionArgs{
// Type: pulumi.String("Delete"),
// },
// Condition: &storage.BucketLifecycleRuleConditionArgs{
// Age: pulumi.Int(3),
// },
// },
// &storage.BucketLifecycleRuleArgs{
// Action: &storage.BucketLifecycleRuleActionArgs{
// Type: pulumi.String("AbortIncompleteMultipartUpload"),
// },
// Condition: &storage.BucketLifecycleRuleConditionArgs{
// Age: pulumi.Int(1),
// },
// },
// },
// Location: pulumi.String("US"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Enabling Public Access Prevention
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/storage"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := storage.NewBucket(ctx, "auto-expire", &storage.BucketArgs{
// ForceDestroy: pulumi.Bool(true),
// Location: pulumi.String("US"),
// PublicAccessPrevention: pulumi.String("enforced"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// # Storage buckets can be imported using the `name` or
//
// `project/name`. If the project is not passed to the import command it will be inferred from the provider block or environment variables. If it cannot be inferred it will be queried from the Compute API (this will fail if the API is not enabled). e.g.
//
// ```sh
//
// $ pulumi import gcp:storage/bucket:Bucket image-store image-store-bucket
//
// ```
//
// ```sh
//
// $ pulumi import gcp:storage/bucket:Bucket image-store tf-test-project/image-store-bucket
//
// ```
//
// `false` in state. If you've set it to `true` in config, run `pulumi up` to update the value set in state. If you delete this resource before updating the value, objects in the bucket will not be destroyed.
type Bucket struct {
pulumi.CustomResourceState
// The bucket's [Autoclass](https://cloud.google.com/storage/docs/autoclass) configuration. Structure is documented below.
Autoclass BucketAutoclassPtrOutput `pulumi:"autoclass"`
// The bucket's [Cross-Origin Resource Sharing (CORS)](https://www.w3.org/TR/cors/) configuration. Multiple blocks of this type are permitted. Structure is documented below.
Cors BucketCorArrayOutput `pulumi:"cors"`
// The bucket's custom location configuration, which specifies the individual regions that comprise a dual-region bucket. If the bucket is designated a single or multi-region, the parameters are empty. Structure is documented below.
CustomPlacementConfig BucketCustomPlacementConfigPtrOutput `pulumi:"customPlacementConfig"`
// Whether or not to automatically apply an eventBasedHold to new objects added to the bucket.
DefaultEventBasedHold pulumi.BoolPtrOutput `pulumi:"defaultEventBasedHold"`
// The bucket's encryption configuration. Structure is documented below.
Encryption BucketEncryptionPtrOutput `pulumi:"encryption"`
// When deleting a bucket, this
// boolean option will delete all contained objects. If you try to delete a
// bucket that contains objects, the provider will fail that run.
ForceDestroy pulumi.BoolPtrOutput `pulumi:"forceDestroy"`
// A map of key/value label pairs to assign to the bucket.
Labels pulumi.StringMapOutput `pulumi:"labels"`
// The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below.
LifecycleRules BucketLifecycleRuleArrayOutput `pulumi:"lifecycleRules"`
// The [GCS location](https://cloud.google.com/storage/docs/bucket-locations).
//
// ***
Location pulumi.StringOutput `pulumi:"location"`
// The bucket's [Access & Storage Logs](https://cloud.google.com/storage/docs/access-logs) configuration. Structure is documented below.
Logging BucketLoggingPtrOutput `pulumi:"logging"`
// The name of the bucket.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringOutput `pulumi:"project"`
// Prevents public access to a bucket. Acceptable values are "inherited" or "enforced". If "inherited", the bucket uses [public access prevention](https://cloud.google.com/storage/docs/public-access-prevention). only if the bucket is subject to the public access prevention organization policy constraint. Defaults to "inherited".
PublicAccessPrevention pulumi.StringOutput `pulumi:"publicAccessPrevention"`
// Enables [Requester Pays](https://cloud.google.com/storage/docs/requester-pays) on a storage bucket.
RequesterPays pulumi.BoolPtrOutput `pulumi:"requesterPays"`
// Configuration of the bucket's data retention policy for how long objects in the bucket should be retained. Structure is documented below.
RetentionPolicy BucketRetentionPolicyPtrOutput `pulumi:"retentionPolicy"`
// The URI of the created resource.
SelfLink pulumi.StringOutput `pulumi:"selfLink"`
// The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `STANDARD`, `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`.
StorageClass pulumi.StringPtrOutput `pulumi:"storageClass"`
// Enables [Uniform bucket-level access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) access to a bucket.
UniformBucketLevelAccess pulumi.BoolOutput `pulumi:"uniformBucketLevelAccess"`
// The base URL of the bucket, in the format `gs://<bucket-name>`.
Url pulumi.StringOutput `pulumi:"url"`
// The bucket's [Versioning](https://cloud.google.com/storage/docs/object-versioning) configuration. Structure is documented below.
Versioning BucketVersioningOutput `pulumi:"versioning"`
// Configuration if the bucket acts as a website. Structure is documented below.
Website BucketWebsiteOutput `pulumi:"website"`
}
// NewBucket registers a new resource with the given unique name, arguments, and options.
func NewBucket(ctx *pulumi.Context,
name string, args *BucketArgs, opts ...pulumi.ResourceOption) (*Bucket, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Location == nil {
return nil, errors.New("invalid value for required argument 'Location'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Bucket
err := ctx.RegisterResource("gcp:storage/bucket:Bucket", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBucket gets an existing Bucket 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 GetBucket(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BucketState, opts ...pulumi.ResourceOption) (*Bucket, error) {
var resource Bucket
err := ctx.ReadResource("gcp:storage/bucket:Bucket", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Bucket resources.
type bucketState struct {
// The bucket's [Autoclass](https://cloud.google.com/storage/docs/autoclass) configuration. Structure is documented below.
Autoclass *BucketAutoclass `pulumi:"autoclass"`
// The bucket's [Cross-Origin Resource Sharing (CORS)](https://www.w3.org/TR/cors/) configuration. Multiple blocks of this type are permitted. Structure is documented below.
Cors []BucketCor `pulumi:"cors"`
// The bucket's custom location configuration, which specifies the individual regions that comprise a dual-region bucket. If the bucket is designated a single or multi-region, the parameters are empty. Structure is documented below.
CustomPlacementConfig *BucketCustomPlacementConfig `pulumi:"customPlacementConfig"`
// Whether or not to automatically apply an eventBasedHold to new objects added to the bucket.
DefaultEventBasedHold *bool `pulumi:"defaultEventBasedHold"`
// The bucket's encryption configuration. Structure is documented below.
Encryption *BucketEncryption `pulumi:"encryption"`
// When deleting a bucket, this
// boolean option will delete all contained objects. If you try to delete a
// bucket that contains objects, the provider will fail that run.
ForceDestroy *bool `pulumi:"forceDestroy"`
// A map of key/value label pairs to assign to the bucket.
Labels map[string]string `pulumi:"labels"`
// The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below.
LifecycleRules []BucketLifecycleRule `pulumi:"lifecycleRules"`
// The [GCS location](https://cloud.google.com/storage/docs/bucket-locations).
//
// ***
Location *string `pulumi:"location"`
// The bucket's [Access & Storage Logs](https://cloud.google.com/storage/docs/access-logs) configuration. Structure is documented below.
Logging *BucketLogging `pulumi:"logging"`
// The name of the bucket.
Name *string `pulumi:"name"`
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project *string `pulumi:"project"`
// Prevents public access to a bucket. Acceptable values are "inherited" or "enforced". If "inherited", the bucket uses [public access prevention](https://cloud.google.com/storage/docs/public-access-prevention). only if the bucket is subject to the public access prevention organization policy constraint. Defaults to "inherited".
PublicAccessPrevention *string `pulumi:"publicAccessPrevention"`
// Enables [Requester Pays](https://cloud.google.com/storage/docs/requester-pays) on a storage bucket.
RequesterPays *bool `pulumi:"requesterPays"`
// Configuration of the bucket's data retention policy for how long objects in the bucket should be retained. Structure is documented below.
RetentionPolicy *BucketRetentionPolicy `pulumi:"retentionPolicy"`
// The URI of the created resource.
SelfLink *string `pulumi:"selfLink"`
// The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `STANDARD`, `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`.
StorageClass *string `pulumi:"storageClass"`
// Enables [Uniform bucket-level access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) access to a bucket.
UniformBucketLevelAccess *bool `pulumi:"uniformBucketLevelAccess"`
// The base URL of the bucket, in the format `gs://<bucket-name>`.
Url *string `pulumi:"url"`
// The bucket's [Versioning](https://cloud.google.com/storage/docs/object-versioning) configuration. Structure is documented below.
Versioning *BucketVersioning `pulumi:"versioning"`
// Configuration if the bucket acts as a website. Structure is documented below.
Website *BucketWebsite `pulumi:"website"`
}
type BucketState struct {
// The bucket's [Autoclass](https://cloud.google.com/storage/docs/autoclass) configuration. Structure is documented below.
Autoclass BucketAutoclassPtrInput
// The bucket's [Cross-Origin Resource Sharing (CORS)](https://www.w3.org/TR/cors/) configuration. Multiple blocks of this type are permitted. Structure is documented below.
Cors BucketCorArrayInput
// The bucket's custom location configuration, which specifies the individual regions that comprise a dual-region bucket. If the bucket is designated a single or multi-region, the parameters are empty. Structure is documented below.
CustomPlacementConfig BucketCustomPlacementConfigPtrInput
// Whether or not to automatically apply an eventBasedHold to new objects added to the bucket.
DefaultEventBasedHold pulumi.BoolPtrInput
// The bucket's encryption configuration. Structure is documented below.
Encryption BucketEncryptionPtrInput
// When deleting a bucket, this
// boolean option will delete all contained objects. If you try to delete a
// bucket that contains objects, the provider will fail that run.
ForceDestroy pulumi.BoolPtrInput
// A map of key/value label pairs to assign to the bucket.
Labels pulumi.StringMapInput
// The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below.
LifecycleRules BucketLifecycleRuleArrayInput
// The [GCS location](https://cloud.google.com/storage/docs/bucket-locations).
//
// ***
Location pulumi.StringPtrInput
// The bucket's [Access & Storage Logs](https://cloud.google.com/storage/docs/access-logs) configuration. Structure is documented below.
Logging BucketLoggingPtrInput
// The name of the bucket.
Name pulumi.StringPtrInput
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringPtrInput
// Prevents public access to a bucket. Acceptable values are "inherited" or "enforced". If "inherited", the bucket uses [public access prevention](https://cloud.google.com/storage/docs/public-access-prevention). only if the bucket is subject to the public access prevention organization policy constraint. Defaults to "inherited".
PublicAccessPrevention pulumi.StringPtrInput
// Enables [Requester Pays](https://cloud.google.com/storage/docs/requester-pays) on a storage bucket.
RequesterPays pulumi.BoolPtrInput
// Configuration of the bucket's data retention policy for how long objects in the bucket should be retained. Structure is documented below.
RetentionPolicy BucketRetentionPolicyPtrInput
// The URI of the created resource.
SelfLink pulumi.StringPtrInput
// The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `STANDARD`, `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`.
StorageClass pulumi.StringPtrInput
// Enables [Uniform bucket-level access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) access to a bucket.
UniformBucketLevelAccess pulumi.BoolPtrInput
// The base URL of the bucket, in the format `gs://<bucket-name>`.
Url pulumi.StringPtrInput
// The bucket's [Versioning](https://cloud.google.com/storage/docs/object-versioning) configuration. Structure is documented below.
Versioning BucketVersioningPtrInput
// Configuration if the bucket acts as a website. Structure is documented below.
Website BucketWebsitePtrInput
}
func (BucketState) ElementType() reflect.Type {
return reflect.TypeOf((*bucketState)(nil)).Elem()
}
type bucketArgs struct {
// The bucket's [Autoclass](https://cloud.google.com/storage/docs/autoclass) configuration. Structure is documented below.
Autoclass *BucketAutoclass `pulumi:"autoclass"`
// The bucket's [Cross-Origin Resource Sharing (CORS)](https://www.w3.org/TR/cors/) configuration. Multiple blocks of this type are permitted. Structure is documented below.
Cors []BucketCor `pulumi:"cors"`
// The bucket's custom location configuration, which specifies the individual regions that comprise a dual-region bucket. If the bucket is designated a single or multi-region, the parameters are empty. Structure is documented below.
CustomPlacementConfig *BucketCustomPlacementConfig `pulumi:"customPlacementConfig"`
// Whether or not to automatically apply an eventBasedHold to new objects added to the bucket.
DefaultEventBasedHold *bool `pulumi:"defaultEventBasedHold"`
// The bucket's encryption configuration. Structure is documented below.
Encryption *BucketEncryption `pulumi:"encryption"`
// When deleting a bucket, this
// boolean option will delete all contained objects. If you try to delete a
// bucket that contains objects, the provider will fail that run.
ForceDestroy *bool `pulumi:"forceDestroy"`
// A map of key/value label pairs to assign to the bucket.
Labels map[string]string `pulumi:"labels"`
// The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below.
LifecycleRules []BucketLifecycleRule `pulumi:"lifecycleRules"`
// The [GCS location](https://cloud.google.com/storage/docs/bucket-locations).
//
// ***
Location string `pulumi:"location"`
// The bucket's [Access & Storage Logs](https://cloud.google.com/storage/docs/access-logs) configuration. Structure is documented below.
Logging *BucketLogging `pulumi:"logging"`
// The name of the bucket.
Name *string `pulumi:"name"`
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project *string `pulumi:"project"`
// Prevents public access to a bucket. Acceptable values are "inherited" or "enforced". If "inherited", the bucket uses [public access prevention](https://cloud.google.com/storage/docs/public-access-prevention). only if the bucket is subject to the public access prevention organization policy constraint. Defaults to "inherited".
PublicAccessPrevention *string `pulumi:"publicAccessPrevention"`
// Enables [Requester Pays](https://cloud.google.com/storage/docs/requester-pays) on a storage bucket.
RequesterPays *bool `pulumi:"requesterPays"`
// Configuration of the bucket's data retention policy for how long objects in the bucket should be retained. Structure is documented below.
RetentionPolicy *BucketRetentionPolicy `pulumi:"retentionPolicy"`
// The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `STANDARD`, `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`.
StorageClass *string `pulumi:"storageClass"`
// Enables [Uniform bucket-level access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) access to a bucket.
UniformBucketLevelAccess *bool `pulumi:"uniformBucketLevelAccess"`
// The bucket's [Versioning](https://cloud.google.com/storage/docs/object-versioning) configuration. Structure is documented below.
Versioning *BucketVersioning `pulumi:"versioning"`
// Configuration if the bucket acts as a website. Structure is documented below.
Website *BucketWebsite `pulumi:"website"`
}
// The set of arguments for constructing a Bucket resource.
type BucketArgs struct {
// The bucket's [Autoclass](https://cloud.google.com/storage/docs/autoclass) configuration. Structure is documented below.
Autoclass BucketAutoclassPtrInput
// The bucket's [Cross-Origin Resource Sharing (CORS)](https://www.w3.org/TR/cors/) configuration. Multiple blocks of this type are permitted. Structure is documented below.
Cors BucketCorArrayInput
// The bucket's custom location configuration, which specifies the individual regions that comprise a dual-region bucket. If the bucket is designated a single or multi-region, the parameters are empty. Structure is documented below.
CustomPlacementConfig BucketCustomPlacementConfigPtrInput
// Whether or not to automatically apply an eventBasedHold to new objects added to the bucket.
DefaultEventBasedHold pulumi.BoolPtrInput
// The bucket's encryption configuration. Structure is documented below.
Encryption BucketEncryptionPtrInput
// When deleting a bucket, this
// boolean option will delete all contained objects. If you try to delete a
// bucket that contains objects, the provider will fail that run.
ForceDestroy pulumi.BoolPtrInput
// A map of key/value label pairs to assign to the bucket.
Labels pulumi.StringMapInput
// The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below.
LifecycleRules BucketLifecycleRuleArrayInput
// The [GCS location](https://cloud.google.com/storage/docs/bucket-locations).
//
// ***
Location pulumi.StringInput
// The bucket's [Access & Storage Logs](https://cloud.google.com/storage/docs/access-logs) configuration. Structure is documented below.
Logging BucketLoggingPtrInput
// The name of the bucket.
Name pulumi.StringPtrInput
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringPtrInput
// Prevents public access to a bucket. Acceptable values are "inherited" or "enforced". If "inherited", the bucket uses [public access prevention](https://cloud.google.com/storage/docs/public-access-prevention). only if the bucket is subject to the public access prevention organization policy constraint. Defaults to "inherited".
PublicAccessPrevention pulumi.StringPtrInput
// Enables [Requester Pays](https://cloud.google.com/storage/docs/requester-pays) on a storage bucket.
RequesterPays pulumi.BoolPtrInput
// Configuration of the bucket's data retention policy for how long objects in the bucket should be retained. Structure is documented below.
RetentionPolicy BucketRetentionPolicyPtrInput
// The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `STANDARD`, `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`.
StorageClass pulumi.StringPtrInput
// Enables [Uniform bucket-level access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) access to a bucket.
UniformBucketLevelAccess pulumi.BoolPtrInput
// The bucket's [Versioning](https://cloud.google.com/storage/docs/object-versioning) configuration. Structure is documented below.
Versioning BucketVersioningPtrInput
// Configuration if the bucket acts as a website. Structure is documented below.
Website BucketWebsitePtrInput
}
func (BucketArgs) ElementType() reflect.Type {
return reflect.TypeOf((*bucketArgs)(nil)).Elem()
}
type BucketInput interface {
pulumi.Input
ToBucketOutput() BucketOutput
ToBucketOutputWithContext(ctx context.Context) BucketOutput
}
func (*Bucket) ElementType() reflect.Type {
return reflect.TypeOf((**Bucket)(nil)).Elem()
}
func (i *Bucket) ToBucketOutput() BucketOutput {
return i.ToBucketOutputWithContext(context.Background())
}
func (i *Bucket) ToBucketOutputWithContext(ctx context.Context) BucketOutput {
return pulumi.ToOutputWithContext(ctx, i).(BucketOutput)
}
func (i *Bucket) ToOutput(ctx context.Context) pulumix.Output[*Bucket] {
return pulumix.Output[*Bucket]{
OutputState: i.ToBucketOutputWithContext(ctx).OutputState,
}
}
// BucketArrayInput is an input type that accepts BucketArray and BucketArrayOutput values.
// You can construct a concrete instance of `BucketArrayInput` via:
//
// BucketArray{ BucketArgs{...} }
type BucketArrayInput interface {
pulumi.Input
ToBucketArrayOutput() BucketArrayOutput
ToBucketArrayOutputWithContext(context.Context) BucketArrayOutput
}
type BucketArray []BucketInput
func (BucketArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Bucket)(nil)).Elem()
}
func (i BucketArray) ToBucketArrayOutput() BucketArrayOutput {
return i.ToBucketArrayOutputWithContext(context.Background())
}
func (i BucketArray) ToBucketArrayOutputWithContext(ctx context.Context) BucketArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BucketArrayOutput)
}
func (i BucketArray) ToOutput(ctx context.Context) pulumix.Output[[]*Bucket] {
return pulumix.Output[[]*Bucket]{
OutputState: i.ToBucketArrayOutputWithContext(ctx).OutputState,
}
}
// BucketMapInput is an input type that accepts BucketMap and BucketMapOutput values.
// You can construct a concrete instance of `BucketMapInput` via:
//
// BucketMap{ "key": BucketArgs{...} }
type BucketMapInput interface {
pulumi.Input
ToBucketMapOutput() BucketMapOutput
ToBucketMapOutputWithContext(context.Context) BucketMapOutput
}
type BucketMap map[string]BucketInput
func (BucketMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Bucket)(nil)).Elem()
}
func (i BucketMap) ToBucketMapOutput() BucketMapOutput {
return i.ToBucketMapOutputWithContext(context.Background())
}
func (i BucketMap) ToBucketMapOutputWithContext(ctx context.Context) BucketMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BucketMapOutput)
}
func (i BucketMap) ToOutput(ctx context.Context) pulumix.Output[map[string]*Bucket] {
return pulumix.Output[map[string]*Bucket]{
OutputState: i.ToBucketMapOutputWithContext(ctx).OutputState,
}
}
type BucketOutput struct{ *pulumi.OutputState }
func (BucketOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Bucket)(nil)).Elem()
}
func (o BucketOutput) ToBucketOutput() BucketOutput {
return o
}
func (o BucketOutput) ToBucketOutputWithContext(ctx context.Context) BucketOutput {
return o
}
func (o BucketOutput) ToOutput(ctx context.Context) pulumix.Output[*Bucket] {
return pulumix.Output[*Bucket]{
OutputState: o.OutputState,
}
}
// The bucket's [Autoclass](https://cloud.google.com/storage/docs/autoclass) configuration. Structure is documented below.
func (o BucketOutput) Autoclass() BucketAutoclassPtrOutput {
return o.ApplyT(func(v *Bucket) BucketAutoclassPtrOutput { return v.Autoclass }).(BucketAutoclassPtrOutput)
}
// The bucket's [Cross-Origin Resource Sharing (CORS)](https://www.w3.org/TR/cors/) configuration. Multiple blocks of this type are permitted. Structure is documented below.
func (o BucketOutput) Cors() BucketCorArrayOutput {
return o.ApplyT(func(v *Bucket) BucketCorArrayOutput { return v.Cors }).(BucketCorArrayOutput)
}
// The bucket's custom location configuration, which specifies the individual regions that comprise a dual-region bucket. If the bucket is designated a single or multi-region, the parameters are empty. Structure is documented below.
func (o BucketOutput) CustomPlacementConfig() BucketCustomPlacementConfigPtrOutput {
return o.ApplyT(func(v *Bucket) BucketCustomPlacementConfigPtrOutput { return v.CustomPlacementConfig }).(BucketCustomPlacementConfigPtrOutput)
}
// Whether or not to automatically apply an eventBasedHold to new objects added to the bucket.
func (o BucketOutput) DefaultEventBasedHold() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *Bucket) pulumi.BoolPtrOutput { return v.DefaultEventBasedHold }).(pulumi.BoolPtrOutput)
}
// The bucket's encryption configuration. Structure is documented below.
func (o BucketOutput) Encryption() BucketEncryptionPtrOutput {
return o.ApplyT(func(v *Bucket) BucketEncryptionPtrOutput { return v.Encryption }).(BucketEncryptionPtrOutput)
}
// When deleting a bucket, this
// boolean option will delete all contained objects. If you try to delete a
// bucket that contains objects, the provider will fail that run.
func (o BucketOutput) ForceDestroy() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *Bucket) pulumi.BoolPtrOutput { return v.ForceDestroy }).(pulumi.BoolPtrOutput)
}
// A map of key/value label pairs to assign to the bucket.
func (o BucketOutput) Labels() pulumi.StringMapOutput {
return o.ApplyT(func(v *Bucket) pulumi.StringMapOutput { return v.Labels }).(pulumi.StringMapOutput)
}
// The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below.
func (o BucketOutput) LifecycleRules() BucketLifecycleRuleArrayOutput {
return o.ApplyT(func(v *Bucket) BucketLifecycleRuleArrayOutput { return v.LifecycleRules }).(BucketLifecycleRuleArrayOutput)
}
// The [GCS location](https://cloud.google.com/storage/docs/bucket-locations).
//
// ***
func (o BucketOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// The bucket's [Access & Storage Logs](https://cloud.google.com/storage/docs/access-logs) configuration. Structure is documented below.
func (o BucketOutput) Logging() BucketLoggingPtrOutput {
return o.ApplyT(func(v *Bucket) BucketLoggingPtrOutput { return v.Logging }).(BucketLoggingPtrOutput)
}
// The name of the bucket.
func (o BucketOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
func (o BucketOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// Prevents public access to a bucket. Acceptable values are "inherited" or "enforced". If "inherited", the bucket uses [public access prevention](https://cloud.google.com/storage/docs/public-access-prevention). only if the bucket is subject to the public access prevention organization policy constraint. Defaults to "inherited".
func (o BucketOutput) PublicAccessPrevention() pulumi.StringOutput {
return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.PublicAccessPrevention }).(pulumi.StringOutput)
}
// Enables [Requester Pays](https://cloud.google.com/storage/docs/requester-pays) on a storage bucket.
func (o BucketOutput) RequesterPays() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *Bucket) pulumi.BoolPtrOutput { return v.RequesterPays }).(pulumi.BoolPtrOutput)
}
// Configuration of the bucket's data retention policy for how long objects in the bucket should be retained. Structure is documented below.
func (o BucketOutput) RetentionPolicy() BucketRetentionPolicyPtrOutput {
return o.ApplyT(func(v *Bucket) BucketRetentionPolicyPtrOutput { return v.RetentionPolicy }).(BucketRetentionPolicyPtrOutput)
}
// The URI of the created resource.
func (o BucketOutput) SelfLink() pulumi.StringOutput {
return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.SelfLink }).(pulumi.StringOutput)
}
// The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `STANDARD`, `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`.
func (o BucketOutput) StorageClass() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Bucket) pulumi.StringPtrOutput { return v.StorageClass }).(pulumi.StringPtrOutput)
}
// Enables [Uniform bucket-level access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) access to a bucket.
func (o BucketOutput) UniformBucketLevelAccess() pulumi.BoolOutput {
return o.ApplyT(func(v *Bucket) pulumi.BoolOutput { return v.UniformBucketLevelAccess }).(pulumi.BoolOutput)
}
// The base URL of the bucket, in the format `gs://<bucket-name>`.
func (o BucketOutput) Url() pulumi.StringOutput {
return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Url }).(pulumi.StringOutput)
}
// The bucket's [Versioning](https://cloud.google.com/storage/docs/object-versioning) configuration. Structure is documented below.
func (o BucketOutput) Versioning() BucketVersioningOutput {
return o.ApplyT(func(v *Bucket) BucketVersioningOutput { return v.Versioning }).(BucketVersioningOutput)
}
// Configuration if the bucket acts as a website. Structure is documented below.
func (o BucketOutput) Website() BucketWebsiteOutput {
return o.ApplyT(func(v *Bucket) BucketWebsiteOutput { return v.Website }).(BucketWebsiteOutput)
}
type BucketArrayOutput struct{ *pulumi.OutputState }
func (BucketArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Bucket)(nil)).Elem()
}
func (o BucketArrayOutput) ToBucketArrayOutput() BucketArrayOutput {
return o
}
func (o BucketArrayOutput) ToBucketArrayOutputWithContext(ctx context.Context) BucketArrayOutput {
return o
}
func (o BucketArrayOutput) ToOutput(ctx context.Context) pulumix.Output[[]*Bucket] {
return pulumix.Output[[]*Bucket]{
OutputState: o.OutputState,
}
}
func (o BucketArrayOutput) Index(i pulumi.IntInput) BucketOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Bucket {
return vs[0].([]*Bucket)[vs[1].(int)]
}).(BucketOutput)
}
type BucketMapOutput struct{ *pulumi.OutputState }
func (BucketMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Bucket)(nil)).Elem()
}
func (o BucketMapOutput) ToBucketMapOutput() BucketMapOutput {
return o
}
func (o BucketMapOutput) ToBucketMapOutputWithContext(ctx context.Context) BucketMapOutput {
return o
}
func (o BucketMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]*Bucket] {
return pulumix.Output[map[string]*Bucket]{
OutputState: o.OutputState,
}
}
func (o BucketMapOutput) MapIndex(k pulumi.StringInput) BucketOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Bucket {
return vs[0].(map[string]*Bucket)[vs[1].(string)]
}).(BucketOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BucketInput)(nil)).Elem(), &Bucket{})
pulumi.RegisterInputType(reflect.TypeOf((*BucketArrayInput)(nil)).Elem(), BucketArray{})
pulumi.RegisterInputType(reflect.TypeOf((*BucketMapInput)(nil)).Elem(), BucketMap{})
pulumi.RegisterOutputType(BucketOutput{})
pulumi.RegisterOutputType(BucketArrayOutput{})
pulumi.RegisterOutputType(BucketMapOutput{})
}