Giter VIP home page Giter VIP logo

aws-api-gateway-cli-test's Introduction

AWS API Gateway Test CLI NPM Version

A simple CLI to test API Gateway endpoints with IAM authorization. Uses the AWS SDK, AWS Cognito JS SDK, and the generic API Gateway Client. Using the login information given, this tool logs a user into the Cognito User Pool, gets the temporary IAM credentials, and makes the API request. It can be difficult to do these steps by hand without scripting them.

Installation

To install globally run the following:

$ npm install -g aws-api-gateway-cli-test

Usage

$ apig-test \
  --username='johndoe' \
  --password='password' \
  --user-pool-id='us-east-1_Xxxxxxxx' \
  --app-client-id='29xxyyxxyxxxyyxxxyy' \
  --cognito-region='us-east-1' \
  --identity-pool-id='us-east-1:99xxyyx-9999-9999-xx0x-99xxxxxxxx' \
  --invoke-url='https://99xxxxxxx.execute-api.us-east-1.amazonaws.com' \
  --api-gateway-region='us-east-1' \
  --api-key='x3xaacea33DCDA3aqafae28aCdaeEWXX1ada3acx' \
  --path-template='/users' \
  --method='GET' \
  --params='{}' \
  --additional-params='{}' \
  --access-token-header='cognito-access-token' \
  --body='{}'

This command takes the following options:

  • username The username of the Cognito User Pool user.

  • password The password of the Cognito User Pool user.

  • user-pool-id The Cognito User Pool Id.

  • app-client-id The Cognito User Pool App Client Id.

  • cognito-region The Cognito User Pool region. Defaults to us-east-1.

  • identity-pool-id The Cognito Identity Pool Id.

  • invoke-url The API Gateway root endpoint.

  • api-gateway-region The API Gateway region. Defaults to us-east-1.

  • api-key The API key if required by the method. Defaults to none.

  • path-template The path template of the API.

  • method The API method. Defaults to GET.

  • params The API params (path, header, querystring, etc) as a JSON string. Defaults to '{}'.

  • additional-params Any additional params (including the querystring) as a JSON string. Defaults to '{}'.

  • access-token-header Header field on which to pass the access token.

  • body The request body as a JSON string. Defaults to '{}'.

For additional documentation on the format for params and additional-params; refer to the generic API Gateway Client docs.

Local Development

Clone the repo and initialize the project.

$ git clone https://github.com/AnomalyInnovations/aws-api-gateway-cli-test
$ cd aws-api-gateway-cli-test
$ npm install

Test the command using node index.js.

To install the apig-test command, run the following:

$ npm link

Feedback

Send us your feedback via Twitter to Frank Wang (@fanjiewang) or Jay V (@jayair). Or send us an email.

aws-api-gateway-cli-test's People

Contributors

abstractlabs avatar jayair avatar jwoptio avatar tschmidleithner avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.