Class: ApiGateway

ApiGateway()

This class represents an API Gateway component. By default CORS is always enabled.

Constructor

new ApiGateway()

Source:

Members

APIName

The full name of this API Gateway.
Source:

binaryMediaTypes

Available MIME types of the endpoint
Source:

Methods

attachLambda(lambda, path, methods, responseConfigOptions)

Attach a Lambda to this API Gateway.
Parameters:
Name Type Description
lambda Lambda the Lambda object
path string the path of which the Lambda should process. This path must already declared in the Swagger file.
methods array an array of methods the Lambda should process. ie ['GET', 'POST']
responseConfigOptions object Exact format please check https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-integration-responses.html
Source:
Example
apiGateway.attachLambda(lambda, '/hello', ['GET'], {
        '.*Invalid parameters.*': {
        statusCode: 400
      }
    });

setDeploymentStages(stages)

Set the stages the enpoint is deployed to. I.e "alpha", "beta"
Parameters:
Name Type Description
stages array the stages in the form of string array
Source:

setIAM(path, methods)

Switch on IAM authentication for the given path and given methods.
Parameters:
Name Type Description
path string path of the function
methods array array of methods that needs to have IAM. For example: ["POST", "GET"]
Source:

setSwagger(swaggerJSON)

Set the swagger JSON specification for the API Gateway. swaggerJSON must be set before you can attach any Lambdas to this API Gateway.
Parameters:
Name Type Description
swaggerJSON object
Source: