@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
169 lines • 6.23 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.ListenerRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Resource for managing an AWS VPC Lattice Listener Rule.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.vpclattice.ListenerRule("example", {
* name: "example",
* listenerIdentifier: exampleAwsVpclatticeListener.listenerId,
* serviceIdentifier: exampleAwsVpclatticeService.id,
* priority: 20,
* match: {
* httpMatch: {
* headerMatches: [{
* name: "example-header",
* caseSensitive: false,
* match: {
* exact: "example-contains",
* },
* }],
* pathMatch: {
* caseSensitive: true,
* match: {
* prefix: "/example-path",
* },
* },
* },
* },
* action: {
* forward: {
* targetGroups: [
* {
* targetGroupIdentifier: exampleAwsVpclatticeTargetGroup.id,
* weight: 1,
* },
* {
* targetGroupIdentifier: example2.id,
* weight: 2,
* },
* ],
* },
* },
* });
* ```
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.vpclattice.ListenerRule("example", {
* name: "example",
* listenerIdentifier: exampleAwsVpclatticeListener.listenerId,
* serviceIdentifier: exampleAwsVpclatticeService.id,
* priority: 10,
* match: {
* httpMatch: {
* pathMatch: {
* caseSensitive: false,
* match: {
* exact: "/example-path",
* },
* },
* },
* },
* action: {
* fixedResponse: {
* statusCode: 404,
* },
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import VPC Lattice Listener Rule using the `id`. For example:
*
* ```sh
* $ pulumi import aws:vpclattice/listenerRule:ListenerRule example service123/listener456/rule789
* ```
*/
class ListenerRule extends pulumi.CustomResource {
/**
* Get an existing ListenerRule 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 ListenerRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ListenerRule. 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'] === ListenerRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state?.action;
resourceInputs["arn"] = state?.arn;
resourceInputs["listenerIdentifier"] = state?.listenerIdentifier;
resourceInputs["match"] = state?.match;
resourceInputs["name"] = state?.name;
resourceInputs["priority"] = state?.priority;
resourceInputs["region"] = state?.region;
resourceInputs["ruleId"] = state?.ruleId;
resourceInputs["serviceIdentifier"] = state?.serviceIdentifier;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
if (args?.action === undefined && !opts.urn) {
throw new Error("Missing required property 'action'");
}
if (args?.listenerIdentifier === undefined && !opts.urn) {
throw new Error("Missing required property 'listenerIdentifier'");
}
if (args?.match === undefined && !opts.urn) {
throw new Error("Missing required property 'match'");
}
if (args?.priority === undefined && !opts.urn) {
throw new Error("Missing required property 'priority'");
}
if (args?.serviceIdentifier === undefined && !opts.urn) {
throw new Error("Missing required property 'serviceIdentifier'");
}
resourceInputs["action"] = args?.action;
resourceInputs["listenerIdentifier"] = args?.listenerIdentifier;
resourceInputs["match"] = args?.match;
resourceInputs["name"] = args?.name;
resourceInputs["priority"] = args?.priority;
resourceInputs["region"] = args?.region;
resourceInputs["serviceIdentifier"] = args?.serviceIdentifier;
resourceInputs["tags"] = args?.tags;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["ruleId"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ListenerRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.ListenerRule = ListenerRule;
/** @internal */
ListenerRule.__pulumiType = 'aws:vpclattice/listenerRule:ListenerRule';
//# sourceMappingURL=listenerRule.js.map