@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
120 lines • 5.17 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.L7rule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an ELB L7 Rule resource within HuaweiCloud.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const loadbalancer1 = new huaweicloud.elb.Loadbalancer("loadbalancer1", {vipSubnetId: _var.subnet_id});
* const listener1 = new huaweicloud.elb.Listener("listener1", {
* protocol: "HTTP",
* protocolPort: 8080,
* loadbalancerId: loadbalancer1.id,
* });
* const pool1 = new huaweicloud.elb.Pool("pool1", {
* protocol: "HTTP",
* lbMethod: "ROUND_ROBIN",
* loadbalancerId: loadbalancer1.id,
* });
* const l7policy1 = new huaweicloud.elb.L7policy("l7policy1", {
* action: "REDIRECT_TO_POOL",
* description: "test l7 policy",
* position: 1,
* listenerId: listener1.id,
* redirectPoolId: pool1.id,
* });
* const l7rule1 = new huaweicloud.elb.L7rule("l7rule1", {
* l7policyId: l7policy1.id,
* type: "PATH",
* compareType: "EQUAL_TO",
* value: "/api",
* });
* ```
*
* ## Import
*
* Load Balancer L7 Rule can be imported using the L7 Policy ID and L7 Rule ID separated by a slash, e.g.bash
*
* ```sh
* $ pulumi import huaweicloud:Elb/l7rule:L7rule l7rule_1 e0bd694a-abbe-450e-b329-0931fd1cc5eb/4086b0c9-b18c-4d1c-b6b8-4c56c3ad2a9e
* ```
*/
class L7rule extends pulumi.CustomResource {
/**
* Get an existing L7rule 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 L7rule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of L7rule. 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'] === L7rule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["adminStateUp"] = state ? state.adminStateUp : undefined;
resourceInputs["compareType"] = state ? state.compareType : undefined;
resourceInputs["key"] = state ? state.key : undefined;
resourceInputs["l7policyId"] = state ? state.l7policyId : undefined;
resourceInputs["listenerId"] = state ? state.listenerId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["tenantId"] = state ? state.tenantId : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["value"] = state ? state.value : undefined;
}
else {
const args = argsOrState;
if ((!args || args.compareType === undefined) && !opts.urn) {
throw new Error("Missing required property 'compareType'");
}
if ((!args || args.l7policyId === undefined) && !opts.urn) {
throw new Error("Missing required property 'l7policyId'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
if ((!args || args.value === undefined) && !opts.urn) {
throw new Error("Missing required property 'value'");
}
resourceInputs["adminStateUp"] = args ? args.adminStateUp : undefined;
resourceInputs["compareType"] = args ? args.compareType : undefined;
resourceInputs["key"] = args ? args.key : undefined;
resourceInputs["l7policyId"] = args ? args.l7policyId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["tenantId"] = args ? args.tenantId : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["value"] = args ? args.value : undefined;
resourceInputs["listenerId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(L7rule.__pulumiType, name, resourceInputs, opts);
}
}
exports.L7rule = L7rule;
/** @internal */
L7rule.__pulumiType = 'huaweicloud:Elb/l7rule:L7rule';
//# sourceMappingURL=l7rule.js.map