UNPKG

@pulumi/aws

Version:

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

187 lines 7.16 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, Object.assign(Object.assign({}, 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 ? state.arn : undefined; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["defaultAction"] = state ? state.defaultAction : undefined; resourceInputs["lastUpdatedAt"] = state ? state.lastUpdatedAt : undefined; resourceInputs["listenerId"] = state ? state.listenerId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["port"] = state ? state.port : undefined; resourceInputs["protocol"] = state ? state.protocol : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["serviceArn"] = state ? state.serviceArn : undefined; resourceInputs["serviceIdentifier"] = state ? state.serviceIdentifier : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; } else { const args = argsOrState; if ((!args || args.defaultAction === undefined) && !opts.urn) { throw new Error("Missing required property 'defaultAction'"); } if ((!args || args.protocol === undefined) && !opts.urn) { throw new Error("Missing required property 'protocol'"); } resourceInputs["defaultAction"] = args ? args.defaultAction : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["port"] = args ? args.port : undefined; resourceInputs["protocol"] = args ? args.protocol : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["serviceArn"] = args ? args.serviceArn : undefined; resourceInputs["serviceIdentifier"] = args ? args.serviceIdentifier : undefined; resourceInputs["tags"] = args ? args.tags : undefined; 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