UNPKG

@pulumi/aws

Version:

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

151 lines 5.68 kB
"use strict"; // *** 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.Alias = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages an AWS Lambda Alias. Use this resource to create an alias that points to a specific Lambda function version for traffic management and deployment strategies. * * For information about Lambda and how to use it, see [What is AWS Lambda?](http://docs.aws.amazon.com/lambda/latest/dg/welcome.html). For information about function aliases, see [CreateAlias](http://docs.aws.amazon.com/lambda/latest/dg/API_CreateAlias.html) and [AliasRoutingConfiguration](https://docs.aws.amazon.com/lambda/latest/dg/API_AliasRoutingConfiguration.html) in the API docs. * * ## Example Usage * * ### Basic Alias * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.lambda.Alias("example", { * name: "production", * description: "Production environment alias", * functionName: exampleAwsLambdaFunction.arn, * functionVersion: "1", * }); * ``` * * ### Alias with Traffic Splitting * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.lambda.Alias("example", { * name: "staging", * description: "Staging environment with traffic splitting", * functionName: exampleAwsLambdaFunction.functionName, * functionVersion: "2", * routingConfig: { * additionalVersionWeights: { * "1": 0.1, * }, * }, * }); * ``` * * ### Blue-Green Deployment Alias * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Alias for gradual rollout * const example = new aws.lambda.Alias("example", { * name: "live", * description: "Live traffic with gradual rollout to new version", * functionName: exampleAwsLambdaFunction.functionName, * functionVersion: "5", * routingConfig: { * additionalVersionWeights: { * "6": 0.05, * }, * }, * }); * ``` * * ### Development Alias * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.lambda.Alias("example", { * name: "dev", * description: "Development environment - always points to latest", * functionName: exampleAwsLambdaFunction.functionName, * functionVersion: "$LATEST", * }); * ``` * * ## Import * * For backwards compatibility, the following legacy `pulumi import` command is also supported: * * ```sh * $ pulumi import aws:lambda/alias:Alias example example/production * ``` */ class Alias extends pulumi.CustomResource { /** * Get an existing Alias 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 Alias(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Alias. 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'] === Alias.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["description"] = state?.description; resourceInputs["functionName"] = state?.functionName; resourceInputs["functionVersion"] = state?.functionVersion; resourceInputs["invokeArn"] = state?.invokeArn; resourceInputs["name"] = state?.name; resourceInputs["region"] = state?.region; resourceInputs["routingConfig"] = state?.routingConfig; } else { const args = argsOrState; if (args?.functionName === undefined && !opts.urn) { throw new Error("Missing required property 'functionName'"); } if (args?.functionVersion === undefined && !opts.urn) { throw new Error("Missing required property 'functionVersion'"); } resourceInputs["description"] = args?.description; resourceInputs["functionName"] = args?.functionName; resourceInputs["functionVersion"] = args?.functionVersion; resourceInputs["name"] = args?.name; resourceInputs["region"] = args?.region; resourceInputs["routingConfig"] = args?.routingConfig; resourceInputs["arn"] = undefined /*out*/; resourceInputs["invokeArn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Alias.__pulumiType, name, resourceInputs, opts); } } exports.Alias = Alias; /** @internal */ Alias.__pulumiType = 'aws:lambda/alias:Alias'; //# sourceMappingURL=alias.js.map