How to use aws-api-gateway-client - 6 common examples

To help you get started, we’ve selected a few aws-api-gateway-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Serverless-Vienna / Comments-Showcase / src / AwsCommentApi.js View on Github external
return new Promise((resolve, reject) => {
      apigClientFactory.newClient({ invokeUrl: APPCONFIG.AWS.FUNCTIONS.INVOKE_URL })
        // .commentsGet({}, {})
        .invokeApi({}, "/comments", "GET", {}, {})
        .then((response) => {
          resolve(this.fixTimestamp(JSON.parse(response.data.body).Items));
        })
        .catch((error) => {
          reject(error);
        });
    });
  }
github AnomalyInnovations / aws-api-gateway-cli-test / index.js View on Github external
function makeRequest(userTokens) {
  console.log("Making API request");

  var apigClient = apigClientFactory.newClient({
    apiKey: argv.apiKey,
    accessKey: AWS.config.credentials.accessKeyId,
    secretKey: AWS.config.credentials.secretAccessKey,
    sessionToken: AWS.config.credentials.sessionToken,
    region: argv.apiGatewayRegion,
    invokeUrl: argv.invokeUrl
  });

  var params = JSON.parse(argv.params);
  var additionalParams = JSON.parse(argv.additionalParams);
  var body = JSON.parse(argv.body);

  if (argv.accessTokenHeader) {
    const tokenHeader = {};
    tokenHeader[argv.accessTokenHeader] = userTokens.accessToken;
    additionalParams.headers = Object.assign({}, additionalParams.headers, tokenHeader);
github AnomalyInnovations / aws-api-gateway-cli-test / index.js View on Github external
#!/usr/bin/env node

var packageJson = require("./package.json");

var AWS = require("aws-sdk");
var AWSCognito = require("amazon-cognito-identity-js");
var apigClientFactory = require("aws-api-gateway-client").default;
var WindowMock = require("window-mock").default;

global.window = { localStorage: new WindowMock().localStorage };
global.navigator = function() {
  return null;
};

var argv = require("yargs")
  .option("username", {
    describe: "Username of the user",
    demandOption: true,
    string: true
  })
  .option("password", {
    describe: "Password of the user",
    demandOption: true
github Coalfire-Research / npk / terraform-selfhost / compute-node / hashcat_wrapper.js View on Github external
aws.config.getCredentials(function(err) {
			if (err) {
				credFailureCount++;
				console.log("Error retrieving credentials:" + err);

				if (credFailureCount < 5) {
					console.log("Retrying");
					return getCredentials();
				} else {
					return Project.reject('Failure retrieving credentials.')
				}
			}

			credentialsReady = 1;

			apiClient = apiClientFactory.newClient({
				invokeUrl: "https://" + apigateway + "/v1/statusreport/",
				accessKey: aws.config.credentials.accessKeyId,
				secretKey: aws.config.credentials.secretAccessKey,
				sessionToken: aws.config.credentials.sessionToken,
				region: "us-west-2"
			});

			setTimeout(getCredentials, 600);

			return success(true);
		});
	});
github Coalfire-Research / npk / terraform-selfhost / compute-node / hashcat_wrapper.js View on Github external
/*jshint esversion: 6 */
/*jshint node: true */

"use strict";

var fs = require('fs');
var os = require('os');
var aws = require('aws-sdk');
var pty = require('node-pty');
var apiClientFactory = require('aws-api-gateway-client').default;

var buffer = "";
var retrigger = "";
var ptyProcess = {};
var credentialsReady = 0;

var region = fs.readFileSync('/root/region', 'ascii').trim();
var manifest = JSON.parse(fs.readFileSync('/root/manifest.json'));
var keyspace = parseInt(fs.readFileSync('/root/keyspace'));
var apigateway = fs.readFileSync('/root/apigateway', 'ascii').trim();
var manifestpath = fs.readFileSync('/root/manifestpath', 'ascii').trim();
var instance_id = fs.readFileSync('/root/instance_id', 'ascii').trim();
var instance_count = parseInt(fs.readFileSync('/root/instance_count'));
var instance_number = parseInt(fs.readFileSync('/root/instance_number'));

var apiClient = null;
github Serverless-Vienna / Comments-Showcase / src / AwsCommentApi.js View on Github external
post(comment) {
    const apigClient = apigClientFactory.newClient({
      accessKey: AWS.config.credentials.accessKeyId,
      secretKey: AWS.config.credentials.secretAccessKey,
      sessionToken: AWS.config.credentials.sessionToken,
      region: APPCONFIG.AWS.REGION,
      invokeUrl: APPCONFIG.AWS.FUNCTIONS.INVOKE_URL
    });
    return apigClient.invokeApi({}, "/comments", "POST", {}, comment);
  }

aws-api-gateway-client

A module for AWS API Gateway client

MIT
Latest version published 4 years ago

Package Health Score

47 / 100
Full package analysis