UNPKG

@pulumi/aws

Version:

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

187 lines 6.72 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.Listener = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource for managing an AWS VPC Lattice Listener. * * ## Example Usage * * ### Fixed response action * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.vpclattice.Service("example", {name: "example"}); * const exampleListener = new aws.vpclattice.Listener("example", { * name: "example", * protocol: "HTTPS", * serviceIdentifier: example.id, * defaultAction: { * fixedResponse: { * statusCode: 404, * }, * }, * }); * ``` * * ### Forward action * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.vpclattice.Service("example", {name: "example"}); * const exampleTargetGroup = new aws.vpclattice.TargetGroup("example", { * name: "example-target-group-1", * type: "INSTANCE", * config: { * port: 80, * protocol: "HTTP", * vpcIdentifier: exampleAwsVpc.id, * }, * }); * const exampleListener = new aws.vpclattice.Listener("example", { * name: "example", * protocol: "HTTP", * serviceIdentifier: example.id, * defaultAction: { * forwards: [{ * targetGroups: [{ * targetGroupIdentifier: exampleTargetGroup.id, * }], * }], * }, * }); * ``` * * ### Forward action with weighted target groups * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.vpclattice.Service("example", {name: "example"}); * const example1 = new aws.vpclattice.TargetGroup("example1", { * name: "example-target-group-1", * type: "INSTANCE", * config: { * port: 80, * protocol: "HTTP", * vpcIdentifier: exampleAwsVpc.id, * }, * }); * const example2 = new aws.vpclattice.TargetGroup("example2", { * name: "example-target-group-2", * type: "INSTANCE", * config: { * port: 8080, * protocol: "HTTP", * vpcIdentifier: exampleAwsVpc.id, * }, * }); * const exampleListener = new aws.vpclattice.Listener("example", { * name: "example", * protocol: "HTTP", * serviceIdentifier: example.id, * defaultAction: { * forwards: [{ * targetGroups: [ * { * targetGroupIdentifier: example1.id, * weight: 80, * }, * { * targetGroupIdentifier: example2.id, * weight: 20, * }, * ], * }], * }, * }); * ``` * * ## Import * * Using `pulumi import`, import VPC Lattice Listener using the `listener_id` of the listener and the `id` of the VPC Lattice service combined with a `/` character. For example: * * ```sh * $ pulumi import aws:vpclattice/listener:Listener example svc-1a2b3c4d/listener-987654321 * ``` */ class Listener extends pulumi.CustomResource { /** * Get an existing Listener 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 Listener(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Listener. 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'] === Listener.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["createdAt"] = state?.createdAt; resourceInputs["defaultAction"] = state?.defaultAction; resourceInputs["lastUpdatedAt"] = state?.lastUpdatedAt; resourceInputs["listenerId"] = state?.listenerId; resourceInputs["name"] = state?.name; resourceInputs["port"] = state?.port; resourceInputs["protocol"] = state?.protocol; resourceInputs["region"] = state?.region; resourceInputs["serviceArn"] = state?.serviceArn; resourceInputs["serviceIdentifier"] = state?.serviceIdentifier; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; } else { const args = argsOrState; if (args?.defaultAction === undefined && !opts.urn) { throw new Error("Missing required property 'defaultAction'"); } if (args?.protocol === undefined && !opts.urn) { throw new Error("Missing required property 'protocol'"); } resourceInputs["defaultAction"] = args?.defaultAction; resourceInputs["name"] = args?.name; resourceInputs["port"] = args?.port; resourceInputs["protocol"] = args?.protocol; resourceInputs["region"] = args?.region; resourceInputs["serviceArn"] = args?.serviceArn; resourceInputs["serviceIdentifier"] = args?.serviceIdentifier; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["lastUpdatedAt"] = undefined /*out*/; resourceInputs["listenerId"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Listener.__pulumiType, name, resourceInputs, opts); } } exports.Listener = Listener; /** @internal */ Listener.__pulumiType = 'aws:vpclattice/listener:Listener'; //# sourceMappingURL=listener.js.map