1. Packages
  2. Auth0 Provider
  3. API Docs
  4. Rule
Auth0 v3.8.3 published on Wednesday, Nov 6, 2024 by Pulumi

auth0.Rule

Explore with Pulumi AI

auth0 logo
Auth0 v3.8.3 published on Wednesday, Nov 6, 2024 by Pulumi

    With Auth0, you can create custom Javascript snippets that run in a secure, isolated sandbox as part of your authentication pipeline, which are otherwise known as rules. This resource allows you to create and manage rules. You can create global variable for use with rules by using the auth0.RuleConfig resource.

    !> This resource is deprecated. Refer to the guide on how to migrate from rules to actions and manage your actions using the auth0.Action resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as auth0 from "@pulumi/auth0";
    
    const myRule = new auth0.Rule("my_rule", {
        name: "empty-rule",
        script: `    function (user, context, callback) {
          callback(null, user, context);
        }
    `,
        enabled: true,
    });
    
    import pulumi
    import pulumi_auth0 as auth0
    
    my_rule = auth0.Rule("my_rule",
        name="empty-rule",
        script="""    function (user, context, callback) {
          callback(null, user, context);
        }
    """,
        enabled=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := auth0.NewRule(ctx, "my_rule", &auth0.RuleArgs{
    			Name:    pulumi.String("empty-rule"),
    			Script:  pulumi.String("    function (user, context, callback) {\n      callback(null, user, context);\n    }\n"),
    			Enabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Auth0 = Pulumi.Auth0;
    
    return await Deployment.RunAsync(() => 
    {
        var myRule = new Auth0.Rule("my_rule", new()
        {
            Name = "empty-rule",
            Script = @"    function (user, context, callback) {
          callback(null, user, context);
        }
    ",
            Enabled = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.auth0.Rule;
    import com.pulumi.auth0.RuleArgs;
    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 myRule = new Rule("myRule", RuleArgs.builder()
                .name("empty-rule")
                .script("""
        function (user, context, callback) {
          callback(null, user, context);
        }
                """)
                .enabled(true)
                .build());
    
        }
    }
    
    resources:
      myRule:
        type: auth0:Rule
        name: my_rule
        properties:
          name: empty-rule
          script: |2
                function (user, context, callback) {
                  callback(null, user, context);
                }
          enabled: true
    

    Create Rule Resource

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

    Constructor syntax

    new Rule(name: string, args: RuleArgs, opts?: CustomResourceOptions);
    @overload
    def Rule(resource_name: str,
             args: RuleArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Rule(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             script: Optional[str] = None,
             enabled: Optional[bool] = None,
             name: Optional[str] = None,
             order: Optional[int] = None)
    func NewRule(ctx *Context, name string, args RuleArgs, opts ...ResourceOption) (*Rule, error)
    public Rule(string name, RuleArgs args, CustomResourceOptions? opts = null)
    public Rule(String name, RuleArgs args)
    public Rule(String name, RuleArgs args, CustomResourceOptions options)
    
    type: auth0:Rule
    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 RuleArgs
    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 RuleArgs
    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 RuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RuleArgs
    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 ruleResource = new Auth0.Rule("ruleResource", new()
    {
        Script = "string",
        Enabled = false,
        Name = "string",
        Order = 0,
    });
    
    example, err := auth0.NewRule(ctx, "ruleResource", &auth0.RuleArgs{
    	Script:  pulumi.String("string"),
    	Enabled: pulumi.Bool(false),
    	Name:    pulumi.String("string"),
    	Order:   pulumi.Int(0),
    })
    
    var ruleResource = new Rule("ruleResource", RuleArgs.builder()
        .script("string")
        .enabled(false)
        .name("string")
        .order(0)
        .build());
    
    rule_resource = auth0.Rule("ruleResource",
        script="string",
        enabled=False,
        name="string",
        order=0)
    
    const ruleResource = new auth0.Rule("ruleResource", {
        script: "string",
        enabled: false,
        name: "string",
        order: 0,
    });
    
    type: auth0:Rule
    properties:
        enabled: false
        name: string
        order: 0
        script: string
    

    Rule 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 Rule resource accepts the following input properties:

    Script string
    Code to be executed when the rule runs.
    Enabled bool
    Indicates whether the rule is enabled.
    Name string
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    Order int
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    Script string
    Code to be executed when the rule runs.
    Enabled bool
    Indicates whether the rule is enabled.
    Name string
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    Order int
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    script String
    Code to be executed when the rule runs.
    enabled Boolean
    Indicates whether the rule is enabled.
    name String
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    order Integer
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    script string
    Code to be executed when the rule runs.
    enabled boolean
    Indicates whether the rule is enabled.
    name string
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    order number
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    script str
    Code to be executed when the rule runs.
    enabled bool
    Indicates whether the rule is enabled.
    name str
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    order int
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    script String
    Code to be executed when the rule runs.
    enabled Boolean
    Indicates whether the rule is enabled.
    name String
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    order Number
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.

    Outputs

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

    Get an existing Rule 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?: RuleState, opts?: CustomResourceOptions): Rule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            enabled: Optional[bool] = None,
            name: Optional[str] = None,
            order: Optional[int] = None,
            script: Optional[str] = None) -> Rule
    func GetRule(ctx *Context, name string, id IDInput, state *RuleState, opts ...ResourceOption) (*Rule, error)
    public static Rule Get(string name, Input<string> id, RuleState? state, CustomResourceOptions? opts = null)
    public static Rule get(String name, Output<String> id, RuleState 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:
    Enabled bool
    Indicates whether the rule is enabled.
    Name string
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    Order int
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    Script string
    Code to be executed when the rule runs.
    Enabled bool
    Indicates whether the rule is enabled.
    Name string
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    Order int
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    Script string
    Code to be executed when the rule runs.
    enabled Boolean
    Indicates whether the rule is enabled.
    name String
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    order Integer
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    script String
    Code to be executed when the rule runs.
    enabled boolean
    Indicates whether the rule is enabled.
    name string
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    order number
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    script string
    Code to be executed when the rule runs.
    enabled bool
    Indicates whether the rule is enabled.
    name str
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    order int
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    script str
    Code to be executed when the rule runs.
    enabled Boolean
    Indicates whether the rule is enabled.
    name String
    Name of the rule. May only contain alphanumeric characters, spaces, and hyphens. May neither start nor end with hyphens or spaces.
    order Number
    Order in which the rule executes relative to other rules. Lower-valued rules execute first.
    script String
    Code to be executed when the rule runs.

    Import

    Existing rules can be imported using their ID.

    Example:

    $ pulumi import auth0:index/rule:Rule my_rule "rul_XXXXXXXXXXXXX"
    

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

    Package Details

    Repository
    Auth0 pulumi/pulumi-auth0
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the auth0 Terraform Provider.
    auth0 logo
    Auth0 v3.8.3 published on Wednesday, Nov 6, 2024 by Pulumi