1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. UserAgentBlockingRule
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

cloudflare.UserAgentBlockingRule

Explore with Pulumi AI

cloudflare logo
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const exampleUserAgentBlockingRule = new cloudflare.UserAgentBlockingRule("example_user_agent_blocking_rule", {
        zoneId: "023e105f4ecef8ad9ca31a8372d0c353",
        configuration: {
            target: "ip",
            value: "198.51.100.4",
        },
        mode: "challenge",
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example_user_agent_blocking_rule = cloudflare.UserAgentBlockingRule("example_user_agent_blocking_rule",
        zone_id="023e105f4ecef8ad9ca31a8372d0c353",
        configuration={
            "target": "ip",
            "value": "198.51.100.4",
        },
        mode="challenge")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v6/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudflare.NewUserAgentBlockingRule(ctx, "example_user_agent_blocking_rule", &cloudflare.UserAgentBlockingRuleArgs{
    			ZoneId: pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
    			Configuration: &cloudflare.UserAgentBlockingRuleConfigurationArgs{
    				Target: pulumi.String("ip"),
    				Value:  pulumi.String("198.51.100.4"),
    			},
    			Mode: pulumi.String("challenge"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleUserAgentBlockingRule = new Cloudflare.UserAgentBlockingRule("example_user_agent_blocking_rule", new()
        {
            ZoneId = "023e105f4ecef8ad9ca31a8372d0c353",
            Configuration = new Cloudflare.Inputs.UserAgentBlockingRuleConfigurationArgs
            {
                Target = "ip",
                Value = "198.51.100.4",
            },
            Mode = "challenge",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.UserAgentBlockingRule;
    import com.pulumi.cloudflare.UserAgentBlockingRuleArgs;
    import com.pulumi.cloudflare.inputs.UserAgentBlockingRuleConfigurationArgs;
    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) {
            var exampleUserAgentBlockingRule = new UserAgentBlockingRule("exampleUserAgentBlockingRule", UserAgentBlockingRuleArgs.builder()
                .zoneId("023e105f4ecef8ad9ca31a8372d0c353")
                .configuration(UserAgentBlockingRuleConfigurationArgs.builder()
                    .target("ip")
                    .value("198.51.100.4")
                    .build())
                .mode("challenge")
                .build());
    
        }
    }
    
    resources:
      exampleUserAgentBlockingRule:
        type: cloudflare:UserAgentBlockingRule
        name: example_user_agent_blocking_rule
        properties:
          zoneId: 023e105f4ecef8ad9ca31a8372d0c353
          configuration:
            target: ip
            value: 198.51.100.4
          mode: challenge
    

    Create UserAgentBlockingRule Resource

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

    Constructor syntax

    new UserAgentBlockingRule(name: string, args: UserAgentBlockingRuleArgs, opts?: CustomResourceOptions);
    @overload
    def UserAgentBlockingRule(resource_name: str,
                              args: UserAgentBlockingRuleArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def UserAgentBlockingRule(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              configuration: Optional[UserAgentBlockingRuleConfigurationArgs] = None,
                              mode: Optional[str] = None,
                              zone_id: Optional[str] = None,
                              ua_rule_id: Optional[str] = None)
    func NewUserAgentBlockingRule(ctx *Context, name string, args UserAgentBlockingRuleArgs, opts ...ResourceOption) (*UserAgentBlockingRule, error)
    public UserAgentBlockingRule(string name, UserAgentBlockingRuleArgs args, CustomResourceOptions? opts = null)
    public UserAgentBlockingRule(String name, UserAgentBlockingRuleArgs args)
    public UserAgentBlockingRule(String name, UserAgentBlockingRuleArgs args, CustomResourceOptions options)
    
    type: cloudflare:UserAgentBlockingRule
    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 UserAgentBlockingRuleArgs
    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 UserAgentBlockingRuleArgs
    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 UserAgentBlockingRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserAgentBlockingRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserAgentBlockingRuleArgs
    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 userAgentBlockingRuleResource = new Cloudflare.UserAgentBlockingRule("userAgentBlockingRuleResource", new()
    {
        Configuration = new Cloudflare.Inputs.UserAgentBlockingRuleConfigurationArgs
        {
            Target = "string",
            Value = "string",
        },
        Mode = "string",
        ZoneId = "string",
        UaRuleId = "string",
    });
    
    example, err := cloudflare.NewUserAgentBlockingRule(ctx, "userAgentBlockingRuleResource", &cloudflare.UserAgentBlockingRuleArgs{
    	Configuration: &cloudflare.UserAgentBlockingRuleConfigurationArgs{
    		Target: pulumi.String("string"),
    		Value:  pulumi.String("string"),
    	},
    	Mode:     pulumi.String("string"),
    	ZoneId:   pulumi.String("string"),
    	UaRuleId: pulumi.String("string"),
    })
    
    var userAgentBlockingRuleResource = new UserAgentBlockingRule("userAgentBlockingRuleResource", UserAgentBlockingRuleArgs.builder()
        .configuration(UserAgentBlockingRuleConfigurationArgs.builder()
            .target("string")
            .value("string")
            .build())
        .mode("string")
        .zoneId("string")
        .uaRuleId("string")
        .build());
    
    user_agent_blocking_rule_resource = cloudflare.UserAgentBlockingRule("userAgentBlockingRuleResource",
        configuration={
            "target": "string",
            "value": "string",
        },
        mode="string",
        zone_id="string",
        ua_rule_id="string")
    
    const userAgentBlockingRuleResource = new cloudflare.UserAgentBlockingRule("userAgentBlockingRuleResource", {
        configuration: {
            target: "string",
            value: "string",
        },
        mode: "string",
        zoneId: "string",
        uaRuleId: "string",
    });
    
    type: cloudflare:UserAgentBlockingRule
    properties:
        configuration:
            target: string
            value: string
        mode: string
        uaRuleId: string
        zoneId: string
    

    UserAgentBlockingRule Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The UserAgentBlockingRule resource accepts the following input properties:

    Configuration UserAgentBlockingRuleConfiguration
    The rule configuration.
    Mode string
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    ZoneId string
    Identifier
    UaRuleId string
    The unique identifier of the User Agent Blocking rule.
    Configuration UserAgentBlockingRuleConfigurationArgs
    The rule configuration.
    Mode string
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    ZoneId string
    Identifier
    UaRuleId string
    The unique identifier of the User Agent Blocking rule.
    configuration UserAgentBlockingRuleConfiguration
    The rule configuration.
    mode String
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    zoneId String
    Identifier
    uaRuleId String
    The unique identifier of the User Agent Blocking rule.
    configuration UserAgentBlockingRuleConfiguration
    The rule configuration.
    mode string
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    zoneId string
    Identifier
    uaRuleId string
    The unique identifier of the User Agent Blocking rule.
    configuration UserAgentBlockingRuleConfigurationArgs
    The rule configuration.
    mode str
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    zone_id str
    Identifier
    ua_rule_id str
    The unique identifier of the User Agent Blocking rule.
    configuration Property Map
    The rule configuration.
    mode String
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    zoneId String
    Identifier
    uaRuleId String
    The unique identifier of the User Agent Blocking rule.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the UserAgentBlockingRule 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 UserAgentBlockingRule Resource

    Get an existing UserAgentBlockingRule 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?: UserAgentBlockingRuleState, opts?: CustomResourceOptions): UserAgentBlockingRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            configuration: Optional[UserAgentBlockingRuleConfigurationArgs] = None,
            mode: Optional[str] = None,
            ua_rule_id: Optional[str] = None,
            zone_id: Optional[str] = None) -> UserAgentBlockingRule
    func GetUserAgentBlockingRule(ctx *Context, name string, id IDInput, state *UserAgentBlockingRuleState, opts ...ResourceOption) (*UserAgentBlockingRule, error)
    public static UserAgentBlockingRule Get(string name, Input<string> id, UserAgentBlockingRuleState? state, CustomResourceOptions? opts = null)
    public static UserAgentBlockingRule get(String name, Output<String> id, UserAgentBlockingRuleState state, CustomResourceOptions options)
    resources:  _:    type: cloudflare:UserAgentBlockingRule    get:      id: ${id}
    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:
    Configuration UserAgentBlockingRuleConfiguration
    The rule configuration.
    Mode string
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    UaRuleId string
    The unique identifier of the User Agent Blocking rule.
    ZoneId string
    Identifier
    Configuration UserAgentBlockingRuleConfigurationArgs
    The rule configuration.
    Mode string
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    UaRuleId string
    The unique identifier of the User Agent Blocking rule.
    ZoneId string
    Identifier
    configuration UserAgentBlockingRuleConfiguration
    The rule configuration.
    mode String
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    uaRuleId String
    The unique identifier of the User Agent Blocking rule.
    zoneId String
    Identifier
    configuration UserAgentBlockingRuleConfiguration
    The rule configuration.
    mode string
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    uaRuleId string
    The unique identifier of the User Agent Blocking rule.
    zoneId string
    Identifier
    configuration UserAgentBlockingRuleConfigurationArgs
    The rule configuration.
    mode str
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    ua_rule_id str
    The unique identifier of the User Agent Blocking rule.
    zone_id str
    Identifier
    configuration Property Map
    The rule configuration.
    mode String
    The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
    uaRuleId String
    The unique identifier of the User Agent Blocking rule.
    zoneId String
    Identifier

    Supporting Types

    UserAgentBlockingRuleConfiguration, UserAgentBlockingRuleConfigurationArgs

    Target string
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    Value string
    The IP address to match. This address will be compared to the IP address of incoming requests.
    Target string
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    Value string
    The IP address to match. This address will be compared to the IP address of incoming requests.
    target String
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    value String
    The IP address to match. This address will be compared to the IP address of incoming requests.
    target string
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    value string
    The IP address to match. This address will be compared to the IP address of incoming requests.
    target str
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    value str
    The IP address to match. This address will be compared to the IP address of incoming requests.
    target String
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    value String
    The IP address to match. This address will be compared to the IP address of incoming requests.

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi