0.8.0 • Published 8 years ago

aws-apigateway-importer v0.8.0

Weekly downloads
5
License
ISC
Repository
github
Last release
8 years ago

aws-apigateway-importer

Circle CI Test Coverage Code Climate

Not quite port of aws-apigateway-importer for Node. It's still very limited in that it will only wholesale import/delete APIs, it also will only handle Swagger JSON files.

Usage

See the example folder included in the repo for the swagger.json file.

var ApiImporter = require('aws-apigateway-importer');
var importer = new ApiImporter('swagger.json');

importer.create(function (err, result) {
  if (err) {
    return console.error(err);
  }

  importer.deploy(function (err, result) {
    if (err) {
      return console.error(err);
    }
    console.log(result);
  });
});

If at anytime the deployment is unsuccessful due to an error the partially created API will be deleted.

Methods

new constructor(doc, options)

Reads the swagger json file and prepares the contents for API creation.

Arguments

  1. doc (String | Object): The path to the Swagger file of a JavaScript object that has the same format as a swagger file.
  2. options (Object): Configuration options for the AWS ApiGateway service.
    • loglevel (String): debug, info, error. See Loglevel for more information.
    • delay (Number): The time in milliseconds to wait between adding integrations and responses to resources.
    • apigateway (Object): Any option available on the API Gateway constructor.

create(callback)

Creates the full API (methods, integrations, etc), but does not deploy it to a server. The API name is pulled from info.title in the swagger.json file.

Arguments

  1. callback(err, result) (Function): Run after creation.

deploy(callback)

Deploys the API so that it is reachable via the internet. the create method must be called before the deploy method.

The Stage name for the api is pulled from the basePath property of the swagger.json file and the leading / is removed.

Arguments

  1. callback(err, result) (Function): Run after deployment.

updateApi(callback)

Deletes all methods and resources on an existing API and recreates it from the Swagger configuration.

Even if methods have the same path and signature they will have new resource IDs. This is a destructive operation for everything but the parent API.

Arguments

  1. callback(err, result) (Function): Run after creation.
0.8.0

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.7.1-1

8 years ago

0.7.1-0

8 years ago

0.7.0

8 years ago

0.7.0-1

8 years ago

0.8.0-0

8 years ago

0.7.0-0

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.6.0-0

8 years ago

0.5.5

8 years ago

0.5.4

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago