1. Packages
  2. Alicloud Provider
  3. API Docs
  4. dcdn
  5. WafPolicy
Alibaba Cloud v3.63.0 published on Monday, Sep 30, 2024 by Pulumi

alicloud.dcdn.WafPolicy

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.63.0 published on Monday, Sep 30, 2024 by Pulumi

    Provides a DCDN Waf Policy resource.

    For information about DCDN Waf Policy and how to use it, see What is Waf Policy.

    NOTE: Available since v1.184.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf_example";
    const _default = new random.index.Integer("default", {
        min: 10000,
        max: 99999,
    });
    const example = new alicloud.dcdn.WafPolicy("example", {
        defenseScene: "waf_group",
        policyName: `${name}_${_default.result}`,
        policyType: "custom",
        status: "on",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf_example"
    default = random.index.Integer("default",
        min=10000,
        max=99999)
    example = alicloud.dcdn.WafPolicy("example",
        defense_scene="waf_group",
        policy_name=f"{name}_{default['result']}",
        policy_type="custom",
        status="on")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dcdn"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf_example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Min: 10000,
    			Max: 99999,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dcdn.NewWafPolicy(ctx, "example", &dcdn.WafPolicyArgs{
    			DefenseScene: pulumi.String("waf_group"),
    			PolicyName:   pulumi.Sprintf("%v_%v", name, _default.Result),
    			PolicyType:   pulumi.String("custom"),
    			Status:       pulumi.String("on"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf_example";
        var @default = new Random.Index.Integer("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var example = new AliCloud.Dcdn.WafPolicy("example", new()
        {
            DefenseScene = "waf_group",
            PolicyName = $"{name}_{@default.Result}",
            PolicyType = "custom",
            Status = "on",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.dcdn.WafPolicy;
    import com.pulumi.alicloud.dcdn.WafPolicyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("tf_example");
            var default_ = new Integer("default", IntegerArgs.builder()
                .min(10000)
                .max(99999)
                .build());
    
            var example = new WafPolicy("example", WafPolicyArgs.builder()
                .defenseScene("waf_group")
                .policyName(String.format("%s_%s", name,default_.result()))
                .policyType("custom")
                .status("on")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf_example
    resources:
      default:
        type: random:integer
        properties:
          min: 10000
          max: 99999
      example:
        type: alicloud:dcdn:WafPolicy
        properties:
          defenseScene: waf_group
          policyName: ${name}_${default.result}
          policyType: custom
          status: on
    

    Create WafPolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new WafPolicy(name: string, args: WafPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def WafPolicy(resource_name: str,
                  args: WafPolicyArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def WafPolicy(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  defense_scene: Optional[str] = None,
                  policy_name: Optional[str] = None,
                  policy_type: Optional[str] = None,
                  status: Optional[str] = None)
    func NewWafPolicy(ctx *Context, name string, args WafPolicyArgs, opts ...ResourceOption) (*WafPolicy, error)
    public WafPolicy(string name, WafPolicyArgs args, CustomResourceOptions? opts = null)
    public WafPolicy(String name, WafPolicyArgs args)
    public WafPolicy(String name, WafPolicyArgs args, CustomResourceOptions options)
    
    type: alicloud:dcdn:WafPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args WafPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args WafPolicyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args WafPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args WafPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args WafPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var wafPolicyResource = new AliCloud.Dcdn.WafPolicy("wafPolicyResource", new()
    {
        DefenseScene = "string",
        PolicyName = "string",
        PolicyType = "string",
        Status = "string",
    });
    
    example, err := dcdn.NewWafPolicy(ctx, "wafPolicyResource", &dcdn.WafPolicyArgs{
    	DefenseScene: pulumi.String("string"),
    	PolicyName:   pulumi.String("string"),
    	PolicyType:   pulumi.String("string"),
    	Status:       pulumi.String("string"),
    })
    
    var wafPolicyResource = new WafPolicy("wafPolicyResource", WafPolicyArgs.builder()
        .defenseScene("string")
        .policyName("string")
        .policyType("string")
        .status("string")
        .build());
    
    waf_policy_resource = alicloud.dcdn.WafPolicy("wafPolicyResource",
        defense_scene="string",
        policy_name="string",
        policy_type="string",
        status="string")
    
    const wafPolicyResource = new alicloud.dcdn.WafPolicy("wafPolicyResource", {
        defenseScene: "string",
        policyName: "string",
        policyType: "string",
        status: "string",
    });
    
    type: alicloud:dcdn:WafPolicy
    properties:
        defenseScene: string
        policyName: string
        policyType: string
        status: string
    

    WafPolicy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The WafPolicy resource accepts the following input properties:

    DefenseScene string
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    PolicyName string
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    PolicyType string
    The type of the protection policy. Valid values: default, custom.
    Status string
    The status of the resource. Valid values: on, off.
    DefenseScene string
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    PolicyName string
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    PolicyType string
    The type of the protection policy. Valid values: default, custom.
    Status string
    The status of the resource. Valid values: on, off.
    defenseScene String
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    policyName String
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    policyType String
    The type of the protection policy. Valid values: default, custom.
    status String
    The status of the resource. Valid values: on, off.
    defenseScene string
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    policyName string
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    policyType string
    The type of the protection policy. Valid values: default, custom.
    status string
    The status of the resource. Valid values: on, off.
    defense_scene str
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    policy_name str
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    policy_type str
    The type of the protection policy. Valid values: default, custom.
    status str
    The status of the resource. Valid values: on, off.
    defenseScene String
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    policyName String
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    policyType String
    The type of the protection policy. Valid values: default, custom.
    status String
    The status of the resource. Valid values: on, off.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the WafPolicy resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing WafPolicy Resource

    Get an existing WafPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: WafPolicyState, opts?: CustomResourceOptions): WafPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            defense_scene: Optional[str] = None,
            policy_name: Optional[str] = None,
            policy_type: Optional[str] = None,
            status: Optional[str] = None) -> WafPolicy
    func GetWafPolicy(ctx *Context, name string, id IDInput, state *WafPolicyState, opts ...ResourceOption) (*WafPolicy, error)
    public static WafPolicy Get(string name, Input<string> id, WafPolicyState? state, CustomResourceOptions? opts = null)
    public static WafPolicy get(String name, Output<String> id, WafPolicyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    DefenseScene string
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    PolicyName string
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    PolicyType string
    The type of the protection policy. Valid values: default, custom.
    Status string
    The status of the resource. Valid values: on, off.
    DefenseScene string
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    PolicyName string
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    PolicyType string
    The type of the protection policy. Valid values: default, custom.
    Status string
    The status of the resource. Valid values: on, off.
    defenseScene String
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    policyName String
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    policyType String
    The type of the protection policy. Valid values: default, custom.
    status String
    The status of the resource. Valid values: on, off.
    defenseScene string
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    policyName string
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    policyType string
    The type of the protection policy. Valid values: default, custom.
    status string
    The status of the resource. Valid values: on, off.
    defense_scene str
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    policy_name str
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    policy_type str
    The type of the protection policy. Valid values: default, custom.
    status str
    The status of the resource. Valid values: on, off.
    defenseScene String
    The type of protection policy. Valid values: waf_group, custom_acl, whitelist, ip_blacklist, region_block.
    policyName String
    The name of the protection policy. The name must be 1 to 64 characters in length, and can contain letters, digits,and underscores (_).
    policyType String
    The type of the protection policy. Valid values: default, custom.
    status String
    The status of the resource. Valid values: on, off.

    Import

    DCDN Waf Policy can be imported using the id, e.g.

    $ pulumi import alicloud:dcdn/wafPolicy:WafPolicy example <id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.63.0 published on Monday, Sep 30, 2024 by Pulumi