auth0.Hook
Explore with Pulumi AI
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("my_hook", {
name: "My Pre User Registration Hook",
script: ` function (user, context, callback) {
callback(null, { user });
}
`,
triggerId: "pre-user-registration",
enabled: true,
secrets: {
foo: "bar",
},
dependencies: {
auth0: "2.30.0",
},
});
import pulumi
import pulumi_auth0 as auth0
my_hook = auth0.Hook("my_hook",
name="My Pre User Registration Hook",
script=""" function (user, context, callback) {
callback(null, { user });
}
""",
trigger_id="pre-user-registration",
enabled=True,
secrets={
"foo": "bar",
},
dependencies={
"auth0": "2.30.0",
})
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, "my_hook", &auth0.HookArgs{
Name: pulumi.String("My Pre User Registration Hook"),
Script: pulumi.String(" function (user, context, callback) {\n callback(null, { user });\n }\n"),
TriggerId: pulumi.String("pre-user-registration"),
Enabled: pulumi.Bool(true),
Secrets: pulumi.StringMap{
"foo": pulumi.String("bar"),
},
Dependencies: pulumi.StringMap{
"auth0": pulumi.String("2.30.0"),
},
})
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("my_hook", new()
{
Name = "My Pre User Registration Hook",
Script = @" function (user, context, callback) {
callback(null, { user });
}
",
TriggerId = "pre-user-registration",
Enabled = true,
Secrets =
{
{ "foo", "bar" },
},
Dependencies =
{
{ "auth0", "2.30.0" },
},
});
});
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()
.name("My Pre User Registration Hook")
.script("""
function (user, context, callback) {
callback(null, { user });
}
""")
.triggerId("pre-user-registration")
.enabled(true)
.secrets(Map.of("foo", "bar"))
.dependencies(Map.of("auth0", "2.30.0"))
.build());
}
}
resources:
myHook:
type: auth0:Hook
name: my_hook
properties:
name: My Pre User Registration Hook
script: |2
function (user, context, callback) {
callback(null, { user });
}
triggerId: pre-user-registration
enabled: true
secrets:
foo: bar
dependencies:
auth0: 2.30.0
Create Hook Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Hook(name: string, args: HookArgs, opts?: CustomResourceOptions);
@overload
def Hook(resource_name: str,
args: HookArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Hook(resource_name: str,
opts: Optional[ResourceOptions] = None,
script: Optional[str] = None,
trigger_id: Optional[str] = None,
dependencies: Optional[Mapping[str, str]] = None,
enabled: Optional[bool] = None,
name: Optional[str] = None,
secrets: Optional[Mapping[str, str]] = None)
func NewHook(ctx *Context, name string, args HookArgs, opts ...ResourceOption) (*Hook, error)
public Hook(string name, HookArgs args, CustomResourceOptions? opts = null)
type: auth0:Hook
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 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var hookResource = new Auth0.Hook("hookResource", new()
{
Script = "string",
TriggerId = "string",
Dependencies =
{
{ "string", "string" },
},
Enabled = false,
Name = "string",
Secrets =
{
{ "string", "string" },
},
});
example, err := auth0.NewHook(ctx, "hookResource", &auth0.HookArgs{
Script: pulumi.String("string"),
TriggerId: pulumi.String("string"),
Dependencies: pulumi.StringMap{
"string": pulumi.String("string"),
},
Enabled: pulumi.Bool(false),
Name: pulumi.String("string"),
Secrets: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var hookResource = new Hook("hookResource", HookArgs.builder()
.script("string")
.triggerId("string")
.dependencies(Map.of("string", "string"))
.enabled(false)
.name("string")
.secrets(Map.of("string", "string"))
.build());
hook_resource = auth0.Hook("hookResource",
script="string",
trigger_id="string",
dependencies={
"string": "string",
},
enabled=False,
name="string",
secrets={
"string": "string",
})
const hookResource = new auth0.Hook("hookResource", {
script: "string",
triggerId: "string",
dependencies: {
string: "string",
},
enabled: false,
name: "string",
secrets: {
string: "string",
},
});
type: auth0:Hook
properties:
dependencies:
string: string
enabled: false
name: string
script: string
secrets:
string: string
triggerId: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Hook resource accepts the following input properties:
- Script string
- Code to be executed when this hook runs.
- Trigger
Id 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, string>
- 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, string>
- The secrets associated with the hook.
- Script string
- Code to be executed when this hook runs.
- Trigger
Id 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]string
- 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]string
- The secrets associated with the hook.
- script String
- Code to be executed when this hook runs.
- trigger
Id 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,String>
- 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,String>
- The secrets associated with the hook.
- script string
- Code to be executed when this hook runs.
- trigger
Id 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]: string}
- 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]: string}
- 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, str]
- 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, str]
- The secrets associated with the hook.
- script String
- Code to be executed when this hook runs.
- trigger
Id 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>
- 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>
- 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, str]] = None,
enabled: Optional[bool] = None,
name: Optional[str] = None,
script: Optional[str] = None,
secrets: Optional[Mapping[str, str]] = 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.
- Dependencies Dictionary<string, string>
- 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, string>
- The secrets associated with the hook.
- Trigger
Id 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]string
- 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]string
- The secrets associated with the hook.
- Trigger
Id 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,String>
- 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,String>
- The secrets associated with the hook.
- trigger
Id 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]: string}
- 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]: string}
- The secrets associated with the hook.
- trigger
Id 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, str]
- 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, str]
- 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<String>
- 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>
- The secrets associated with the hook.
- trigger
Id 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"
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.