UNPKG

@pulumi/aws-serverless

Version:

Pulumi Amazon Web Services (AWS) Serverless Components.

85 lines (84 loc) 2.33 kB
import * as aws from "@pulumi/aws"; import * as pulumi from "@pulumi/pulumi"; import { Handler } from "./function"; export interface Request { resource: string; path: string; httpMethod: string; headers: { [header: string]: string; }; queryStringParameters: { [param: string]: string; }; pathParameters: { [param: string]: string; }; stageVariables: { [name: string]: string; }; requestContext: RequestContext; body: string; isBase64Encoded: boolean; } export interface RequestContext { accountId: string; resourceId: string; stage: string; requestId: string; identity: RequestIdentity; resourcePath: string; httpMethod: string; apiId: string; } export interface RequestIdentity { cognitoIdentityPoolId?: string; accountId?: string; cognitoIdentityId?: string; caller?: string; apiKey?: string; sourceIp?: string; cognitoAuthenticationType?: string; cognitoAuthenticationProvider?: string; userArn?: string; userAgent?: string; user?: string; } export interface Response { isBase64Encoded?: boolean; statusCode: number; headers?: { [header: string]: string; }; body: string; } export declare type RouteHandler = Handler<Request, Response>; export declare type Method = "ANY" | "GET" | "PUT" | "POST" | "DELETE" | "PATCH"; export declare type Route = { path: string; method: Method; handler: RouteHandler; }; export interface APIArgs { /** * Routes to use to initialize the APIGateway. * * Either [routes] or [swaggerSpec] must be specified. */ routes?: Route[]; /** * A SwaggerSpec to use to initialize the APIGateway. Note that you must manually provide permission for any route * targets to be invoked by API Gateway when using [swaggerSpec]. * * Either [routes] or [swaggerSpec] must be specified. */ swaggerSpec?: pulumi.Input<string>; stageName?: pulumi.Input<string>; } export declare class API extends pulumi.ComponentResource { restAPI: aws.apigateway.RestApi; deployment: aws.apigateway.Deployment; stage: aws.apigateway.Stage; url: pulumi.Output<string>; constructor(name: string, args: APIArgs, opts?: pulumi.ResourceOptions); }