UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

252 lines (251 loc) • 11.5 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages an Amazon API Gateway Version 2 authorizer. * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). * * ## Example Usage * * ### Basic WebSocket API * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.apigatewayv2.Authorizer("example", { * apiId: exampleAwsApigatewayv2Api.id, * authorizerType: "REQUEST", * authorizerUri: exampleAwsLambdaFunction.invokeArn, * identitySources: ["route.request.header.Auth"], * name: "example-authorizer", * }); * ``` * * ### Basic HTTP API * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.apigatewayv2.Authorizer("example", { * apiId: exampleAwsApigatewayv2Api.id, * authorizerType: "REQUEST", * authorizerUri: exampleAwsLambdaFunction.invokeArn, * identitySources: ["$request.header.Authorization"], * name: "example-authorizer", * authorizerPayloadFormatVersion: "2.0", * }); * ``` * * ## Import * * Using `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example: * * ```sh * $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334 * ``` */ export declare class Authorizer extends pulumi.CustomResource { /** * Get an existing Authorizer resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: AuthorizerState, opts?: pulumi.CustomResourceOptions): Authorizer; /** * Returns true if the given object is an instance of Authorizer. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Authorizer; /** * API identifier. */ readonly apiId: pulumi.Output<string>; /** * Required credentials as an IAM role for API Gateway to invoke the authorizer. * Supported only for `REQUEST` authorizers. */ readonly authorizerCredentialsArn: pulumi.Output<string | undefined>; /** * Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. * Valid values: `1.0`, `2.0`. */ readonly authorizerPayloadFormatVersion: pulumi.Output<string | undefined>; /** * Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. * If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. * Supported only for HTTP API Lambda authorizers. */ readonly authorizerResultTtlInSeconds: pulumi.Output<number>; /** * Authorizer type. Valid values: `JWT`, `REQUEST`. * Specify `REQUEST` for a Lambda function using incoming request parameters. * For HTTP APIs, specify `JWT` to use JSON Web Tokens. */ readonly authorizerType: pulumi.Output<string>; /** * Authorizer's Uniform Resource Identifier (URI). * For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invokeArn` attribute of the `aws.lambda.Function` resource. * Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. */ readonly authorizerUri: pulumi.Output<string | undefined>; /** * Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. * Supported only for HTTP APIs. */ readonly enableSimpleResponses: pulumi.Output<boolean | undefined>; /** * Identity sources for which authorization is requested. * For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. * For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. */ readonly identitySources: pulumi.Output<string[] | undefined>; /** * Configuration of a JWT authorizer. Required for the `JWT` authorizer type. * Supported only for HTTP APIs. */ readonly jwtConfiguration: pulumi.Output<outputs.apigatewayv2.AuthorizerJwtConfiguration | undefined>; /** * Name of the authorizer. Must be between 1 and 128 characters in length. */ readonly name: pulumi.Output<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * Create a Authorizer resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: AuthorizerArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Authorizer resources. */ export interface AuthorizerState { /** * API identifier. */ apiId?: pulumi.Input<string>; /** * Required credentials as an IAM role for API Gateway to invoke the authorizer. * Supported only for `REQUEST` authorizers. */ authorizerCredentialsArn?: pulumi.Input<string>; /** * Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. * Valid values: `1.0`, `2.0`. */ authorizerPayloadFormatVersion?: pulumi.Input<string>; /** * Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. * If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. * Supported only for HTTP API Lambda authorizers. */ authorizerResultTtlInSeconds?: pulumi.Input<number>; /** * Authorizer type. Valid values: `JWT`, `REQUEST`. * Specify `REQUEST` for a Lambda function using incoming request parameters. * For HTTP APIs, specify `JWT` to use JSON Web Tokens. */ authorizerType?: pulumi.Input<string>; /** * Authorizer's Uniform Resource Identifier (URI). * For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invokeArn` attribute of the `aws.lambda.Function` resource. * Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. */ authorizerUri?: pulumi.Input<string>; /** * Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. * Supported only for HTTP APIs. */ enableSimpleResponses?: pulumi.Input<boolean>; /** * Identity sources for which authorization is requested. * For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. * For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. */ identitySources?: pulumi.Input<pulumi.Input<string>[]>; /** * Configuration of a JWT authorizer. Required for the `JWT` authorizer type. * Supported only for HTTP APIs. */ jwtConfiguration?: pulumi.Input<inputs.apigatewayv2.AuthorizerJwtConfiguration>; /** * Name of the authorizer. Must be between 1 and 128 characters in length. */ name?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; } /** * The set of arguments for constructing a Authorizer resource. */ export interface AuthorizerArgs { /** * API identifier. */ apiId: pulumi.Input<string>; /** * Required credentials as an IAM role for API Gateway to invoke the authorizer. * Supported only for `REQUEST` authorizers. */ authorizerCredentialsArn?: pulumi.Input<string>; /** * Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. * Valid values: `1.0`, `2.0`. */ authorizerPayloadFormatVersion?: pulumi.Input<string>; /** * Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. * If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. * Supported only for HTTP API Lambda authorizers. */ authorizerResultTtlInSeconds?: pulumi.Input<number>; /** * Authorizer type. Valid values: `JWT`, `REQUEST`. * Specify `REQUEST` for a Lambda function using incoming request parameters. * For HTTP APIs, specify `JWT` to use JSON Web Tokens. */ authorizerType: pulumi.Input<string>; /** * Authorizer's Uniform Resource Identifier (URI). * For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invokeArn` attribute of the `aws.lambda.Function` resource. * Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. */ authorizerUri?: pulumi.Input<string>; /** * Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. * Supported only for HTTP APIs. */ enableSimpleResponses?: pulumi.Input<boolean>; /** * Identity sources for which authorization is requested. * For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. * For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. */ identitySources?: pulumi.Input<pulumi.Input<string>[]>; /** * Configuration of a JWT authorizer. Required for the `JWT` authorizer type. * Supported only for HTTP APIs. */ jwtConfiguration?: pulumi.Input<inputs.apigatewayv2.AuthorizerJwtConfiguration>; /** * Name of the authorizer. Must be between 1 and 128 characters in length. */ name?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; }