@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
120 lines • 5.24 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Authorizer = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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
* ```
*/
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, id, state, opts) {
return new Authorizer(name, state, { ...opts, id: id });
}
/**
* 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) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Authorizer.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["apiId"] = state?.apiId;
resourceInputs["authorizerCredentialsArn"] = state?.authorizerCredentialsArn;
resourceInputs["authorizerPayloadFormatVersion"] = state?.authorizerPayloadFormatVersion;
resourceInputs["authorizerResultTtlInSeconds"] = state?.authorizerResultTtlInSeconds;
resourceInputs["authorizerType"] = state?.authorizerType;
resourceInputs["authorizerUri"] = state?.authorizerUri;
resourceInputs["enableSimpleResponses"] = state?.enableSimpleResponses;
resourceInputs["identitySources"] = state?.identitySources;
resourceInputs["jwtConfiguration"] = state?.jwtConfiguration;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
}
else {
const args = argsOrState;
if (args?.apiId === undefined && !opts.urn) {
throw new Error("Missing required property 'apiId'");
}
if (args?.authorizerType === undefined && !opts.urn) {
throw new Error("Missing required property 'authorizerType'");
}
resourceInputs["apiId"] = args?.apiId;
resourceInputs["authorizerCredentialsArn"] = args?.authorizerCredentialsArn;
resourceInputs["authorizerPayloadFormatVersion"] = args?.authorizerPayloadFormatVersion;
resourceInputs["authorizerResultTtlInSeconds"] = args?.authorizerResultTtlInSeconds;
resourceInputs["authorizerType"] = args?.authorizerType;
resourceInputs["authorizerUri"] = args?.authorizerUri;
resourceInputs["enableSimpleResponses"] = args?.enableSimpleResponses;
resourceInputs["identitySources"] = args?.identitySources;
resourceInputs["jwtConfiguration"] = args?.jwtConfiguration;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Authorizer.__pulumiType, name, resourceInputs, opts);
}
}
exports.Authorizer = Authorizer;
/** @internal */
Authorizer.__pulumiType = 'aws:apigatewayv2/authorizer:Authorizer';
//# sourceMappingURL=authorizer.js.map