Add [lein-aws-api-gateway "1.10.68"]
to the :plugins
vector of your
project.clj
or profile.clj
.
Configure your project.clj
by adding an :api-gateway
configuration map:
:api-gateway {:api-id "your-api-id"
:swagger "target/swagger.json"}
The configuration parameters map to the command line arguments in the aws-apigateway-importer, in particular:
swagger
– (required) the path to the Swagger file that should be used in the import. Depending on your workflow, this is most likely somewhere in target
, if auto-generated or somewhere in resources
if hand-craftedapi-id
– (required, for update
and deploy
tasks) the ID of the API that should be updated. The update-api
task will fail if no api-id
has been specified, but it is not required for the create
task. You can retrieve the API ID by running aws apigateway get-rest-apis
if you have the AWS command line tools installed.The plugin does not allow or encourage specifying authentication credentials in the project.clj
, so you have to chose one of the following options:
AWS_ACCESS_KEY
and AWS_SECRET_KEY
environment variables. This works well for continuous integration environmentsaws.accessKeyId
and aws.secretKey
Java environment variables.~/.aws/credentials
, which can be set using the was configure
commandFor further reference, please check the AWS Java SDK Credentials Reference documentation.
In order to create a new API, use following command:
lein aws-api-gateway create
Creating a new API will return the API ID. This ID is important for future use. The :api-id
in your configuration will be ignored when running this task.
To update an API, run
lein aws-api-gateway update
To delete an already existing API, run
lein aws-api-gateway delete <API-ID>
To deploy an existing API, run
lein aws-api-gateway deploy <STAGE>
If you want to deploy the API, your Swagger file should use the x-amazon-apigateway-auth
and x-amazon-apigateway-integration
extensions. The aws-apigateway-importer documentation provides an example.
Clone and install the plugin:
git clone https://github.com/trieloff/lein-aws-apigateway.git
cd lein-aws-apigateway
lein install
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close