Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_events_targets: Support AppSync GraphQL targets #29884

Open
2 tasks
thelegendtubaguy opened this issue Apr 18, 2024 · 1 comment · Fixed by rwlxxvii/containers#140 · 4 remaining pull requests
Open
2 tasks

aws_events_targets: Support AppSync GraphQL targets #29884

thelegendtubaguy opened this issue Apr 18, 2024 · 1 comment · Fixed by rwlxxvii/containers#140 · 4 remaining pull requests
Labels
@aws-cdk/aws-events-targets effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@thelegendtubaguy
Copy link

Describe the feature

EventBridge now supports setting rule targets to an AppSync API:
https://aws.amazon.com/blogs/compute/build-real-time-applications-with-amazon-eventbridge-and-aws-appsync/

I would like to use CDK to configure my event bus rule to target an appsync api mutation.

Use Case

When using an event based architecture, it would be extremely beneficial to route events matching a pattern to any number of subscribed clients to a graphql api.

Proposed Solution

CloudFormation already has this capability, so potentially follow what you can do in CF.
https://serverlessland.com/patterns/eventbridge-to-appsync-sam

Other Information

Will also need the ability to set the input transformer and pass appsync parameters.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.137.0

Environment details (OS name and version, etc.)

Typescript 5.4.5

@thelegendtubaguy thelegendtubaguy added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Apr 18, 2024
@khushail khushail added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Apr 18, 2024
@khushail khushail self-assigned this Apr 18, 2024
@khushail khushail removed the needs-triage This issue or PR still needs to be triaged. label Apr 18, 2024
@pahud
Copy link
Contributor

pahud commented Apr 19, 2024

Yeah, looks like we need to implement AppSync GraphQL target class for the aws-events-targets library. It should be very straightforward, we just need to create a new class which implements events.IRuleTarget and return relevant config in the bind() method. Check the EventBus target for your reference.

Are you interested to submit a PR to help us move this forward?

Please help us prioritize with 👍 .

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Apr 19, 2024
mergify bot pushed a commit that referenced this issue May 13, 2024
…target (#29584)

### Reason for this change

Introduces support to configure AppSync GraphQLAPI as an EventBridge target.

- announcement: https://aws.amazon.com/about-aws/whats-new/2024/01/amazon-eventbridge-appsync-target-buses/
- documentation: https://docs.aws.amazon.com/eventbridge/latest/userguide/target-appsync.html

### Description of changes

- Expose `GraphQLEndpointArn` attribute in L2 GraphQLAPI construct
- Implement `events.IRuleTarget` for `AppSync`

```ts
rule.addTarget(new targets.AppSync(api, {
  graphQLOperation: 'mutation Publish($message: String!){ publish(message: $message) { message } }',
  variables: events.RuleTargetInput.fromObject({
    message: 'hello world',
  }),
  deadLetterQueue: queue,
}));
```

### Description of how you validated changes

unit test and integration tests

### Issue

Solves #29884

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@NOUIY NOUIY linked a pull request Jun 7, 2024 that will close this issue
@NOUIY NOUIY linked a pull request Jun 14, 2024 that will close this issue
@NOUIY NOUIY linked a pull request Jun 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment