github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/eventTarget.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 cloudwatch 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 // Provides an EventBridge Target resource. 16 // 17 // > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical. 18 // 19 // ## Example Usage 20 // 21 // ### Kinesis Usage 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "encoding/json" 30 // 31 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 32 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kinesis" 33 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 34 // 35 // ) 36 // 37 // func main() { 38 // pulumi.Run(func(ctx *pulumi.Context) error { 39 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 40 // "source": []string{ 41 // "aws.autoscaling", 42 // }, 43 // "detail-type": []string{ 44 // "EC2 Instance Launch Successful", 45 // "EC2 Instance Terminate Successful", 46 // "EC2 Instance Launch Unsuccessful", 47 // "EC2 Instance Terminate Unsuccessful", 48 // }, 49 // }) 50 // if err != nil { 51 // return err 52 // } 53 // json0 := string(tmpJSON0) 54 // console, err := cloudwatch.NewEventRule(ctx, "console", &cloudwatch.EventRuleArgs{ 55 // Name: pulumi.String("capture-ec2-scaling-events"), 56 // Description: pulumi.String("Capture all EC2 scaling events"), 57 // EventPattern: pulumi.String(json0), 58 // }) 59 // if err != nil { 60 // return err 61 // } 62 // testStream, err := kinesis.NewStream(ctx, "test_stream", &kinesis.StreamArgs{ 63 // Name: pulumi.String("kinesis-test"), 64 // ShardCount: pulumi.Int(1), 65 // }) 66 // if err != nil { 67 // return err 68 // } 69 // _, err = cloudwatch.NewEventTarget(ctx, "yada", &cloudwatch.EventTargetArgs{ 70 // TargetId: pulumi.String("Yada"), 71 // Rule: console.Name, 72 // Arn: testStream.Arn, 73 // RunCommandTargets: cloudwatch.EventTargetRunCommandTargetArray{ 74 // &cloudwatch.EventTargetRunCommandTargetArgs{ 75 // Key: pulumi.String("tag:Name"), 76 // Values: pulumi.StringArray{ 77 // pulumi.String("FooBar"), 78 // }, 79 // }, 80 // &cloudwatch.EventTargetRunCommandTargetArgs{ 81 // Key: pulumi.String("InstanceIds"), 82 // Values: pulumi.StringArray{ 83 // pulumi.String("i-162058cd308bffec2"), 84 // }, 85 // }, 86 // }, 87 // }) 88 // if err != nil { 89 // return err 90 // } 91 // return nil 92 // }) 93 // } 94 // 95 // ``` 96 // <!--End PulumiCodeChooser --> 97 // 98 // ### SSM Document Usage 99 // 100 // <!--Start PulumiCodeChooser --> 101 // ```go 102 // package main 103 // 104 // import ( 105 // 106 // "encoding/json" 107 // 108 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 109 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 110 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm" 111 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 112 // 113 // ) 114 // 115 // func main() { 116 // pulumi.Run(func(ctx *pulumi.Context) error { 117 // ssmLifecycleTrust, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 118 // Statements: []iam.GetPolicyDocumentStatement{ 119 // { 120 // Actions: []string{ 121 // "sts:AssumeRole", 122 // }, 123 // Principals: []iam.GetPolicyDocumentStatementPrincipal{ 124 // { 125 // Type: "Service", 126 // Identifiers: []string{ 127 // "events.amazonaws.com", 128 // }, 129 // }, 130 // }, 131 // }, 132 // }, 133 // }, nil) 134 // if err != nil { 135 // return err 136 // } 137 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 138 // "schemaVersion": "1.2", 139 // "description": "Stop an instance", 140 // "parameters": nil, 141 // "runtimeConfig": map[string]interface{}{ 142 // "aws:runShellScript": map[string]interface{}{ 143 // "properties": []map[string]interface{}{ 144 // map[string]interface{}{ 145 // "id": "0.aws:runShellScript", 146 // "runCommand": []string{ 147 // "halt", 148 // }, 149 // }, 150 // }, 151 // }, 152 // }, 153 // }) 154 // if err != nil { 155 // return err 156 // } 157 // json0 := string(tmpJSON0) 158 // stopInstance, err := ssm.NewDocument(ctx, "stop_instance", &ssm.DocumentArgs{ 159 // Name: pulumi.String("stop_instance"), 160 // DocumentType: pulumi.String("Command"), 161 // Content: pulumi.String(json0), 162 // }) 163 // if err != nil { 164 // return err 165 // } 166 // ssmLifecycle := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{ 167 // Statements: iam.GetPolicyDocumentStatementArray{ 168 // &iam.GetPolicyDocumentStatementArgs{ 169 // Effect: pulumi.String("Allow"), 170 // Actions: pulumi.StringArray{ 171 // pulumi.String("ssm:SendCommand"), 172 // }, 173 // Resources: pulumi.StringArray{ 174 // pulumi.String("arn:aws:ec2:eu-west-1:1234567890:instance/*"), 175 // }, 176 // Conditions: iam.GetPolicyDocumentStatementConditionArray{ 177 // &iam.GetPolicyDocumentStatementConditionArgs{ 178 // Test: pulumi.String("StringEquals"), 179 // Variable: pulumi.String("ec2:ResourceTag/Terminate"), 180 // Values: pulumi.StringArray{ 181 // pulumi.String("*"), 182 // }, 183 // }, 184 // }, 185 // }, 186 // &iam.GetPolicyDocumentStatementArgs{ 187 // Effect: pulumi.String("Allow"), 188 // Actions: pulumi.StringArray{ 189 // pulumi.String("ssm:SendCommand"), 190 // }, 191 // Resources: pulumi.StringArray{ 192 // stopInstance.Arn, 193 // }, 194 // }, 195 // }, 196 // }, nil) 197 // ssmLifecycleRole, err := iam.NewRole(ctx, "ssm_lifecycle", &iam.RoleArgs{ 198 // Name: pulumi.String("SSMLifecycle"), 199 // AssumeRolePolicy: pulumi.String(ssmLifecycleTrust.Json), 200 // }) 201 // if err != nil { 202 // return err 203 // } 204 // ssmLifecyclePolicy, err := iam.NewPolicy(ctx, "ssm_lifecycle", &iam.PolicyArgs{ 205 // Name: pulumi.String("SSMLifecycle"), 206 // Policy: ssmLifecycle.ApplyT(func(ssmLifecycle iam.GetPolicyDocumentResult) (*string, error) { 207 // return &ssmLifecycle.Json, nil 208 // }).(pulumi.StringPtrOutput), 209 // }) 210 // if err != nil { 211 // return err 212 // } 213 // _, err = iam.NewRolePolicyAttachment(ctx, "ssm_lifecycle", &iam.RolePolicyAttachmentArgs{ 214 // PolicyArn: ssmLifecyclePolicy.Arn, 215 // Role: ssmLifecycleRole.Name, 216 // }) 217 // if err != nil { 218 // return err 219 // } 220 // stopInstances, err := cloudwatch.NewEventRule(ctx, "stop_instances", &cloudwatch.EventRuleArgs{ 221 // Name: pulumi.String("StopInstance"), 222 // Description: pulumi.String("Stop instances nightly"), 223 // ScheduleExpression: pulumi.String("cron(0 0 * * ? *)"), 224 // }) 225 // if err != nil { 226 // return err 227 // } 228 // _, err = cloudwatch.NewEventTarget(ctx, "stop_instances", &cloudwatch.EventTargetArgs{ 229 // TargetId: pulumi.String("StopInstance"), 230 // Arn: stopInstance.Arn, 231 // Rule: stopInstances.Name, 232 // RoleArn: ssmLifecycleRole.Arn, 233 // RunCommandTargets: cloudwatch.EventTargetRunCommandTargetArray{ 234 // &cloudwatch.EventTargetRunCommandTargetArgs{ 235 // Key: pulumi.String("tag:Terminate"), 236 // Values: pulumi.StringArray{ 237 // pulumi.String("midnight"), 238 // }, 239 // }, 240 // }, 241 // }) 242 // if err != nil { 243 // return err 244 // } 245 // return nil 246 // }) 247 // } 248 // 249 // ``` 250 // <!--End PulumiCodeChooser --> 251 // 252 // ### RunCommand Usage 253 // 254 // <!--Start PulumiCodeChooser --> 255 // ```go 256 // package main 257 // 258 // import ( 259 // 260 // "fmt" 261 // 262 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 263 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 264 // 265 // ) 266 // 267 // func main() { 268 // pulumi.Run(func(ctx *pulumi.Context) error { 269 // stopInstances, err := cloudwatch.NewEventRule(ctx, "stop_instances", &cloudwatch.EventRuleArgs{ 270 // Name: pulumi.String("StopInstance"), 271 // Description: pulumi.String("Stop instances nightly"), 272 // ScheduleExpression: pulumi.String("cron(0 0 * * ? *)"), 273 // }) 274 // if err != nil { 275 // return err 276 // } 277 // _, err = cloudwatch.NewEventTarget(ctx, "stop_instances", &cloudwatch.EventTargetArgs{ 278 // TargetId: pulumi.String("StopInstance"), 279 // Arn: pulumi.String(fmt.Sprintf("arn:aws:ssm:%v::document/AWS-RunShellScript", awsRegion)), 280 // Input: pulumi.String("{\"commands\":[\"halt\"]}"), 281 // Rule: stopInstances.Name, 282 // RoleArn: pulumi.Any(ssmLifecycle.Arn), 283 // RunCommandTargets: cloudwatch.EventTargetRunCommandTargetArray{ 284 // &cloudwatch.EventTargetRunCommandTargetArgs{ 285 // Key: pulumi.String("tag:Terminate"), 286 // Values: pulumi.StringArray{ 287 // pulumi.String("midnight"), 288 // }, 289 // }, 290 // }, 291 // }) 292 // if err != nil { 293 // return err 294 // } 295 // return nil 296 // }) 297 // } 298 // 299 // ``` 300 // <!--End PulumiCodeChooser --> 301 // 302 // ### ECS Run Task with Role and Task Override Usage 303 // 304 // <!--Start PulumiCodeChooser --> 305 // ```go 306 // package main 307 // 308 // import ( 309 // 310 // "encoding/json" 311 // 312 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 313 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 314 // "github.com/pulumi/pulumi-std/sdk/go/std" 315 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 316 // 317 // ) 318 // func main() { 319 // pulumi.Run(func(ctx *pulumi.Context) error { 320 // assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 321 // Statements: []iam.GetPolicyDocumentStatement{ 322 // { 323 // Effect: pulumi.StringRef("Allow"), 324 // Principals: []iam.GetPolicyDocumentStatementPrincipal{ 325 // { 326 // Type: "Service", 327 // Identifiers: []string{ 328 // "events.amazonaws.com", 329 // }, 330 // }, 331 // }, 332 // Actions: []string{ 333 // "sts:AssumeRole", 334 // }, 335 // }, 336 // }, 337 // }, nil); 338 // if err != nil { 339 // return err 340 // } 341 // ecsEvents, err := iam.NewRole(ctx, "ecs_events", &iam.RoleArgs{ 342 // Name: pulumi.String("ecs_events"), 343 // AssumeRolePolicy: pulumi.String(assumeRole.Json), 344 // }) 345 // if err != nil { 346 // return err 347 // } 348 // ecsEventsRunTaskWithAnyRole, err := iam.GetPolicyDocument(ctx, invokeReplace, err := std.Replace(ctx, &std.ReplaceArgs{ 349 // Text: taskName.Arn, 350 // Search: "/:\\d+$/", 351 // Replace: ":*", 352 // }, nil) 353 // if err != nil { 354 // return err 355 // } 356 // &iam.GetPolicyDocumentArgs{ 357 // Statements: pulumi.Array{ 358 // iam.GetPolicyDocumentStatement{ 359 // Effect: pulumi.StringRef("Allow"), 360 // Actions: []string{ 361 // "iam:PassRole", 362 // }, 363 // Resources: []string{ 364 // "*", 365 // }, 366 // }, 367 // iam.GetPolicyDocumentStatement{ 368 // Effect: pulumi.StringRef("Allow"), 369 // Actions: []string{ 370 // "ecs:RunTask", 371 // }, 372 // Resources: interface{}{ 373 // invokeReplace.Result, 374 // }, 375 // }, 376 // }, 377 // }, nil); 378 // if err != nil { 379 // return err 380 // } 381 // _, err = iam.NewRolePolicy(ctx, "ecs_events_run_task_with_any_role", &iam.RolePolicyArgs{ 382 // Name: pulumi.String("ecs_events_run_task_with_any_role"), 383 // Role: ecsEvents.ID(), 384 // Policy: pulumi.String(ecsEventsRunTaskWithAnyRole.Json), 385 // }) 386 // if err != nil { 387 // return err 388 // } 389 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 390 // "containerOverrides": []map[string]interface{}{ 391 // map[string]interface{}{ 392 // "name": "name-of-container-to-override", 393 // "command": []string{ 394 // "bin/console", 395 // "scheduled-task", 396 // }, 397 // }, 398 // }, 399 // }) 400 // if err != nil { 401 // return err 402 // } 403 // json0 := string(tmpJSON0) 404 // _, err = cloudwatch.NewEventTarget(ctx, "ecs_scheduled_task", &cloudwatch.EventTargetArgs{ 405 // TargetId: pulumi.String("run-scheduled-task-every-hour"), 406 // Arn: pulumi.Any(clusterName.Arn), 407 // Rule: pulumi.Any(everyHour.Name), 408 // RoleArn: ecsEvents.Arn, 409 // EcsTarget: &cloudwatch.EventTargetEcsTargetArgs{ 410 // TaskCount: pulumi.Int(1), 411 // TaskDefinitionArn: pulumi.Any(taskName.Arn), 412 // }, 413 // Input: pulumi.String(json0), 414 // }) 415 // if err != nil { 416 // return err 417 // } 418 // return nil 419 // }) 420 // } 421 // ``` 422 // <!--End PulumiCodeChooser --> 423 // 424 // ### API Gateway target 425 // 426 // <!--Start PulumiCodeChooser --> 427 // ```go 428 // package main 429 // 430 // import ( 431 // 432 // "fmt" 433 // 434 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway" 435 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 436 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 437 // 438 // ) 439 // 440 // func main() { 441 // pulumi.Run(func(ctx *pulumi.Context) error { 442 // exampleEventRule, err := cloudwatch.NewEventRule(ctx, "example", nil) 443 // if err != nil { 444 // return err 445 // } 446 // exampleDeployment, err := apigateway.NewDeployment(ctx, "example", &apigateway.DeploymentArgs{ 447 // RestApi: pulumi.Any(exampleAwsApiGatewayRestApi.Id), 448 // }) 449 // if err != nil { 450 // return err 451 // } 452 // exampleStage, err := apigateway.NewStage(ctx, "example", &apigateway.StageArgs{ 453 // RestApi: pulumi.Any(exampleAwsApiGatewayRestApi.Id), 454 // Deployment: exampleDeployment.ID(), 455 // }) 456 // if err != nil { 457 // return err 458 // } 459 // _, err = cloudwatch.NewEventTarget(ctx, "example", &cloudwatch.EventTargetArgs{ 460 // Arn: exampleStage.ExecutionArn.ApplyT(func(executionArn string) (string, error) { 461 // return fmt.Sprintf("%v/GET", executionArn), nil 462 // }).(pulumi.StringOutput), 463 // Rule: exampleEventRule.ID(), 464 // HttpTarget: &cloudwatch.EventTargetHttpTargetArgs{ 465 // QueryStringParameters: pulumi.StringMap{ 466 // "Body": pulumi.String("$.detail.body"), 467 // }, 468 // HeaderParameters: pulumi.StringMap{ 469 // "Env": pulumi.String("Test"), 470 // }, 471 // }, 472 // }) 473 // if err != nil { 474 // return err 475 // } 476 // return nil 477 // }) 478 // } 479 // 480 // ``` 481 // <!--End PulumiCodeChooser --> 482 // 483 // ### Cross-Account Event Bus target 484 // 485 // <!--Start PulumiCodeChooser --> 486 // ```go 487 // package main 488 // 489 // import ( 490 // 491 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 492 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 493 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 494 // 495 // ) 496 // 497 // func main() { 498 // pulumi.Run(func(ctx *pulumi.Context) error { 499 // assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 500 // Statements: []iam.GetPolicyDocumentStatement{ 501 // { 502 // Effect: pulumi.StringRef("Allow"), 503 // Principals: []iam.GetPolicyDocumentStatementPrincipal{ 504 // { 505 // Type: "Service", 506 // Identifiers: []string{ 507 // "events.amazonaws.com", 508 // }, 509 // }, 510 // }, 511 // Actions: []string{ 512 // "sts:AssumeRole", 513 // }, 514 // }, 515 // }, 516 // }, nil) 517 // if err != nil { 518 // return err 519 // } 520 // eventBusInvokeRemoteEventBusRole, err := iam.NewRole(ctx, "event_bus_invoke_remote_event_bus", &iam.RoleArgs{ 521 // Name: pulumi.String("event-bus-invoke-remote-event-bus"), 522 // AssumeRolePolicy: pulumi.String(assumeRole.Json), 523 // }) 524 // if err != nil { 525 // return err 526 // } 527 // eventBusInvokeRemoteEventBus, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 528 // Statements: []iam.GetPolicyDocumentStatement{ 529 // { 530 // Effect: pulumi.StringRef("Allow"), 531 // Actions: []string{ 532 // "events:PutEvents", 533 // }, 534 // Resources: []string{ 535 // "arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus", 536 // }, 537 // }, 538 // }, 539 // }, nil) 540 // if err != nil { 541 // return err 542 // } 543 // eventBusInvokeRemoteEventBusPolicy, err := iam.NewPolicy(ctx, "event_bus_invoke_remote_event_bus", &iam.PolicyArgs{ 544 // Name: pulumi.String("event_bus_invoke_remote_event_bus"), 545 // Policy: pulumi.String(eventBusInvokeRemoteEventBus.Json), 546 // }) 547 // if err != nil { 548 // return err 549 // } 550 // _, err = iam.NewRolePolicyAttachment(ctx, "event_bus_invoke_remote_event_bus", &iam.RolePolicyAttachmentArgs{ 551 // Role: eventBusInvokeRemoteEventBusRole.Name, 552 // PolicyArn: eventBusInvokeRemoteEventBusPolicy.Arn, 553 // }) 554 // if err != nil { 555 // return err 556 // } 557 // stopInstances, err := cloudwatch.NewEventRule(ctx, "stop_instances", &cloudwatch.EventRuleArgs{ 558 // Name: pulumi.String("StopInstance"), 559 // Description: pulumi.String("Stop instances nightly"), 560 // ScheduleExpression: pulumi.String("cron(0 0 * * ? *)"), 561 // }) 562 // if err != nil { 563 // return err 564 // } 565 // _, err = cloudwatch.NewEventTarget(ctx, "stop_instances", &cloudwatch.EventTargetArgs{ 566 // TargetId: pulumi.String("StopInstance"), 567 // Arn: pulumi.String("arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus"), 568 // Rule: stopInstances.Name, 569 // RoleArn: eventBusInvokeRemoteEventBusRole.Arn, 570 // }) 571 // if err != nil { 572 // return err 573 // } 574 // return nil 575 // }) 576 // } 577 // 578 // ``` 579 // <!--End PulumiCodeChooser --> 580 // 581 // ### Input Transformer Usage - JSON Object 582 // 583 // <!--Start PulumiCodeChooser --> 584 // ```go 585 // package main 586 // 587 // import ( 588 // 589 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 590 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 591 // 592 // ) 593 // 594 // func main() { 595 // pulumi.Run(func(ctx *pulumi.Context) error { 596 // exampleEventRule, err := cloudwatch.NewEventRule(ctx, "example", nil) 597 // if err != nil { 598 // return err 599 // } 600 // _, err = cloudwatch.NewEventTarget(ctx, "example", &cloudwatch.EventTargetArgs{ 601 // Arn: pulumi.Any(exampleAwsLambdaFunction.Arn), 602 // Rule: exampleEventRule.ID(), 603 // InputTransformer: &cloudwatch.EventTargetInputTransformerArgs{ 604 // InputPaths: pulumi.StringMap{ 605 // "instance": pulumi.String("$.detail.instance"), 606 // "status": pulumi.String("$.detail.status"), 607 // }, 608 // InputTemplate: pulumi.String("{\n \"instance_id\": <instance>,\n \"instance_status\": <status>\n}\n"), 609 // }, 610 // }) 611 // if err != nil { 612 // return err 613 // } 614 // return nil 615 // }) 616 // } 617 // 618 // ``` 619 // <!--End PulumiCodeChooser --> 620 // 621 // ### Input Transformer Usage - Simple String 622 // 623 // <!--Start PulumiCodeChooser --> 624 // ```go 625 // package main 626 // 627 // import ( 628 // 629 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 630 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 631 // 632 // ) 633 // 634 // func main() { 635 // pulumi.Run(func(ctx *pulumi.Context) error { 636 // exampleEventRule, err := cloudwatch.NewEventRule(ctx, "example", nil) 637 // if err != nil { 638 // return err 639 // } 640 // _, err = cloudwatch.NewEventTarget(ctx, "example", &cloudwatch.EventTargetArgs{ 641 // Arn: pulumi.Any(exampleAwsLambdaFunction.Arn), 642 // Rule: exampleEventRule.ID(), 643 // InputTransformer: &cloudwatch.EventTargetInputTransformerArgs{ 644 // InputPaths: pulumi.StringMap{ 645 // "instance": pulumi.String("$.detail.instance"), 646 // "status": pulumi.String("$.detail.status"), 647 // }, 648 // InputTemplate: pulumi.String("\"<instance> is in state <status>\""), 649 // }, 650 // }) 651 // if err != nil { 652 // return err 653 // } 654 // return nil 655 // }) 656 // } 657 // 658 // ``` 659 // <!--End PulumiCodeChooser --> 660 // 661 // ### Cloudwatch Log Group Usage 662 // 663 // <!--Start PulumiCodeChooser --> 664 // ```go 665 // package main 666 // 667 // import ( 668 // 669 // "encoding/json" 670 // "fmt" 671 // 672 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 673 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 674 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 675 // 676 // ) 677 // 678 // func main() { 679 // pulumi.Run(func(ctx *pulumi.Context) error { 680 // example, err := cloudwatch.NewLogGroup(ctx, "example", &cloudwatch.LogGroupArgs{ 681 // Name: pulumi.String("/aws/events/guardduty/logs"), 682 // RetentionInDays: pulumi.Int(1), 683 // }) 684 // if err != nil { 685 // return err 686 // } 687 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 688 // "source": []string{ 689 // "aws.guardduty", 690 // }, 691 // }) 692 // if err != nil { 693 // return err 694 // } 695 // json0 := string(tmpJSON0) 696 // exampleEventRule, err := cloudwatch.NewEventRule(ctx, "example", &cloudwatch.EventRuleArgs{ 697 // Name: pulumi.String("guard-duty_event_rule"), 698 // Description: pulumi.String("GuardDuty Findings"), 699 // EventPattern: pulumi.String(json0), 700 // Tags: pulumi.StringMap{ 701 // "Environment": pulumi.String("example"), 702 // }, 703 // }) 704 // if err != nil { 705 // return err 706 // } 707 // exampleLogPolicy := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{ 708 // Statements: iam.GetPolicyDocumentStatementArray{ 709 // &iam.GetPolicyDocumentStatementArgs{ 710 // Effect: pulumi.String("Allow"), 711 // Actions: pulumi.StringArray{ 712 // pulumi.String("logs:CreateLogStream"), 713 // }, 714 // Resources: pulumi.StringArray{ 715 // example.Arn.ApplyT(func(arn string) (string, error) { 716 // return fmt.Sprintf("%v:*", arn), nil 717 // }).(pulumi.StringOutput), 718 // }, 719 // Principals: iam.GetPolicyDocumentStatementPrincipalArray{ 720 // &iam.GetPolicyDocumentStatementPrincipalArgs{ 721 // Type: pulumi.String("Service"), 722 // Identifiers: pulumi.StringArray{ 723 // pulumi.String("events.amazonaws.com"), 724 // pulumi.String("delivery.logs.amazonaws.com"), 725 // }, 726 // }, 727 // }, 728 // }, 729 // &iam.GetPolicyDocumentStatementArgs{ 730 // Effect: pulumi.String("Allow"), 731 // Actions: pulumi.StringArray{ 732 // pulumi.String("logs:PutLogEvents"), 733 // }, 734 // Resources: pulumi.StringArray{ 735 // example.Arn.ApplyT(func(arn string) (string, error) { 736 // return fmt.Sprintf("%v:*:*", arn), nil 737 // }).(pulumi.StringOutput), 738 // }, 739 // Principals: iam.GetPolicyDocumentStatementPrincipalArray{ 740 // &iam.GetPolicyDocumentStatementPrincipalArgs{ 741 // Type: pulumi.String("Service"), 742 // Identifiers: pulumi.StringArray{ 743 // pulumi.String("events.amazonaws.com"), 744 // pulumi.String("delivery.logs.amazonaws.com"), 745 // }, 746 // }, 747 // }, 748 // Conditions: iam.GetPolicyDocumentStatementConditionArray{ 749 // &iam.GetPolicyDocumentStatementConditionArgs{ 750 // Test: pulumi.String("ArnEquals"), 751 // Values: pulumi.StringArray{ 752 // exampleEventRule.Arn, 753 // }, 754 // Variable: pulumi.String("aws:SourceArn"), 755 // }, 756 // }, 757 // }, 758 // }, 759 // }, nil) 760 // _, err = cloudwatch.NewLogResourcePolicy(ctx, "example", &cloudwatch.LogResourcePolicyArgs{ 761 // PolicyDocument: exampleLogPolicy.ApplyT(func(exampleLogPolicy iam.GetPolicyDocumentResult) (*string, error) { 762 // return &exampleLogPolicy.Json, nil 763 // }).(pulumi.StringPtrOutput), 764 // PolicyName: pulumi.String("guardduty-log-publishing-policy"), 765 // }) 766 // if err != nil { 767 // return err 768 // } 769 // _, err = cloudwatch.NewEventTarget(ctx, "example", &cloudwatch.EventTargetArgs{ 770 // Rule: exampleEventRule.Name, 771 // Arn: example.Arn, 772 // }) 773 // if err != nil { 774 // return err 775 // } 776 // return nil 777 // }) 778 // } 779 // 780 // ``` 781 // <!--End PulumiCodeChooser --> 782 // 783 // ## Import 784 // 785 // Using `pulumi import`, import EventBridge Targets using `event_bus_name/rule-name/target-id` (if you omit `event_bus_name`, the `default` event bus will be used). For example: 786 // 787 // ```sh 788 // $ pulumi import aws:cloudwatch/eventTarget:EventTarget test-event-target rule-name/target-id 789 // ``` 790 type EventTarget struct { 791 pulumi.CustomResourceState 792 793 // The Amazon Resource Name (ARN) of the target. 794 Arn pulumi.StringOutput `pulumi:"arn"` 795 // Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed. 796 BatchTarget EventTargetBatchTargetPtrOutput `pulumi:"batchTarget"` 797 // Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed. 798 DeadLetterConfig EventTargetDeadLetterConfigPtrOutput `pulumi:"deadLetterConfig"` 799 // Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed. 800 EcsTarget EventTargetEcsTargetPtrOutput `pulumi:"ecsTarget"` 801 // The name or ARN of the event bus to associate with the rule. 802 // If you omit this, the `default` event bus is used. 803 EventBusName pulumi.StringPtrOutput `pulumi:"eventBusName"` 804 // Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed. 805 HttpTarget EventTargetHttpTargetPtrOutput `pulumi:"httpTarget"` 806 // Valid JSON text passed to the target. Conflicts with `inputPath` and `inputTransformer`. 807 Input pulumi.StringPtrOutput `pulumi:"input"` 808 // The value of the [JSONPath](http://goessner.net/articles/JsonPath/) that is used for extracting part of the matched event when passing it to the target. Conflicts with `input` and `inputTransformer`. 809 InputPath pulumi.StringPtrOutput `pulumi:"inputPath"` 810 // Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with `input` and `inputPath`. 811 InputTransformer EventTargetInputTransformerPtrOutput `pulumi:"inputTransformer"` 812 // Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed. 813 KinesisTarget EventTargetKinesisTargetPtrOutput `pulumi:"kinesisTarget"` 814 // Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed. 815 RedshiftTarget EventTargetRedshiftTargetPtrOutput `pulumi:"redshiftTarget"` 816 // Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed. 817 RetryPolicy EventTargetRetryPolicyPtrOutput `pulumi:"retryPolicy"` 818 // The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if `ecsTarget` is used or target in `arn` is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. 819 RoleArn pulumi.StringPtrOutput `pulumi:"roleArn"` 820 // The name of the rule you want to add targets to. 821 // 822 // The following arguments are optional: 823 Rule pulumi.StringOutput `pulumi:"rule"` 824 // Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed. 825 RunCommandTargets EventTargetRunCommandTargetArrayOutput `pulumi:"runCommandTargets"` 826 // Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed. 827 SagemakerPipelineTarget EventTargetSagemakerPipelineTargetPtrOutput `pulumi:"sagemakerPipelineTarget"` 828 // Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed. 829 SqsTarget EventTargetSqsTargetPtrOutput `pulumi:"sqsTarget"` 830 // The unique target assignment ID. If missing, will generate a random, unique id. 831 TargetId pulumi.StringOutput `pulumi:"targetId"` 832 } 833 834 // NewEventTarget registers a new resource with the given unique name, arguments, and options. 835 func NewEventTarget(ctx *pulumi.Context, 836 name string, args *EventTargetArgs, opts ...pulumi.ResourceOption) (*EventTarget, error) { 837 if args == nil { 838 return nil, errors.New("missing one or more required arguments") 839 } 840 841 if args.Arn == nil { 842 return nil, errors.New("invalid value for required argument 'Arn'") 843 } 844 if args.Rule == nil { 845 return nil, errors.New("invalid value for required argument 'Rule'") 846 } 847 opts = internal.PkgResourceDefaultOpts(opts) 848 var resource EventTarget 849 err := ctx.RegisterResource("aws:cloudwatch/eventTarget:EventTarget", name, args, &resource, opts...) 850 if err != nil { 851 return nil, err 852 } 853 return &resource, nil 854 } 855 856 // GetEventTarget gets an existing EventTarget resource's state with the given name, ID, and optional 857 // state properties that are used to uniquely qualify the lookup (nil if not required). 858 func GetEventTarget(ctx *pulumi.Context, 859 name string, id pulumi.IDInput, state *EventTargetState, opts ...pulumi.ResourceOption) (*EventTarget, error) { 860 var resource EventTarget 861 err := ctx.ReadResource("aws:cloudwatch/eventTarget:EventTarget", name, id, state, &resource, opts...) 862 if err != nil { 863 return nil, err 864 } 865 return &resource, nil 866 } 867 868 // Input properties used for looking up and filtering EventTarget resources. 869 type eventTargetState struct { 870 // The Amazon Resource Name (ARN) of the target. 871 Arn *string `pulumi:"arn"` 872 // Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed. 873 BatchTarget *EventTargetBatchTarget `pulumi:"batchTarget"` 874 // Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed. 875 DeadLetterConfig *EventTargetDeadLetterConfig `pulumi:"deadLetterConfig"` 876 // Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed. 877 EcsTarget *EventTargetEcsTarget `pulumi:"ecsTarget"` 878 // The name or ARN of the event bus to associate with the rule. 879 // If you omit this, the `default` event bus is used. 880 EventBusName *string `pulumi:"eventBusName"` 881 // Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed. 882 HttpTarget *EventTargetHttpTarget `pulumi:"httpTarget"` 883 // Valid JSON text passed to the target. Conflicts with `inputPath` and `inputTransformer`. 884 Input *string `pulumi:"input"` 885 // The value of the [JSONPath](http://goessner.net/articles/JsonPath/) that is used for extracting part of the matched event when passing it to the target. Conflicts with `input` and `inputTransformer`. 886 InputPath *string `pulumi:"inputPath"` 887 // Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with `input` and `inputPath`. 888 InputTransformer *EventTargetInputTransformer `pulumi:"inputTransformer"` 889 // Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed. 890 KinesisTarget *EventTargetKinesisTarget `pulumi:"kinesisTarget"` 891 // Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed. 892 RedshiftTarget *EventTargetRedshiftTarget `pulumi:"redshiftTarget"` 893 // Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed. 894 RetryPolicy *EventTargetRetryPolicy `pulumi:"retryPolicy"` 895 // The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if `ecsTarget` is used or target in `arn` is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. 896 RoleArn *string `pulumi:"roleArn"` 897 // The name of the rule you want to add targets to. 898 // 899 // The following arguments are optional: 900 Rule *string `pulumi:"rule"` 901 // Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed. 902 RunCommandTargets []EventTargetRunCommandTarget `pulumi:"runCommandTargets"` 903 // Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed. 904 SagemakerPipelineTarget *EventTargetSagemakerPipelineTarget `pulumi:"sagemakerPipelineTarget"` 905 // Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed. 906 SqsTarget *EventTargetSqsTarget `pulumi:"sqsTarget"` 907 // The unique target assignment ID. If missing, will generate a random, unique id. 908 TargetId *string `pulumi:"targetId"` 909 } 910 911 type EventTargetState struct { 912 // The Amazon Resource Name (ARN) of the target. 913 Arn pulumi.StringPtrInput 914 // Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed. 915 BatchTarget EventTargetBatchTargetPtrInput 916 // Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed. 917 DeadLetterConfig EventTargetDeadLetterConfigPtrInput 918 // Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed. 919 EcsTarget EventTargetEcsTargetPtrInput 920 // The name or ARN of the event bus to associate with the rule. 921 // If you omit this, the `default` event bus is used. 922 EventBusName pulumi.StringPtrInput 923 // Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed. 924 HttpTarget EventTargetHttpTargetPtrInput 925 // Valid JSON text passed to the target. Conflicts with `inputPath` and `inputTransformer`. 926 Input pulumi.StringPtrInput 927 // The value of the [JSONPath](http://goessner.net/articles/JsonPath/) that is used for extracting part of the matched event when passing it to the target. Conflicts with `input` and `inputTransformer`. 928 InputPath pulumi.StringPtrInput 929 // Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with `input` and `inputPath`. 930 InputTransformer EventTargetInputTransformerPtrInput 931 // Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed. 932 KinesisTarget EventTargetKinesisTargetPtrInput 933 // Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed. 934 RedshiftTarget EventTargetRedshiftTargetPtrInput 935 // Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed. 936 RetryPolicy EventTargetRetryPolicyPtrInput 937 // The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if `ecsTarget` is used or target in `arn` is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. 938 RoleArn pulumi.StringPtrInput 939 // The name of the rule you want to add targets to. 940 // 941 // The following arguments are optional: 942 Rule pulumi.StringPtrInput 943 // Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed. 944 RunCommandTargets EventTargetRunCommandTargetArrayInput 945 // Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed. 946 SagemakerPipelineTarget EventTargetSagemakerPipelineTargetPtrInput 947 // Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed. 948 SqsTarget EventTargetSqsTargetPtrInput 949 // The unique target assignment ID. If missing, will generate a random, unique id. 950 TargetId pulumi.StringPtrInput 951 } 952 953 func (EventTargetState) ElementType() reflect.Type { 954 return reflect.TypeOf((*eventTargetState)(nil)).Elem() 955 } 956 957 type eventTargetArgs struct { 958 // The Amazon Resource Name (ARN) of the target. 959 Arn string `pulumi:"arn"` 960 // Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed. 961 BatchTarget *EventTargetBatchTarget `pulumi:"batchTarget"` 962 // Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed. 963 DeadLetterConfig *EventTargetDeadLetterConfig `pulumi:"deadLetterConfig"` 964 // Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed. 965 EcsTarget *EventTargetEcsTarget `pulumi:"ecsTarget"` 966 // The name or ARN of the event bus to associate with the rule. 967 // If you omit this, the `default` event bus is used. 968 EventBusName *string `pulumi:"eventBusName"` 969 // Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed. 970 HttpTarget *EventTargetHttpTarget `pulumi:"httpTarget"` 971 // Valid JSON text passed to the target. Conflicts with `inputPath` and `inputTransformer`. 972 Input *string `pulumi:"input"` 973 // The value of the [JSONPath](http://goessner.net/articles/JsonPath/) that is used for extracting part of the matched event when passing it to the target. Conflicts with `input` and `inputTransformer`. 974 InputPath *string `pulumi:"inputPath"` 975 // Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with `input` and `inputPath`. 976 InputTransformer *EventTargetInputTransformer `pulumi:"inputTransformer"` 977 // Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed. 978 KinesisTarget *EventTargetKinesisTarget `pulumi:"kinesisTarget"` 979 // Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed. 980 RedshiftTarget *EventTargetRedshiftTarget `pulumi:"redshiftTarget"` 981 // Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed. 982 RetryPolicy *EventTargetRetryPolicy `pulumi:"retryPolicy"` 983 // The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if `ecsTarget` is used or target in `arn` is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. 984 RoleArn *string `pulumi:"roleArn"` 985 // The name of the rule you want to add targets to. 986 // 987 // The following arguments are optional: 988 Rule string `pulumi:"rule"` 989 // Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed. 990 RunCommandTargets []EventTargetRunCommandTarget `pulumi:"runCommandTargets"` 991 // Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed. 992 SagemakerPipelineTarget *EventTargetSagemakerPipelineTarget `pulumi:"sagemakerPipelineTarget"` 993 // Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed. 994 SqsTarget *EventTargetSqsTarget `pulumi:"sqsTarget"` 995 // The unique target assignment ID. If missing, will generate a random, unique id. 996 TargetId *string `pulumi:"targetId"` 997 } 998 999 // The set of arguments for constructing a EventTarget resource. 1000 type EventTargetArgs struct { 1001 // The Amazon Resource Name (ARN) of the target. 1002 Arn pulumi.StringInput 1003 // Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed. 1004 BatchTarget EventTargetBatchTargetPtrInput 1005 // Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed. 1006 DeadLetterConfig EventTargetDeadLetterConfigPtrInput 1007 // Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed. 1008 EcsTarget EventTargetEcsTargetPtrInput 1009 // The name or ARN of the event bus to associate with the rule. 1010 // If you omit this, the `default` event bus is used. 1011 EventBusName pulumi.StringPtrInput 1012 // Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed. 1013 HttpTarget EventTargetHttpTargetPtrInput 1014 // Valid JSON text passed to the target. Conflicts with `inputPath` and `inputTransformer`. 1015 Input pulumi.StringPtrInput 1016 // The value of the [JSONPath](http://goessner.net/articles/JsonPath/) that is used for extracting part of the matched event when passing it to the target. Conflicts with `input` and `inputTransformer`. 1017 InputPath pulumi.StringPtrInput 1018 // Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with `input` and `inputPath`. 1019 InputTransformer EventTargetInputTransformerPtrInput 1020 // Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed. 1021 KinesisTarget EventTargetKinesisTargetPtrInput 1022 // Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed. 1023 RedshiftTarget EventTargetRedshiftTargetPtrInput 1024 // Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed. 1025 RetryPolicy EventTargetRetryPolicyPtrInput 1026 // The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if `ecsTarget` is used or target in `arn` is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. 1027 RoleArn pulumi.StringPtrInput 1028 // The name of the rule you want to add targets to. 1029 // 1030 // The following arguments are optional: 1031 Rule pulumi.StringInput 1032 // Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed. 1033 RunCommandTargets EventTargetRunCommandTargetArrayInput 1034 // Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed. 1035 SagemakerPipelineTarget EventTargetSagemakerPipelineTargetPtrInput 1036 // Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed. 1037 SqsTarget EventTargetSqsTargetPtrInput 1038 // The unique target assignment ID. If missing, will generate a random, unique id. 1039 TargetId pulumi.StringPtrInput 1040 } 1041 1042 func (EventTargetArgs) ElementType() reflect.Type { 1043 return reflect.TypeOf((*eventTargetArgs)(nil)).Elem() 1044 } 1045 1046 type EventTargetInput interface { 1047 pulumi.Input 1048 1049 ToEventTargetOutput() EventTargetOutput 1050 ToEventTargetOutputWithContext(ctx context.Context) EventTargetOutput 1051 } 1052 1053 func (*EventTarget) ElementType() reflect.Type { 1054 return reflect.TypeOf((**EventTarget)(nil)).Elem() 1055 } 1056 1057 func (i *EventTarget) ToEventTargetOutput() EventTargetOutput { 1058 return i.ToEventTargetOutputWithContext(context.Background()) 1059 } 1060 1061 func (i *EventTarget) ToEventTargetOutputWithContext(ctx context.Context) EventTargetOutput { 1062 return pulumi.ToOutputWithContext(ctx, i).(EventTargetOutput) 1063 } 1064 1065 // EventTargetArrayInput is an input type that accepts EventTargetArray and EventTargetArrayOutput values. 1066 // You can construct a concrete instance of `EventTargetArrayInput` via: 1067 // 1068 // EventTargetArray{ EventTargetArgs{...} } 1069 type EventTargetArrayInput interface { 1070 pulumi.Input 1071 1072 ToEventTargetArrayOutput() EventTargetArrayOutput 1073 ToEventTargetArrayOutputWithContext(context.Context) EventTargetArrayOutput 1074 } 1075 1076 type EventTargetArray []EventTargetInput 1077 1078 func (EventTargetArray) ElementType() reflect.Type { 1079 return reflect.TypeOf((*[]*EventTarget)(nil)).Elem() 1080 } 1081 1082 func (i EventTargetArray) ToEventTargetArrayOutput() EventTargetArrayOutput { 1083 return i.ToEventTargetArrayOutputWithContext(context.Background()) 1084 } 1085 1086 func (i EventTargetArray) ToEventTargetArrayOutputWithContext(ctx context.Context) EventTargetArrayOutput { 1087 return pulumi.ToOutputWithContext(ctx, i).(EventTargetArrayOutput) 1088 } 1089 1090 // EventTargetMapInput is an input type that accepts EventTargetMap and EventTargetMapOutput values. 1091 // You can construct a concrete instance of `EventTargetMapInput` via: 1092 // 1093 // EventTargetMap{ "key": EventTargetArgs{...} } 1094 type EventTargetMapInput interface { 1095 pulumi.Input 1096 1097 ToEventTargetMapOutput() EventTargetMapOutput 1098 ToEventTargetMapOutputWithContext(context.Context) EventTargetMapOutput 1099 } 1100 1101 type EventTargetMap map[string]EventTargetInput 1102 1103 func (EventTargetMap) ElementType() reflect.Type { 1104 return reflect.TypeOf((*map[string]*EventTarget)(nil)).Elem() 1105 } 1106 1107 func (i EventTargetMap) ToEventTargetMapOutput() EventTargetMapOutput { 1108 return i.ToEventTargetMapOutputWithContext(context.Background()) 1109 } 1110 1111 func (i EventTargetMap) ToEventTargetMapOutputWithContext(ctx context.Context) EventTargetMapOutput { 1112 return pulumi.ToOutputWithContext(ctx, i).(EventTargetMapOutput) 1113 } 1114 1115 type EventTargetOutput struct{ *pulumi.OutputState } 1116 1117 func (EventTargetOutput) ElementType() reflect.Type { 1118 return reflect.TypeOf((**EventTarget)(nil)).Elem() 1119 } 1120 1121 func (o EventTargetOutput) ToEventTargetOutput() EventTargetOutput { 1122 return o 1123 } 1124 1125 func (o EventTargetOutput) ToEventTargetOutputWithContext(ctx context.Context) EventTargetOutput { 1126 return o 1127 } 1128 1129 // The Amazon Resource Name (ARN) of the target. 1130 func (o EventTargetOutput) Arn() pulumi.StringOutput { 1131 return o.ApplyT(func(v *EventTarget) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 1132 } 1133 1134 // Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed. 1135 func (o EventTargetOutput) BatchTarget() EventTargetBatchTargetPtrOutput { 1136 return o.ApplyT(func(v *EventTarget) EventTargetBatchTargetPtrOutput { return v.BatchTarget }).(EventTargetBatchTargetPtrOutput) 1137 } 1138 1139 // Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed. 1140 func (o EventTargetOutput) DeadLetterConfig() EventTargetDeadLetterConfigPtrOutput { 1141 return o.ApplyT(func(v *EventTarget) EventTargetDeadLetterConfigPtrOutput { return v.DeadLetterConfig }).(EventTargetDeadLetterConfigPtrOutput) 1142 } 1143 1144 // Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed. 1145 func (o EventTargetOutput) EcsTarget() EventTargetEcsTargetPtrOutput { 1146 return o.ApplyT(func(v *EventTarget) EventTargetEcsTargetPtrOutput { return v.EcsTarget }).(EventTargetEcsTargetPtrOutput) 1147 } 1148 1149 // The name or ARN of the event bus to associate with the rule. 1150 // If you omit this, the `default` event bus is used. 1151 func (o EventTargetOutput) EventBusName() pulumi.StringPtrOutput { 1152 return o.ApplyT(func(v *EventTarget) pulumi.StringPtrOutput { return v.EventBusName }).(pulumi.StringPtrOutput) 1153 } 1154 1155 // Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed. 1156 func (o EventTargetOutput) HttpTarget() EventTargetHttpTargetPtrOutput { 1157 return o.ApplyT(func(v *EventTarget) EventTargetHttpTargetPtrOutput { return v.HttpTarget }).(EventTargetHttpTargetPtrOutput) 1158 } 1159 1160 // Valid JSON text passed to the target. Conflicts with `inputPath` and `inputTransformer`. 1161 func (o EventTargetOutput) Input() pulumi.StringPtrOutput { 1162 return o.ApplyT(func(v *EventTarget) pulumi.StringPtrOutput { return v.Input }).(pulumi.StringPtrOutput) 1163 } 1164 1165 // The value of the [JSONPath](http://goessner.net/articles/JsonPath/) that is used for extracting part of the matched event when passing it to the target. Conflicts with `input` and `inputTransformer`. 1166 func (o EventTargetOutput) InputPath() pulumi.StringPtrOutput { 1167 return o.ApplyT(func(v *EventTarget) pulumi.StringPtrOutput { return v.InputPath }).(pulumi.StringPtrOutput) 1168 } 1169 1170 // Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with `input` and `inputPath`. 1171 func (o EventTargetOutput) InputTransformer() EventTargetInputTransformerPtrOutput { 1172 return o.ApplyT(func(v *EventTarget) EventTargetInputTransformerPtrOutput { return v.InputTransformer }).(EventTargetInputTransformerPtrOutput) 1173 } 1174 1175 // Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed. 1176 func (o EventTargetOutput) KinesisTarget() EventTargetKinesisTargetPtrOutput { 1177 return o.ApplyT(func(v *EventTarget) EventTargetKinesisTargetPtrOutput { return v.KinesisTarget }).(EventTargetKinesisTargetPtrOutput) 1178 } 1179 1180 // Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed. 1181 func (o EventTargetOutput) RedshiftTarget() EventTargetRedshiftTargetPtrOutput { 1182 return o.ApplyT(func(v *EventTarget) EventTargetRedshiftTargetPtrOutput { return v.RedshiftTarget }).(EventTargetRedshiftTargetPtrOutput) 1183 } 1184 1185 // Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed. 1186 func (o EventTargetOutput) RetryPolicy() EventTargetRetryPolicyPtrOutput { 1187 return o.ApplyT(func(v *EventTarget) EventTargetRetryPolicyPtrOutput { return v.RetryPolicy }).(EventTargetRetryPolicyPtrOutput) 1188 } 1189 1190 // The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if `ecsTarget` is used or target in `arn` is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. 1191 func (o EventTargetOutput) RoleArn() pulumi.StringPtrOutput { 1192 return o.ApplyT(func(v *EventTarget) pulumi.StringPtrOutput { return v.RoleArn }).(pulumi.StringPtrOutput) 1193 } 1194 1195 // The name of the rule you want to add targets to. 1196 // 1197 // The following arguments are optional: 1198 func (o EventTargetOutput) Rule() pulumi.StringOutput { 1199 return o.ApplyT(func(v *EventTarget) pulumi.StringOutput { return v.Rule }).(pulumi.StringOutput) 1200 } 1201 1202 // Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed. 1203 func (o EventTargetOutput) RunCommandTargets() EventTargetRunCommandTargetArrayOutput { 1204 return o.ApplyT(func(v *EventTarget) EventTargetRunCommandTargetArrayOutput { return v.RunCommandTargets }).(EventTargetRunCommandTargetArrayOutput) 1205 } 1206 1207 // Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed. 1208 func (o EventTargetOutput) SagemakerPipelineTarget() EventTargetSagemakerPipelineTargetPtrOutput { 1209 return o.ApplyT(func(v *EventTarget) EventTargetSagemakerPipelineTargetPtrOutput { return v.SagemakerPipelineTarget }).(EventTargetSagemakerPipelineTargetPtrOutput) 1210 } 1211 1212 // Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed. 1213 func (o EventTargetOutput) SqsTarget() EventTargetSqsTargetPtrOutput { 1214 return o.ApplyT(func(v *EventTarget) EventTargetSqsTargetPtrOutput { return v.SqsTarget }).(EventTargetSqsTargetPtrOutput) 1215 } 1216 1217 // The unique target assignment ID. If missing, will generate a random, unique id. 1218 func (o EventTargetOutput) TargetId() pulumi.StringOutput { 1219 return o.ApplyT(func(v *EventTarget) pulumi.StringOutput { return v.TargetId }).(pulumi.StringOutput) 1220 } 1221 1222 type EventTargetArrayOutput struct{ *pulumi.OutputState } 1223 1224 func (EventTargetArrayOutput) ElementType() reflect.Type { 1225 return reflect.TypeOf((*[]*EventTarget)(nil)).Elem() 1226 } 1227 1228 func (o EventTargetArrayOutput) ToEventTargetArrayOutput() EventTargetArrayOutput { 1229 return o 1230 } 1231 1232 func (o EventTargetArrayOutput) ToEventTargetArrayOutputWithContext(ctx context.Context) EventTargetArrayOutput { 1233 return o 1234 } 1235 1236 func (o EventTargetArrayOutput) Index(i pulumi.IntInput) EventTargetOutput { 1237 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventTarget { 1238 return vs[0].([]*EventTarget)[vs[1].(int)] 1239 }).(EventTargetOutput) 1240 } 1241 1242 type EventTargetMapOutput struct{ *pulumi.OutputState } 1243 1244 func (EventTargetMapOutput) ElementType() reflect.Type { 1245 return reflect.TypeOf((*map[string]*EventTarget)(nil)).Elem() 1246 } 1247 1248 func (o EventTargetMapOutput) ToEventTargetMapOutput() EventTargetMapOutput { 1249 return o 1250 } 1251 1252 func (o EventTargetMapOutput) ToEventTargetMapOutputWithContext(ctx context.Context) EventTargetMapOutput { 1253 return o 1254 } 1255 1256 func (o EventTargetMapOutput) MapIndex(k pulumi.StringInput) EventTargetOutput { 1257 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventTarget { 1258 return vs[0].(map[string]*EventTarget)[vs[1].(string)] 1259 }).(EventTargetOutput) 1260 } 1261 1262 func init() { 1263 pulumi.RegisterInputType(reflect.TypeOf((*EventTargetInput)(nil)).Elem(), &EventTarget{}) 1264 pulumi.RegisterInputType(reflect.TypeOf((*EventTargetArrayInput)(nil)).Elem(), EventTargetArray{}) 1265 pulumi.RegisterInputType(reflect.TypeOf((*EventTargetMapInput)(nil)).Elem(), EventTargetMap{}) 1266 pulumi.RegisterOutputType(EventTargetOutput{}) 1267 pulumi.RegisterOutputType(EventTargetArrayOutput{}) 1268 pulumi.RegisterOutputType(EventTargetMapOutput{}) 1269 }