@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
169 lines • 6.66 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, Object.assign(Object.assign({}, 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 ? state.action : undefined;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["listenerIdentifier"] = state ? state.listenerIdentifier : undefined;
resourceInputs["match"] = state ? state.match : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["priority"] = state ? state.priority : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["ruleId"] = state ? state.ruleId : 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.action === undefined) && !opts.urn) {
throw new Error("Missing required property 'action'");
}
if ((!args || args.listenerIdentifier === undefined) && !opts.urn) {
throw new Error("Missing required property 'listenerIdentifier'");
}
if ((!args || args.match === undefined) && !opts.urn) {
throw new Error("Missing required property 'match'");
}
if ((!args || args.priority === undefined) && !opts.urn) {
throw new Error("Missing required property 'priority'");
}
if ((!args || args.serviceIdentifier === undefined) && !opts.urn) {
throw new Error("Missing required property 'serviceIdentifier'");
}
resourceInputs["action"] = args ? args.action : undefined;
resourceInputs["listenerIdentifier"] = args ? args.listenerIdentifier : undefined;
resourceInputs["match"] = args ? args.match : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["priority"] = args ? args.priority : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["serviceIdentifier"] = args ? args.serviceIdentifier : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
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