diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index f91e788..dc20bbf 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 5a857039-7f4b-42d5-86fd-449767242ed2 management: - docChecksum: 8ae07697a4f59d026a44a7d6b287f46b + docChecksum: cdc191ce1bf61d7565b6f4caa1ea7ff9 docVersion: 1.0.0 - speakeasyVersion: 1.303.4 - generationVersion: 2.340.2 - releaseVersion: 0.8.4 - configChecksum: 03142a0481bf8be5abbdacf2803b0832 + speakeasyVersion: 1.330.0 + generationVersion: 2.361.10 + releaseVersion: 0.11.0 + configChecksum: fe1f4f47e217555f3049bc6b86f7300b repoURL: https://github.com/epilot-dev/terraform-provider-epilot-workflow.git repoSubDirectory: . published: true @@ -21,15 +21,16 @@ features: unions: 2.85.0 terraform: additionalDependencies: 0.1.0 - core: 3.21.3 + core: 3.23.3 deprecations: 2.81.1 globalSecurity: 2.81.6 globalServerURLs: 2.82.1 - unions: 2.81.14 + unions: 2.81.15 generatedFiles: - internal/sdk/workflows.go - internal/sdk/sdk.go - internal/sdk/models/errors/sdkerror.go + - internal/sdk/retry/config.go - internal/sdk/types/bigint.go - internal/sdk/types/date.go - internal/sdk/types/datetime.go diff --git a/README.md b/README.md index 7104fe4..074e14c 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ terraform { required_providers { epilot-workflow = { source = "epilot-dev/epilot-workflow" - version = "0.8.4" + version = "0.11.0" } } } diff --git a/docs/data-sources/workflow_definition.md b/docs/data-sources/workflow_definition.md index b365328..e8205f4 100644 --- a/docs/data-sources/workflow_definition.md +++ b/docs/data-sources/workflow_definition.md @@ -14,17 +14,13 @@ WorkflowDefinition DataSource ```terraform data "epilot-workflow_workflow_definition" "my_workflowdefinition" { - id = "7hj28a" + definition_id = "7hj28a" } ``` ## Schema -### Required - -- `id` (String) Short uuid (length 8) to identify the Workflow Definition. - ### Read-Only - `assigned_to` (List of String) @@ -32,9 +28,10 @@ data "epilot-workflow_workflow_definition" "my_workflowdefinition" { - `creation_time` (String) ISO String Date & Time - `description` (String) - `due_date` (String) -- `dynamic_due_date` (Attributes) set a Duedate for a step then a specific (see [below for nested schema](#nestedatt--dynamic_due_date)) +- `dynamic_due_date` (String) set a Duedate for a step then a specific. Parsed as JSON. - `enable_ecp_workflow` (Boolean) Indicates whether this workflow is available for End Customer Portal or not. By default it's not. - `flow` (Attributes List) (see [below for nested schema](#nestedatt--flow)) +- `id` (String) The ID of this resource. - `last_update_time` (String) ISO String Date & Time - `name` (String) - `update_entity_attributes` (Attributes List) (see [below for nested schema](#nestedatt--update_entity_attributes)) @@ -48,17 +45,6 @@ Read-Only: - `id` (String) - -### Nested Schema for `dynamic_due_date` - -Read-Only: - -- `action_type_condition` (String) must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"] -- `number_of_units` (Number) -- `step_id` (String) -- `time_period` (String) must be one of ["days", "weeks", "months"] - - ### Nested Schema for `flow` @@ -87,7 +73,7 @@ Read-Only: - `automation_config` (Attributes) (see [below for nested schema](#nestedatt--flow--section--steps--automation_config)) - `description` (Attributes) Longer information regarding Task (see [below for nested schema](#nestedatt--flow--section--steps--description)) - `due_date` (String) -- `dynamic_due_date` (Attributes) set a Duedate for a step then a specific (see [below for nested schema](#nestedatt--flow--section--steps--dynamic_due_date)) +- `dynamic_due_date` (String) set a Duedate for a step then a specific. Parsed as JSON. - `ecp` (Attributes) Details regarding ECP for the workflow step (see [below for nested schema](#nestedatt--flow--section--steps--ecp)) - `execution_type` (String) must be one of ["MANUAL", "AUTOMATION"] - `id` (String) @@ -116,17 +102,6 @@ Read-Only: - `value` (String) - -### Nested Schema for `flow.section.steps.user_ids` - -Read-Only: - -- `action_type_condition` (String) must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"] -- `number_of_units` (Number) -- `step_id` (String) -- `time_period` (String) must be one of ["days", "weeks", "months"] - - ### Nested Schema for `flow.section.steps.user_ids` @@ -200,7 +175,7 @@ Read-Only: - `automation_config` (Attributes) (see [below for nested schema](#nestedatt--flow--step--automation_config)) - `description` (Attributes) Longer information regarding Task (see [below for nested schema](#nestedatt--flow--step--description)) - `due_date` (String) -- `dynamic_due_date` (Attributes) set a Duedate for a step then a specific (see [below for nested schema](#nestedatt--flow--step--dynamic_due_date)) +- `dynamic_due_date` (String) set a Duedate for a step then a specific. Parsed as JSON. - `ecp` (Attributes) Details regarding ECP for the workflow step (see [below for nested schema](#nestedatt--flow--step--ecp)) - `execution_type` (String) must be one of ["MANUAL", "AUTOMATION"] - `id` (String) @@ -229,17 +204,6 @@ Read-Only: - `value` (String) - -### Nested Schema for `flow.step.dynamic_due_date` - -Read-Only: - -- `action_type_condition` (String) must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"] -- `number_of_units` (Number) -- `step_id` (String) -- `time_period` (String) must be one of ["days", "weeks", "months"] - - ### Nested Schema for `flow.step.ecp` diff --git a/docs/index.md b/docs/index.md index 5d83101..cba4e83 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,7 @@ terraform { required_providers { epilot-workflow = { source = "epilot-dev/epilot-workflow" - version = "0.8.3" + version = "0.10.0" } } } diff --git a/docs/resources/workflow_definition.md b/docs/resources/workflow_definition.md index 512169e..8ad6709 100644 --- a/docs/resources/workflow_definition.md +++ b/docs/resources/workflow_definition.md @@ -13,434 +13,82 @@ WorkflowDefinition Resource ## Example Usage ```terraform -# Provider definitions -terraform { - required_providers { - epilot-workflow = { - source = "epilot-dev/epilot-workflow" - version = "0.2.2" - } - } -} - -variable epilot_auth { - type = string -} - - - -provider "epilot-workflow" { - bearer_auth = var.epilot_auth -} - - -# resource "epilot-workflow_workflow_definition" "my_workflowdefinition" { -# description = "...my_description..." -# due_date = "2021-04-27T12:00:00.000Z" -# enable_ecp_workflow = false -# flow = [ -# { -# section = { -# id = "2a31ed4e-b201-4187-9740-15a348b64814" -# name = "Meredith Bruen" -# order = 1.95 -# steps = [ -# { -# assigned_to = [ -# "...", -# ] -# automation_config = { -# flow_id = "...my_flow_id..." -# } -# description = { -# enabled = true -# value = "...my_value..." -# } -# due_date = "2021-04-27T12:00:00.000Z" -# dynamic_due_date = { -# action_type_condition = "STEP_CLOSED" -# number_of_units = 73.8 -# step_id = "...my_step_id..." -# time_period = "weeks" -# } -# ecp = { -# description = "...my_description..." -# enabled = false -# journey = { -# id = "64361b27-76d7-498c-b5f3-e120ea0dc9e1" -# journey_id = "...my_journey_id..." -# name = "Lorraine Witting" -# } -# label = "...my_label..." -# } -# execution_type = "AUTOMATION" -# id = "3f96aa0e-3408-45f7-9b11-76521d792fea" -# installer = { -# description = "...my_description..." -# enabled = true -# journey = { -# id = "830af35a-c0f0-4516-986c-6d56674fb26d" -# journey_id = "...my_journey_id..." -# name = "Paulette O'Hara" -# } -# label = "...my_label..." -# } -# journey = { -# id = "9b2b84e8-8293-4d18-a93f-16fc9936c940" -# journey_id = "...my_journey_id..." -# name = "Dr. Joel Hermann" -# } -# name = "Lorene Denesik" -# order = 4.83 -# requirements = [ -# { -# condition = "CLOSED" -# definition_id = "...my_definition_id..." -# type = "STEP" -# }, -# ] -# type = "SECTION" -# user_ids = [ -# 9.27, -# ] -# }, -# ] -# type = "STEP" -# } -# }, -# ] -# name = "Nishu workflowing" -# } - -resource "epilot-workflow_workflow_definition" "new_workflow_definition" { - assigned_to = [ - "56201", - ] - closing_reasons = [ - { - id = "J-9JNspGlmqHadNMfJCkj" - }, - { - id = "vH2hoSZwV9odnm6mHRpsf" - }, - ] - description = "Fitsch test - blueprints" - enable_ecp_workflow = true +resource "epilot-workflow_workflow_definition" "my_workflowdefinition" { + creation_time = "2021-04-27T12:01:13.000Z" + definition_id = "7hj28a" + description = "...my_description..." + due_date = "2021-04-27T12:00:00.000Z" + dynamic_due_date = "{ \"see\": \"documentation\" }" + enable_ecp_workflow = false flow = [ - { - step = { - assigned_to = [] - automation_config = { - flow_id = "58c35c04-9663-492f-872f-196552197bcf" - } - ecp = { - enabled = true - label = "2.Schritt" - } - execution_type = "AUTOMATION" - id = "ulcZkL" - installer = { - enabled = true - label = "Installer label" - } - name = "test assignee variablen" - order = 1 - requirements = [] - type = "STEP" - user_ids = [] - } - }, - { - step = { - assigned_to = [ - "101408", - ] - ecp = { - description = "33" - enabled = true - label = "3.Schritt" - } - id = "vZJNxC" - installer = { - description = "abc" - enabled = true - label = "aaa" - } - name = "4. Aufgabe" - order = 2 - requirements = [] - type = "STEP" - user_ids = [] - } - }, { section = { - id = "P9p_N8" - name = "5. Aufgabe" - order = 3 + id = "2a31ed4e-b201-4187-9740-15a348b64814" + name = "Meredith Bruen" + order = 1.95 steps = [ { - assigned_to = [] + assigned_to = [ + "...", + ] automation_config = { - flow_id = "b282a5e4-40c6-487f-a85d-8053d194027d" + flow_id = "...my_flow_id..." } - ecp = { + description = { enabled = true - label = "4.Schritt" + value = "...my_value..." } - execution_type = "AUTOMATION" - id = "-Rjb7y" - name = "Demo test 20" - order = 4 - requirements = [] - type = "STEP" - user_ids = [] - }, - ] - type = "SECTION" - } - }, - { - section = { - id = "J0fYIk" - name = "2 Aufgabe" - order = 5 - steps = [ - { - assigned_to = [] + due_date = "2021-04-27T12:00:00.000Z" + dynamic_due_date = "{ \"see\": \"documentation\" }" ecp = { - enabled = true - label = "1.Schritt" + description = "...my_description..." + enabled = false + journey = { + id = "b9364361-b277-46d7-98c7-5f3e120ea0dc" + journey_id = "...my_journey_id..." + name = "Mrs. Grady Bins" + } + label = "...my_label..." } - id = "qA1wAj" - name = "2.2" - order = 6 - requirements = [] - type = "STEP" - user_ids = [] - }, - ] - type = "SECTION" - } - }, - { - section = { - id = "wdMc2C" - name = "6. Aufgabe" - order = 7 - steps = [ - { - assigned_to = [] - ecp = { - enabled = true - label = "5.Schritt" - } - id = "_VzDmC" - name = "6.1" - order = 8 - requirements = [] - type = "STEP" - user_ids = [] - }, - { - assigned_to = [] - automation_config = { - flow_id = "e0cf0f34-ebd3-44af-896d-cee9dcf89986" - } - ecp = {} execution_type = "AUTOMATION" - id = "ysfBl6Jx" - name = "ABC neuer NAME" - order = 9 - requirements = [] - type = "STEP" - user_ids = [] - }, - ] - type = "SECTION" - } - }, - { - section = { - id = "Kr0VHGpp" - name = "test" - order = 10 - steps = [ - { - assigned_to = [] - automation_config = { - flow_id = "986befe7-42ae-4cf4-9db5-5d380c8b7e0b" + id = "f93f96aa-0e34-4085-b7db-1176521d792f" + installer = { + description = "...my_description..." + enabled = true + journey = { + id = "a4830af3-5ac0-4f05-96d8-6c6d56674fb2" + journey_id = "...my_journey_id..." + name = "Elena Kuhic" + } + label = "...my_label..." } - ecp = {} - execution_type = "AUTOMATION" - id = "PghwjBKl" - name = "Stadt7 Test" - order = 11 - requirements = [] - type = "STEP" - user_ids = [] - }, - ] - type = "SECTION" - } - }, - { - section = { - id = "w2sA7xeY" - name = "test2" - order = 12 - steps = [ - { - assigned_to = [] - ecp = {} - id = "nQ1Nmmj0" - name = "test2" - order = 13 - requirements = [] - type = "STEP" - user_ids = [] - }, - ] - type = "SECTION" - } - }, - { - section = { - id = "2DZ5ypub" - name = "test3" - order = 14 - steps = [ - { - assigned_to = [] - ecp = {} - id = "NQeLA5GC" - name = "test3" - order = 15 - requirements = [] - type = "STEP" - user_ids = [] - }, - ] - type = "SECTION" - } - }, - { - section = { - id = "v0d41u98" - name = "Gestern noch Schritt, heute schon Phase" - order = 16 - steps = [ - { - assigned_to = [] - ecp = {} - id = "PqxLvCrb" - name = "phasenfroh" - order = 17 - requirements = [] - type = "STEP" - user_ids = [] - }, - { - assigned_to = [] - ecp = {} - id = "XZp0_yfi" - name = "Phas ohne Boden" - order = 18 - requirements = [] - type = "STEP" - user_ids = [] - }, - ] - type = "SECTION" - } - }, - { - step = { - assigned_to = [] - ecp = { - enabled = true - label = "Tes 1" - } - id = "yKAubPJy" - name = "Unabhängiger Schritt" - order = 19 - requirements = [] - type = "STEP" - user_ids = [] - } - }, - { - section = { - id = "J7cZEGEo" - name = "Gleich ne ganze Phase" - order = 20 - steps = [ - { - assigned_to = [] - ecp = {} - id = "KcM5SesM" - name = "Teil 1 der Phase" - order = 21 - requirements = [] - type = "STEP" - user_ids = [] - }, - { - assigned_to = [] - ecp = {} - id = "Smu-9fTo" - name = "Teil 2 der Phase" - order = 22 - requirements = [] - type = "STEP" - user_ids = [] - }, - { - assigned_to = [] - ecp = {} - id = "PV4mCyCY" - name = "Teil 3 der Phase" - order = 23 - requirements = [] - type = "STEP" - user_ids = [] - }, - { - assigned_to = [] - ecp = {} - id = "xbODvcLf" - name = "4. Teil der Phase" - order = 24 - requirements = [] - type = "STEP" - user_ids = [] - }, - { - assigned_to = [] - ecp = {} - id = "M0TGW_yc" - name = "Phase Nummer 5" - order = 25 - requirements = [] - type = "STEP" - user_ids = [] + journey = { + id = "9f9b2b84-e882-493d-9869-3f16fc9936c9" + journey_id = "...my_journey_id..." + name = "Kimberly Marvin" + } + name = "Dr. Eloise Nader" + order = 66.72 + requirements = [ + { + condition = "CLOSED" + definition_id = "...my_definition_id..." + type = "SECTION" + }, + ] + type = "STEP" + user_ids = [ + 31.44, + ] }, ] type = "SECTION" } }, ] - name = "Nishu test" - update_entity_attributes = [ - { - source = "current_section" - target = { - entity_attribute = "mein_individueller_status" - entity_schema = "opportunity" - } - }, - ] - user_ids = [] + id = "1470408a-193e-4721-a537-6b6381b5dd26" + last_update_time = "2021-04-27T12:01:13.000Z" + name = "Eloise Kreiger DVM" } ``` @@ -459,13 +107,16 @@ resource "epilot-workflow_workflow_definition" "new_workflow_definition" { - `creation_time` (String) ISO String Date & Time - `description` (String) - `due_date` (String) -- `dynamic_due_date` (Attributes) set a Duedate for a step then a specific (see [below for nested schema](#nestedatt--dynamic_due_date)) +- `dynamic_due_date` (String) set a Duedate for a step then a specific. Parsed as JSON. - `enable_ecp_workflow` (Boolean) Indicates whether this workflow is available for End Customer Portal or not. By default it's not. -- `id` (String) Id of the definition to de deleted. - `last_update_time` (String) ISO String Date & Time - `update_entity_attributes` (Attributes List) (see [below for nested schema](#nestedatt--update_entity_attributes)) - `user_ids` (List of Number) This field is deprecated. Please use assignedTo +### Read-Only + +- `id` (String) The ID of this resource. + ### Nested Schema for `flow` @@ -494,7 +145,7 @@ Optional: - `automation_config` (Attributes) (see [below for nested schema](#nestedatt--flow--section--steps--automation_config)) - `description` (Attributes) Longer information regarding Task (see [below for nested schema](#nestedatt--flow--section--steps--description)) - `due_date` (String) -- `dynamic_due_date` (Attributes) set a Duedate for a step then a specific (see [below for nested schema](#nestedatt--flow--section--steps--dynamic_due_date)) +- `dynamic_due_date` (String) set a Duedate for a step then a specific. Parsed as JSON. - `ecp` (Attributes) Details regarding ECP for the workflow step (see [below for nested schema](#nestedatt--flow--section--steps--ecp)) - `execution_type` (String) must be one of ["MANUAL", "AUTOMATION"] - `id` (String) @@ -523,17 +174,6 @@ Optional: - `value` (String) - -### Nested Schema for `flow.section.steps.user_ids` - -Optional: - -- `action_type_condition` (String) Not Null; must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"] -- `number_of_units` (Number) Not Null -- `step_id` (String) -- `time_period` (String) Not Null; must be one of ["days", "weeks", "months"] - - ### Nested Schema for `flow.section.steps.user_ids` @@ -607,7 +247,7 @@ Optional: - `automation_config` (Attributes) (see [below for nested schema](#nestedatt--flow--step--automation_config)) - `description` (Attributes) Longer information regarding Task (see [below for nested schema](#nestedatt--flow--step--description)) - `due_date` (String) -- `dynamic_due_date` (Attributes) set a Duedate for a step then a specific (see [below for nested schema](#nestedatt--flow--step--dynamic_due_date)) +- `dynamic_due_date` (String) set a Duedate for a step then a specific. Parsed as JSON. - `ecp` (Attributes) Details regarding ECP for the workflow step (see [below for nested schema](#nestedatt--flow--step--ecp)) - `execution_type` (String) must be one of ["MANUAL", "AUTOMATION"] - `id` (String) @@ -636,17 +276,6 @@ Optional: - `value` (String) - -### Nested Schema for `flow.step.dynamic_due_date` - -Optional: - -- `action_type_condition` (String) Not Null; must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"] -- `number_of_units` (Number) Not Null -- `step_id` (String) -- `time_period` (String) Not Null; must be one of ["days", "weeks", "months"] - - ### Nested Schema for `flow.step.ecp` @@ -719,17 +348,6 @@ Optional: - `id` (String) Not Null - -### Nested Schema for `dynamic_due_date` - -Optional: - -- `action_type_condition` (String) Not Null; must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"] -- `number_of_units` (Number) Not Null -- `step_id` (String) -- `time_period` (String) Not Null; must be one of ["days", "weeks", "months"] - - ### Nested Schema for `update_entity_attributes` @@ -751,5 +369,5 @@ Optional: Import is supported using the following syntax: ```shell -terraform import epilot-workflow_workflow_definition.my_epilot-workflow_workflow_definition "7hj28a" +terraform import epilot-workflow_workflow_definition.my_epilot-workflow_workflow_definition "" ``` diff --git a/examples/data-sources/epilot-workflow_workflow_definition/data-source.tf b/examples/data-sources/epilot-workflow_workflow_definition/data-source.tf index 5159002..e0b2b3d 100644 --- a/examples/data-sources/epilot-workflow_workflow_definition/data-source.tf +++ b/examples/data-sources/epilot-workflow_workflow_definition/data-source.tf @@ -1,3 +1,3 @@ data "epilot-workflow_workflow_definition" "my_workflowdefinition" { - id = "7hj28a" + definition_id = "7hj28a" } \ No newline at end of file diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 50dcefa..e89a00a 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { epilot-workflow = { source = "epilot-dev/epilot-workflow" - version = "0.8.4" + version = "0.11.0" } } } diff --git a/examples/resources/epilot-workflow_workflow_definition/import.sh b/examples/resources/epilot-workflow_workflow_definition/import.sh index 4f2d498..e37820e 100644 --- a/examples/resources/epilot-workflow_workflow_definition/import.sh +++ b/examples/resources/epilot-workflow_workflow_definition/import.sh @@ -1 +1 @@ -terraform import epilot-workflow_workflow_definition.my_epilot-workflow_workflow_definition "7hj28a" +terraform import epilot-workflow_workflow_definition.my_epilot-workflow_workflow_definition "" diff --git a/examples/resources/epilot-workflow_workflow_definition/resource.tf b/examples/resources/epilot-workflow_workflow_definition/resource.tf index 5f4c385..01410ce 100644 --- a/examples/resources/epilot-workflow_workflow_definition/resource.tf +++ b/examples/resources/epilot-workflow_workflow_definition/resource.tf @@ -1,5 +1,6 @@ resource "epilot-workflow_workflow_definition" "my_workflowdefinition" { creation_time = "2021-04-27T12:01:13.000Z" + definition_id = "7hj28a" description = "...my_description..." due_date = "2021-04-27T12:00:00.000Z" enable_ecp_workflow = false diff --git a/examples/voila/workflow_definition_wfKCWrxgJ.tf b/examples/voila/workflow_definition_wfKCWrxgJ.tf new file mode 100644 index 0000000..9b69d5a --- /dev/null +++ b/examples/voila/workflow_definition_wfKCWrxgJ.tf @@ -0,0 +1,419 @@ +# Provider definitions +terraform { + required_providers { + epilot-journey = { + source = "epilot-dev/epilot-journey" + version = "1.0.1" + + } + epilot-product = { + source = "epilot-dev/epilot-product" + version = "0.6.2" + } + epilot-automation = { + source = "epilot-dev/epilot-automation" + version = "2.0.1" + } + epilot-entitymapping = { + source = "epilot-dev/epilot-entitymapping" + version = "1.6.7" + } + epilot-designbuilder = { + source = "epilot-dev/epilot-designbuilder" + version = "0.0.5" + } + epilot-file = { + source = "epilot-dev/epilot-file" + version = "2.2.3" + } + epilot-emailtemplate = { + source = "epilot-dev/epilot-emailtemplate" + version = "0.0.2" + } + epilot-schema = { + source = "epilot-dev/epilot-schema" + version = "4.0.0" + } + epilot-workflow = { + source = "epilot-dev/epilot-workflow" + version = "0.2.3" + } + } +} + +# Variables +variable "epilot_auth" { + type = string +} +variable "journey_api_url" { + type = string + default = "https://journey-config.sls.epilot.io" +} +variable "product_api_url" { + type = string + default = "https://product.sls.epilot.io" +} +variable "automation_api_url" { + type = string + default = "https://automation.sls.epilot.io" +} +variable "file_api_url" { + type = string + default = "https://file.sls.epilot.io" +} +variable "emailtemplate_api_url" { + type = string + default = "https://email-template.sls.epilot.io" +} +variable "designbuilder_api_url" { + type = string + default = "https://design-builder-api.sls.epilot.io" +} +variable "entitymapping_api_url" { + type = string + default = "https://entity-mapping.sls.epilot.io" +} +variable "schema_api_url" { + type = string + default = "https://entity.sls.epilot.io" +} +variable "workflow_api_url" { + type = string + default = "https://workflows-definition.sls.epilot.io" +} + +# Providers configuration +provider "epilot-journey" { + epilot_auth = var.epilot_auth + server_url = var.journey_api_url +} +provider "epilot-product" { + epilot_auth = var.epilot_auth + server_url = var.product_api_url +} +provider "epilot-automation" { + epilot_auth = var.epilot_auth + server_url = var.automation_api_url +} +provider "epilot-file" { + epilot_auth = var.epilot_auth + server_url = var.file_api_url +} +provider "epilot-emailtemplate" { + epilot_auth = var.epilot_auth + server_url = var.emailtemplate_api_url +} +provider "epilot-designbuilder" { + custom_authorizer = var.epilot_auth + server_url = var.designbuilder_api_url +} +provider "epilot-entitymapping" { + epilot_auth = var.epilot_auth + server_url = var.entitymapping_api_url +} +provider "epilot-schema" { + epilot_auth = var.epilot_auth + server_url = var.schema_api_url +} +provider "epilot-workflow" { + bearer_auth = var.epilot_auth + server_url = var.workflow_api_url +} + +# epilot-workflow_workflow_definition.workflow_definition_wfKCWrxgJ: +resource "epilot-workflow_workflow_definition" "workflow_definition_wfKCWrxgJ" { + assigned_to = [ + "11001018", + "11000566", + "10002602", + "911676_11001026", + "911677_11001027", + "placeholder_ecp_customers", + ] + closing_reasons = [ + { + id = "qgK9sGbKoS7NxlAbNReVn" + }, + { + id = "1gNTrk7Kx50g7EKGPc5GR" + }, + ] + + description = "Brew a nice cup of coffee :) " + enable_ecp_workflow = false + flow = [ + { + step = { + assigned_to = [ + "11001018", + "10002602", + "911674_11001023", + "placeholder_ecp_customers", + ] + automation_config = { + flow_id = "7262dcc1-0352-4bfc-9981-a2b8797c2d32" + } + description = { + enabled = true + value = "Ladida" + } + due_date = "2024-06-19T15:29:00.000Z" + ecp = { + enabled = false + } + execution_type = "AUTOMATION" + + installer = { + enabled = false + } + journey = { + id = "49c36269-b6f2-49d6-82d2-050328899e79" + journey_id = "f9c7bf40-2f19-11ef-ab16-6546f1cba0b0" + name = "public data valiation" + } + name = "Choose high quality coffee beans" + order = 1 + requirements = [] + type = "STEP" + user_ids = [] + } + }, + { + section = { + + name = "Pre-steps" + order = 2 + steps = [ + { + assigned_to = [] + description = { + enabled = true + value = "The standard ratio is about 1 to 2 tablespoons of coffee per 6 ounces of water. Adjust according to your taste preferences. For a standard 12-cup coffee maker, you’ll need about 12-24 tablespoons (3/4 to 1 1/2 cups) of coffee." + } + dynamic_due_date = { + action_type_condition = null + number_of_units = 0 + time_period = null + } + ecp = { + enabled = false + } + + installer = { + enabled = false + } + name = "Measure the right amounts of coffee and water " + order = 3 + requirements = [] + type = "STEP" + user_ids = [] + }, + { + assigned_to = [] + description = { + enabled = true + value = "If using whole beans, grind them to a medium grind, similar to the texture of sand. This is ideal for drip coffee makers. Too fine a grind can lead to over-extraction and a bitter taste, while too coarse can lead to under-extraction and a weak flavor." + } + due_date = "2024-05-23T20:11:00.000Z" + ecp = { + enabled = false + } + + installer = { + enabled = false + } + name = "Grind the coffee beans" + order = 4 + requirements = [ + { + condition = "CLOSED" + definition_id = "3bF4nboZ" + type = "STEP" + }, + ] + type = "STEP" + user_ids = [] + }, + ] + type = "SECTION" + } + }, + { + section = { + + name = "Prepare the coffee" + order = 5 + steps = [ + { + assigned_to = [] + ecp = { + enabled = false + } + + installer = { + enabled = false + } + name = "Add coffee grounds into the filter" + order = 6 + requirements = [ + { + condition = "CLOSED" + definition_id = "3bF4nboZ" + type = "STEP" + }, + { + condition = "CLOSED" + definition_id = "56z3PpJ-" + type = "STEP" + }, + ] + type = "STEP" + user_ids = [] + }, + { + assigned_to = [] + description = { + enabled = true + value = "Pour the measured amount of filtered water into the coffee maker’s water reservoir" + } + ecp = { + enabled = false + } + + installer = { + enabled = false + } + name = "Add water" + order = 7 + requirements = [ + { + condition = "CLOSED" + definition_id = "lLr14EM1" + type = "STEP" + }, + ] + type = "STEP" + user_ids = [] + }, + { + assigned_to = [] + dynamic_due_date = { + action_type_condition = null + number_of_units = 0 + time_period = null + } + ecp = { + enabled = false + } + + installer = { + enabled = false + } + name = "Start brewing" + order = 8 + requirements = [ + { + condition = "CLOSED" + definition_id = "3bF4nboZ" + type = "STEP" + }, + { + condition = "CLOSED" + definition_id = "lLr14EM1" + type = "STEP" + }, + { + condition = "CLOSED" + definition_id = "56z3PpJ-" + type = "STEP" + }, + { + condition = "CLOSED" + definition_id = "Kpo2TBM0" + type = "STEP" + }, + { + condition = "CLOSED" + definition_id = "hr__AP3D" + type = "STEP" + }, + ] + type = "STEP" + user_ids = [] + }, + ] + type = "SECTION" + } + }, + { + step = { + assigned_to = [] + ecp = { + enabled = false + } + + installer = { + enabled = false + } + name = "Serve fresh" + order = 9 + requirements = [] + type = "STEP" + user_ids = [] + } + }, + { + section = { + + name = "A new phase" + order = 10 + steps = [ + { + assigned_to = [] + + name = "Something else" + order = 11 + requirements = [] + type = "STEP" + user_ids = [] + }, + ] + type = "SECTION" + } + }, + { + step = { + assigned_to = [] + automation_config = { + flow_id = "378d2cad-91b9-4161-9fda-fc3df1908490" + } + ecp = { + enabled = false + } + execution_type = "AUTOMATION" + + installer = { + enabled = false + } + name = "Enjoy" + order = 12 + requirements = [] + type = "STEP" + user_ids = [] + } + }, + ] + + + name = "Brew a cup of coffee" + update_entity_attributes = [ + { + source = "workflow_status" + target = { + entity_attribute = "status" + entity_schema = "opportunity" + } + }, + ] + user_ids = [] +} diff --git a/gen.yaml b/gen.yaml index 0397cfd..6ba32af 100644 --- a/gen.yaml +++ b/gen.yaml @@ -27,7 +27,7 @@ go: outputModelSuffix: output packageName: openapi terraform: - version: 0.8.4 + version: 0.11.0 additionalDataSources: [] additionalDependencies: {} additionalResources: [] diff --git a/internal/provider/workflowdefinition_data_source.go b/internal/provider/workflowdefinition_data_source.go index 5b63484..3699084 100644 --- a/internal/provider/workflowdefinition_data_source.go +++ b/internal/provider/workflowdefinition_data_source.go @@ -465,8 +465,7 @@ func (r *WorkflowDefinitionDataSource) Schema(ctx context.Context, req datasourc }, }, "id": schema.StringAttribute{ - Required: true, - Description: `Short uuid (length 8) to identify the Workflow Definition.`, + Computed: true, }, "last_update_time": schema.StringAttribute{ Computed: true, diff --git a/internal/provider/workflowdefinition_data_source_sdk.go b/internal/provider/workflowdefinition_data_source_sdk.go index 0d8cdf2..ec17e80 100644 --- a/internal/provider/workflowdefinition_data_source_sdk.go +++ b/internal/provider/workflowdefinition_data_source_sdk.go @@ -35,10 +35,22 @@ func (r *WorkflowDefinitionDataSourceModel) RefreshFromSharedWorkflowDefinition( r.DynamicDueDate = nil } else { r.DynamicDueDate = &tfTypes.DynamicDueDate{} - r.DynamicDueDate.ActionTypeCondition = types.StringValue(string(resp.DynamicDueDate.ActionTypeCondition)) - r.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(resp.DynamicDueDate.NumberOfUnits))) + if resp.DynamicDueDate.ActionTypeCondition != nil { + r.DynamicDueDate.ActionTypeCondition = types.StringValue(string(*resp.DynamicDueDate.ActionTypeCondition)) + } else { + r.DynamicDueDate.ActionTypeCondition = types.StringNull() + } + if resp.DynamicDueDate.NumberOfUnits != nil { + r.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(*resp.DynamicDueDate.NumberOfUnits))) + } else { + r.DynamicDueDate.NumberOfUnits = types.NumberNull() + } r.DynamicDueDate.StepID = types.StringPointerValue(resp.DynamicDueDate.StepID) - r.DynamicDueDate.TimePeriod = types.StringValue(string(resp.DynamicDueDate.TimePeriod)) + if resp.DynamicDueDate.TimePeriod != nil { + r.DynamicDueDate.TimePeriod = types.StringValue(string(*resp.DynamicDueDate.TimePeriod)) + } else { + r.DynamicDueDate.TimePeriod = types.StringNull() + } } r.EnableECPWorkflow = types.BoolPointerValue(resp.EnableECPWorkflow) r.Flow = []tfTypes.Flow{} @@ -77,10 +89,22 @@ func (r *WorkflowDefinitionDataSourceModel) RefreshFromSharedWorkflowDefinition( steps1.DynamicDueDate = nil } else { steps1.DynamicDueDate = &tfTypes.DynamicDueDate{} - steps1.DynamicDueDate.ActionTypeCondition = types.StringValue(string(stepsItem.DynamicDueDate.ActionTypeCondition)) - steps1.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(stepsItem.DynamicDueDate.NumberOfUnits))) + if stepsItem.DynamicDueDate.ActionTypeCondition != nil { + steps1.DynamicDueDate.ActionTypeCondition = types.StringValue(string(*stepsItem.DynamicDueDate.ActionTypeCondition)) + } else { + steps1.DynamicDueDate.ActionTypeCondition = types.StringNull() + } + if stepsItem.DynamicDueDate.NumberOfUnits != nil { + steps1.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(*stepsItem.DynamicDueDate.NumberOfUnits))) + } else { + steps1.DynamicDueDate.NumberOfUnits = types.NumberNull() + } steps1.DynamicDueDate.StepID = types.StringPointerValue(stepsItem.DynamicDueDate.StepID) - steps1.DynamicDueDate.TimePeriod = types.StringValue(string(stepsItem.DynamicDueDate.TimePeriod)) + if stepsItem.DynamicDueDate.TimePeriod != nil { + steps1.DynamicDueDate.TimePeriod = types.StringValue(string(*stepsItem.DynamicDueDate.TimePeriod)) + } else { + steps1.DynamicDueDate.TimePeriod = types.StringNull() + } } if stepsItem.Ecp == nil { steps1.Ecp = nil @@ -195,10 +219,22 @@ func (r *WorkflowDefinitionDataSourceModel) RefreshFromSharedWorkflowDefinition( flow1.Step.DynamicDueDate = nil } else { flow1.Step.DynamicDueDate = &tfTypes.DynamicDueDate{} - flow1.Step.DynamicDueDate.ActionTypeCondition = types.StringValue(string(flowItem.Step.DynamicDueDate.ActionTypeCondition)) - flow1.Step.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(flowItem.Step.DynamicDueDate.NumberOfUnits))) + if flowItem.Step.DynamicDueDate.ActionTypeCondition != nil { + flow1.Step.DynamicDueDate.ActionTypeCondition = types.StringValue(string(*flowItem.Step.DynamicDueDate.ActionTypeCondition)) + } else { + flow1.Step.DynamicDueDate.ActionTypeCondition = types.StringNull() + } + if flowItem.Step.DynamicDueDate.NumberOfUnits != nil { + flow1.Step.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(*flowItem.Step.DynamicDueDate.NumberOfUnits))) + } else { + flow1.Step.DynamicDueDate.NumberOfUnits = types.NumberNull() + } flow1.Step.DynamicDueDate.StepID = types.StringPointerValue(flowItem.Step.DynamicDueDate.StepID) - flow1.Step.DynamicDueDate.TimePeriod = types.StringValue(string(flowItem.Step.DynamicDueDate.TimePeriod)) + if flowItem.Step.DynamicDueDate.TimePeriod != nil { + flow1.Step.DynamicDueDate.TimePeriod = types.StringValue(string(*flowItem.Step.DynamicDueDate.TimePeriod)) + } else { + flow1.Step.DynamicDueDate.TimePeriod = types.StringNull() + } } if flowItem.Step.Ecp == nil { flow1.Step.Ecp = nil diff --git a/internal/provider/workflowdefinition_resource.go b/internal/provider/workflowdefinition_resource.go index 872a115..489bc8a 100644 --- a/internal/provider/workflowdefinition_resource.go +++ b/internal/provider/workflowdefinition_resource.go @@ -102,9 +102,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc "action_type_condition": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"]`, + Description: `must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"]`, Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( "WORKFLOW_STARTED", "STEP_CLOSED", @@ -112,12 +111,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc }, }, "number_of_units": schema.NumberAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.Number{ - speakeasy_numbervalidators.NotNull(), - }, + Computed: true, + Optional: true, }, "step_id": schema.StringAttribute{ Computed: true, @@ -126,9 +121,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc "time_period": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be one of ["days", "weeks", "months"]`, + Description: `must be one of ["days", "weeks", "months"]`, Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( "days", "weeks", @@ -222,9 +216,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc "action_type_condition": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"]`, + Description: `must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"]`, Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( "WORKFLOW_STARTED", "STEP_CLOSED", @@ -232,12 +225,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc }, }, "number_of_units": schema.NumberAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.Number{ - speakeasy_numbervalidators.NotNull(), - }, + Computed: true, + Optional: true, }, "step_id": schema.StringAttribute{ Computed: true, @@ -246,9 +235,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc "time_period": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be one of ["days", "weeks", "months"]`, + Description: `must be one of ["days", "weeks", "months"]`, Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( "days", "weeks", @@ -516,9 +504,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc "action_type_condition": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"]`, + Description: `must be one of ["WORKFLOW_STARTED", "STEP_CLOSED"]`, Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( "WORKFLOW_STARTED", "STEP_CLOSED", @@ -526,12 +513,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc }, }, "number_of_units": schema.NumberAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.Number{ - speakeasy_numbervalidators.NotNull(), - }, + Computed: true, + Optional: true, }, "step_id": schema.StringAttribute{ Computed: true, @@ -540,9 +523,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc "time_period": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be one of ["days", "weeks", "months"]`, + Description: `must be one of ["days", "weeks", "months"]`, Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( "days", "weeks", @@ -749,9 +731,8 @@ func (r *WorkflowDefinitionResource) Schema(ctx context.Context, req resource.Sc }, }, "id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Id of the definition to de deleted.`, + Computed: true, + Optional: true, }, "last_update_time": schema.StringAttribute{ Computed: true, diff --git a/internal/provider/workflowdefinition_resource_sdk.go b/internal/provider/workflowdefinition_resource_sdk.go index d12a38a..e7b6a55 100644 --- a/internal/provider/workflowdefinition_resource_sdk.go +++ b/internal/provider/workflowdefinition_resource_sdk.go @@ -41,15 +41,30 @@ func (r *WorkflowDefinitionResourceModel) ToSharedWorkflowDefinition() *shared.W } var dynamicDueDate *shared.DynamicDueDate if r.DynamicDueDate != nil { - actionTypeCondition := shared.ActionTypeCondition(r.DynamicDueDate.ActionTypeCondition.ValueString()) - numberOfUnits, _ := r.DynamicDueDate.NumberOfUnits.ValueBigFloat().Float64() + actionTypeCondition := new(shared.ActionTypeCondition) + if !r.DynamicDueDate.ActionTypeCondition.IsUnknown() && !r.DynamicDueDate.ActionTypeCondition.IsNull() { + *actionTypeCondition = shared.ActionTypeCondition(r.DynamicDueDate.ActionTypeCondition.ValueString()) + } else { + actionTypeCondition = nil + } + numberOfUnits := new(float64) + if !r.DynamicDueDate.NumberOfUnits.IsUnknown() && !r.DynamicDueDate.NumberOfUnits.IsNull() { + *numberOfUnits, _ = r.DynamicDueDate.NumberOfUnits.ValueBigFloat().Float64() + } else { + numberOfUnits = nil + } stepID := new(string) if !r.DynamicDueDate.StepID.IsUnknown() && !r.DynamicDueDate.StepID.IsNull() { *stepID = r.DynamicDueDate.StepID.ValueString() } else { stepID = nil } - timePeriod := shared.TimePeriod(r.DynamicDueDate.TimePeriod.ValueString()) + timePeriod := new(shared.TimePeriod) + if !r.DynamicDueDate.TimePeriod.IsUnknown() && !r.DynamicDueDate.TimePeriod.IsNull() { + *timePeriod = shared.TimePeriod(r.DynamicDueDate.TimePeriod.ValueString()) + } else { + timePeriod = nil + } dynamicDueDate = &shared.DynamicDueDate{ ActionTypeCondition: actionTypeCondition, NumberOfUnits: numberOfUnits, @@ -114,15 +129,30 @@ func (r *WorkflowDefinitionResourceModel) ToSharedWorkflowDefinition() *shared.W } var dynamicDueDate1 *shared.DynamicDueDate if stepsItem.DynamicDueDate != nil { - actionTypeCondition1 := shared.ActionTypeCondition(stepsItem.DynamicDueDate.ActionTypeCondition.ValueString()) - numberOfUnits1, _ := stepsItem.DynamicDueDate.NumberOfUnits.ValueBigFloat().Float64() + actionTypeCondition1 := new(shared.ActionTypeCondition) + if !stepsItem.DynamicDueDate.ActionTypeCondition.IsUnknown() && !stepsItem.DynamicDueDate.ActionTypeCondition.IsNull() { + *actionTypeCondition1 = shared.ActionTypeCondition(stepsItem.DynamicDueDate.ActionTypeCondition.ValueString()) + } else { + actionTypeCondition1 = nil + } + numberOfUnits1 := new(float64) + if !stepsItem.DynamicDueDate.NumberOfUnits.IsUnknown() && !stepsItem.DynamicDueDate.NumberOfUnits.IsNull() { + *numberOfUnits1, _ = stepsItem.DynamicDueDate.NumberOfUnits.ValueBigFloat().Float64() + } else { + numberOfUnits1 = nil + } stepId1 := new(string) if !stepsItem.DynamicDueDate.StepID.IsUnknown() && !stepsItem.DynamicDueDate.StepID.IsNull() { *stepId1 = stepsItem.DynamicDueDate.StepID.ValueString() } else { stepId1 = nil } - timePeriod1 := shared.TimePeriod(stepsItem.DynamicDueDate.TimePeriod.ValueString()) + timePeriod1 := new(shared.TimePeriod) + if !stepsItem.DynamicDueDate.TimePeriod.IsUnknown() && !stepsItem.DynamicDueDate.TimePeriod.IsNull() { + *timePeriod1 = shared.TimePeriod(stepsItem.DynamicDueDate.TimePeriod.ValueString()) + } else { + timePeriod1 = nil + } dynamicDueDate1 = &shared.DynamicDueDate{ ActionTypeCondition: actionTypeCondition1, NumberOfUnits: numberOfUnits1, @@ -362,15 +392,30 @@ func (r *WorkflowDefinitionResourceModel) ToSharedWorkflowDefinition() *shared.W } var dynamicDueDate2 *shared.DynamicDueDate if flowItem.Step.DynamicDueDate != nil { - actionTypeCondition2 := shared.ActionTypeCondition(flowItem.Step.DynamicDueDate.ActionTypeCondition.ValueString()) - numberOfUnits2, _ := flowItem.Step.DynamicDueDate.NumberOfUnits.ValueBigFloat().Float64() + actionTypeCondition2 := new(shared.ActionTypeCondition) + if !flowItem.Step.DynamicDueDate.ActionTypeCondition.IsUnknown() && !flowItem.Step.DynamicDueDate.ActionTypeCondition.IsNull() { + *actionTypeCondition2 = shared.ActionTypeCondition(flowItem.Step.DynamicDueDate.ActionTypeCondition.ValueString()) + } else { + actionTypeCondition2 = nil + } + numberOfUnits2 := new(float64) + if !flowItem.Step.DynamicDueDate.NumberOfUnits.IsUnknown() && !flowItem.Step.DynamicDueDate.NumberOfUnits.IsNull() { + *numberOfUnits2, _ = flowItem.Step.DynamicDueDate.NumberOfUnits.ValueBigFloat().Float64() + } else { + numberOfUnits2 = nil + } stepId2 := new(string) if !flowItem.Step.DynamicDueDate.StepID.IsUnknown() && !flowItem.Step.DynamicDueDate.StepID.IsNull() { *stepId2 = flowItem.Step.DynamicDueDate.StepID.ValueString() } else { stepId2 = nil } - timePeriod2 := shared.TimePeriod(flowItem.Step.DynamicDueDate.TimePeriod.ValueString()) + timePeriod2 := new(shared.TimePeriod) + if !flowItem.Step.DynamicDueDate.TimePeriod.IsUnknown() && !flowItem.Step.DynamicDueDate.TimePeriod.IsNull() { + *timePeriod2 = shared.TimePeriod(flowItem.Step.DynamicDueDate.TimePeriod.ValueString()) + } else { + timePeriod2 = nil + } dynamicDueDate2 = &shared.DynamicDueDate{ ActionTypeCondition: actionTypeCondition2, NumberOfUnits: numberOfUnits2, @@ -639,10 +684,22 @@ func (r *WorkflowDefinitionResourceModel) RefreshFromSharedWorkflowDefinition(re r.DynamicDueDate = nil } else { r.DynamicDueDate = &tfTypes.DynamicDueDate{} - r.DynamicDueDate.ActionTypeCondition = types.StringValue(string(resp.DynamicDueDate.ActionTypeCondition)) - r.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(resp.DynamicDueDate.NumberOfUnits))) + if resp.DynamicDueDate.ActionTypeCondition != nil { + r.DynamicDueDate.ActionTypeCondition = types.StringValue(string(*resp.DynamicDueDate.ActionTypeCondition)) + } else { + r.DynamicDueDate.ActionTypeCondition = types.StringNull() + } + if resp.DynamicDueDate.NumberOfUnits != nil { + r.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(*resp.DynamicDueDate.NumberOfUnits))) + } else { + r.DynamicDueDate.NumberOfUnits = types.NumberNull() + } r.DynamicDueDate.StepID = types.StringPointerValue(resp.DynamicDueDate.StepID) - r.DynamicDueDate.TimePeriod = types.StringValue(string(resp.DynamicDueDate.TimePeriod)) + if resp.DynamicDueDate.TimePeriod != nil { + r.DynamicDueDate.TimePeriod = types.StringValue(string(*resp.DynamicDueDate.TimePeriod)) + } else { + r.DynamicDueDate.TimePeriod = types.StringNull() + } } r.EnableECPWorkflow = types.BoolPointerValue(resp.EnableECPWorkflow) r.Flow = []tfTypes.Flow{} @@ -681,10 +738,22 @@ func (r *WorkflowDefinitionResourceModel) RefreshFromSharedWorkflowDefinition(re steps1.DynamicDueDate = nil } else { steps1.DynamicDueDate = &tfTypes.DynamicDueDate{} - steps1.DynamicDueDate.ActionTypeCondition = types.StringValue(string(stepsItem.DynamicDueDate.ActionTypeCondition)) - steps1.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(stepsItem.DynamicDueDate.NumberOfUnits))) + if stepsItem.DynamicDueDate.ActionTypeCondition != nil { + steps1.DynamicDueDate.ActionTypeCondition = types.StringValue(string(*stepsItem.DynamicDueDate.ActionTypeCondition)) + } else { + steps1.DynamicDueDate.ActionTypeCondition = types.StringNull() + } + if stepsItem.DynamicDueDate.NumberOfUnits != nil { + steps1.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(*stepsItem.DynamicDueDate.NumberOfUnits))) + } else { + steps1.DynamicDueDate.NumberOfUnits = types.NumberNull() + } steps1.DynamicDueDate.StepID = types.StringPointerValue(stepsItem.DynamicDueDate.StepID) - steps1.DynamicDueDate.TimePeriod = types.StringValue(string(stepsItem.DynamicDueDate.TimePeriod)) + if stepsItem.DynamicDueDate.TimePeriod != nil { + steps1.DynamicDueDate.TimePeriod = types.StringValue(string(*stepsItem.DynamicDueDate.TimePeriod)) + } else { + steps1.DynamicDueDate.TimePeriod = types.StringNull() + } } if stepsItem.Ecp == nil { steps1.Ecp = nil @@ -799,10 +868,22 @@ func (r *WorkflowDefinitionResourceModel) RefreshFromSharedWorkflowDefinition(re flow1.Step.DynamicDueDate = nil } else { flow1.Step.DynamicDueDate = &tfTypes.DynamicDueDate{} - flow1.Step.DynamicDueDate.ActionTypeCondition = types.StringValue(string(flowItem.Step.DynamicDueDate.ActionTypeCondition)) - flow1.Step.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(flowItem.Step.DynamicDueDate.NumberOfUnits))) + if flowItem.Step.DynamicDueDate.ActionTypeCondition != nil { + flow1.Step.DynamicDueDate.ActionTypeCondition = types.StringValue(string(*flowItem.Step.DynamicDueDate.ActionTypeCondition)) + } else { + flow1.Step.DynamicDueDate.ActionTypeCondition = types.StringNull() + } + if flowItem.Step.DynamicDueDate.NumberOfUnits != nil { + flow1.Step.DynamicDueDate.NumberOfUnits = types.NumberValue(big.NewFloat(float64(*flowItem.Step.DynamicDueDate.NumberOfUnits))) + } else { + flow1.Step.DynamicDueDate.NumberOfUnits = types.NumberNull() + } flow1.Step.DynamicDueDate.StepID = types.StringPointerValue(flowItem.Step.DynamicDueDate.StepID) - flow1.Step.DynamicDueDate.TimePeriod = types.StringValue(string(flowItem.Step.DynamicDueDate.TimePeriod)) + if flowItem.Step.DynamicDueDate.TimePeriod != nil { + flow1.Step.DynamicDueDate.TimePeriod = types.StringValue(string(*flowItem.Step.DynamicDueDate.TimePeriod)) + } else { + flow1.Step.DynamicDueDate.TimePeriod = types.StringNull() + } } if flowItem.Step.Ecp == nil { flow1.Step.Ecp = nil diff --git a/internal/sdk/internal/utils/contenttype.go b/internal/sdk/internal/utils/contenttype.go index 8ed13e2..763f2d6 100644 --- a/internal/sdk/internal/utils/contenttype.go +++ b/internal/sdk/internal/utils/contenttype.go @@ -9,6 +9,10 @@ import ( ) func MatchContentType(contentType string, pattern string) bool { + if contentType == "" { + contentType = "application/octet-stream" + } + if contentType == pattern || pattern == "*" || pattern == "*/*" { return true } diff --git a/internal/sdk/internal/utils/retries.go b/internal/sdk/internal/utils/retries.go index ff39d0d..fb9318c 100644 --- a/internal/sdk/internal/utils/retries.go +++ b/internal/sdk/internal/utils/retries.go @@ -6,32 +6,25 @@ import ( "context" "errors" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk/retry" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/cenkalti/backoff/v4" ) var errRequestFailed = errors.New("request failed") -type BackoffStrategy struct { - InitialInterval int - MaxInterval int - Exponent float64 - MaxElapsedTime int -} +// Deprecated: Use retry.BackoffStrategy instead. +type BackoffStrategy = retry.BackoffStrategy -type RetryConfig struct { - Strategy string - Backoff *BackoffStrategy - RetryConnectionErrors bool -} +// Deprecated: Use retry.Config instead. +type RetryConfig = retry.Config type Retries struct { - Config *RetryConfig + Config *retry.Config StatusCodes []string } diff --git a/internal/sdk/models/shared/dynamicduedate.go b/internal/sdk/models/shared/dynamicduedate.go index 6756774..b34b252 100644 --- a/internal/sdk/models/shared/dynamicduedate.go +++ b/internal/sdk/models/shared/dynamicduedate.go @@ -64,22 +64,22 @@ func (e *TimePeriod) UnmarshalJSON(data []byte) error { // DynamicDueDate - set a Duedate for a step then a specific type DynamicDueDate struct { - ActionTypeCondition ActionTypeCondition `json:"actionTypeCondition"` - NumberOfUnits float64 `json:"numberOfUnits"` - StepID *string `json:"stepId,omitempty"` - TimePeriod TimePeriod `json:"timePeriod"` + ActionTypeCondition *ActionTypeCondition `json:"actionTypeCondition,omitempty"` + NumberOfUnits *float64 `json:"numberOfUnits,omitempty"` + StepID *string `json:"stepId,omitempty"` + TimePeriod *TimePeriod `json:"timePeriod,omitempty"` } -func (o *DynamicDueDate) GetActionTypeCondition() ActionTypeCondition { +func (o *DynamicDueDate) GetActionTypeCondition() *ActionTypeCondition { if o == nil { - return ActionTypeCondition("") + return nil } return o.ActionTypeCondition } -func (o *DynamicDueDate) GetNumberOfUnits() float64 { +func (o *DynamicDueDate) GetNumberOfUnits() *float64 { if o == nil { - return 0.0 + return nil } return o.NumberOfUnits } @@ -91,9 +91,9 @@ func (o *DynamicDueDate) GetStepID() *string { return o.StepID } -func (o *DynamicDueDate) GetTimePeriod() TimePeriod { +func (o *DynamicDueDate) GetTimePeriod() *TimePeriod { if o == nil { - return TimePeriod("") + return nil } return o.TimePeriod } diff --git a/internal/sdk/retry/config.go b/internal/sdk/retry/config.go new file mode 100644 index 0000000..dbbd57e --- /dev/null +++ b/internal/sdk/retry/config.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package retry + +type BackoffStrategy struct { + InitialInterval int + MaxInterval int + Exponent float64 + MaxElapsedTime int +} + +type Config struct { + Strategy string + Backoff *BackoffStrategy + RetryConnectionErrors bool +} diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go index 60dc8dd..335258e 100644 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -8,6 +8,7 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk/internal/hooks" "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk/internal/utils" "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk/retry" "net/http" "time" ) @@ -50,7 +51,7 @@ type sdkConfiguration struct { SDKVersion string GenVersion string UserAgent string - RetryConfig *utils.RetryConfig + RetryConfig *retry.Config Hooks *hooks.Hooks } @@ -123,7 +124,7 @@ func WithSecuritySource(security func(context.Context) (shared.Security, error)) } } -func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption { +func WithRetryConfig(retryConfig retry.Config) SDKOption { return func(sdk *SDK) { sdk.sdkConfiguration.RetryConfig = &retryConfig } @@ -136,8 +137,8 @@ func New(opts ...SDKOption) *SDK { Language: "go", OpenAPIDocVersion: "1.0.0", SDKVersion: "0.0.1", - GenVersion: "2.340.2", - UserAgent: "speakeasy-sdk/go 0.0.1 2.340.2 1.0.0 github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk", + GenVersion: "2.361.10", + UserAgent: "speakeasy-sdk/go 0.0.1 2.361.10 1.0.0 github.com/epilot-dev/terraform-provider-epilot-workflow/internal/sdk", Hooks: hooks.New(), }, } diff --git a/workflow.yaml b/workflow.yaml index 03a65f4..919e2c8 100644 --- a/workflow.yaml +++ b/workflow.yaml @@ -791,10 +791,6 @@ components: - STEP_CLOSED stepId: type: string - required: - - numberOfUnits - - timePeriod - - actionTypeCondition StepRequirement: description: describe the requirement for step enablement