1. Packages
  2. Auth0
  3. API Docs
  4. Hook
Auth0 v3.3.1 published on Thursday, Mar 14, 2024 by Pulumi

auth0.Hook

Explore with Pulumi AI

auth0 logo
Auth0 v3.3.1 published on Thursday, Mar 14, 2024 by Pulumi

    Hooks are secure, self-contained functions that allow you to customize the behavior of Auth0 when executed for selected extensibility points of the Auth0 platform. Auth0 invokes Hooks during runtime to execute your custom Node.js code. Depending on the extensibility point, you can use hooks with Database Connections and/or Passwordless Connections.

    !> This resource is deprecated. Refer to the guide on how to migrate from hooks 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 myHook = new auth0.Hook("myHook", {
        dependencies: {
            auth0: "2.30.0",
        },
        enabled: true,
        script: `    function (user, context, callback) {
          callback(null, { user });
        }
      
    `,
        secrets: {
            foo: "bar",
        },
        triggerId: "pre-user-registration",
    });
    
    import pulumi
    import pulumi_auth0 as auth0
    
    my_hook = auth0.Hook("myHook",
        dependencies={
            "auth0": "2.30.0",
        },
        enabled=True,
        script="""    function (user, context, callback) {
          callback(null, { user });
        }
      
    """,
        secrets={
            "foo": "bar",
        },
        trigger_id="pre-user-registration")
    
    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.NewHook(ctx, "myHook", &auth0.HookArgs{
    			Dependencies: pulumi.Map{
    				"auth0": pulumi.Any("2.30.0"),
    			},
    			Enabled: pulumi.Bool(true),
    			Script:  pulumi.String("    function (user, context, callback) {\n      callback(null, { user });\n    }\n  \n"),
    			Secrets: pulumi.Map{
    				"foo": pulumi.Any("bar"),
    			},
    			TriggerId: pulumi.String("pre-user-registration"),
    		})
    		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 myHook = new Auth0.Hook("myHook", new()
        {
            Dependencies = 
            {
                { "auth0", "2.30.0" },
            },
            Enabled = true,
            Script = @"    function (user, context, callback) {
          callback(null, { user });
        }
      
    ",
            Secrets = 
            {
                { "foo", "bar" },
            },
            TriggerId = "pre-user-registration",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.auth0.Hook;
    import com.pulumi.auth0.HookArgs;
    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 myHook = new Hook("myHook", HookArgs.builder()        
                .dependencies(Map.of("auth0", "2.30.0"))
                .enabled(true)
                .script("""
        function (user, context, callback) {
          callback(null, { user });
        }
      
                """)
                .secrets(Map.of("foo", "bar"))
                .triggerId("pre-user-registration")
                .build());
    
        }
    }
    
    resources:
      myHook:
        type: auth0:Hook
        properties:
          dependencies:
            auth0: 2.30.0
          enabled: true
          script: "    function (user, context, callback) {\n      callback(null, { user });\n    }\n  \n"
          secrets:
            foo: bar
          triggerId: pre-user-registration
    

    Create Hook Resource

    new Hook(name: string, args: HookArgs, opts?: CustomResourceOptions);
    @overload
    def Hook(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             dependencies: Optional[Mapping[str, Any]] = None,
             enabled: Optional[bool] = None,
             name: Optional[str] = None,
             script: Optional[str] = None,
             secrets: Optional[Mapping[str, Any]] = None,
             trigger_id: Optional[str] = None)
    @overload
    def Hook(resource_name: str,
             args: HookArgs,
             opts: Optional[ResourceOptions] = None)
    func NewHook(ctx *Context, name string, args HookArgs, opts ...ResourceOption) (*Hook, error)
    public Hook(string name, HookArgs args, CustomResourceOptions? opts = null)
    public Hook(String name, HookArgs args)
    public Hook(String name, HookArgs args, CustomResourceOptions options)
    
    type: auth0:Hook
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args HookArgs
    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 HookArgs
    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 HookArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args HookArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args HookArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    Script string
    Code to be executed when this hook runs.
    TriggerId string
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    Dependencies Dictionary<string, object>
    Dependencies of this hook used by the WebTask server.
    Enabled bool
    Whether the hook is enabled, or disabled.
    Name string
    Name of this hook.
    Secrets Dictionary<string, object>
    The secrets associated with the hook.
    Script string
    Code to be executed when this hook runs.
    TriggerId string
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    Dependencies map[string]interface{}
    Dependencies of this hook used by the WebTask server.
    Enabled bool
    Whether the hook is enabled, or disabled.
    Name string
    Name of this hook.
    Secrets map[string]interface{}
    The secrets associated with the hook.
    script String
    Code to be executed when this hook runs.
    triggerId String
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    dependencies Map<String,Object>
    Dependencies of this hook used by the WebTask server.
    enabled Boolean
    Whether the hook is enabled, or disabled.
    name String
    Name of this hook.
    secrets Map<String,Object>
    The secrets associated with the hook.
    script string
    Code to be executed when this hook runs.
    triggerId string
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    dependencies {[key: string]: any}
    Dependencies of this hook used by the WebTask server.
    enabled boolean
    Whether the hook is enabled, or disabled.
    name string
    Name of this hook.
    secrets {[key: string]: any}
    The secrets associated with the hook.
    script str
    Code to be executed when this hook runs.
    trigger_id str
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    dependencies Mapping[str, Any]
    Dependencies of this hook used by the WebTask server.
    enabled bool
    Whether the hook is enabled, or disabled.
    name str
    Name of this hook.
    secrets Mapping[str, Any]
    The secrets associated with the hook.
    script String
    Code to be executed when this hook runs.
    triggerId String
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    dependencies Map<Any>
    Dependencies of this hook used by the WebTask server.
    enabled Boolean
    Whether the hook is enabled, or disabled.
    name String
    Name of this hook.
    secrets Map<Any>
    The secrets associated with the hook.

    Outputs

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

    Get an existing Hook 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?: HookState, opts?: CustomResourceOptions): Hook
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            dependencies: Optional[Mapping[str, Any]] = None,
            enabled: Optional[bool] = None,
            name: Optional[str] = None,
            script: Optional[str] = None,
            secrets: Optional[Mapping[str, Any]] = None,
            trigger_id: Optional[str] = None) -> Hook
    func GetHook(ctx *Context, name string, id IDInput, state *HookState, opts ...ResourceOption) (*Hook, error)
    public static Hook Get(string name, Input<string> id, HookState? state, CustomResourceOptions? opts = null)
    public static Hook get(String name, Output<String> id, HookState 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:
    Dependencies Dictionary<string, object>
    Dependencies of this hook used by the WebTask server.
    Enabled bool
    Whether the hook is enabled, or disabled.
    Name string
    Name of this hook.
    Script string
    Code to be executed when this hook runs.
    Secrets Dictionary<string, object>
    The secrets associated with the hook.
    TriggerId string
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    Dependencies map[string]interface{}
    Dependencies of this hook used by the WebTask server.
    Enabled bool
    Whether the hook is enabled, or disabled.
    Name string
    Name of this hook.
    Script string
    Code to be executed when this hook runs.
    Secrets map[string]interface{}
    The secrets associated with the hook.
    TriggerId string
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    dependencies Map<String,Object>
    Dependencies of this hook used by the WebTask server.
    enabled Boolean
    Whether the hook is enabled, or disabled.
    name String
    Name of this hook.
    script String
    Code to be executed when this hook runs.
    secrets Map<String,Object>
    The secrets associated with the hook.
    triggerId String
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    dependencies {[key: string]: any}
    Dependencies of this hook used by the WebTask server.
    enabled boolean
    Whether the hook is enabled, or disabled.
    name string
    Name of this hook.
    script string
    Code to be executed when this hook runs.
    secrets {[key: string]: any}
    The secrets associated with the hook.
    triggerId string
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    dependencies Mapping[str, Any]
    Dependencies of this hook used by the WebTask server.
    enabled bool
    Whether the hook is enabled, or disabled.
    name str
    Name of this hook.
    script str
    Code to be executed when this hook runs.
    secrets Mapping[str, Any]
    The secrets associated with the hook.
    trigger_id str
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.
    dependencies Map<Any>
    Dependencies of this hook used by the WebTask server.
    enabled Boolean
    Whether the hook is enabled, or disabled.
    name String
    Name of this hook.
    script String
    Code to be executed when this hook runs.
    secrets Map<Any>
    The secrets associated with the hook.
    triggerId String
    Execution stage of this rule. Can be credentials-exchange, pre-user-registration, post-user-registration, post-change-password, or send-phone-message.

    Import

    This resource can be imported by specifying the hook ID.

    Example:

    $ pulumi import auth0:index/hook:Hook my_hook "00001"
    

    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.3.1 published on Thursday, Mar 14, 2024 by Pulumi