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

Access GraphQLApi from AppSync through ARN #6959

Closed
1 of 2 tasks
renanmav opened this issue Mar 24, 2020 · 1 comment · Fixed by #9254
Closed
1 of 2 tasks

Access GraphQLApi from AppSync through ARN #6959

renanmav opened this issue Mar 24, 2020 · 1 comment · Fixed by #9254
Assignees
Labels
@aws-cdk/aws-appsync Related to AWS AppSync effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2

Comments

@renanmav
Copy link

We should allow using the AppSync.GraphQLApi without needing to instantiate it (new). Something similar that already exists is the fromFunctionArn of @aws-cdk/aws-lambda.

Use Case

When I would like to share my GraphQLApi across multiple stacks, this would be very useful.

Proposed Solution

image

Other

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

This is a 🚀 Feature Request

@renanmav renanmav added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 24, 2020
@SomayaB SomayaB added the @aws-cdk/aws-appsync Related to AWS AppSync label Mar 25, 2020
@MrArnoldPalmer MrArnoldPalmer added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Mar 26, 2020
@BryanPan342 BryanPan342 self-assigned this Jul 17, 2020
@BryanPan342
Copy link
Contributor

@renanmav Thanks for bringing up this feature 😃

I'm assuming the desired feature is simply a class that has access to the apiId and arn and adjusting implementation of DataSource and Resolver to just take the api.id:

However, this will cause a problem with the implementation in resolver.ts here

this.resolver.addDependsOn(props.api.schema);

I'm a little apprehensive on passing around schema across stacks... so if we were to make it so that only apiId and arn are passed around.. then whatever stack that contains the GraphQLApi will need to be provisioned first.

Willing to have a discussion about this though so whoever has comments to this please chime in!

@BryanPan342 BryanPan342 added the in-progress This issue is being actively worked on. label Jul 23, 2020
@mergify mergify bot closed this as completed in #9254 Aug 15, 2020
mergify bot pushed a commit that referenced this issue Aug 15, 2020
**[ISSUE]**
Appsync missing `fromXxx` functionality, making multiple stack appsync interaction impossible. 

**[Approach]**
Created a base class for  `GraphQLApi` and a `IGraphQLApi` interface for imports. Added `fromXxxAttributes` functions to code base that can add dataSources.

**[Notes]**
Only accessible props from `IGraphQLApi` are `apiId` and `arn`. Only accessible functions from `IGraphQLApi` are the `addXxxDataSource` functions.

Added `props-physical-name:@aws-cdk/aws-appsync.GraphQLApiProps` as linter exception because the breaking change isn't worth the return of making the physical name (name exists already).

Added `from-method:@aws-cdk/aws-appsync.GraphQLApi` as linter exception because a `fromGraphQLApiAttributes` function will turn into `from_graph_q_l_api_attributes` in python.

Fixes #6959 

BREAKING CHANGE: **appsync.addXxxDataSource** `name` and `description` props are now optional and in an `DataSourceOptions` interface. 
- **appsync**:  the props `name` and `description` in `addXxxDataSource` have been moved into new props `options`  of type `DataSourceOptions`
- **appsync**: `DataSourceOptions.name` defaults to id
- **appsync**: `DataSourceOptions.description` defaults to undefined

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-appsync Related to AWS AppSync effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants