1. Packages
  2. Cloudflare
  3. API Docs
  4. UserAgentBlockingRule
Cloudflare v5.24.0 published on Thursday, Mar 28, 2024 by Pulumi

cloudflare.UserAgentBlockingRule

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.24.0 published on Thursday, Mar 28, 2024 by Pulumi

    Provides a resource to manage User Agent Blocking Rules.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const example1 = new cloudflare.UserAgentBlockingRule("example1", {
        configuration: {
            target: "ua",
            value: "Chrome",
        },
        description: "My description 1",
        mode: "js_challenge",
        paused: false,
        zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
    });
    const example2 = new cloudflare.UserAgentBlockingRule("example2", {
        configuration: {
            target: "ua",
            value: "Mozilla",
        },
        description: "My description 22",
        mode: "challenge",
        paused: true,
        zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example1 = cloudflare.UserAgentBlockingRule("example1",
        configuration=cloudflare.UserAgentBlockingRuleConfigurationArgs(
            target="ua",
            value="Chrome",
        ),
        description="My description 1",
        mode="js_challenge",
        paused=False,
        zone_id="0da42c8d2132a9ddaf714f9e7c920711")
    example2 = cloudflare.UserAgentBlockingRule("example2",
        configuration=cloudflare.UserAgentBlockingRuleConfigurationArgs(
            target="ua",
            value="Mozilla",
        ),
        description="My description 22",
        mode="challenge",
        paused=True,
        zone_id="0da42c8d2132a9ddaf714f9e7c920711")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudflare.NewUserAgentBlockingRule(ctx, "example1", &cloudflare.UserAgentBlockingRuleArgs{
    			Configuration: &cloudflare.UserAgentBlockingRuleConfigurationArgs{
    				Target: pulumi.String("ua"),
    				Value:  pulumi.String("Chrome"),
    			},
    			Description: pulumi.String("My description 1"),
    			Mode:        pulumi.String("js_challenge"),
    			Paused:      pulumi.Bool(false),
    			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cloudflare.NewUserAgentBlockingRule(ctx, "example2", &cloudflare.UserAgentBlockingRuleArgs{
    			Configuration: &cloudflare.UserAgentBlockingRuleConfigurationArgs{
    				Target: pulumi.String("ua"),
    				Value:  pulumi.String("Mozilla"),
    			},
    			Description: pulumi.String("My description 22"),
    			Mode:        pulumi.String("challenge"),
    			Paused:      pulumi.Bool(true),
    			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
    		})
    		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 example1 = new Cloudflare.UserAgentBlockingRule("example1", new()
        {
            Configuration = new Cloudflare.Inputs.UserAgentBlockingRuleConfigurationArgs
            {
                Target = "ua",
                Value = "Chrome",
            },
            Description = "My description 1",
            Mode = "js_challenge",
            Paused = false,
            ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
        });
    
        var example2 = new Cloudflare.UserAgentBlockingRule("example2", new()
        {
            Configuration = new Cloudflare.Inputs.UserAgentBlockingRuleConfigurationArgs
            {
                Target = "ua",
                Value = "Mozilla",
            },
            Description = "My description 22",
            Mode = "challenge",
            Paused = true,
            ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
        });
    
    });
    
    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 example1 = new UserAgentBlockingRule("example1", UserAgentBlockingRuleArgs.builder()        
                .configuration(UserAgentBlockingRuleConfigurationArgs.builder()
                    .target("ua")
                    .value("Chrome")
                    .build())
                .description("My description 1")
                .mode("js_challenge")
                .paused(false)
                .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
                .build());
    
            var example2 = new UserAgentBlockingRule("example2", UserAgentBlockingRuleArgs.builder()        
                .configuration(UserAgentBlockingRuleConfigurationArgs.builder()
                    .target("ua")
                    .value("Mozilla")
                    .build())
                .description("My description 22")
                .mode("challenge")
                .paused(true)
                .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
                .build());
    
        }
    }
    
    resources:
      example1:
        type: cloudflare:UserAgentBlockingRule
        properties:
          configuration:
            target: ua
            value: Chrome
          description: My description 1
          mode: js_challenge
          paused: false
          zoneId: 0da42c8d2132a9ddaf714f9e7c920711
      example2:
        type: cloudflare:UserAgentBlockingRule
        properties:
          configuration:
            target: ua
            value: Mozilla
          description: My description 22
          mode: challenge
          paused: true
          zoneId: 0da42c8d2132a9ddaf714f9e7c920711
    

    Create UserAgentBlockingRule Resource

    new UserAgentBlockingRule(name: string, args: UserAgentBlockingRuleArgs, opts?: CustomResourceOptions);
    @overload
    def UserAgentBlockingRule(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              configuration: Optional[UserAgentBlockingRuleConfigurationArgs] = None,
                              description: Optional[str] = None,
                              mode: Optional[str] = None,
                              paused: Optional[bool] = None,
                              zone_id: Optional[str] = None)
    @overload
    def UserAgentBlockingRule(resource_name: str,
                              args: UserAgentBlockingRuleArgs,
                              opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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

    The UserAgentBlockingRule resource accepts the following input properties:

    Configuration UserAgentBlockingRuleConfiguration
    The configuration object for the current rule.
    Description string
    An informative summary of the rule.
    Mode string
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    Paused bool
    When true, indicates that the rule is currently paused.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    Configuration UserAgentBlockingRuleConfigurationArgs
    The configuration object for the current rule.
    Description string
    An informative summary of the rule.
    Mode string
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    Paused bool
    When true, indicates that the rule is currently paused.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    configuration UserAgentBlockingRuleConfiguration
    The configuration object for the current rule.
    description String
    An informative summary of the rule.
    mode String
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    paused Boolean
    When true, indicates that the rule is currently paused.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    configuration UserAgentBlockingRuleConfiguration
    The configuration object for the current rule.
    description string
    An informative summary of the rule.
    mode string
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    paused boolean
    When true, indicates that the rule is currently paused.
    zoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    configuration UserAgentBlockingRuleConfigurationArgs
    The configuration object for the current rule.
    description str
    An informative summary of the rule.
    mode str
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    paused bool
    When true, indicates that the rule is currently paused.
    zone_id str
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    configuration Property Map
    The configuration object for the current rule.
    description String
    An informative summary of the rule.
    mode String
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    paused Boolean
    When true, indicates that the rule is currently paused.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

    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,
            description: Optional[str] = None,
            mode: Optional[str] = None,
            paused: Optional[bool] = 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)
    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:
    Configuration UserAgentBlockingRuleConfiguration
    The configuration object for the current rule.
    Description string
    An informative summary of the rule.
    Mode string
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    Paused bool
    When true, indicates that the rule is currently paused.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    Configuration UserAgentBlockingRuleConfigurationArgs
    The configuration object for the current rule.
    Description string
    An informative summary of the rule.
    Mode string
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    Paused bool
    When true, indicates that the rule is currently paused.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    configuration UserAgentBlockingRuleConfiguration
    The configuration object for the current rule.
    description String
    An informative summary of the rule.
    mode String
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    paused Boolean
    When true, indicates that the rule is currently paused.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    configuration UserAgentBlockingRuleConfiguration
    The configuration object for the current rule.
    description string
    An informative summary of the rule.
    mode string
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    paused boolean
    When true, indicates that the rule is currently paused.
    zoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    configuration UserAgentBlockingRuleConfigurationArgs
    The configuration object for the current rule.
    description str
    An informative summary of the rule.
    mode str
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    paused bool
    When true, indicates that the rule is currently paused.
    zone_id str
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    configuration Property Map
    The configuration object for the current rule.
    description String
    An informative summary of the rule.
    mode String
    The action to apply to a matched request. Available values: block, challenge, js_challenge, managed_challenge.
    paused Boolean
    When true, indicates that the rule is currently paused.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

    Supporting Types

    UserAgentBlockingRuleConfiguration, UserAgentBlockingRuleConfigurationArgs

    Target string
    The configuration target for this rule. You must set the target to ua for User Agent Blocking rules.
    Value string
    The exact user agent string to match. This value will be compared to the received User-Agent HTTP header value.
    Target string
    The configuration target for this rule. You must set the target to ua for User Agent Blocking rules.
    Value string
    The exact user agent string to match. This value will be compared to the received User-Agent HTTP header value.
    target String
    The configuration target for this rule. You must set the target to ua for User Agent Blocking rules.
    value String
    The exact user agent string to match. This value will be compared to the received User-Agent HTTP header value.
    target string
    The configuration target for this rule. You must set the target to ua for User Agent Blocking rules.
    value string
    The exact user agent string to match. This value will be compared to the received User-Agent HTTP header value.
    target str
    The configuration target for this rule. You must set the target to ua for User Agent Blocking rules.
    value str
    The exact user agent string to match. This value will be compared to the received User-Agent HTTP header value.
    target String
    The configuration target for this rule. You must set the target to ua for User Agent Blocking rules.
    value String
    The exact user agent string to match. This value will be compared to the received User-Agent HTTP header value.

    Import

    $ pulumi import cloudflare:index/userAgentBlockingRule:UserAgentBlockingRule example <zone_id>/<user_agent_blocking_rule_id>
    

    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 v5.24.0 published on Thursday, Mar 28, 2024 by Pulumi