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

auth0.TriggerActions

Explore with Pulumi AI

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

    With this resource, you can bind actions to a trigger. Once actions are created and deployed, they can be attached (i.e. bound) to a trigger so that it will be executed as part of a flow. The list of actions reflects the order in which they will be executed during the appropriate flow.

    !> This resource manages all the action bindings to a trigger. In contrast, the auth0.TriggerAction resource only appends an action to the trigger binding. To avoid potential issues, it is recommended not to use this resource in conjunction with the auth0.TriggerAction resource when binding actions to the same trigger.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as auth0 from "@pulumi/auth0";
    
    const actionFoo = new auth0.Action("action_foo", {
        name: "Test Trigger Binding Foo",
        code: `exports.onContinuePostLogin = async (event, api) => {
      console.log("foo");
    };"
    `,
        deploy: true,
        supportedTriggers: {
            id: "post-login",
            version: "v3",
        },
    });
    const actionBar = new auth0.Action("action_bar", {
        name: "Test Trigger Binding Bar",
        code: `exports.onContinuePostLogin = async (event, api) => {
      console.log("bar");
    };"
    `,
        deploy: true,
        supportedTriggers: {
            id: "post-login",
            version: "v3",
        },
    });
    const loginFlow = new auth0.TriggerActions("login_flow", {
        trigger: "post-login",
        actions: [
            {
                id: actionFoo.id,
                displayName: actionFoo.name,
            },
            {
                id: actionBar.id,
                displayName: actionBar.name,
            },
        ],
    });
    
    import pulumi
    import pulumi_auth0 as auth0
    
    action_foo = auth0.Action("action_foo",
        name="Test Trigger Binding Foo",
        code="""exports.onContinuePostLogin = async (event, api) => {
      console.log("foo");
    };"
    """,
        deploy=True,
        supported_triggers={
            "id": "post-login",
            "version": "v3",
        })
    action_bar = auth0.Action("action_bar",
        name="Test Trigger Binding Bar",
        code="""exports.onContinuePostLogin = async (event, api) => {
      console.log("bar");
    };"
    """,
        deploy=True,
        supported_triggers={
            "id": "post-login",
            "version": "v3",
        })
    login_flow = auth0.TriggerActions("login_flow",
        trigger="post-login",
        actions=[
            {
                "id": action_foo.id,
                "display_name": action_foo.name,
            },
            {
                "id": action_bar.id,
                "display_name": action_bar.name,
            },
        ])
    
    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 {
    		actionFoo, err := auth0.NewAction(ctx, "action_foo", &auth0.ActionArgs{
    			Name:   pulumi.String("Test Trigger Binding Foo"),
    			Code:   pulumi.String("exports.onContinuePostLogin = async (event, api) => {\n  console.log(\"foo\");\n};\"\n"),
    			Deploy: pulumi.Bool(true),
    			SupportedTriggers: &auth0.ActionSupportedTriggersArgs{
    				Id:      pulumi.String("post-login"),
    				Version: pulumi.String("v3"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		actionBar, err := auth0.NewAction(ctx, "action_bar", &auth0.ActionArgs{
    			Name:   pulumi.String("Test Trigger Binding Bar"),
    			Code:   pulumi.String("exports.onContinuePostLogin = async (event, api) => {\n  console.log(\"bar\");\n};\"\n"),
    			Deploy: pulumi.Bool(true),
    			SupportedTriggers: &auth0.ActionSupportedTriggersArgs{
    				Id:      pulumi.String("post-login"),
    				Version: pulumi.String("v3"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewTriggerActions(ctx, "login_flow", &auth0.TriggerActionsArgs{
    			Trigger: pulumi.String("post-login"),
    			Actions: auth0.TriggerActionsActionArray{
    				&auth0.TriggerActionsActionArgs{
    					Id:          actionFoo.ID(),
    					DisplayName: actionFoo.Name,
    				},
    				&auth0.TriggerActionsActionArgs{
    					Id:          actionBar.ID(),
    					DisplayName: actionBar.Name,
    				},
    			},
    		})
    		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 actionFoo = new Auth0.Action("action_foo", new()
        {
            Name = "Test Trigger Binding Foo",
            Code = @"exports.onContinuePostLogin = async (event, api) => {
      console.log(""foo"");
    };""
    ",
            Deploy = true,
            SupportedTriggers = new Auth0.Inputs.ActionSupportedTriggersArgs
            {
                Id = "post-login",
                Version = "v3",
            },
        });
    
        var actionBar = new Auth0.Action("action_bar", new()
        {
            Name = "Test Trigger Binding Bar",
            Code = @"exports.onContinuePostLogin = async (event, api) => {
      console.log(""bar"");
    };""
    ",
            Deploy = true,
            SupportedTriggers = new Auth0.Inputs.ActionSupportedTriggersArgs
            {
                Id = "post-login",
                Version = "v3",
            },
        });
    
        var loginFlow = new Auth0.TriggerActions("login_flow", new()
        {
            Trigger = "post-login",
            Actions = new[]
            {
                new Auth0.Inputs.TriggerActionsActionArgs
                {
                    Id = actionFoo.Id,
                    DisplayName = actionFoo.Name,
                },
                new Auth0.Inputs.TriggerActionsActionArgs
                {
                    Id = actionBar.Id,
                    DisplayName = actionBar.Name,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.auth0.Action;
    import com.pulumi.auth0.ActionArgs;
    import com.pulumi.auth0.inputs.ActionSupportedTriggersArgs;
    import com.pulumi.auth0.TriggerActions;
    import com.pulumi.auth0.TriggerActionsArgs;
    import com.pulumi.auth0.inputs.TriggerActionsActionArgs;
    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 actionFoo = new Action("actionFoo", ActionArgs.builder()
                .name("Test Trigger Binding Foo")
                .code("""
    exports.onContinuePostLogin = async (event, api) => {
      console.log("foo");
    };"
                """)
                .deploy(true)
                .supportedTriggers(ActionSupportedTriggersArgs.builder()
                    .id("post-login")
                    .version("v3")
                    .build())
                .build());
    
            var actionBar = new Action("actionBar", ActionArgs.builder()
                .name("Test Trigger Binding Bar")
                .code("""
    exports.onContinuePostLogin = async (event, api) => {
      console.log("bar");
    };"
                """)
                .deploy(true)
                .supportedTriggers(ActionSupportedTriggersArgs.builder()
                    .id("post-login")
                    .version("v3")
                    .build())
                .build());
    
            var loginFlow = new TriggerActions("loginFlow", TriggerActionsArgs.builder()
                .trigger("post-login")
                .actions(            
                    TriggerActionsActionArgs.builder()
                        .id(actionFoo.id())
                        .displayName(actionFoo.name())
                        .build(),
                    TriggerActionsActionArgs.builder()
                        .id(actionBar.id())
                        .displayName(actionBar.name())
                        .build())
                .build());
    
        }
    }
    
    resources:
      actionFoo:
        type: auth0:Action
        name: action_foo
        properties:
          name: Test Trigger Binding Foo
          code: |
            exports.onContinuePostLogin = async (event, api) => {
              console.log("foo");
            };"        
          deploy: true
          supportedTriggers:
            id: post-login
            version: v3
      actionBar:
        type: auth0:Action
        name: action_bar
        properties:
          name: Test Trigger Binding Bar
          code: |
            exports.onContinuePostLogin = async (event, api) => {
              console.log("bar");
            };"        
          deploy: true
          supportedTriggers:
            id: post-login
            version: v3
      loginFlow:
        type: auth0:TriggerActions
        name: login_flow
        properties:
          trigger: post-login
          actions:
            - id: ${actionFoo.id}
              displayName: ${actionFoo.name}
            - id: ${actionBar.id}
              displayName: ${actionBar.name}
    

    Create TriggerActions Resource

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

    Constructor syntax

    new TriggerActions(name: string, args: TriggerActionsArgs, opts?: CustomResourceOptions);
    @overload
    def TriggerActions(resource_name: str,
                       args: TriggerActionsArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def TriggerActions(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       actions: Optional[Sequence[TriggerActionsActionArgs]] = None,
                       trigger: Optional[str] = None)
    func NewTriggerActions(ctx *Context, name string, args TriggerActionsArgs, opts ...ResourceOption) (*TriggerActions, error)
    public TriggerActions(string name, TriggerActionsArgs args, CustomResourceOptions? opts = null)
    public TriggerActions(String name, TriggerActionsArgs args)
    public TriggerActions(String name, TriggerActionsArgs args, CustomResourceOptions options)
    
    type: auth0:TriggerActions
    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 TriggerActionsArgs
    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 TriggerActionsArgs
    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 TriggerActionsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TriggerActionsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TriggerActionsArgs
    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 triggerActionsResource = new Auth0.TriggerActions("triggerActionsResource", new()
    {
        Actions = new[]
        {
            new Auth0.Inputs.TriggerActionsActionArgs
            {
                DisplayName = "string",
                Id = "string",
            },
        },
        Trigger = "string",
    });
    
    example, err := auth0.NewTriggerActions(ctx, "triggerActionsResource", &auth0.TriggerActionsArgs{
    	Actions: auth0.TriggerActionsActionArray{
    		&auth0.TriggerActionsActionArgs{
    			DisplayName: pulumi.String("string"),
    			Id:          pulumi.String("string"),
    		},
    	},
    	Trigger: pulumi.String("string"),
    })
    
    var triggerActionsResource = new TriggerActions("triggerActionsResource", TriggerActionsArgs.builder()
        .actions(TriggerActionsActionArgs.builder()
            .displayName("string")
            .id("string")
            .build())
        .trigger("string")
        .build());
    
    trigger_actions_resource = auth0.TriggerActions("triggerActionsResource",
        actions=[{
            "display_name": "string",
            "id": "string",
        }],
        trigger="string")
    
    const triggerActionsResource = new auth0.TriggerActions("triggerActionsResource", {
        actions: [{
            displayName: "string",
            id: "string",
        }],
        trigger: "string",
    });
    
    type: auth0:TriggerActions
    properties:
        actions:
            - displayName: string
              id: string
        trigger: string
    

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

    Actions List<TriggerActionsAction>
    The list of actions bound to this trigger.
    Trigger string
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    Actions []TriggerActionsActionArgs
    The list of actions bound to this trigger.
    Trigger string
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    actions List<TriggerActionsAction>
    The list of actions bound to this trigger.
    trigger String
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    actions TriggerActionsAction[]
    The list of actions bound to this trigger.
    trigger string
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    actions Sequence[TriggerActionsActionArgs]
    The list of actions bound to this trigger.
    trigger str
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    actions List<Property Map>
    The list of actions bound to this trigger.
    trigger String
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.

    Outputs

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

    Get an existing TriggerActions 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?: TriggerActionsState, opts?: CustomResourceOptions): TriggerActions
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            actions: Optional[Sequence[TriggerActionsActionArgs]] = None,
            trigger: Optional[str] = None) -> TriggerActions
    func GetTriggerActions(ctx *Context, name string, id IDInput, state *TriggerActionsState, opts ...ResourceOption) (*TriggerActions, error)
    public static TriggerActions Get(string name, Input<string> id, TriggerActionsState? state, CustomResourceOptions? opts = null)
    public static TriggerActions get(String name, Output<String> id, TriggerActionsState 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:
    Actions List<TriggerActionsAction>
    The list of actions bound to this trigger.
    Trigger string
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    Actions []TriggerActionsActionArgs
    The list of actions bound to this trigger.
    Trigger string
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    actions List<TriggerActionsAction>
    The list of actions bound to this trigger.
    trigger String
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    actions TriggerActionsAction[]
    The list of actions bound to this trigger.
    trigger string
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    actions Sequence[TriggerActionsActionArgs]
    The list of actions bound to this trigger.
    trigger str
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.
    actions List<Property Map>
    The list of actions bound to this trigger.
    trigger String
    The ID of the trigger to bind with. Options include: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge.

    Supporting Types

    TriggerActionsAction, TriggerActionsActionArgs

    DisplayName string
    The display name of the action within the flow.
    Id string
    Action ID.
    DisplayName string
    The display name of the action within the flow.
    Id string
    Action ID.
    displayName String
    The display name of the action within the flow.
    id String
    Action ID.
    displayName string
    The display name of the action within the flow.
    id string
    Action ID.
    display_name str
    The display name of the action within the flow.
    id str
    Action ID.
    displayName String
    The display name of the action within the flow.
    id String
    Action ID.

    Import

    This resource can be imported using the bindings trigger ID.

    Example:

    $ pulumi import auth0:index/triggerActions:TriggerActions example "post-login"
    

    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