github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3/bucketNotification.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package s3 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Manages a S3 Bucket Notification Configuration. For additional information, see the [Configuring S3 Event Notifications section in the Amazon S3 Developer Guide](https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html). 16 // 17 // > **NOTE:** S3 Buckets only support a single notification configuration. Declaring multiple `s3.BucketNotification` resources to the same S3 Bucket will cause a perpetual difference in configuration. See the example "Trigger multiple Lambda functions" for an option. 18 // 19 // > This resource cannot be used with S3 directory buckets. 20 // 21 // ## Example Usage 22 // 23 // ### Add notification configuration to SNS Topic 24 // 25 // <!--Start PulumiCodeChooser --> 26 // ```go 27 // package main 28 // 29 // import ( 30 // 31 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 32 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" 33 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns" 34 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 35 // 36 // ) 37 // 38 // func main() { 39 // pulumi.Run(func(ctx *pulumi.Context) error { 40 // bucket, err := s3.NewBucketV2(ctx, "bucket", &s3.BucketV2Args{ 41 // Bucket: pulumi.String("your-bucket-name"), 42 // }) 43 // if err != nil { 44 // return err 45 // } 46 // topic := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{ 47 // Statements: iam.GetPolicyDocumentStatementArray{ 48 // &iam.GetPolicyDocumentStatementArgs{ 49 // Effect: pulumi.String("Allow"), 50 // Principals: iam.GetPolicyDocumentStatementPrincipalArray{ 51 // &iam.GetPolicyDocumentStatementPrincipalArgs{ 52 // Type: pulumi.String("Service"), 53 // Identifiers: pulumi.StringArray{ 54 // pulumi.String("s3.amazonaws.com"), 55 // }, 56 // }, 57 // }, 58 // Actions: pulumi.StringArray{ 59 // pulumi.String("SNS:Publish"), 60 // }, 61 // Resources: pulumi.StringArray{ 62 // pulumi.String("arn:aws:sns:*:*:s3-event-notification-topic"), 63 // }, 64 // Conditions: iam.GetPolicyDocumentStatementConditionArray{ 65 // &iam.GetPolicyDocumentStatementConditionArgs{ 66 // Test: pulumi.String("ArnLike"), 67 // Variable: pulumi.String("aws:SourceArn"), 68 // Values: pulumi.StringArray{ 69 // bucket.Arn, 70 // }, 71 // }, 72 // }, 73 // }, 74 // }, 75 // }, nil) 76 // topicTopic, err := sns.NewTopic(ctx, "topic", &sns.TopicArgs{ 77 // Name: pulumi.String("s3-event-notification-topic"), 78 // Policy: topic.ApplyT(func(topic iam.GetPolicyDocumentResult) (*string, error) { 79 // return &topic.Json, nil 80 // }).(pulumi.StringPtrOutput), 81 // }) 82 // if err != nil { 83 // return err 84 // } 85 // _, err = s3.NewBucketNotification(ctx, "bucket_notification", &s3.BucketNotificationArgs{ 86 // Bucket: bucket.ID(), 87 // Topics: s3.BucketNotificationTopicArray{ 88 // &s3.BucketNotificationTopicArgs{ 89 // TopicArn: topicTopic.Arn, 90 // Events: pulumi.StringArray{ 91 // pulumi.String("s3:ObjectCreated:*"), 92 // }, 93 // FilterSuffix: pulumi.String(".log"), 94 // }, 95 // }, 96 // }) 97 // if err != nil { 98 // return err 99 // } 100 // return nil 101 // }) 102 // } 103 // 104 // ``` 105 // <!--End PulumiCodeChooser --> 106 // 107 // ### Add notification configuration to SQS Queue 108 // 109 // <!--Start PulumiCodeChooser --> 110 // ```go 111 // package main 112 // 113 // import ( 114 // 115 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 116 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" 117 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sqs" 118 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 119 // 120 // ) 121 // 122 // func main() { 123 // pulumi.Run(func(ctx *pulumi.Context) error { 124 // bucket, err := s3.NewBucketV2(ctx, "bucket", &s3.BucketV2Args{ 125 // Bucket: pulumi.String("your-bucket-name"), 126 // }) 127 // if err != nil { 128 // return err 129 // } 130 // queue := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{ 131 // Statements: iam.GetPolicyDocumentStatementArray{ 132 // &iam.GetPolicyDocumentStatementArgs{ 133 // Effect: pulumi.String("Allow"), 134 // Principals: iam.GetPolicyDocumentStatementPrincipalArray{ 135 // &iam.GetPolicyDocumentStatementPrincipalArgs{ 136 // Type: pulumi.String("*"), 137 // Identifiers: pulumi.StringArray{ 138 // pulumi.String("*"), 139 // }, 140 // }, 141 // }, 142 // Actions: pulumi.StringArray{ 143 // pulumi.String("sqs:SendMessage"), 144 // }, 145 // Resources: pulumi.StringArray{ 146 // pulumi.String("arn:aws:sqs:*:*:s3-event-notification-queue"), 147 // }, 148 // Conditions: iam.GetPolicyDocumentStatementConditionArray{ 149 // &iam.GetPolicyDocumentStatementConditionArgs{ 150 // Test: pulumi.String("ArnEquals"), 151 // Variable: pulumi.String("aws:SourceArn"), 152 // Values: pulumi.StringArray{ 153 // bucket.Arn, 154 // }, 155 // }, 156 // }, 157 // }, 158 // }, 159 // }, nil) 160 // queueQueue, err := sqs.NewQueue(ctx, "queue", &sqs.QueueArgs{ 161 // Name: pulumi.String("s3-event-notification-queue"), 162 // Policy: queue.ApplyT(func(queue iam.GetPolicyDocumentResult) (*string, error) { 163 // return &queue.Json, nil 164 // }).(pulumi.StringPtrOutput), 165 // }) 166 // if err != nil { 167 // return err 168 // } 169 // _, err = s3.NewBucketNotification(ctx, "bucket_notification", &s3.BucketNotificationArgs{ 170 // Bucket: bucket.ID(), 171 // Queues: s3.BucketNotificationQueueArray{ 172 // &s3.BucketNotificationQueueArgs{ 173 // QueueArn: queueQueue.Arn, 174 // Events: pulumi.StringArray{ 175 // pulumi.String("s3:ObjectCreated:*"), 176 // }, 177 // FilterSuffix: pulumi.String(".log"), 178 // }, 179 // }, 180 // }) 181 // if err != nil { 182 // return err 183 // } 184 // return nil 185 // }) 186 // } 187 // 188 // ``` 189 // <!--End PulumiCodeChooser --> 190 // 191 // ### Add notification configuration to Lambda Function 192 // 193 // <!--Start PulumiCodeChooser --> 194 // ```go 195 // package main 196 // 197 // import ( 198 // 199 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 200 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 201 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" 202 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 203 // 204 // ) 205 // 206 // func main() { 207 // pulumi.Run(func(ctx *pulumi.Context) error { 208 // assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 209 // Statements: []iam.GetPolicyDocumentStatement{ 210 // { 211 // Effect: pulumi.StringRef("Allow"), 212 // Principals: []iam.GetPolicyDocumentStatementPrincipal{ 213 // { 214 // Type: "Service", 215 // Identifiers: []string{ 216 // "lambda.amazonaws.com", 217 // }, 218 // }, 219 // }, 220 // Actions: []string{ 221 // "sts:AssumeRole", 222 // }, 223 // }, 224 // }, 225 // }, nil) 226 // if err != nil { 227 // return err 228 // } 229 // iamForLambda, err := iam.NewRole(ctx, "iam_for_lambda", &iam.RoleArgs{ 230 // Name: pulumi.String("iam_for_lambda"), 231 // AssumeRolePolicy: pulumi.String(assumeRole.Json), 232 // }) 233 // if err != nil { 234 // return err 235 // } 236 // _, err = lambda.NewFunction(ctx, "func", &lambda.FunctionArgs{ 237 // Code: pulumi.NewFileArchive("your-function.zip"), 238 // Name: pulumi.String("example_lambda_name"), 239 // Role: iamForLambda.Arn, 240 // Handler: pulumi.String("exports.example"), 241 // Runtime: pulumi.String(lambda.RuntimeGo1dx), 242 // }) 243 // if err != nil { 244 // return err 245 // } 246 // bucket, err := s3.NewBucketV2(ctx, "bucket", &s3.BucketV2Args{ 247 // Bucket: pulumi.String("your-bucket-name"), 248 // }) 249 // if err != nil { 250 // return err 251 // } 252 // allowBucket, err := lambda.NewPermission(ctx, "allow_bucket", &lambda.PermissionArgs{ 253 // StatementId: pulumi.String("AllowExecutionFromS3Bucket"), 254 // Action: pulumi.String("lambda:InvokeFunction"), 255 // Function: _func.Arn, 256 // Principal: pulumi.String("s3.amazonaws.com"), 257 // SourceArn: bucket.Arn, 258 // }) 259 // if err != nil { 260 // return err 261 // } 262 // _, err = s3.NewBucketNotification(ctx, "bucket_notification", &s3.BucketNotificationArgs{ 263 // Bucket: bucket.ID(), 264 // LambdaFunctions: s3.BucketNotificationLambdaFunctionArray{ 265 // &s3.BucketNotificationLambdaFunctionArgs{ 266 // LambdaFunctionArn: _func.Arn, 267 // Events: pulumi.StringArray{ 268 // pulumi.String("s3:ObjectCreated:*"), 269 // }, 270 // FilterPrefix: pulumi.String("AWSLogs/"), 271 // FilterSuffix: pulumi.String(".log"), 272 // }, 273 // }, 274 // }, pulumi.DependsOn([]pulumi.Resource{ 275 // allowBucket, 276 // })) 277 // if err != nil { 278 // return err 279 // } 280 // return nil 281 // }) 282 // } 283 // 284 // ``` 285 // <!--End PulumiCodeChooser --> 286 // 287 // ### Trigger multiple Lambda functions 288 // 289 // <!--Start PulumiCodeChooser --> 290 // ```go 291 // package main 292 // 293 // import ( 294 // 295 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 296 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 297 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" 298 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 299 // 300 // ) 301 // 302 // func main() { 303 // pulumi.Run(func(ctx *pulumi.Context) error { 304 // assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 305 // Statements: []iam.GetPolicyDocumentStatement{ 306 // { 307 // Effect: pulumi.StringRef("Allow"), 308 // Principals: []iam.GetPolicyDocumentStatementPrincipal{ 309 // { 310 // Type: "Service", 311 // Identifiers: []string{ 312 // "lambda.amazonaws.com", 313 // }, 314 // }, 315 // }, 316 // Actions: []string{ 317 // "sts:AssumeRole", 318 // }, 319 // }, 320 // }, 321 // }, nil) 322 // if err != nil { 323 // return err 324 // } 325 // iamForLambda, err := iam.NewRole(ctx, "iam_for_lambda", &iam.RoleArgs{ 326 // Name: pulumi.String("iam_for_lambda"), 327 // AssumeRolePolicy: pulumi.String(assumeRole.Json), 328 // }) 329 // if err != nil { 330 // return err 331 // } 332 // func1, err := lambda.NewFunction(ctx, "func1", &lambda.FunctionArgs{ 333 // Code: pulumi.NewFileArchive("your-function1.zip"), 334 // Name: pulumi.String("example_lambda_name1"), 335 // Role: iamForLambda.Arn, 336 // Handler: pulumi.String("exports.example"), 337 // Runtime: pulumi.String(lambda.RuntimeGo1dx), 338 // }) 339 // if err != nil { 340 // return err 341 // } 342 // bucket, err := s3.NewBucketV2(ctx, "bucket", &s3.BucketV2Args{ 343 // Bucket: pulumi.String("your-bucket-name"), 344 // }) 345 // if err != nil { 346 // return err 347 // } 348 // allowBucket1, err := lambda.NewPermission(ctx, "allow_bucket1", &lambda.PermissionArgs{ 349 // StatementId: pulumi.String("AllowExecutionFromS3Bucket1"), 350 // Action: pulumi.String("lambda:InvokeFunction"), 351 // Function: func1.Arn, 352 // Principal: pulumi.String("s3.amazonaws.com"), 353 // SourceArn: bucket.Arn, 354 // }) 355 // if err != nil { 356 // return err 357 // } 358 // func2, err := lambda.NewFunction(ctx, "func2", &lambda.FunctionArgs{ 359 // Code: pulumi.NewFileArchive("your-function2.zip"), 360 // Name: pulumi.String("example_lambda_name2"), 361 // Role: iamForLambda.Arn, 362 // Handler: pulumi.String("exports.example"), 363 // }) 364 // if err != nil { 365 // return err 366 // } 367 // allowBucket2, err := lambda.NewPermission(ctx, "allow_bucket2", &lambda.PermissionArgs{ 368 // StatementId: pulumi.String("AllowExecutionFromS3Bucket2"), 369 // Action: pulumi.String("lambda:InvokeFunction"), 370 // Function: func2.Arn, 371 // Principal: pulumi.String("s3.amazonaws.com"), 372 // SourceArn: bucket.Arn, 373 // }) 374 // if err != nil { 375 // return err 376 // } 377 // _, err = s3.NewBucketNotification(ctx, "bucket_notification", &s3.BucketNotificationArgs{ 378 // Bucket: bucket.ID(), 379 // LambdaFunctions: s3.BucketNotificationLambdaFunctionArray{ 380 // &s3.BucketNotificationLambdaFunctionArgs{ 381 // LambdaFunctionArn: func1.Arn, 382 // Events: pulumi.StringArray{ 383 // pulumi.String("s3:ObjectCreated:*"), 384 // }, 385 // FilterPrefix: pulumi.String("AWSLogs/"), 386 // FilterSuffix: pulumi.String(".log"), 387 // }, 388 // &s3.BucketNotificationLambdaFunctionArgs{ 389 // LambdaFunctionArn: func2.Arn, 390 // Events: pulumi.StringArray{ 391 // pulumi.String("s3:ObjectCreated:*"), 392 // }, 393 // FilterPrefix: pulumi.String("OtherLogs/"), 394 // FilterSuffix: pulumi.String(".log"), 395 // }, 396 // }, 397 // }, pulumi.DependsOn([]pulumi.Resource{ 398 // allowBucket1, 399 // allowBucket2, 400 // })) 401 // if err != nil { 402 // return err 403 // } 404 // return nil 405 // }) 406 // } 407 // 408 // ``` 409 // <!--End PulumiCodeChooser --> 410 // 411 // ### Add multiple notification configurations to SQS Queue 412 // 413 // <!--Start PulumiCodeChooser --> 414 // ```go 415 // package main 416 // 417 // import ( 418 // 419 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 420 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" 421 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sqs" 422 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 423 // 424 // ) 425 // 426 // func main() { 427 // pulumi.Run(func(ctx *pulumi.Context) error { 428 // bucket, err := s3.NewBucketV2(ctx, "bucket", &s3.BucketV2Args{ 429 // Bucket: pulumi.String("your-bucket-name"), 430 // }) 431 // if err != nil { 432 // return err 433 // } 434 // queue := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{ 435 // Statements: iam.GetPolicyDocumentStatementArray{ 436 // &iam.GetPolicyDocumentStatementArgs{ 437 // Effect: pulumi.String("Allow"), 438 // Principals: iam.GetPolicyDocumentStatementPrincipalArray{ 439 // &iam.GetPolicyDocumentStatementPrincipalArgs{ 440 // Type: pulumi.String("*"), 441 // Identifiers: pulumi.StringArray{ 442 // pulumi.String("*"), 443 // }, 444 // }, 445 // }, 446 // Actions: pulumi.StringArray{ 447 // pulumi.String("sqs:SendMessage"), 448 // }, 449 // Resources: pulumi.StringArray{ 450 // pulumi.String("arn:aws:sqs:*:*:s3-event-notification-queue"), 451 // }, 452 // Conditions: iam.GetPolicyDocumentStatementConditionArray{ 453 // &iam.GetPolicyDocumentStatementConditionArgs{ 454 // Test: pulumi.String("ArnEquals"), 455 // Variable: pulumi.String("aws:SourceArn"), 456 // Values: pulumi.StringArray{ 457 // bucket.Arn, 458 // }, 459 // }, 460 // }, 461 // }, 462 // }, 463 // }, nil) 464 // queueQueue, err := sqs.NewQueue(ctx, "queue", &sqs.QueueArgs{ 465 // Name: pulumi.String("s3-event-notification-queue"), 466 // Policy: queue.ApplyT(func(queue iam.GetPolicyDocumentResult) (*string, error) { 467 // return &queue.Json, nil 468 // }).(pulumi.StringPtrOutput), 469 // }) 470 // if err != nil { 471 // return err 472 // } 473 // _, err = s3.NewBucketNotification(ctx, "bucket_notification", &s3.BucketNotificationArgs{ 474 // Bucket: bucket.ID(), 475 // Queues: s3.BucketNotificationQueueArray{ 476 // &s3.BucketNotificationQueueArgs{ 477 // Id: pulumi.String("image-upload-event"), 478 // QueueArn: queueQueue.Arn, 479 // Events: pulumi.StringArray{ 480 // pulumi.String("s3:ObjectCreated:*"), 481 // }, 482 // FilterPrefix: pulumi.String("images/"), 483 // }, 484 // &s3.BucketNotificationQueueArgs{ 485 // Id: pulumi.String("video-upload-event"), 486 // QueueArn: queueQueue.Arn, 487 // Events: pulumi.StringArray{ 488 // pulumi.String("s3:ObjectCreated:*"), 489 // }, 490 // FilterPrefix: pulumi.String("videos/"), 491 // }, 492 // }, 493 // }) 494 // if err != nil { 495 // return err 496 // } 497 // return nil 498 // }) 499 // } 500 // 501 // ``` 502 // <!--End PulumiCodeChooser --> 503 // 504 // For JSON syntax, use an array instead of defining the `queue` key twice. 505 // 506 // ### Emit events to EventBridge 507 // 508 // <!--Start PulumiCodeChooser --> 509 // ```go 510 // package main 511 // 512 // import ( 513 // 514 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" 515 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 516 // 517 // ) 518 // 519 // func main() { 520 // pulumi.Run(func(ctx *pulumi.Context) error { 521 // bucket, err := s3.NewBucketV2(ctx, "bucket", &s3.BucketV2Args{ 522 // Bucket: pulumi.String("your-bucket-name"), 523 // }) 524 // if err != nil { 525 // return err 526 // } 527 // _, err = s3.NewBucketNotification(ctx, "bucket_notification", &s3.BucketNotificationArgs{ 528 // Bucket: bucket.ID(), 529 // Eventbridge: pulumi.Bool(true), 530 // }) 531 // if err != nil { 532 // return err 533 // } 534 // return nil 535 // }) 536 // } 537 // 538 // ``` 539 // <!--End PulumiCodeChooser --> 540 // 541 // ## Import 542 // 543 // Using `pulumi import`, import S3 bucket notification using the `bucket`. For example: 544 // 545 // ```sh 546 // $ pulumi import aws:s3/bucketNotification:BucketNotification bucket_notification bucket-name 547 // ``` 548 type BucketNotification struct { 549 pulumi.CustomResourceState 550 551 // Name of the bucket for notification configuration. 552 // 553 // The following arguments are optional: 554 Bucket pulumi.StringOutput `pulumi:"bucket"` 555 // Whether to enable Amazon EventBridge notifications. Defaults to `false`. 556 Eventbridge pulumi.BoolPtrOutput `pulumi:"eventbridge"` 557 // Used to configure notifications to a Lambda Function. See below. 558 LambdaFunctions BucketNotificationLambdaFunctionArrayOutput `pulumi:"lambdaFunctions"` 559 // Notification configuration to SQS Queue. See below. 560 Queues BucketNotificationQueueArrayOutput `pulumi:"queues"` 561 // Notification configuration to SNS Topic. See below. 562 Topics BucketNotificationTopicArrayOutput `pulumi:"topics"` 563 } 564 565 // NewBucketNotification registers a new resource with the given unique name, arguments, and options. 566 func NewBucketNotification(ctx *pulumi.Context, 567 name string, args *BucketNotificationArgs, opts ...pulumi.ResourceOption) (*BucketNotification, error) { 568 if args == nil { 569 return nil, errors.New("missing one or more required arguments") 570 } 571 572 if args.Bucket == nil { 573 return nil, errors.New("invalid value for required argument 'Bucket'") 574 } 575 opts = internal.PkgResourceDefaultOpts(opts) 576 var resource BucketNotification 577 err := ctx.RegisterResource("aws:s3/bucketNotification:BucketNotification", name, args, &resource, opts...) 578 if err != nil { 579 return nil, err 580 } 581 return &resource, nil 582 } 583 584 // GetBucketNotification gets an existing BucketNotification resource's state with the given name, ID, and optional 585 // state properties that are used to uniquely qualify the lookup (nil if not required). 586 func GetBucketNotification(ctx *pulumi.Context, 587 name string, id pulumi.IDInput, state *BucketNotificationState, opts ...pulumi.ResourceOption) (*BucketNotification, error) { 588 var resource BucketNotification 589 err := ctx.ReadResource("aws:s3/bucketNotification:BucketNotification", name, id, state, &resource, opts...) 590 if err != nil { 591 return nil, err 592 } 593 return &resource, nil 594 } 595 596 // Input properties used for looking up and filtering BucketNotification resources. 597 type bucketNotificationState struct { 598 // Name of the bucket for notification configuration. 599 // 600 // The following arguments are optional: 601 Bucket *string `pulumi:"bucket"` 602 // Whether to enable Amazon EventBridge notifications. Defaults to `false`. 603 Eventbridge *bool `pulumi:"eventbridge"` 604 // Used to configure notifications to a Lambda Function. See below. 605 LambdaFunctions []BucketNotificationLambdaFunction `pulumi:"lambdaFunctions"` 606 // Notification configuration to SQS Queue. See below. 607 Queues []BucketNotificationQueue `pulumi:"queues"` 608 // Notification configuration to SNS Topic. See below. 609 Topics []BucketNotificationTopic `pulumi:"topics"` 610 } 611 612 type BucketNotificationState struct { 613 // Name of the bucket for notification configuration. 614 // 615 // The following arguments are optional: 616 Bucket pulumi.StringPtrInput 617 // Whether to enable Amazon EventBridge notifications. Defaults to `false`. 618 Eventbridge pulumi.BoolPtrInput 619 // Used to configure notifications to a Lambda Function. See below. 620 LambdaFunctions BucketNotificationLambdaFunctionArrayInput 621 // Notification configuration to SQS Queue. See below. 622 Queues BucketNotificationQueueArrayInput 623 // Notification configuration to SNS Topic. See below. 624 Topics BucketNotificationTopicArrayInput 625 } 626 627 func (BucketNotificationState) ElementType() reflect.Type { 628 return reflect.TypeOf((*bucketNotificationState)(nil)).Elem() 629 } 630 631 type bucketNotificationArgs struct { 632 // Name of the bucket for notification configuration. 633 // 634 // The following arguments are optional: 635 Bucket string `pulumi:"bucket"` 636 // Whether to enable Amazon EventBridge notifications. Defaults to `false`. 637 Eventbridge *bool `pulumi:"eventbridge"` 638 // Used to configure notifications to a Lambda Function. See below. 639 LambdaFunctions []BucketNotificationLambdaFunction `pulumi:"lambdaFunctions"` 640 // Notification configuration to SQS Queue. See below. 641 Queues []BucketNotificationQueue `pulumi:"queues"` 642 // Notification configuration to SNS Topic. See below. 643 Topics []BucketNotificationTopic `pulumi:"topics"` 644 } 645 646 // The set of arguments for constructing a BucketNotification resource. 647 type BucketNotificationArgs struct { 648 // Name of the bucket for notification configuration. 649 // 650 // The following arguments are optional: 651 Bucket pulumi.StringInput 652 // Whether to enable Amazon EventBridge notifications. Defaults to `false`. 653 Eventbridge pulumi.BoolPtrInput 654 // Used to configure notifications to a Lambda Function. See below. 655 LambdaFunctions BucketNotificationLambdaFunctionArrayInput 656 // Notification configuration to SQS Queue. See below. 657 Queues BucketNotificationQueueArrayInput 658 // Notification configuration to SNS Topic. See below. 659 Topics BucketNotificationTopicArrayInput 660 } 661 662 func (BucketNotificationArgs) ElementType() reflect.Type { 663 return reflect.TypeOf((*bucketNotificationArgs)(nil)).Elem() 664 } 665 666 type BucketNotificationInput interface { 667 pulumi.Input 668 669 ToBucketNotificationOutput() BucketNotificationOutput 670 ToBucketNotificationOutputWithContext(ctx context.Context) BucketNotificationOutput 671 } 672 673 func (*BucketNotification) ElementType() reflect.Type { 674 return reflect.TypeOf((**BucketNotification)(nil)).Elem() 675 } 676 677 func (i *BucketNotification) ToBucketNotificationOutput() BucketNotificationOutput { 678 return i.ToBucketNotificationOutputWithContext(context.Background()) 679 } 680 681 func (i *BucketNotification) ToBucketNotificationOutputWithContext(ctx context.Context) BucketNotificationOutput { 682 return pulumi.ToOutputWithContext(ctx, i).(BucketNotificationOutput) 683 } 684 685 // BucketNotificationArrayInput is an input type that accepts BucketNotificationArray and BucketNotificationArrayOutput values. 686 // You can construct a concrete instance of `BucketNotificationArrayInput` via: 687 // 688 // BucketNotificationArray{ BucketNotificationArgs{...} } 689 type BucketNotificationArrayInput interface { 690 pulumi.Input 691 692 ToBucketNotificationArrayOutput() BucketNotificationArrayOutput 693 ToBucketNotificationArrayOutputWithContext(context.Context) BucketNotificationArrayOutput 694 } 695 696 type BucketNotificationArray []BucketNotificationInput 697 698 func (BucketNotificationArray) ElementType() reflect.Type { 699 return reflect.TypeOf((*[]*BucketNotification)(nil)).Elem() 700 } 701 702 func (i BucketNotificationArray) ToBucketNotificationArrayOutput() BucketNotificationArrayOutput { 703 return i.ToBucketNotificationArrayOutputWithContext(context.Background()) 704 } 705 706 func (i BucketNotificationArray) ToBucketNotificationArrayOutputWithContext(ctx context.Context) BucketNotificationArrayOutput { 707 return pulumi.ToOutputWithContext(ctx, i).(BucketNotificationArrayOutput) 708 } 709 710 // BucketNotificationMapInput is an input type that accepts BucketNotificationMap and BucketNotificationMapOutput values. 711 // You can construct a concrete instance of `BucketNotificationMapInput` via: 712 // 713 // BucketNotificationMap{ "key": BucketNotificationArgs{...} } 714 type BucketNotificationMapInput interface { 715 pulumi.Input 716 717 ToBucketNotificationMapOutput() BucketNotificationMapOutput 718 ToBucketNotificationMapOutputWithContext(context.Context) BucketNotificationMapOutput 719 } 720 721 type BucketNotificationMap map[string]BucketNotificationInput 722 723 func (BucketNotificationMap) ElementType() reflect.Type { 724 return reflect.TypeOf((*map[string]*BucketNotification)(nil)).Elem() 725 } 726 727 func (i BucketNotificationMap) ToBucketNotificationMapOutput() BucketNotificationMapOutput { 728 return i.ToBucketNotificationMapOutputWithContext(context.Background()) 729 } 730 731 func (i BucketNotificationMap) ToBucketNotificationMapOutputWithContext(ctx context.Context) BucketNotificationMapOutput { 732 return pulumi.ToOutputWithContext(ctx, i).(BucketNotificationMapOutput) 733 } 734 735 type BucketNotificationOutput struct{ *pulumi.OutputState } 736 737 func (BucketNotificationOutput) ElementType() reflect.Type { 738 return reflect.TypeOf((**BucketNotification)(nil)).Elem() 739 } 740 741 func (o BucketNotificationOutput) ToBucketNotificationOutput() BucketNotificationOutput { 742 return o 743 } 744 745 func (o BucketNotificationOutput) ToBucketNotificationOutputWithContext(ctx context.Context) BucketNotificationOutput { 746 return o 747 } 748 749 // Name of the bucket for notification configuration. 750 // 751 // The following arguments are optional: 752 func (o BucketNotificationOutput) Bucket() pulumi.StringOutput { 753 return o.ApplyT(func(v *BucketNotification) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput) 754 } 755 756 // Whether to enable Amazon EventBridge notifications. Defaults to `false`. 757 func (o BucketNotificationOutput) Eventbridge() pulumi.BoolPtrOutput { 758 return o.ApplyT(func(v *BucketNotification) pulumi.BoolPtrOutput { return v.Eventbridge }).(pulumi.BoolPtrOutput) 759 } 760 761 // Used to configure notifications to a Lambda Function. See below. 762 func (o BucketNotificationOutput) LambdaFunctions() BucketNotificationLambdaFunctionArrayOutput { 763 return o.ApplyT(func(v *BucketNotification) BucketNotificationLambdaFunctionArrayOutput { return v.LambdaFunctions }).(BucketNotificationLambdaFunctionArrayOutput) 764 } 765 766 // Notification configuration to SQS Queue. See below. 767 func (o BucketNotificationOutput) Queues() BucketNotificationQueueArrayOutput { 768 return o.ApplyT(func(v *BucketNotification) BucketNotificationQueueArrayOutput { return v.Queues }).(BucketNotificationQueueArrayOutput) 769 } 770 771 // Notification configuration to SNS Topic. See below. 772 func (o BucketNotificationOutput) Topics() BucketNotificationTopicArrayOutput { 773 return o.ApplyT(func(v *BucketNotification) BucketNotificationTopicArrayOutput { return v.Topics }).(BucketNotificationTopicArrayOutput) 774 } 775 776 type BucketNotificationArrayOutput struct{ *pulumi.OutputState } 777 778 func (BucketNotificationArrayOutput) ElementType() reflect.Type { 779 return reflect.TypeOf((*[]*BucketNotification)(nil)).Elem() 780 } 781 782 func (o BucketNotificationArrayOutput) ToBucketNotificationArrayOutput() BucketNotificationArrayOutput { 783 return o 784 } 785 786 func (o BucketNotificationArrayOutput) ToBucketNotificationArrayOutputWithContext(ctx context.Context) BucketNotificationArrayOutput { 787 return o 788 } 789 790 func (o BucketNotificationArrayOutput) Index(i pulumi.IntInput) BucketNotificationOutput { 791 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BucketNotification { 792 return vs[0].([]*BucketNotification)[vs[1].(int)] 793 }).(BucketNotificationOutput) 794 } 795 796 type BucketNotificationMapOutput struct{ *pulumi.OutputState } 797 798 func (BucketNotificationMapOutput) ElementType() reflect.Type { 799 return reflect.TypeOf((*map[string]*BucketNotification)(nil)).Elem() 800 } 801 802 func (o BucketNotificationMapOutput) ToBucketNotificationMapOutput() BucketNotificationMapOutput { 803 return o 804 } 805 806 func (o BucketNotificationMapOutput) ToBucketNotificationMapOutputWithContext(ctx context.Context) BucketNotificationMapOutput { 807 return o 808 } 809 810 func (o BucketNotificationMapOutput) MapIndex(k pulumi.StringInput) BucketNotificationOutput { 811 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BucketNotification { 812 return vs[0].(map[string]*BucketNotification)[vs[1].(string)] 813 }).(BucketNotificationOutput) 814 } 815 816 func init() { 817 pulumi.RegisterInputType(reflect.TypeOf((*BucketNotificationInput)(nil)).Elem(), &BucketNotification{}) 818 pulumi.RegisterInputType(reflect.TypeOf((*BucketNotificationArrayInput)(nil)).Elem(), BucketNotificationArray{}) 819 pulumi.RegisterInputType(reflect.TypeOf((*BucketNotificationMapInput)(nil)).Elem(), BucketNotificationMap{}) 820 pulumi.RegisterOutputType(BucketNotificationOutput{}) 821 pulumi.RegisterOutputType(BucketNotificationArrayOutput{}) 822 pulumi.RegisterOutputType(BucketNotificationMapOutput{}) 823 }