How to use the ApiGatewayV2 function from aws-sdk

Find comprehensive JavaScript aws-sdk.ApiGatewayV2 code examples handpicked from public code repositorys.

9
10
11
12
13
14
15
16
17
else {
  let {header, notfound, error, deleted} = print(inventory)

  header('API Gateway WebSocket APIs')

  let gateway = new aws.ApiGatewayV2({region: process.env.AWS_REGION})
  gateway.getApis({}, function getApis(err, result) {
    if (err) error(err.message)
    else {
fork icon99
star icon0
watch icon1

19
20
21
22
23
24
25
26
27
 * @param {string} apiName Name of API
 * @param {string} apiRegion 
 * @returns {Promise<{apiId: string, apiUrl: string}>} Id and URL of the endpoint
 */
async function createApi(apiName, apiRegion) {
  const apigatewayv2 = new AWS.ApiGatewayV2({
    apiVersion: '2018-11-29',
    region: apiRegion,
  })
fork icon7
star icon159
watch icon5

+ 9 other calls in file

0
1
2
3
4
5
6
7
8
9
// warning: there is no guarantee that this version will stay same
// 2.1055.0 is the version of `aws-sdk` at the time of development
const aws = require('aws-sdk');
const util = require('util');

const apigatewayv2 = new aws.ApiGatewayV2();

const deleteDomainName = util.promisify(
  apigatewayv2.deleteDomainName.bind(apigatewayv2)
);
fork icon0
star icon1
watch icon1

0
1
2
3
4
5
6
7
8
let aws = require('aws-sdk')
let waterfall = require('run-waterfall')

module.exports = function route({api, env, name, region, account, RouteKey}, callback) {

  let gateway = new aws.ApiGatewayV2({region})
  let lambda = new aws.Lambda({region})

  let arn = `arn:aws:lambda:${region}:${account}:function:${name}-${env}-ws-${RouteKey.replace('$', '')}`
fork icon99
star icon0
watch icon3

36
37
38
39
40
41
42
43
44
45

const readerWebSocketApiId = findOutput(cloudformationOutputs, 'ReaderWebSocketApiId');

// Delete stages
AWS.config.update({ region: awsRegion });
const apigatewayv2 = new AWS.ApiGatewayV2();

const deleteStageWriterParams = {
  ApiId: writerWebSocketApiId,
  StageName: 'demo',
fork icon18
star icon42
watch icon11

2
3
4
5
6
7
8
9
10
11
class ApiGatewayManager {
  constructor(serviceName, version, region) {
    this.ServiceName = serviceName;
    this.Version = version;
    this.apiGatewayFactory = new APIGateway({ region });
    this.apiGatewayFactoryV2 = new ApiGatewayV2({ region });
  }

  async GetApiGatewayPromise() {
    const apisV2 = await this.apiGatewayFactoryV2.getApis({ MaxResults: '500' }).promise();
fork icon4
star icon32
watch icon3

15
16
17
18
19
20
21
22
23
24
  const lambda = new AWS.Lambda(this.config);
  return lambda;
}

apigatewayv2 () {
  const apigatewayv2 = new AWS.ApiGatewayV2(this.config);
  return apigatewayv2;
}

iam () {
fork icon3
star icon2
watch icon4