-
Notifications
You must be signed in to change notification settings - Fork 17
/
awss3.go
7686 lines (6782 loc) · 202 KB
/
awss3.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
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package awss3
import (
"time"
_init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
"github.com/aws/aws-cdk-go/awscdk/v2"
"github.com/aws/aws-cdk-go/awscdk/v2/awsevents"
"github.com/aws/aws-cdk-go/awscdk/v2/awsiam"
"github.com/aws/aws-cdk-go/awscdk/v2/awskms"
"github.com/aws/aws-cdk-go/awscdk/v2/awss3/internal"
"github.com/aws/constructs-go/constructs/v10"
)
// Experimental.
type BlockPublicAccess interface {
BlockPublicAcls() *bool
SetBlockPublicAcls(val *bool)
BlockPublicPolicy() *bool
SetBlockPublicPolicy(val *bool)
IgnorePublicAcls() *bool
SetIgnorePublicAcls(val *bool)
RestrictPublicBuckets() *bool
SetRestrictPublicBuckets(val *bool)
}
// The jsii proxy struct for BlockPublicAccess
type jsiiProxy_BlockPublicAccess struct {
_ byte // padding
}
func (j *jsiiProxy_BlockPublicAccess) BlockPublicAcls() *bool {
var returns *bool
_jsii_.Get(
j,
"blockPublicAcls",
&returns,
)
return returns
}
func (j *jsiiProxy_BlockPublicAccess) BlockPublicPolicy() *bool {
var returns *bool
_jsii_.Get(
j,
"blockPublicPolicy",
&returns,
)
return returns
}
func (j *jsiiProxy_BlockPublicAccess) IgnorePublicAcls() *bool {
var returns *bool
_jsii_.Get(
j,
"ignorePublicAcls",
&returns,
)
return returns
}
func (j *jsiiProxy_BlockPublicAccess) RestrictPublicBuckets() *bool {
var returns *bool
_jsii_.Get(
j,
"restrictPublicBuckets",
&returns,
)
return returns
}
// Experimental.
func NewBlockPublicAccess(options *BlockPublicAccessOptions) BlockPublicAccess {
_init_.Initialize()
j := jsiiProxy_BlockPublicAccess{}
_jsii_.Create(
"aws-cdk-lib.aws_s3.BlockPublicAccess",
[]interface{}{options},
&j,
)
return &j
}
// Experimental.
func NewBlockPublicAccess_Override(b BlockPublicAccess, options *BlockPublicAccessOptions) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_s3.BlockPublicAccess",
[]interface{}{options},
b,
)
}
func (j *jsiiProxy_BlockPublicAccess) SetBlockPublicAcls(val *bool) {
_jsii_.Set(
j,
"blockPublicAcls",
val,
)
}
func (j *jsiiProxy_BlockPublicAccess) SetBlockPublicPolicy(val *bool) {
_jsii_.Set(
j,
"blockPublicPolicy",
val,
)
}
func (j *jsiiProxy_BlockPublicAccess) SetIgnorePublicAcls(val *bool) {
_jsii_.Set(
j,
"ignorePublicAcls",
val,
)
}
func (j *jsiiProxy_BlockPublicAccess) SetRestrictPublicBuckets(val *bool) {
_jsii_.Set(
j,
"restrictPublicBuckets",
val,
)
}
func BlockPublicAccess_BLOCK_ACLS() BlockPublicAccess {
_init_.Initialize()
var returns BlockPublicAccess
_jsii_.StaticGet(
"aws-cdk-lib.aws_s3.BlockPublicAccess",
"BLOCK_ACLS",
&returns,
)
return returns
}
func BlockPublicAccess_BLOCK_ALL() BlockPublicAccess {
_init_.Initialize()
var returns BlockPublicAccess
_jsii_.StaticGet(
"aws-cdk-lib.aws_s3.BlockPublicAccess",
"BLOCK_ALL",
&returns,
)
return returns
}
// Experimental.
type BlockPublicAccessOptions struct {
// Whether to block public ACLs.
// See: https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options
//
// Experimental.
BlockPublicAcls *bool `json:"blockPublicAcls"`
// Whether to block public policy.
// See: https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options
//
// Experimental.
BlockPublicPolicy *bool `json:"blockPublicPolicy"`
// Whether to ignore public ACLs.
// See: https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options
//
// Experimental.
IgnorePublicAcls *bool `json:"ignorePublicAcls"`
// Whether to restrict public access.
// See: https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options
//
// Experimental.
RestrictPublicBuckets *bool `json:"restrictPublicBuckets"`
}
// An S3 bucket with associated policy objects.
//
// This bucket does not yet have all features that exposed by the underlying
// BucketResource.
// Experimental.
type Bucket interface {
BucketBase
AutoCreatePolicy() *bool
SetAutoCreatePolicy(val *bool)
BucketArn() *string
BucketDomainName() *string
BucketDualStackDomainName() *string
BucketName() *string
BucketRegionalDomainName() *string
BucketWebsiteDomainName() *string
BucketWebsiteUrl() *string
DisallowPublicAccess() *bool
SetDisallowPublicAccess(val *bool)
EncryptionKey() awskms.IKey
Env() *awscdk.ResourceEnvironment
IsWebsite() *bool
Node() constructs.Node
PhysicalName() *string
Policy() BucketPolicy
SetPolicy(val BucketPolicy)
Stack() awscdk.Stack
AddCorsRule(rule *CorsRule)
AddEventNotification(event EventType, dest IBucketNotificationDestination, filters ...*NotificationKeyFilter)
AddInventory(inventory *Inventory)
AddLifecycleRule(rule *LifecycleRule)
AddMetric(metric *BucketMetrics)
AddObjectCreatedNotification(dest IBucketNotificationDestination, filters ...*NotificationKeyFilter)
AddObjectRemovedNotification(dest IBucketNotificationDestination, filters ...*NotificationKeyFilter)
AddToResourcePolicy(permission awsiam.PolicyStatement) *awsiam.AddToResourcePolicyResult
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
ArnForObjects(keyPattern *string) *string
GeneratePhysicalName() *string
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
GetResourceNameAttribute(nameAttr *string) *string
GrantDelete(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant
GrantPublicAccess(keyPrefix *string, allowedActions ...*string) awsiam.Grant
GrantPut(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant
GrantPutAcl(identity awsiam.IGrantable, objectsKeyPattern *string) awsiam.Grant
GrantRead(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant
GrantReadWrite(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant
GrantWrite(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant
OnCloudTrailEvent(id *string, options *OnCloudTrailBucketEventOptions) awsevents.Rule
OnCloudTrailPutObject(id *string, options *OnCloudTrailBucketEventOptions) awsevents.Rule
OnCloudTrailWriteObject(id *string, options *OnCloudTrailBucketEventOptions) awsevents.Rule
S3UrlForObject(key *string) *string
ToString() *string
UrlForObject(key *string) *string
VirtualHostedUrlForObject(key *string, options *VirtualHostedStyleUrlOptions) *string
}
// The jsii proxy struct for Bucket
type jsiiProxy_Bucket struct {
jsiiProxy_BucketBase
}
func (j *jsiiProxy_Bucket) AutoCreatePolicy() *bool {
var returns *bool
_jsii_.Get(
j,
"autoCreatePolicy",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) BucketArn() *string {
var returns *string
_jsii_.Get(
j,
"bucketArn",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) BucketDomainName() *string {
var returns *string
_jsii_.Get(
j,
"bucketDomainName",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) BucketDualStackDomainName() *string {
var returns *string
_jsii_.Get(
j,
"bucketDualStackDomainName",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) BucketName() *string {
var returns *string
_jsii_.Get(
j,
"bucketName",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) BucketRegionalDomainName() *string {
var returns *string
_jsii_.Get(
j,
"bucketRegionalDomainName",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) BucketWebsiteDomainName() *string {
var returns *string
_jsii_.Get(
j,
"bucketWebsiteDomainName",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) BucketWebsiteUrl() *string {
var returns *string
_jsii_.Get(
j,
"bucketWebsiteUrl",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) DisallowPublicAccess() *bool {
var returns *bool
_jsii_.Get(
j,
"disallowPublicAccess",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) EncryptionKey() awskms.IKey {
var returns awskms.IKey
_jsii_.Get(
j,
"encryptionKey",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) Env() *awscdk.ResourceEnvironment {
var returns *awscdk.ResourceEnvironment
_jsii_.Get(
j,
"env",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) IsWebsite() *bool {
var returns *bool
_jsii_.Get(
j,
"isWebsite",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) Node() constructs.Node {
var returns constructs.Node
_jsii_.Get(
j,
"node",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) PhysicalName() *string {
var returns *string
_jsii_.Get(
j,
"physicalName",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) Policy() BucketPolicy {
var returns BucketPolicy
_jsii_.Get(
j,
"policy",
&returns,
)
return returns
}
func (j *jsiiProxy_Bucket) Stack() awscdk.Stack {
var returns awscdk.Stack
_jsii_.Get(
j,
"stack",
&returns,
)
return returns
}
// Experimental.
func NewBucket(scope constructs.Construct, id *string, props *BucketProps) Bucket {
_init_.Initialize()
j := jsiiProxy_Bucket{}
_jsii_.Create(
"aws-cdk-lib.aws_s3.Bucket",
[]interface{}{scope, id, props},
&j,
)
return &j
}
// Experimental.
func NewBucket_Override(b Bucket, scope constructs.Construct, id *string, props *BucketProps) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_s3.Bucket",
[]interface{}{scope, id, props},
b,
)
}
func (j *jsiiProxy_Bucket) SetAutoCreatePolicy(val *bool) {
_jsii_.Set(
j,
"autoCreatePolicy",
val,
)
}
func (j *jsiiProxy_Bucket) SetDisallowPublicAccess(val *bool) {
_jsii_.Set(
j,
"disallowPublicAccess",
val,
)
}
func (j *jsiiProxy_Bucket) SetPolicy(val BucketPolicy) {
_jsii_.Set(
j,
"policy",
val,
)
}
// Experimental.
func Bucket_FromBucketArn(scope constructs.Construct, id *string, bucketArn *string) IBucket {
_init_.Initialize()
var returns IBucket
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_s3.Bucket",
"fromBucketArn",
[]interface{}{scope, id, bucketArn},
&returns,
)
return returns
}
// Creates a Bucket construct that represents an external bucket.
// Experimental.
func Bucket_FromBucketAttributes(scope constructs.Construct, id *string, attrs *BucketAttributes) IBucket {
_init_.Initialize()
var returns IBucket
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_s3.Bucket",
"fromBucketAttributes",
[]interface{}{scope, id, attrs},
&returns,
)
return returns
}
// Experimental.
func Bucket_FromBucketName(scope constructs.Construct, id *string, bucketName *string) IBucket {
_init_.Initialize()
var returns IBucket
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_s3.Bucket",
"fromBucketName",
[]interface{}{scope, id, bucketName},
&returns,
)
return returns
}
// Checks if `x` is a construct.
//
// Returns: true if `x` is an object created from a class which extends `Construct`.
// Deprecated: use `x instanceof Construct` instead
func Bucket_IsConstruct(x interface{}) *bool {
_init_.Initialize()
var returns *bool
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_s3.Bucket",
"isConstruct",
[]interface{}{x},
&returns,
)
return returns
}
// Check whether the given construct is a Resource.
// Experimental.
func Bucket_IsResource(construct constructs.IConstruct) *bool {
_init_.Initialize()
var returns *bool
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_s3.Bucket",
"isResource",
[]interface{}{construct},
&returns,
)
return returns
}
// Adds a cross-origin access configuration for objects in an Amazon S3 bucket.
// Experimental.
func (b *jsiiProxy_Bucket) AddCorsRule(rule *CorsRule) {
_jsii_.InvokeVoid(
b,
"addCorsRule",
[]interface{}{rule},
)
}
// Adds a bucket notification event destination.
//
// TODO: EXAMPLE
//
// See: https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
//
// Experimental.
func (b *jsiiProxy_Bucket) AddEventNotification(event EventType, dest IBucketNotificationDestination, filters ...*NotificationKeyFilter) {
args := []interface{}{event, dest}
for _, a := range filters {
args = append(args, a)
}
_jsii_.InvokeVoid(
b,
"addEventNotification",
args,
)
}
// Add an inventory configuration.
// Experimental.
func (b *jsiiProxy_Bucket) AddInventory(inventory *Inventory) {
_jsii_.InvokeVoid(
b,
"addInventory",
[]interface{}{inventory},
)
}
// Add a lifecycle rule to the bucket.
// Experimental.
func (b *jsiiProxy_Bucket) AddLifecycleRule(rule *LifecycleRule) {
_jsii_.InvokeVoid(
b,
"addLifecycleRule",
[]interface{}{rule},
)
}
// Adds a metrics configuration for the CloudWatch request metrics from the bucket.
// Experimental.
func (b *jsiiProxy_Bucket) AddMetric(metric *BucketMetrics) {
_jsii_.InvokeVoid(
b,
"addMetric",
[]interface{}{metric},
)
}
// Subscribes a destination to receive notifications when an object is created in the bucket.
//
// This is identical to calling
// `onEvent(EventType.OBJECT_CREATED)`.
// Experimental.
func (b *jsiiProxy_Bucket) AddObjectCreatedNotification(dest IBucketNotificationDestination, filters ...*NotificationKeyFilter) {
args := []interface{}{dest}
for _, a := range filters {
args = append(args, a)
}
_jsii_.InvokeVoid(
b,
"addObjectCreatedNotification",
args,
)
}
// Subscribes a destination to receive notifications when an object is removed from the bucket.
//
// This is identical to calling
// `onEvent(EventType.OBJECT_REMOVED)`.
// Experimental.
func (b *jsiiProxy_Bucket) AddObjectRemovedNotification(dest IBucketNotificationDestination, filters ...*NotificationKeyFilter) {
args := []interface{}{dest}
for _, a := range filters {
args = append(args, a)
}
_jsii_.InvokeVoid(
b,
"addObjectRemovedNotification",
args,
)
}
// Adds a statement to the resource policy for a principal (i.e. account/role/service) to perform actions on this bucket and/or its contents. Use `bucketArn` and `arnForObjects(keys)` to obtain ARNs for this bucket or objects.
//
// Note that the policy statement may or may not be added to the policy.
// For example, when an `IBucket` is created from an existing bucket,
// it's not possible to tell whether the bucket already has a policy
// attached, let alone to re-use that policy to add more statements to it.
// So it's safest to do nothing in these cases.
//
// Returns: metadata about the execution of this method. If the policy
// was not added, the value of `statementAdded` will be `false`. You
// should always check this value to make sure that the operation was
// actually carried out. Otherwise, synthesis and deploy will terminate
// silently, which may be confusing.
// Experimental.
func (b *jsiiProxy_Bucket) AddToResourcePolicy(permission awsiam.PolicyStatement) *awsiam.AddToResourcePolicyResult {
var returns *awsiam.AddToResourcePolicyResult
_jsii_.Invoke(
b,
"addToResourcePolicy",
[]interface{}{permission},
&returns,
)
return returns
}
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
func (b *jsiiProxy_Bucket) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {
_jsii_.InvokeVoid(
b,
"applyRemovalPolicy",
[]interface{}{policy},
)
}
// Returns an ARN that represents all objects within the bucket that match the key pattern specified.
//
// To represent all keys, specify ``"*"``.
//
// If you need to specify a keyPattern with multiple components, concatenate them into a single string, e.g.:
//
// arnForObjects(`home/${team}/${user}/*`)
// Experimental.
func (b *jsiiProxy_Bucket) ArnForObjects(keyPattern *string) *string {
var returns *string
_jsii_.Invoke(
b,
"arnForObjects",
[]interface{}{keyPattern},
&returns,
)
return returns
}
// Experimental.
func (b *jsiiProxy_Bucket) GeneratePhysicalName() *string {
var returns *string
_jsii_.Invoke(
b,
"generatePhysicalName",
nil, // no parameters
&returns,
)
return returns
}
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
func (b *jsiiProxy_Bucket) GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string {
var returns *string
_jsii_.Invoke(
b,
"getResourceArnAttribute",
[]interface{}{arnAttr, arnComponents},
&returns,
)
return returns
}
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
func (b *jsiiProxy_Bucket) GetResourceNameAttribute(nameAttr *string) *string {
var returns *string
_jsii_.Invoke(
b,
"getResourceNameAttribute",
[]interface{}{nameAttr},
&returns,
)
return returns
}
// Grants s3:DeleteObject* permission to an IAM principal for objects in this bucket.
// Experimental.
func (b *jsiiProxy_Bucket) GrantDelete(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant {
var returns awsiam.Grant
_jsii_.Invoke(
b,
"grantDelete",
[]interface{}{identity, objectsKeyPattern},
&returns,
)
return returns
}
// Allows unrestricted access to objects from this bucket.
//
// IMPORTANT: This permission allows anyone to perform actions on S3 objects
// in this bucket, which is useful for when you configure your bucket as a
// website and want everyone to be able to read objects in the bucket without
// needing to authenticate.
//
// Without arguments, this method will grant read ("s3:GetObject") access to
// all objects ("*") in the bucket.
//
// The method returns the `iam.Grant` object, which can then be modified
// as needed. For example, you can add a condition that will restrict access only
// to an IPv4 range like this:
//
// const grant = bucket.grantPublicAccess();
// grant.resourceStatement!.addCondition(‘IpAddress’, { “aws:SourceIp”: “54.240.143.0/24” });
//
// Note that if this `IBucket` refers to an existing bucket, possibly not
// managed by CloudFormation, this method will have no effect, since it's
// impossible to modify the policy of an existing bucket.
// Experimental.
func (b *jsiiProxy_Bucket) GrantPublicAccess(keyPrefix *string, allowedActions ...*string) awsiam.Grant {
args := []interface{}{keyPrefix}
for _, a := range allowedActions {
args = append(args, a)
}
var returns awsiam.Grant
_jsii_.Invoke(
b,
"grantPublicAccess",
args,
&returns,
)
return returns
}
// Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal.
//
// If encryption is used, permission to use the key to encrypt the contents
// of written files will also be granted to the same principal.
// Experimental.
func (b *jsiiProxy_Bucket) GrantPut(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant {
var returns awsiam.Grant
_jsii_.Invoke(
b,
"grantPut",
[]interface{}{identity, objectsKeyPattern},
&returns,
)
return returns
}
// Grant the given IAM identity permissions to modify the ACLs of objects in the given Bucket.
//
// If your application has the '@aws-cdk/aws-s3:grantWriteWithoutAcl' feature flag set,
// calling {@link grantWrite} or {@link grantReadWrite} no longer grants permissions to modify the ACLs of the objects;
// in this case, if you need to modify object ACLs, call this method explicitly.
// Experimental.
func (b *jsiiProxy_Bucket) GrantPutAcl(identity awsiam.IGrantable, objectsKeyPattern *string) awsiam.Grant {
var returns awsiam.Grant
_jsii_.Invoke(
b,
"grantPutAcl",
[]interface{}{identity, objectsKeyPattern},
&returns,
)
return returns
}
// Grant read permissions for this bucket and it's contents to an IAM principal (Role/Group/User).
//
// If encryption is used, permission to use the key to decrypt the contents
// of the bucket will also be granted to the same principal.
// Experimental.
func (b *jsiiProxy_Bucket) GrantRead(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant {
var returns awsiam.Grant
_jsii_.Invoke(
b,
"grantRead",
[]interface{}{identity, objectsKeyPattern},
&returns,
)
return returns
}
// Grants read/write permissions for this bucket and it's contents to an IAM principal (Role/Group/User).
//
// If an encryption key is used, permission to use the key for
// encrypt/decrypt will also be granted.
//
// Before CDK version 1.85.0, this method granted the `s3:PutObject*` permission that included `s3:PutObjectAcl`,
// which could be used to grant read/write object access to IAM principals in other accounts.
// If you want to get rid of that behavior, update your CDK version to 1.85.0 or later,
// and make sure the `@aws-cdk/aws-s3:grantWriteWithoutAcl` feature flag is set to `true`
// in the `context` key of your cdk.json file.
// If you've already updated, but still need the principal to have permissions to modify the ACLs,
// use the {@link grantPutAcl} method.
// Experimental.
func (b *jsiiProxy_Bucket) GrantReadWrite(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant {
var returns awsiam.Grant
_jsii_.Invoke(
b,
"grantReadWrite",
[]interface{}{identity, objectsKeyPattern},
&returns,
)
return returns
}
// Grant write permissions to this bucket to an IAM principal.
//
// If encryption is used, permission to use the key to encrypt the contents
// of written files will also be granted to the same principal.
//
// Before CDK version 1.85.0, this method granted the `s3:PutObject*` permission that included `s3:PutObjectAcl`,
// which could be used to grant read/write object access to IAM principals in other accounts.
// If you want to get rid of that behavior, update your CDK version to 1.85.0 or later,
// and make sure the `@aws-cdk/aws-s3:grantWriteWithoutAcl` feature flag is set to `true`
// in the `context` key of your cdk.json file.
// If you've already updated, but still need the principal to have permissions to modify the ACLs,
// use the {@link grantPutAcl} method.
// Experimental.
func (b *jsiiProxy_Bucket) GrantWrite(identity awsiam.IGrantable, objectsKeyPattern interface{}) awsiam.Grant {
var returns awsiam.Grant
_jsii_.Invoke(
b,
"grantWrite",
[]interface{}{identity, objectsKeyPattern},
&returns,
)
return returns
}
// Define a CloudWatch event that triggers when something happens to this repository.
//
// Requires that there exists at least one CloudTrail Trail in your account
// that captures the event. This method will not create the Trail.
// Experimental.
func (b *jsiiProxy_Bucket) OnCloudTrailEvent(id *string, options *OnCloudTrailBucketEventOptions) awsevents.Rule {
var returns awsevents.Rule
_jsii_.Invoke(
b,
"onCloudTrailEvent",
[]interface{}{id, options},
&returns,
)
return returns
}
// Defines an AWS CloudWatch event that triggers when an object is uploaded to the specified paths (keys) in this bucket using the PutObject API call.
//
// Note that some tools like `aws s3 cp` will automatically use either
// PutObject or the multipart upload API depending on the file size,
// so using `onCloudTrailWriteObject` may be preferable.
//
// Requires that there exists at least one CloudTrail Trail in your account
// that captures the event. This method will not create the Trail.
// Experimental.
func (b *jsiiProxy_Bucket) OnCloudTrailPutObject(id *string, options *OnCloudTrailBucketEventOptions) awsevents.Rule {
var returns awsevents.Rule
_jsii_.Invoke(
b,
"onCloudTrailPutObject",
[]interface{}{id, options},
&returns,
)
return returns
}
// Defines an AWS CloudWatch event that triggers when an object at the specified paths (keys) in this bucket are written to.
//
// This includes
// the events PutObject, CopyObject, and CompleteMultipartUpload.
//
// Note that some tools like `aws s3 cp` will automatically use either
// PutObject or the multipart upload API depending on the file size,
// so using this method may be preferable to `onCloudTrailPutObject`.
//
// Requires that there exists at least one CloudTrail Trail in your account
// that captures the event. This method will not create the Trail.
// Experimental.
func (b *jsiiProxy_Bucket) OnCloudTrailWriteObject(id *string, options *OnCloudTrailBucketEventOptions) awsevents.Rule {
var returns awsevents.Rule
_jsii_.Invoke(
b,
"onCloudTrailWriteObject",
[]interface{}{id, options},
&returns,
)
return returns
}
// The S3 URL of an S3 object.
//
// For example:
//
// Returns: an ObjectS3Url token
//
// TODO: EXAMPLE
//
// Experimental.
func (b *jsiiProxy_Bucket) S3UrlForObject(key *string) *string {
var returns *string
_jsii_.Invoke(
b,
"s3UrlForObject",
[]interface{}{key},
&returns,
)
return returns
}
// Returns a string representation of this construct.
// Experimental.
func (b *jsiiProxy_Bucket) ToString() *string {