From 5532b736fad56ef2d84c6853eb329788dd2d4851 Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea Date: Mon, 17 Oct 2022 13:40:14 +0200 Subject: [PATCH 1/7] Add guide on how to retrieve available action triggers --- docs/guides/action_triggers.md | 208 +++++++++++++++++++++ docs/guides/quickstart.md | 2 +- docs/resources/action.md | 2 +- internal/provider/resource_auth0_action.go | 4 +- templates/guides/action_triggers.md | 208 +++++++++++++++++++++ templates/guides/quickstart.md | 2 +- 6 files changed, 422 insertions(+), 4 deletions(-) create mode 100644 docs/guides/action_triggers.md create mode 100644 templates/guides/action_triggers.md diff --git a/docs/guides/action_triggers.md b/docs/guides/action_triggers.md new file mode 100644 index 000000000..dce457240 --- /dev/null +++ b/docs/guides/action_triggers.md @@ -0,0 +1,208 @@ +--- +page_title: Retrieve triggers available within actions +description: |- +Retrieve the set of triggers currently available within actions. +--- + +# Retrieving the set of triggers available within actions + +In this guide we'll show how to retrieve the set of triggers currently available within actions. +A trigger is an extensibility point to which actions can be bound. + +## Get an API Explorer Token + +Head to the APIs section of your [Auth0 Dashboard](https://manage.auth0.com/#/apis) and click on the +**Auth0 Management API**. + +get_api_explorer_token_1 + +Click on the **Create & Authorize Test Application** within the **API Explorer** tab. + +get_api_explorer_token_2 + +Copy the **Token** contents and go to the [Management API Explorer](https://auth0.com/docs/api/management/v2). + +get_api_explorer_token_3 + +Click the **Set API Token** button at the top left. + +Set the **API Token** by pasting the **Token** that you copied above. + +Click the **Set Token** button. + +get_api_explorer_token_4 + +Retrieve the set of triggers available within actions by clicking on the **Try** button at +[https://auth0.com/docs/api/management/v2#!/Actions/get_triggers](https://auth0.com/docs/api/management/v2#!/Actions/get_triggers). + +get_api_explorer_token_5 + + +At the time of writing (_2022-10-17_) the available triggers are the following: + +```json +{ + "triggers": [ + { + "id": "post-login", + "version": "v2", + "status": "DEPRECATED", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "post-login", + "version": "v3", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [ + { + "id": "post-login", + "version": "v2" + } + ] + }, + { + "id": "post-login", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "credentials-exchange", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "credentials-exchange", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "pre-user-registration", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "pre-user-registration", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "post-user-registration", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "post-user-registration", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "post-change-password", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "post-change-password", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "send-phone-message", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "send-phone-message", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "compatible_triggers": [] + } + ] +} +``` + +Use these to set up your `supported_triggers` block within the `auth0_action` resource: + +```terraform +resource "auth0_action" "my_action" { + name = format("Test Action %s", timestamp()) + runtime = "node16" + code = <<-EOT + exports.onExecutePostLogin = async (event, api) => { + console.log(event); + }; + EOT + + supported_triggers { + id = "post-login" + version = "v3" + } +} +``` diff --git a/docs/guides/quickstart.md b/docs/guides/quickstart.md index 415f2ed3b..be8b9cf38 100644 --- a/docs/guides/quickstart.md +++ b/docs/guides/quickstart.md @@ -1,5 +1,5 @@ --- -page_title: "Getting Started" +page_title: Quickstart description: |- Quickly get started with the Auth0 Provider. --- diff --git a/docs/resources/action.md b/docs/resources/action.md index 7679ee44a..fa06128d3 100644 --- a/docs/resources/action.md +++ b/docs/resources/action.md @@ -61,7 +61,7 @@ resource "auth0_action" "my_action" { - `code` (String) The source code of the action. - `name` (String) The name of the action. -- `supported_triggers` (Block List, Min: 1, Max: 1) List of triggers that this action supports. At this time, an action can only target a single trigger at a time. (see [below for nested schema](#nestedblock--supported_triggers)) +- `supported_triggers` (Block List, Min: 1, Max: 1) List of triggers that this action supports. At this time, an action can only target a single trigger at a time. Read [Retrieving the set of triggers available within actions](https://registry.terraform.io/providers/auth0/auth0/latest/docs/guides/action_triggers)to retrieve the latest trigger versions supported. (see [below for nested schema](#nestedblock--supported_triggers)) ### Optional diff --git a/internal/provider/resource_auth0_action.go b/internal/provider/resource_auth0_action.go index dd990e93a..ad4abfc35 100644 --- a/internal/provider/resource_auth0_action.go +++ b/internal/provider/resource_auth0_action.go @@ -54,7 +54,9 @@ func newAction() *schema.Resource { }, }, Description: "List of triggers that this action supports. " + - "At this time, an action can only target a single trigger at a time.", + "At this time, an action can only target a single trigger at a time. " + + "Read [Retrieving the set of triggers available within actions](https://registry.terraform.io/providers/auth0/auth0/latest/docs/guides/action_triggers)" + + "to retrieve the latest trigger versions supported.", }, "code": { Type: schema.TypeString, diff --git a/templates/guides/action_triggers.md b/templates/guides/action_triggers.md new file mode 100644 index 000000000..dce457240 --- /dev/null +++ b/templates/guides/action_triggers.md @@ -0,0 +1,208 @@ +--- +page_title: Retrieve triggers available within actions +description: |- +Retrieve the set of triggers currently available within actions. +--- + +# Retrieving the set of triggers available within actions + +In this guide we'll show how to retrieve the set of triggers currently available within actions. +A trigger is an extensibility point to which actions can be bound. + +## Get an API Explorer Token + +Head to the APIs section of your [Auth0 Dashboard](https://manage.auth0.com/#/apis) and click on the +**Auth0 Management API**. + +get_api_explorer_token_1 + +Click on the **Create & Authorize Test Application** within the **API Explorer** tab. + +get_api_explorer_token_2 + +Copy the **Token** contents and go to the [Management API Explorer](https://auth0.com/docs/api/management/v2). + +get_api_explorer_token_3 + +Click the **Set API Token** button at the top left. + +Set the **API Token** by pasting the **Token** that you copied above. + +Click the **Set Token** button. + +get_api_explorer_token_4 + +Retrieve the set of triggers available within actions by clicking on the **Try** button at +[https://auth0.com/docs/api/management/v2#!/Actions/get_triggers](https://auth0.com/docs/api/management/v2#!/Actions/get_triggers). + +get_api_explorer_token_5 + + +At the time of writing (_2022-10-17_) the available triggers are the following: + +```json +{ + "triggers": [ + { + "id": "post-login", + "version": "v2", + "status": "DEPRECATED", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "post-login", + "version": "v3", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [ + { + "id": "post-login", + "version": "v2" + } + ] + }, + { + "id": "post-login", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "credentials-exchange", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "credentials-exchange", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "pre-user-registration", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "pre-user-registration", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "post-user-registration", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "post-user-registration", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "post-change-password", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "post-change-password", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "default_runtime": "node12", + "compatible_triggers": [] + }, + { + "id": "send-phone-message", + "version": "v2", + "status": "CURRENT", + "runtimes": [ + "node12", + "node16" + ], + "default_runtime": "node16", + "compatible_triggers": [] + }, + { + "id": "send-phone-message", + "version": "v1", + "status": "DEPRECATED", + "runtimes": [ + "node12" + ], + "compatible_triggers": [] + } + ] +} +``` + +Use these to set up your `supported_triggers` block within the `auth0_action` resource: + +```terraform +resource "auth0_action" "my_action" { + name = format("Test Action %s", timestamp()) + runtime = "node16" + code = <<-EOT + exports.onExecutePostLogin = async (event, api) => { + console.log(event); + }; + EOT + + supported_triggers { + id = "post-login" + version = "v3" + } +} +``` diff --git a/templates/guides/quickstart.md b/templates/guides/quickstart.md index 415f2ed3b..be8b9cf38 100644 --- a/templates/guides/quickstart.md +++ b/templates/guides/quickstart.md @@ -1,5 +1,5 @@ --- -page_title: "Getting Started" +page_title: Quickstart description: |- Quickly get started with the Auth0 Provider. --- From 3ec341af4542238cf51d033c587a178aeb0f5041 Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Mon, 17 Oct 2022 11:34:22 -0300 Subject: [PATCH 2/7] Update docs/resources/action.md --- docs/resources/action.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/action.md b/docs/resources/action.md index fa06128d3..f019a5460 100644 --- a/docs/resources/action.md +++ b/docs/resources/action.md @@ -61,7 +61,7 @@ resource "auth0_action" "my_action" { - `code` (String) The source code of the action. - `name` (String) The name of the action. -- `supported_triggers` (Block List, Min: 1, Max: 1) List of triggers that this action supports. At this time, an action can only target a single trigger at a time. Read [Retrieving the set of triggers available within actions](https://registry.terraform.io/providers/auth0/auth0/latest/docs/guides/action_triggers)to retrieve the latest trigger versions supported. (see [below for nested schema](#nestedblock--supported_triggers)) +- `supported_triggers` (Block List, Min: 1, Max: 1) List of triggers that this action supports. At this time, an action can only target a single trigger at a time. Read [Retrieving the set of triggers available within actions](https://registry.terraform.io/providers/auth0/auth0/latest/docs/guides/action_triggers) to retrieve the latest trigger versions supported. (see [below for nested schema](#nestedblock--supported_triggers)) ### Optional From f2761a420bd6a39ba0ba22a4aa636728a14c67fa Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Mon, 17 Oct 2022 11:34:28 -0300 Subject: [PATCH 3/7] Update internal/provider/resource_auth0_action.go --- internal/provider/resource_auth0_action.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/provider/resource_auth0_action.go b/internal/provider/resource_auth0_action.go index ad4abfc35..c57c3943c 100644 --- a/internal/provider/resource_auth0_action.go +++ b/internal/provider/resource_auth0_action.go @@ -55,7 +55,7 @@ func newAction() *schema.Resource { }, Description: "List of triggers that this action supports. " + "At this time, an action can only target a single trigger at a time. " + - "Read [Retrieving the set of triggers available within actions](https://registry.terraform.io/providers/auth0/auth0/latest/docs/guides/action_triggers)" + + "Read [Retrieving the set of triggers available within actions](https://registry.terraform.io/providers/auth0/auth0/latest/docs/guides/action_triggers) " + "to retrieve the latest trigger versions supported.", }, "code": { From 98103fc0fcf7a9273fa58803e2733fe493dbe73c Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Mon, 17 Oct 2022 11:35:10 -0300 Subject: [PATCH 4/7] Update docs/guides/action_triggers.md --- docs/guides/action_triggers.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/guides/action_triggers.md b/docs/guides/action_triggers.md index dce457240..d4d281b5c 100644 --- a/docs/guides/action_triggers.md +++ b/docs/guides/action_triggers.md @@ -37,7 +37,6 @@ Retrieve the set of triggers available within actions by clicking on the **Try** get_api_explorer_token_5 - At the time of writing (_2022-10-17_) the available triggers are the following: ```json From d5c0c5c57ef36451fa31080c29b9570e74304578 Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Mon, 17 Oct 2022 11:35:45 -0300 Subject: [PATCH 5/7] Update templates/guides/action_triggers.md --- templates/guides/action_triggers.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/guides/action_triggers.md b/templates/guides/action_triggers.md index dce457240..03b2f2bd9 100644 --- a/templates/guides/action_triggers.md +++ b/templates/guides/action_triggers.md @@ -36,8 +36,6 @@ Retrieve the set of triggers available within actions by clicking on the **Try** [https://auth0.com/docs/api/management/v2#!/Actions/get_triggers](https://auth0.com/docs/api/management/v2#!/Actions/get_triggers). get_api_explorer_token_5 - - At the time of writing (_2022-10-17_) the available triggers are the following: ```json From c10941ca7d97338584f564c1c3569b9b1c619440 Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Mon, 17 Oct 2022 11:36:30 -0300 Subject: [PATCH 6/7] Update templates/guides/action_triggers.md --- templates/guides/action_triggers.md | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/guides/action_triggers.md b/templates/guides/action_triggers.md index 03b2f2bd9..d4d281b5c 100644 --- a/templates/guides/action_triggers.md +++ b/templates/guides/action_triggers.md @@ -36,6 +36,7 @@ Retrieve the set of triggers available within actions by clicking on the **Try** [https://auth0.com/docs/api/management/v2#!/Actions/get_triggers](https://auth0.com/docs/api/management/v2#!/Actions/get_triggers). get_api_explorer_token_5 + At the time of writing (_2022-10-17_) the available triggers are the following: ```json From a122c479bf9d72df3c44e4110a3e9a6840982422 Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea Date: Tue, 18 Oct 2022 09:32:14 +0200 Subject: [PATCH 7/7] Update templates/guides/action_triggers.md --- docs/guides/action_triggers.md | 11 +++++------ templates/guides/action_triggers.md | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/guides/action_triggers.md b/docs/guides/action_triggers.md index d4d281b5c..a50b53261 100644 --- a/docs/guides/action_triggers.md +++ b/docs/guides/action_triggers.md @@ -11,12 +11,11 @@ A trigger is an extensibility point to which actions can be bound. ## Get an API Explorer Token -Head to the APIs section of your [Auth0 Dashboard](https://manage.auth0.com/#/apis) and click on the -**Auth0 Management API**. +Head to the APIs section of your [Auth0 Dashboard](https://manage.auth0.com/#/apis) and select **Auth0 Management API**. get_api_explorer_token_1 -Click on the **Create & Authorize Test Application** within the **API Explorer** tab. +Select **Create & Authorize Test Application** within the **API Explorer** tab. get_api_explorer_token_2 @@ -24,15 +23,15 @@ Copy the **Token** contents and go to the [Management API Explorer](https://auth get_api_explorer_token_3 -Click the **Set API Token** button at the top left. +Select **Set API Token** button at the top left. Set the **API Token** by pasting the **Token** that you copied above. -Click the **Set Token** button. +Select **Set Token** button. get_api_explorer_token_4 -Retrieve the set of triggers available within actions by clicking on the **Try** button at +Retrieve the set of triggers available within actions by selecting the **Try** button at [https://auth0.com/docs/api/management/v2#!/Actions/get_triggers](https://auth0.com/docs/api/management/v2#!/Actions/get_triggers). get_api_explorer_token_5 diff --git a/templates/guides/action_triggers.md b/templates/guides/action_triggers.md index d4d281b5c..a50b53261 100644 --- a/templates/guides/action_triggers.md +++ b/templates/guides/action_triggers.md @@ -11,12 +11,11 @@ A trigger is an extensibility point to which actions can be bound. ## Get an API Explorer Token -Head to the APIs section of your [Auth0 Dashboard](https://manage.auth0.com/#/apis) and click on the -**Auth0 Management API**. +Head to the APIs section of your [Auth0 Dashboard](https://manage.auth0.com/#/apis) and select **Auth0 Management API**. get_api_explorer_token_1 -Click on the **Create & Authorize Test Application** within the **API Explorer** tab. +Select **Create & Authorize Test Application** within the **API Explorer** tab. get_api_explorer_token_2 @@ -24,15 +23,15 @@ Copy the **Token** contents and go to the [Management API Explorer](https://auth get_api_explorer_token_3 -Click the **Set API Token** button at the top left. +Select **Set API Token** button at the top left. Set the **API Token** by pasting the **Token** that you copied above. -Click the **Set Token** button. +Select **Set Token** button. get_api_explorer_token_4 -Retrieve the set of triggers available within actions by clicking on the **Try** button at +Retrieve the set of triggers available within actions by selecting the **Try** button at [https://auth0.com/docs/api/management/v2#!/Actions/get_triggers](https://auth0.com/docs/api/management/v2#!/Actions/get_triggers). get_api_explorer_token_5