vgribok / openapi2apigee

OpenAPI to Apigee API Proxy using Node.js Utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

openapi-apigee-node-utility

npm version Build Status JavaScript Style Guide

openapi2apigee module converts a standard Open API spec 2.0 (previously known as Swagger) into an Apigee API Proxy bundle and deploys into an Apigee Edge Organization.

Pre-requisite

  • node.js

Installation

You can install openapi2apigee either through npm or by cloning the code from this GitHub repo. This README covers the installation steps with npm.

Installation from npm

From a Terminal Window:

$ npm install -g openapi2apigee

Command reference and examples

generateApi

Generates Apigee API Proxy bundle from OpenAPI specification file and deploys to Apigee Edge Organization.

Example

$ openapi2apigee generateApi petStore -s http://petstore.swagger.io/v2/swagger.json -D -d /Users/me/Desktop/

Articles

Getting Started with OpenAPI

openapi2apigee Apigee-127 Extensions support

Secure APIs using OAuth 2.0 & Verify API Key Policies in Apigee using OpenAPI 2.0

Running in a Docker Container to Generate & Deploy a Proxy

Overview

Project's Dockerfile enables running openapi2apigee as a Docker container, eliminating the need to have Node.js installed on the system where it runs. Having Docker installed is required instead.

Please note that since Docker images are immutable, so generating Proxy Bundle and storing it within the Container for later use makes no sense. Therefore, openapi2apigee Docker container always runs the tool with the -D option, i.e. deploying the Proxy to Apigee.

Building the Image

To build the image, run

docker build --rm -t openapi2apigee .

Preparing to Run

Following Environment variable could be set to pass command line arguments to the container, when container is run:

  • APIGEE_ORG (required): Apigee organization name
  • APIGEE_USER_ID (required): Apigee user, typically your email address
  • APIGEE_USER_PASSWORD (required): Apigee user password
  • APIGEE_PROXY_NAME (required): The name of the Apigee proxy to be created
  • OPEN_API (required): URL or content of the OpenAPI/Swagger spec used to generate Apigee Proxy from.
  • SERVICE_ENDPOINT_URL (optional): Service URL. If not provided, the one specified in the OpenAPI spec will be used.
  • APIGEE_ENVIRONMENTS (optional): Default is 'test'. Apigee environment(s) to which Proxy will be deployed. Multiple environments could be specified by comma, like test,prod.
  • APIGEE_VIRTUAL_HOSTS (optional): Default is 'default,secure'. Allows specifying Apigee virtual hosts for the target endpoint.
  • APIGEE_BASE_URL (optional): Default is 'https://api.enterprise.apigee.com'. Apigee Edge API base URL.

Running the Container

An example of how to run openapi2apigee as a Docker container:

docker run \
    -e APIGEE_ORG=you-org-name \
    -e APIGEE_USER_ID=user@domain.com \
    -e APIGEE_USER_PASSWORD=verySecureP@ssw0rd \
    -e APIGEE_PROXY_NAME=my-super-proxy \
    -e OPEN_API=https://raw.githubusercontent.com/Azure/api-management-samples/master/apis/httpbin.swagger.json \
    openapi2apigee

About

OpenAPI to Apigee API Proxy using Node.js Utility

License:MIT License


Languages

Language:JavaScript 97.6%Language:Smarty 1.0%Language:Dockerfile 0.9%Language:Shell 0.5%