Skip to content

Commit

Permalink
0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ramgrandhi committed Nov 17, 2020
1 parent 4df8308 commit e6248ae
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog


## [0.2.1](https://www.npmjs.com/package/serverless-wso2-apim/v/0.2.1) (2020-08-27)
## [0.2.0](https://www.npmjs.com/package/serverless-wso2-apim/v/0.2.0) (2020-08-27)

### New Features
- All parameters under `custom : wso2apim` now supports [Serverless variables](https://www.serverless.com/framework/docs/providers/aws/guide/variables/) syntax.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ or
```yml
custom:
wso2apim:
enabled: false # Default is 'true'. When set to 'false' explicitly, deployment will be skipped
host: 'wso2-apimanager.com' # WSO2 API Manager Host
port: 443 # WSO2 API Manager Port
versionSlug: 'v0.14' # WSO2 API Manager's Management API version
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-wso2-apim",
"version": "0.2.0",
"version": "0.3.0",
"description": "Serverless Framework plugin for WSO2 API Manager",
"main": "src/index.js",
"scripts": {
Expand Down
24 changes: 20 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ class Serverless_WSO2_APIM {
this.serverless = serverless;
this.options = options;

this.wso2APIM = serverless.service.custom.wso2apim;
this.apiDefs = this.wso2APIM.apidefs;
this.cmd = this.serverless.pluginManager.cliCommands.join('|');


this.hooks = {
'after:deploy:deploy': this.deploy.bind(this),
'after:info:info': this.info.bind(this),
Expand All @@ -39,22 +36,41 @@ class Serverless_WSO2_APIM {
// * Use no `console.log()` but use `this.serverless.cli.log()`
// * Use `throw new Error(err)` when you want the execution to halt!
// -----------------


async initPluginState() {
this.wso2APIM = this.serverless.service.custom.wso2apim;
this.apiDefs = this.wso2APIM.apidefs;
}
async deploy() {
await this.initPluginState();
await this.validateConfig();
if (this.wso2APIM.enabled !== undefined && this.wso2APIM.enabled === false) {
this.serverless.cli.log(pluginNameSuffix + "Configuration is disabled globally, Skipping deployment.. OK");
return;
}
await this.registerClient();
await this.generateToken();
await this.uploadCerts();
await this.createOrUpdateAPIDefs();
}
async info() {
await this.initPluginState();
await this.validateConfig();
if (this.wso2APIM.enabled !== undefined && this.wso2APIM.enabled === false) {
this.serverless.cli.log(pluginNameSuffix + "Configuration is disabled globally, Skipping retrieval.. OK");
return;
}
await this.registerClient();
await this.generateToken();
await this.listAPIDefs();
}
async remove() {
await this.initPluginState();
await this.validateConfig();
if (this.wso2APIM.enabled !== undefined && this.wso2APIM.enabled === false) {
this.serverless.cli.log(pluginNameSuffix + "Configuration is disabled globally, Skipping deletion.. OK");
return;
}
await this.registerClient();
await this.generateToken();
await this.removeAPIDefsAndCerts();
Expand Down

0 comments on commit e6248ae

Please sign in to comment.