From e9153b9ed969a8d6f67f8acd7a70614b345f8c7c Mon Sep 17 00:00:00 2001 From: Stefan Benz Date: Mon, 19 Feb 2024 14:09:09 +0100 Subject: [PATCH] fix: enum docs for trigger_actions --- docs/index.md | 3 +-- docs/resources/trigger_actions.md | 4 ++-- zitadel/helper/helper.go | 15 +++++++++++++-- zitadel/trigger_actions/resource.go | 2 ++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/index.md b/docs/index.md index 132889e0..426af813 100644 --- a/docs/index.md +++ b/docs/index.md @@ -31,7 +31,7 @@ terraform { required_providers { zitadel = { source = "zitadel/zitadel" - version = "1.0.0-alpha.16" + version = "1.0.7" } } } @@ -40,7 +40,6 @@ provider "zitadel" { domain = "localhost" insecure = "true" port = "8080" - project = "170832731415117995" jwt_profile_file = "local-token" } ``` diff --git a/docs/resources/trigger_actions.md b/docs/resources/trigger_actions.md index ebcba7de..88c40e5a 100644 --- a/docs/resources/trigger_actions.md +++ b/docs/resources/trigger_actions.md @@ -26,8 +26,8 @@ resource "zitadel_trigger_actions" "default" { ### Required - `action_ids` (Set of String) IDs of the triggered actions -- `flow_type` (String) Type of the flow to which the action triggers belong, supported values: , FLOW_TYPE_EXTERNAL_AUTHENTICATION, FLOW_TYPE_CUSTOMISE_TOKEN -- `trigger_type` (String) Trigger type on when the actions get triggered, supported values: , TRIGGER_TYPE_POST_AUTHENTICATION, TRIGGER_TYPE_PRE_CREATION, TRIGGER_TYPE_POST_CREATION, TRIGGER_TYPE_PRE_USERINFO_CREATION +- `flow_type` (String) Type of the flow to which the action triggers belong, supported values: FLOW_TYPE_EXTERNAL_AUTHENTICATION, FLOW_TYPE_CUSTOMISE_TOKEN, FLOW_TYPE_INTERNAL_AUTHENTICATION, FLOW_TYPE_SAML_RESPONSE +- `trigger_type` (String) Trigger type on when the actions get triggered, supported values: TRIGGER_TYPE_POST_AUTHENTICATION, TRIGGER_TYPE_PRE_CREATION, TRIGGER_TYPE_POST_CREATION, TRIGGER_TYPE_PRE_USERINFO_CREATION, TRIGGER_TYPE_PRE_ACCESS_TOKEN_CREATION, TRIGGER_TYPE_PRE_SAML_RESPONSE_CREATION ### Optional diff --git a/zitadel/helper/helper.go b/zitadel/helper/helper.go index 85a54e52..c26a011b 100644 --- a/zitadel/helper/helper.go +++ b/zitadel/helper/helper.go @@ -124,8 +124,19 @@ func GetStringFromAttr(ctx context.Context, attrs map[string]attr.Value, key str func DescriptionEnumValuesList(enum map[int32]string) string { str := ", supported values: " values := make([]string, len(enum)) - for i := 0; i < len(enum); i++ { - values[i] = enum[int32(i)] + highest := 0 + for k := range enum { + if int(k) > highest { + highest = int(k) + } + } + + j := 0 + for i := 0; i < highest+1; i++ { + if value, ok := enum[int32(i)]; ok { + values[j] = value + j++ + } } str += strings.Join(values, ", ") return str diff --git a/zitadel/trigger_actions/resource.go b/zitadel/trigger_actions/resource.go index 507aa873..72a59d8e 100644 --- a/zitadel/trigger_actions/resource.go +++ b/zitadel/trigger_actions/resource.go @@ -57,6 +57,7 @@ func FlowTypes() map[int32]string { 1: "FLOW_TYPE_EXTERNAL_AUTHENTICATION", 2: "FLOW_TYPE_CUSTOMISE_TOKEN", 3: "FLOW_TYPE_INTERNAL_AUTHENTICATION", + 4: "FLOW_TYPE_SAML_RESPONSE", } } func TriggerTypes() map[int32]string { @@ -66,5 +67,6 @@ func TriggerTypes() map[int32]string { 3: "TRIGGER_TYPE_POST_CREATION", 4: "TRIGGER_TYPE_PRE_USERINFO_CREATION", 5: "TRIGGER_TYPE_PRE_ACCESS_TOKEN_CREATION", + 7: "TRIGGER_TYPE_PRE_SAML_RESPONSE_CREATION", } }