UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

258 lines (257 loc) 10.3 kB
import * as pulumi from "@pulumi/pulumi"; /** * 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> * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: RuleBlacklistState, opts?: pulumi.CustomResourceOptions): RuleBlacklist; /** * 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: any): obj is RuleBlacklist; /** * Specifies the protective action. Defaults to `0`. The value can be: * + `0`: block the request. * + `1`: allow the request. * + `2`: log the request only. */ readonly action: pulumi.Output<number | undefined>; /** * Specifies the WAF address group ID. * This parameter is required when `ipAddress` is not specified. The parameter `addressGroupId` and `ipAddress` * can not be configured together. */ readonly addressGroupId: pulumi.Output<string | undefined>; /** * The name of the IP address group. */ readonly addressGroupName: pulumi.Output<string>; /** * The number of IP addresses or IP address ranges in the IP address group. */ readonly addressGroupSize: pulumi.Output<number>; /** * Specifies the rule description of the WAF address group. */ readonly description: pulumi.Output<string | undefined>; /** * Specifies the enterprise project ID of WAF rule blacklist * and whitelist. For enterprise users, if omitted, default enterprise project will be used. * Changing this parameter will create a new resource. */ readonly enterpriseProjectId: pulumi.Output<string | undefined>; /** * Specifies the IP address or range. For example, **192.168.0.125** or **192.168.0.0/24**. * This parameter is required when `addressGroupId` is not specified. The parameter `addressGroupId` and `ipAddress` * can not be configured together. */ readonly ipAddress: pulumi.Output<string | undefined>; /** * Specifies the rule name. The value can contain a maximum of `64` characters. * Only letters, digits, hyphens (-), underscores (_) and periods (.) are allowed. */ readonly name: pulumi.Output<string>; /** * Specifies the WAF policy ID. Changing this parameter will create a new resource. */ readonly policyId: pulumi.Output<string>; /** * Specifies the region in which to create the WAF blacklist and whitelist rule resource. * If omitted, the provider-level region will be used. Changing this parameter will create a new resource. */ readonly region: pulumi.Output<string>; /** * Specifies the status of WAF blacklist and whitelist rule. * Valid values are as follows: * + **0**: Disabled. * + **1**: Enabled. */ readonly status: pulumi.Output<number | undefined>; /** * Create a RuleBlacklist resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: RuleBlacklistArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering RuleBlacklist resources. */ export interface RuleBlacklistState { /** * Specifies the protective action. Defaults to `0`. The value can be: * + `0`: block the request. * + `1`: allow the request. * + `2`: log the request only. */ action?: pulumi.Input<number>; /** * Specifies the WAF address group ID. * This parameter is required when `ipAddress` is not specified. The parameter `addressGroupId` and `ipAddress` * can not be configured together. */ addressGroupId?: pulumi.Input<string>; /** * The name of the IP address group. */ addressGroupName?: pulumi.Input<string>; /** * The number of IP addresses or IP address ranges in the IP address group. */ addressGroupSize?: pulumi.Input<number>; /** * Specifies the rule description of the WAF address group. */ description?: pulumi.Input<string>; /** * Specifies the enterprise project ID of WAF rule blacklist * and whitelist. For enterprise users, if omitted, default enterprise project will be used. * Changing this parameter will create a new resource. */ enterpriseProjectId?: pulumi.Input<string>; /** * Specifies the IP address or range. For example, **192.168.0.125** or **192.168.0.0/24**. * This parameter is required when `addressGroupId` is not specified. The parameter `addressGroupId` and `ipAddress` * can not be configured together. */ ipAddress?: pulumi.Input<string>; /** * Specifies the rule name. The value can contain a maximum of `64` characters. * Only letters, digits, hyphens (-), underscores (_) and periods (.) are allowed. */ name?: pulumi.Input<string>; /** * Specifies the WAF policy ID. Changing this parameter will create a new resource. */ policyId?: pulumi.Input<string>; /** * Specifies the region in which to create the WAF blacklist and whitelist rule resource. * If omitted, the provider-level region will be used. Changing this parameter will create a new resource. */ region?: pulumi.Input<string>; /** * Specifies the status of WAF blacklist and whitelist rule. * Valid values are as follows: * + **0**: Disabled. * + **1**: Enabled. */ status?: pulumi.Input<number>; } /** * The set of arguments for constructing a RuleBlacklist resource. */ export interface RuleBlacklistArgs { /** * Specifies the protective action. Defaults to `0`. The value can be: * + `0`: block the request. * + `1`: allow the request. * + `2`: log the request only. */ action?: pulumi.Input<number>; /** * Specifies the WAF address group ID. * This parameter is required when `ipAddress` is not specified. The parameter `addressGroupId` and `ipAddress` * can not be configured together. */ addressGroupId?: pulumi.Input<string>; /** * Specifies the rule description of the WAF address group. */ description?: pulumi.Input<string>; /** * Specifies the enterprise project ID of WAF rule blacklist * and whitelist. For enterprise users, if omitted, default enterprise project will be used. * Changing this parameter will create a new resource. */ enterpriseProjectId?: pulumi.Input<string>; /** * Specifies the IP address or range. For example, **192.168.0.125** or **192.168.0.0/24**. * This parameter is required when `addressGroupId` is not specified. The parameter `addressGroupId` and `ipAddress` * can not be configured together. */ ipAddress?: pulumi.Input<string>; /** * Specifies the rule name. The value can contain a maximum of `64` characters. * Only letters, digits, hyphens (-), underscores (_) and periods (.) are allowed. */ name?: pulumi.Input<string>; /** * Specifies the WAF policy ID. Changing this parameter will create a new resource. */ policyId: pulumi.Input<string>; /** * Specifies the region in which to create the WAF blacklist and whitelist rule resource. * If omitted, the provider-level region will be used. Changing this parameter will create a new resource. */ region?: pulumi.Input<string>; /** * Specifies the status of WAF blacklist and whitelist rule. * Valid values are as follows: * + **0**: Disabled. * + **1**: Enabled. */ status?: pulumi.Input<number>; }