@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
127 lines • 4.86 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.FunctionUrl = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a Lambda function URL. Creates a dedicated HTTP(S) endpoint for a Lambda function to enable direct invocation via HTTP requests.
*
* ## Example Usage
*
* ### Basic Function URL with No Authentication
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.lambda.FunctionUrl("example", {
* functionName: exampleAwsLambdaFunction.functionName,
* authorizationType: "NONE",
* });
* ```
*
* ### Function URL with IAM Authentication and CORS Configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.lambda.FunctionUrl("example", {
* functionName: exampleAwsLambdaFunction.functionName,
* qualifier: "my_alias",
* authorizationType: "AWS_IAM",
* invokeMode: "RESPONSE_STREAM",
* cors: {
* allowCredentials: true,
* allowOrigins: ["https://example.com"],
* allowMethods: [
* "GET",
* "POST",
* ],
* allowHeaders: [
* "date",
* "keep-alive",
* ],
* exposeHeaders: [
* "keep-alive",
* "date",
* ],
* maxAge: 86400,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Lambda function URLs using the `function_name` or `function_name/qualifier`. For example:
*
* ```sh
* $ pulumi import aws:lambda/functionUrl:FunctionUrl example example
* ```
*/
class FunctionUrl extends pulumi.CustomResource {
/**
* Get an existing FunctionUrl 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 FunctionUrl(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of FunctionUrl. 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'] === FunctionUrl.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["authorizationType"] = state?.authorizationType;
resourceInputs["cors"] = state?.cors;
resourceInputs["functionArn"] = state?.functionArn;
resourceInputs["functionName"] = state?.functionName;
resourceInputs["functionUrl"] = state?.functionUrl;
resourceInputs["invokeMode"] = state?.invokeMode;
resourceInputs["qualifier"] = state?.qualifier;
resourceInputs["region"] = state?.region;
resourceInputs["urlId"] = state?.urlId;
}
else {
const args = argsOrState;
if (args?.authorizationType === undefined && !opts.urn) {
throw new Error("Missing required property 'authorizationType'");
}
if (args?.functionName === undefined && !opts.urn) {
throw new Error("Missing required property 'functionName'");
}
resourceInputs["authorizationType"] = args?.authorizationType;
resourceInputs["cors"] = args?.cors;
resourceInputs["functionName"] = args?.functionName;
resourceInputs["invokeMode"] = args?.invokeMode;
resourceInputs["qualifier"] = args?.qualifier;
resourceInputs["region"] = args?.region;
resourceInputs["functionArn"] = undefined /*out*/;
resourceInputs["functionUrl"] = undefined /*out*/;
resourceInputs["urlId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(FunctionUrl.__pulumiType, name, resourceInputs, opts);
}
}
exports.FunctionUrl = FunctionUrl;
/** @internal */
FunctionUrl.__pulumiType = 'aws:lambda/functionUrl:FunctionUrl';
//# sourceMappingURL=functionUrl.js.map