Auth0

Pulumi Official
Package maintained by Pulumi
v2.9.0 published on Thursday, May 26, 2022 by Pulumi

TriggerBinding

With this resource, you can bind an action to a trigger. Once an action is created and deployed, it 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.

Example Usage

using Pulumi;
using Auth0 = Pulumi.Auth0;

class MyStack : Stack
{
    public MyStack()
    {
        var actionFoo = new Auth0.Action("actionFoo", new Auth0.ActionArgs
        {
            SupportedTriggers = new Auth0.Inputs.ActionSupportedTriggersArgs
            {
                Id = "post-login",
                Version = "v2",
            },
            Code = @"exports.onContinuePostLogin = async (event, api) => { 
	console.log(""foo"") 
};""
",
            Deploy = true,
        });
        var actionBar = new Auth0.Action("actionBar", new Auth0.ActionArgs
        {
            SupportedTriggers = new Auth0.Inputs.ActionSupportedTriggersArgs
            {
                Id = "post-login",
                Version = "v2",
            },
            Code = @"exports.onContinuePostLogin = async (event, api) => { 
	console.log(""bar"") 
};""
",
            Deploy = true,
        });
        var loginFlow = new Auth0.TriggerBinding("loginFlow", new Auth0.TriggerBindingArgs
        {
            Trigger = "post-login",
            Actions = 
            {
                new Auth0.Inputs.TriggerBindingActionArgs
                {
                    Id = actionFoo.Id,
                    DisplayName = actionFoo.Name,
                },
                new Auth0.Inputs.TriggerBindingActionArgs
                {
                    Id = actionBar.Id,
                    DisplayName = actionBar.Name,
                },
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-auth0/sdk/v2/go/auth0"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		actionFoo, err := auth0.NewAction(ctx, "actionFoo", &auth0.ActionArgs{
			SupportedTriggers: &ActionSupportedTriggersArgs{
				Id:      pulumi.String("post-login"),
				Version: pulumi.String("v2"),
			},
			Code: pulumi.String(fmt.Sprintf("%v%v%v", "exports.onContinuePostLogin = async (event, api) => { \n", "	console.log(\"foo\") \n", "};\"\n")),
			Deploy: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		actionBar, err := auth0.NewAction(ctx, "actionBar", &auth0.ActionArgs{
			SupportedTriggers: &ActionSupportedTriggersArgs{
				Id:      pulumi.String("post-login"),
				Version: pulumi.String("v2"),
			},
			Code: pulumi.String(fmt.Sprintf("%v%v%v", "exports.onContinuePostLogin = async (event, api) => { \n", "	console.log(\"bar\") \n", "};\"\n")),
			Deploy: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = auth0.NewTriggerBinding(ctx, "loginFlow", &auth0.TriggerBindingArgs{
			Trigger: pulumi.String("post-login"),
			Actions: TriggerBindingActionArray{
				&TriggerBindingActionArgs{
					Id:          actionFoo.ID(),
					DisplayName: actionFoo.Name,
				},
				&TriggerBindingActionArgs{
					Id:          actionBar.ID(),
					DisplayName: actionBar.Name,
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

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()        
            .supportedTriggers(ActionSupportedTriggersArgs.builder()
                .id("post-login")
                .version("v2")
                .build())
            .code("""
exports.onContinuePostLogin = async (event, api) => { 
	console.log("foo") 
};"
            """)
            .deploy(true)
            .build());

        var actionBar = new Action("actionBar", ActionArgs.builder()        
            .supportedTriggers(ActionSupportedTriggersArgs.builder()
                .id("post-login")
                .version("v2")
                .build())
            .code("""
exports.onContinuePostLogin = async (event, api) => { 
	console.log("bar") 
};"
            """)
            .deploy(true)
            .build());

        var loginFlow = new TriggerBinding("loginFlow", TriggerBindingArgs.builder()        
            .trigger("post-login")
            .actions(            
                TriggerBindingActionArgs.builder()
                    .id(actionFoo.id())
                    .displayName(actionFoo.name())
                    .build(),
                TriggerBindingActionArgs.builder()
                    .id(actionBar.id())
                    .displayName(actionBar.name())
                    .build())
            .build());

    }
}
import pulumi
import pulumi_auth0 as auth0

action_foo = auth0.Action("actionFoo",
    supported_triggers=auth0.ActionSupportedTriggersArgs(
        id="post-login",
        version="v2",
    ),
    code="""exports.onContinuePostLogin = async (event, api) => { 
	console.log("foo") 
};"
""",
    deploy=True)
action_bar = auth0.Action("actionBar",
    supported_triggers=auth0.ActionSupportedTriggersArgs(
        id="post-login",
        version="v2",
    ),
    code="""exports.onContinuePostLogin = async (event, api) => { 
	console.log("bar") 
};"
""",
    deploy=True)
login_flow = auth0.TriggerBinding("loginFlow",
    trigger="post-login",
    actions=[
        auth0.TriggerBindingActionArgs(
            id=action_foo.id,
            display_name=action_foo.name,
        ),
        auth0.TriggerBindingActionArgs(
            id=action_bar.id,
            display_name=action_bar.name,
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as auth0 from "@pulumi/auth0";

const actionFoo = new auth0.Action("actionFoo", {
    supportedTriggers: {
        id: "post-login",
        version: "v2",
    },
    code: `exports.onContinuePostLogin = async (event, api) => { 
	console.log("foo") 
};"
`,
    deploy: true,
});
const actionBar = new auth0.Action("actionBar", {
    supportedTriggers: {
        id: "post-login",
        version: "v2",
    },
    code: `exports.onContinuePostLogin = async (event, api) => { 
	console.log("bar") 
};"
`,
    deploy: true,
});
const loginFlow = new auth0.TriggerBinding("loginFlow", {
    trigger: "post-login",
    actions: [
        {
            id: actionFoo.id,
            displayName: actionFoo.name,
        },
        {
            id: actionBar.id,
            displayName: actionBar.name,
        },
    ],
});
resources:
  actionFoo:
    type: auth0:Action
    properties:
      supportedTriggers:
        id: post-login
        version: v2
      code: "exports.onContinuePostLogin = async (event, api) => { \n\tconsole.log(\"foo\") \n};\"\n"
      deploy: true
  actionBar:
    type: auth0:Action
    properties:
      supportedTriggers:
        id: post-login
        version: v2
      code: "exports.onContinuePostLogin = async (event, api) => { \n\tconsole.log(\"bar\") \n};\"\n"
      deploy: true
  loginFlow:
    type: auth0:TriggerBinding
    properties:
      trigger: post-login
      actions:
        - id: ${actionFoo.id}
          displayName: ${actionFoo.name}
        - id: ${actionBar.id}
          displayName: ${actionBar.name}

Create a TriggerBinding Resource

new TriggerBinding(name: string, args: TriggerBindingArgs, opts?: CustomResourceOptions);
@overload
def TriggerBinding(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   actions: Optional[Sequence[TriggerBindingActionArgs]] = None,
                   trigger: Optional[str] = None)
@overload
def TriggerBinding(resource_name: str,
                   args: TriggerBindingArgs,
                   opts: Optional[ResourceOptions] = None)
func NewTriggerBinding(ctx *Context, name string, args TriggerBindingArgs, opts ...ResourceOption) (*TriggerBinding, error)
public TriggerBinding(string name, TriggerBindingArgs args, CustomResourceOptions? opts = null)
public TriggerBinding(String name, TriggerBindingArgs args)
public TriggerBinding(String name, TriggerBindingArgs args, CustomResourceOptions options)
type: auth0:TriggerBinding
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args TriggerBindingArgs
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 TriggerBindingArgs
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 TriggerBindingArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args TriggerBindingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args TriggerBindingArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Actions List<TriggerBindingActionArgs>

The actions bound to this trigger. For details, see Actions.

Trigger string

The id of the trigger to bind with

Actions []TriggerBindingActionArgs

The actions bound to this trigger. For details, see Actions.

Trigger string

The id of the trigger to bind with

actions List<TriggerBindingActionArgs>

The actions bound to this trigger. For details, see Actions.

trigger String

The id of the trigger to bind with

actions TriggerBindingActionArgs[]

The actions bound to this trigger. For details, see Actions.

trigger string

The id of the trigger to bind with

actions Sequence[TriggerBindingActionArgs]

The actions bound to this trigger. For details, see Actions.

trigger str

The id of the trigger to bind with

actions List<Property Map>

The actions bound to this trigger. For details, see Actions.

trigger String

The id of the trigger to bind with

Outputs

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

Get an existing TriggerBinding 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?: TriggerBindingState, opts?: CustomResourceOptions): TriggerBinding
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        actions: Optional[Sequence[TriggerBindingActionArgs]] = None,
        trigger: Optional[str] = None) -> TriggerBinding
func GetTriggerBinding(ctx *Context, name string, id IDInput, state *TriggerBindingState, opts ...ResourceOption) (*TriggerBinding, error)
public static TriggerBinding Get(string name, Input<string> id, TriggerBindingState? state, CustomResourceOptions? opts = null)
public static TriggerBinding get(String name, Output<String> id, TriggerBindingState 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<TriggerBindingActionArgs>

The actions bound to this trigger. For details, see Actions.

Trigger string

The id of the trigger to bind with

Actions []TriggerBindingActionArgs

The actions bound to this trigger. For details, see Actions.

Trigger string

The id of the trigger to bind with

actions List<TriggerBindingActionArgs>

The actions bound to this trigger. For details, see Actions.

trigger String

The id of the trigger to bind with

actions TriggerBindingActionArgs[]

The actions bound to this trigger. For details, see Actions.

trigger string

The id of the trigger to bind with

actions Sequence[TriggerBindingActionArgs]

The actions bound to this trigger. For details, see Actions.

trigger str

The id of the trigger to bind with

actions List<Property Map>

The actions bound to this trigger. For details, see Actions.

trigger String

The id of the trigger to bind with

Supporting Types

TriggerBindingAction

DisplayName string

The name of an action.

Id string

Trigger ID.

DisplayName string

The name of an action.

Id string

Trigger ID.

displayName String

The name of an action.

id String

Trigger ID.

displayName string

The name of an action.

id string

Trigger ID.

display_name str

The name of an action.

id str

Trigger ID.

displayName String

The name of an action.

id String

Trigger ID.

Import

auth0_trigger_binding can be imported using the bindings trigger ID, e.g.

 $ pulumi import auth0:index/triggerBinding:TriggerBinding example "post-login"

Package Details

Repository
https://github.com/pulumi/pulumi-auth0
License
Apache-2.0
Notes

This Pulumi package is based on the auth0 Terraform Provider.