Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Api-gateway generation seems to be tightly coupled to stage name #90

Closed
matjamesymj opened this issue Jul 10, 2020 · 1 comment
Closed

Comments

@matjamesymj
Copy link

The problem with the generated client is it seems tightly coupled to the rest-api-id and stage-name specified so the generated code can’t be used if you want to communicate with a different stage-name or rest-api-id. It may be that i am not using it correctly but it is not clear how I can use the single generated gem for multiple environments. We would like to
generate a single gem and use this gem for each environment, e.g. stage names: devalopera, dev, int, prod.

I have had to do the following:

From the generated code I needed to override some behaviour in https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/APIGateway/Client.html

The method we needed to override is the set_api which sets the https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Seahorse/Model/Api.html.

The instance of this API object is defined in a module within the generated code called ClientApi. I have created a new class which includes this module so we can provide our own initialization of the Seahorse::Model::Api. This is a copy of what is defined in the generated module ClientApi but I swap out some key options like the stage-name and rest-api-id using environment variables.

Hopefully there is a simpler solution to using the generated gem for multiple stage names?

https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-generate-sdk-cli.html

@mcdwil
Copy link
Contributor

mcdwil commented Sep 23, 2020

Hi, thanks for getting in touch. I'm sorry to hear that you've had problems with generated code. This repo is meant for feedback and collaboration on the documentation. If you're still looking for other solutions, I'd recommend posting on the API Gateway forum.

Thanks,
Will

@mcdwil mcdwil closed this as completed Sep 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants