@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
127 lines • 5.8 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.RuleBlacklist = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a WAF blacklist and whitelist rule resource within HuaweiCloud.
*
* > **NOTE:** All WAF resources depend on WAF instances, and the WAF instances need to be purchased before they can be
* used. The blacklist and whitelist rule resource can be used in Cloud Mode and Dedicated Mode.
*
* ## Example Usage
* ### WAF rule blacklist and whitelist with IP address
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const policyId = config.requireObject("policyId");
* const rule = new huaweicloud.waf.RuleBlacklist("rule", {
* policyId: policyId,
* ipAddress: "192.168.0.0/24",
* action: 0,
* description: "test description",
* });
* ```
* ### WAF rule blacklist and whitelist with address group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const policyId = config.requireObject("policyId");
* const addressGroupId = config.requireObject("addressGroupId");
* const enterpriseProjectId = config.requireObject("enterpriseProjectId");
* const rule = new huaweicloud.waf.RuleBlacklist("rule", {
* policyId: policyId,
* addressGroupId: addressGroupId,
* enterpriseProjectId: enterpriseProjectId,
* action: 1,
* description: "test description",
* });
* ```
*
* ## Import
*
* There are two ways to import WAF rule blacklist state. * Using `policy_id` and `rule_id`, separated by a slash, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Waf/ruleBlacklist:RuleBlacklist test <policy_id>/<rule_id>
* ```
*
* * Using `policy_id`, `rule_id` and `enterprise_project_id`, separated by slashes, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Waf/ruleBlacklist:RuleBlacklist test <policy_id>/<rule_id>/<enterprise_project_id>
* ```
*/
class RuleBlacklist extends pulumi.CustomResource {
/**
* Get an existing RuleBlacklist 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 RuleBlacklist(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of RuleBlacklist. 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'] === RuleBlacklist.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state ? state.action : undefined;
resourceInputs["addressGroupId"] = state ? state.addressGroupId : undefined;
resourceInputs["addressGroupName"] = state ? state.addressGroupName : undefined;
resourceInputs["addressGroupSize"] = state ? state.addressGroupSize : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["ipAddress"] = state ? state.ipAddress : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["policyId"] = state ? state.policyId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["status"] = state ? state.status : undefined;
}
else {
const args = argsOrState;
if ((!args || args.policyId === undefined) && !opts.urn) {
throw new Error("Missing required property 'policyId'");
}
resourceInputs["action"] = args ? args.action : undefined;
resourceInputs["addressGroupId"] = args ? args.addressGroupId : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["ipAddress"] = args ? args.ipAddress : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["policyId"] = args ? args.policyId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["status"] = args ? args.status : undefined;
resourceInputs["addressGroupName"] = undefined /*out*/;
resourceInputs["addressGroupSize"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RuleBlacklist.__pulumiType, name, resourceInputs, opts);
}
}
exports.RuleBlacklist = RuleBlacklist;
/** @internal */
RuleBlacklist.__pulumiType = 'huaweicloud:Waf/ruleBlacklist:RuleBlacklist';
//# sourceMappingURL=ruleBlacklist.js.map