@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
152 lines • 5.81 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
* ### Create by value
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const l7policyId = config.requireObject("l7policyId");
* const l7rule1 = new huaweicloud.dedicatedelb.L7rule("l7rule1", {
* l7policyId: l7policyId,
* type: "PATH",
* compareType: "EQUAL_TO",
* value: "/api",
* });
* ```
* ### Create by conditions and type is HOST_NAME
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const l7policyId = config.requireObject("l7policyId");
* const l7rule1 = new huaweicloud.dedicatedelb.L7rule("l7rule1", {
* l7policyId: l7policyId,
* type: "HOST_NAME",
* compareType: "EQUAL_TO",
* conditions: [{
* value: "test.com",
* }],
* });
* ```
* ### Create by conditions and type is HEADER
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const l7policyId = config.requireObject("l7policyId");
* const l7rule1 = new huaweicloud.dedicatedelb.L7rule("l7rule1", {
* l7policyId: l7policyId,
* type: "HEADER",
* compareType: "EQUAL_TO",
* conditions: [{
* key: "testKey",
* value: "testValue",
* }],
* });
* ```
* ### Create by conditions and type is SOURCE_IP
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const l7policyId = config.requireObject("l7policyId");
* const l7rule1 = new huaweicloud.dedicatedelb.L7rule("l7rule1", {
* l7policyId: l7policyId,
* type: "SOURCE_IP",
* compareType: "EQUAL_TO",
* conditions: [{
* value: "192.168.0.2/32",
* }],
* });
* ```
*
* ## Import
*
* ELB L7 rule can be imported using the `l7policy_id` and `id` separated by a slash, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:DedicatedElb/l7rule:L7rule rule_1 <l7policy_id>/<id>
* ```
*/
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["compareType"] = state ? state.compareType : undefined;
resourceInputs["conditions"] = state ? state.conditions : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["l7policyId"] = state ? state.l7policyId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : 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'");
}
resourceInputs["compareType"] = args ? args.compareType : undefined;
resourceInputs["conditions"] = args ? args.conditions : undefined;
resourceInputs["l7policyId"] = args ? args.l7policyId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["value"] = args ? args.value : undefined;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(L7rule.__pulumiType, name, resourceInputs, opts);
}
}
exports.L7rule = L7rule;
/** @internal */
L7rule.__pulumiType = 'huaweicloud:DedicatedElb/l7rule:L7rule';
//# sourceMappingURL=l7rule.js.map