Skip to content
New issue

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

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

Already on GitHub? # to your account

software.amazon.awscdk.services.apigateway.SpecRestApi: adjust method to add integration #29604

Open
2 tasks
argenstijn opened this issue Mar 25, 2024 · 3 comments
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway feature-request A feature should be added or improved. p2

Comments

@argenstijn
Copy link

Describe the feature

I would like to create an API by an openapi schema. But i want to change one method of the API to add an integration to it. I don't want to change the openapi schema (using AWS tags to configure the integration!).

Currently this is impossible to do? right?

Use Case

I want to add the integration on POST method in CDK itself.

Proposed Solution

No response

Other Information

No response

Acknowledgements

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

CDK version used

latest

Environment details (OS name and version, etc.)

linux

@argenstijn argenstijn added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 25, 2024
@github-actions github-actions bot added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label Mar 25, 2024
@argenstijn
Copy link
Author

Or it would be nice to change the openapi schema in CDK. But then it would be very nice that AWSIntegration could be represented as OPEN API schema integration:

"x-amazon-apigateway-integration" : {
      "credentials" : "arn:aws:iam::xxxxxxxxxxxxxxx:role/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "httpMethod" : "POST",
      "uri" : "arn:aws:apigateway:yyyyyy:events:action/PutEvents",
      "responses" : {
        "default" : {
          "statusCode" : "200",
          "responseParameters" : {
            "method.response.header.Access-Control-Allow-Methods" : "'OPTIONS,POST'",
            "method.response.header.Access-Control-Allow-Headers" : "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",
            "method.response.header.Access-Control-Allow-Origin" : "'*'"
          },
          "responseTemplates" : {
            "application/json" : "#set($val = $input.path('$.Entries[0].EventId'))\n{\n  \"eventId\": \"$val\"\n}"
          }
        }
      },
      "requestTemplates" : {
        "application/json" : "#set($context.requestOverride.header.X-Amz-Target = \"AWSEvents.PutEvents\")\n#set($context.requestOverride.header.Content-Type = \"application/x-amz-json-1.1\")            \n#set($inputRoot = $input.json('$')) \n{ \n  \"Entries\": [\n    {\n      \"Detail\": \"$util.escapeJavaScript($inputRoot).replaceAll(\"\\\\'\",\"'\")\",\n      \"DetailType\": \"ddddddddddddddddddddd\",\n      \"EventBusName\": \"xxxxxxxxxxxxxxxxxxxxxxxxx\",\n      \"Source\":\"AABRelatieMutationPublication\"\n    }\n  ]\n}"
      },
      "passthroughBehavior" : "never",
      "type" : "aws"
    }
  }

@tim-finnigan tim-finnigan self-assigned this Mar 26, 2024
@tim-finnigan tim-finnigan added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Mar 26, 2024
@tim-finnigan
Copy link

Thanks for the feature request. Linking related documentation for reference: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.SpecRestApi.html

As mentioned there:

All Resources and Methods need to be defined as part of the OpenAPI specification file, and cannot be added via the CDK.

So I'm not sure this feature request could be considered, unless I'm missing or misunderstanding something.

@tim-finnigan tim-finnigan added p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Mar 26, 2024
@tim-finnigan tim-finnigan removed their assignment Mar 26, 2024
@argenstijn
Copy link
Author

@tim-finnigan Yes, you cannot add. But my question is not about adding but about changed.

So for example: through openapi schema you define a method X for URI Y. With CDK you only change/add an integration to the method X for URI Y.

If that is not possible it would be nice if you could define the integration within CDK and you could have a openapi schema json/yaml representation of that. That way you can inject this part into the openapi schema before creating the SpecRestApi.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Mar 28, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants