serverless-wso2-apim
Serverless Framework plugin to manage APIs in WSO2 API Manager.
Compatible with
- serverlessˆ1.75
- WSO2 API Manager 2.6.0
Features
- Create or Update your API definitions (including backend certificates) seamlessly with one command -
sls deploy
. - Manage your API definitions via
sls info
andsls remove
. - Automatically uploads backend certificates (including CAs) to enable HTTP/S based connectivity with backends.
- Backend certificates can be supplied using
file://
(relative to whereserverless.yml
file is located) orarn:aws:acm:..
(AWS ACM Certificate ARN). - Automatically publish / re-publish APIs to WSO2 API Store on every deploy.
Install Plugin
-
Discover it on npmjs.com @ here
-
yarn add -D serverless-wso2-apim
or
npm install --save serverless-wso2-apim
-
Then in
serverless.yml
add following entry to the plugins array:plugins:- serverless-wso2-apim
Using the Plugin
-
Make sure you have a Serverless project set up as described here.
-
Add configuration options to your Serverless configuration, as below.
custom:wso2apim:enabled: truehost: 'wso2-apimanager.com' # WSO2 API Manager Hostport: 443 # WSO2 API Manager PortversionSlug: 'v0.14' # WSO2 API Manager's Management API versionuser: 'user@tenant' # Username, with tenant symbolpass: 'pass' # PasswordgatewayEnv: 'Production' # Target Gateway Environment -
Add one or more API definitions to your Serverless configuration, as below.
custom:wso2apim:enabled: trueapidefs:- myAwesomeAPI: # Identifier of your API definitionname: 'MyAwesomeAPI' # (CANNOT BE UPDATED LATER) Name of API that shows up in WSO2 API Consoleversion: 'v1' # (CANNOT BE UPDATED LATER) Version, which also forms a part of the API URL ultimatelyrootContext: '/myawesomeapi' # (CANNOT BE UPDATED LATER) Runtime context of API which will be exposed by WSO2 API Gateway. Must be unique across the Gateway Environment.description: 'My Awesome API'visibility: 'PUBLIC' # Accessible from Public Internet, Visible to everyonebackend:http: # HTTP-based BackendsbaseUrl: 'https://backend:port/123' # Backend RESTful base URLcertChain: 'file://certs/backend.cer' # Optional, certificate chain in PEM (base64) format.# Alternatively, you can also supply AWS ACM Certificate ARN (e.g. arn:aws:acm:...) too.maxTps: 100 # Throttling, Transactions per secondtags:- my-awesome-api- awesomenessswaggerSpec: # Swagger specification in YML, currently supports 2.0swagger: '2.0'...info:...paths:... -
Run
sls deploy
to create-and-publish (or) update-and-republish API definitions (and associated backend certificates, if supplied) in WSO2 API Manager. -
Run
sls info
to view the status of API deployment on WSO2 API Manager. -
Run
sls remove
to delete API definitions (and associated backend certificates, if exists) when there are no active subscriptions exist on those APIs. -
** COMING SOON **
Runsls remove --force
(** USE WITH CAUTION **) to forcefully delete API definitions (and associated backend certificates) despite any active subscriptions that may exist. API definitions will be retired and deprecated before removing it completely from WSO2 API Manager.
Limitations and Backlog items
- Limited to creation of RESTful APIs using Swagger 2.0 on WSO2 API Manager.
- Limited to WSO2 API Manager 2.6.0 which uses v0.14 as management API version.
- For a full list of backlog items, refer to what's coming up?
Need Help?
- Join us on Slack here