Skip to content

Commit

Permalink
Merge pull request #160 from zitadel/enum-docs
Browse files Browse the repository at this point in the history
fix: enum docs for trigger_actions
  • Loading branch information
eliobischof authored Feb 27, 2024
2 parents 547de50 + e9153b9 commit b6f449e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
3 changes: 1 addition & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ terraform {
required_providers {
zitadel = {
source = "zitadel/zitadel"
version = "1.0.0-alpha.16"
version = "1.0.7"
}
}
}
Expand All @@ -40,7 +40,6 @@ provider "zitadel" {
domain = "localhost"
insecure = "true"
port = "8080"
project = "170832731415117995"
jwt_profile_file = "local-token"
}
```
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/trigger_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 13 additions & 2 deletions zitadel/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions zitadel/trigger_actions/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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",
}
}

0 comments on commit b6f449e

Please sign in to comment.