diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 4c4f41e..5a59081 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,18 +1,18 @@ lockVersion: 2.0.0 id: 6df5dec4-6d34-4c07-99f4-b36e64bbb781 management: - docChecksum: 931ee85754666315b98eaa2f7ba29ec3 + docChecksum: d792a8b25d8ed58499761d7eaf4a6284 docVersion: 1.0.0 - speakeasyVersion: 1.300.1 - generationVersion: 2.339.1 - releaseVersion: 0.3.1 - configChecksum: 25f553ef26e58bdbb7e784ed7bd307a9 + speakeasyVersion: 1.303.4 + generationVersion: 2.340.2 + releaseVersion: 0.3.4 + configChecksum: f724d8c3d33384cabeccff137d6299da features: terraform: additionalDependencies: 0.1.0 additionalProperties: 0.1.2 constsAndDefaults: 0.1.4 - core: 3.21.2 + core: 3.21.3 deprecations: 2.81.1 globalSecurity: 2.81.6 globalServerURLs: 2.82.1 @@ -94,20 +94,6 @@ generatedFiles: - internal/sdk/models/shared/retryreq.go - internal/sdk/models/shared/startexecutionrequest.go - internal/sdk/models/shared/automationflow.go - - internal/sdk/models/shared/anytrigger.go - - internal/sdk/models/shared/frontendsubmittrigger.go - - internal/sdk/models/shared/journeysubmittrigger.go - - internal/sdk/models/shared/apisubmissiontrigger.go - - internal/sdk/models/shared/entityoperationtrigger.go - - internal/sdk/models/shared/equalsignorecasecondition.go - - internal/sdk/models/shared/anythingbutcondition.go - - internal/sdk/models/shared/existscondition.go - - internal/sdk/models/shared/prefixcondition.go - - internal/sdk/models/shared/suffixcondition.go - - internal/sdk/models/shared/wildcardcondition.go - - internal/sdk/models/shared/activitytrigger.go - - internal/sdk/models/shared/entitymanualtrigger.go - - internal/sdk/models/shared/receivedemailtrigger.go - internal/sdk/models/shared/automationflowinput.go - internal/sdk/models/shared/searchautomationsresp.go - internal/sdk/models/shared/security.go @@ -163,34 +149,6 @@ generatedFiles: - internal/provider/types/source.go - internal/provider/types/condition.go - internal/provider/types/action_condition.go - - internal/provider/types/configuration.go - - internal/provider/types/activity_trigger.go - - internal/provider/types/api_submission_trigger_configuration.go - - internal/provider/types/api_submission_trigger.go - - internal/provider/types/entity_manual_trigger_configuration.go - - internal/provider/types/entity_manual_trigger.go - - internal/provider/types/file_config.go - - internal/provider/types/ecp_config.go - - internal/provider/types/anything_but_condition.go - - internal/provider/types/equals_ignore_case_condition.go - - internal/provider/types/exists_condition.go - - internal/provider/types/prefix_condition.go - - internal/provider/types/suffix_condition.go - - internal/provider/types/wildcard_condition.go - - internal/provider/types/entity_operation_trigger_schemas_type.go - - internal/provider/types/activity.go - - internal/provider/types/two.go - - internal/provider/types/diff.go - - internal/provider/types/entity_operation_trigger_operation.go - - internal/provider/types/filter_config.go - - internal/provider/types/entity_operation_trigger_configuration.go - - internal/provider/types/entity_operation_trigger.go - - internal/provider/types/frontend_submit_trigger.go - - internal/provider/types/journey_submit_trigger_configuration.go - - internal/provider/types/journey_submit_trigger.go - - internal/provider/types/received_email_trigger_configuration.go - - internal/provider/types/received_email_trigger.go - - internal/provider/types/any_trigger.go - USAGE.md - internal/provider/provider.go - examples/provider/provider.tf diff --git a/Makefile b/Makefile index 67e7003..09c355a 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,8 @@ overlay.yaml: speakeasy: $(eval TMP := $(shell mktemp -d)) - speakeasy overlay apply -s automation.yaml -o overlay.yaml > $(TMP)/final.yaml + curl https://docs.api.epilot.io/automation.yaml > $(TMP)/openapi.yaml + speakeasy overlay apply -s $(TMP)/openapi.yaml -o overlay.yaml > $(TMP)/final.yaml speakeasy generate sdk --lang terraform -o . -s $(TMP)/final.yaml docs: diff --git a/README.md b/README.md index 0e55c30..1a1773c 100755 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ terraform { required_providers { epilot-automation = { source = "epilot-dev/epilot-automation" - version = "0.3.1" + version = "0.3.4" } } } diff --git a/docs/data-sources/flow.md b/docs/data-sources/flow.md index ba779be..9a6e55b 100644 --- a/docs/data-sources/flow.md +++ b/docs/data-sources/flow.md @@ -34,7 +34,7 @@ data "epilot-automation_flow" "my_flow" { - `flow_name` (String) A descriptive name for the Automation - `system_flow` (Boolean) Determines if the flow is a system generated flow - `trigger_conditions` (List of String) -- `triggers` (Attributes List) (see [below for nested schema](#nestedatt--triggers)) +- `triggers` (List of String) - `version` (Number) Version of the flow @@ -69,412 +69,3 @@ Read-Only: - `schema` (String) - - - -### Nested Schema for `triggers` - -Read-Only: - -- `activity_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--activity_trigger)) -- `api_submission_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--api_submission_trigger)) -- `entity_manual_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_manual_trigger)) -- `entity_operation_trigger` (Attributes) - If provides filter_config, executes an automation based on the filtered configuration when an entity event occurs. -- The conditions on a filter follows the event bridge patterns - `https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html` - | Comparison | Example | Rule syntax | - |------------------------|-----------------------------------------------------|----------------------------------------------------------| - | Null | first_name is null | `"first_name": [ null ]` | - | Empty | last_name is empty | `"last_name": [""]` | - | Equals | email is "j.doe@email.com" | `"email": [ "j.doe@email.com" ]` | - | Equals (ignore case) | first_name is "John" | `"first_name": [ { "equals-ignore-case": "john" } ]` | - | And | fist_name is "John" and last_name is "Doe" | `"first_name": [ "John" ], "last_name": ["Doe"]` | - | Or | PaymentType is "Invoice" or "SEPA" | `"PaymentType": [ "invoice", "sepa"]` | - | Or (multiple fields) | first_name is "John", or last_name is "Doe". | `"$or": [ { "first_name": [ "John" ] }, { "last_name": [ "Doe" ] } ]` | - | Not | status is anything but "cancelled" | `"status": [ { "anything-but": [ "cancelled" ] } ]` | - | Numeric (equals) | Price is 100 | `"Price": [ { "numeric": [ "=", 100 ] } ]` | - | Numeric (range) | Price is more than 10, and less than or equal to 20 | `"Price": [ { "numeric": [ ">", 10, "<=", 20 ] } ]` | - | Exists | ProductName exists | `"ProductName": [ { "exists": true } ]` | - | Does not exist | ProductName does not exist | `"ProductName": [ { "exists": false } ]` | - | Begins with | OpportunityNumber starts with OPP- | `"opportunity_number": [ { "prefix": "OPP-" } ]` | - | Ends with | FileName ends with a .png extension | `"filename": [ { "suffix": ".png" } ]` | - | Wildcard | search a string using a wildcard | `"email": [ { "wildcard": "*@doe.com" } ]` | - - To run the execution on all update events - ``` - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "operation": ["updateEntity"] - } - } - } - ``` - - To run the execution only when the updates are from a portal user - ``` - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "operation": ["updateEntity"] - }, - "activity": { - "type": "EntityUpdatedFromPortal" - } - } - } - ``` - - To run the execution only when there is an update on a specific attribute - ``` - Only starts the automation when the email on a contact is changed - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "operation": ["updateEntity"], - "payload": { - "_schema": ["contact"] - }, - "diff": { - "updated": { - "email": [{ "exists": true }] - } - } - } - } - } - ``` - - To run the execution only when a specific attribute is altered(created/updated/deleted) - ``` - Only starts the automation when a price is altered on a contract - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "payload": { - "_schema": ["contract"] - }, - "diff": { - // Whether he first_name has been added, updated, or removed - $or: [ - { - 'added.first_name': [{ exists: true }] - }, - { - 'updated.first_name': [{ exists: true }] - }, - { - 'deleted.first_name': [{ exists: true }] - } - ] - } - } - } - } - ``` - - To run the execution if an attribute is changed from one state to another - ``` - Only starts the automation when the order status changes from `open_for_acceptance` to `placed` - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "operation": ["updateEntity"], - "payload": { - "_schema": ["order"], - "status": ["placed"] - }, - "diff": { - "updated": { - "status": ["open_for_acceptance"] - } - } - } - } - } - ``` (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger)) -- `frontend_submit_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--frontend_submit_trigger)) -- `journey_submit_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--journey_submit_trigger)) -- `received_email_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--received_email_trigger)) - - -### Nested Schema for `triggers.activity_trigger` - -Read-Only: - -- `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--activity_trigger--configuration)) -- `id` (String) -- `type` (String) must be one of ["activity"] - - -### Nested Schema for `triggers.activity_trigger.configuration` - -Read-Only: - -- `schema` (String) -- `types` (List of String) - - - - -### Nested Schema for `triggers.api_submission_trigger` - -Read-Only: - -- `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--api_submission_trigger--configuration)) -- `id` (String) -- `type` (String) must be one of ["api_submission"] - - -### Nested Schema for `triggers.api_submission_trigger.configuration` - -Read-Only: - -- `source_id` (String) - - - - -### Nested Schema for `triggers.entity_manual_trigger` - -Read-Only: - -- `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_manual_trigger--configuration)) -- `id` (String) -- `type` (String) must be one of ["entity_manual"] - - -### Nested Schema for `triggers.entity_manual_trigger.configuration` - -Read-Only: - -- `schema` (String) Which entity type can this automation be triggered from - - - - -### Nested Schema for `triggers.entity_operation_trigger` - -Read-Only: - -- `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration)) -- `id` (String) -- `type` (String) must be one of ["entity_operation"] - - -### Nested Schema for `triggers.entity_operation_trigger.configuration` - -Read-Only: - -- `ecp_config` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--ecp_config)) -- `exclude_activities` (List of String) -- `filter_config` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--filter_config)) -- `include_activities` (List of String) -- `operations` (List of String) -- `schema` (String) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema` - -Read-Only: - -- `file_config` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--file_config)) -- `origin` (String) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.file_config` - -Read-Only: - -- `shared_with_end_customer` (Boolean) - - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema` - -Read-Only: - -- `activity` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity)) -- `operation` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--operation)) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity` - -Read-Only: - -- `type` (Attributes List) Filter on activity type. If not specified, all activities will be matched on execution. -Example: - 1. Filter the events when an entity is updated from portal - ``` - { - "activity":{ - "type": ["EntityUpdatedFromPortal"] - } - } - ``` - 2. Filter the events when either a doc is uploaded/removed on an entity from a portal - ``` - { - "activity":{ - "type": ["DocUploadedFromPortal", "DocRemovedFromPortal"] - } - } - ``` (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type)) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type` - -Read-Only: - -- `anything_but_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--anything_but_condition)) -- `equals_ignore_case_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--equals_ignore_case_condition)) -- `exists_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--exists_condition)) -- `prefix_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--prefix_condition)) -- `str` (String) -- `suffix_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--suffix_condition)) -- `wildcard_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--wildcard_condition)) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Read-Only: - -- `anything_but` (List of String) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Read-Only: - -- `equals_ignore_case` (String) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Read-Only: - -- `exists` (Boolean) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Read-Only: - -- `prefix` (String) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Read-Only: - -- `suffix` (String) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Read-Only: - -- `wildcard` (String) - - - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.operation` - -Read-Only: - -- `diff` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--operation--diff)) -- `operation` (List of String) Filter on operation type. If not specified, all operations will be matched on execution. -Example: - 1. Filter all the createEntity/updateEntity operations - ``` - { - "operation":{ - "operation": ["createEntity", "updateEntity"] - } - } - ``` -- `payload` (String) Parsed as JSON. - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.operation.payload` - -Read-Only: - -- `any` (String) Parsed as JSON. -- `two` (Attributes) Diff to it's prior state when an entity is updated (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--operation--payload--two)) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.operation.payload.two` - -Read-Only: - -- `added` (String) Parsed as JSON. -- `deleted` (String) Parsed as JSON. -- `updated` (String) Parsed as JSON. - - - - - - - - -### Nested Schema for `triggers.frontend_submit_trigger` - -Read-Only: - -- `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--frontend_submit_trigger--configuration)) -- `id` (String) -- `type` (String) must be one of ["frontend_submission"] - - -### Nested Schema for `triggers.frontend_submit_trigger.configuration` - -Read-Only: - -- `source_id` (String) - - - - -### Nested Schema for `triggers.journey_submit_trigger` - -Read-Only: - -- `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--journey_submit_trigger--configuration)) -- `id` (String) -- `type` (String) must be one of ["journey_submission"] - - -### Nested Schema for `triggers.journey_submit_trigger.configuration` - -Read-Only: - -- `source_id` (String) - - - - -### Nested Schema for `triggers.received_email_trigger` - -Read-Only: - -- `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--received_email_trigger--configuration)) -- `id` (String) -- `type` (String) must be one of ["received_email"] - - -### Nested Schema for `triggers.received_email_trigger.configuration` - -Read-Only: - -- `message_type` (String) must be one of ["RECEIVED"] - - diff --git a/docs/index.md b/docs/index.md index 82bc947..1fcabb8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,7 @@ terraform { required_providers { epilot-automation = { source = "epilot-dev/epilot-automation" - version = "0.3.1" + version = "0.3.4" } } } diff --git a/docs/resources/flow.md b/docs/resources/flow.md index c7959be..8c7fc87 100644 --- a/docs/resources/flow.md +++ b/docs/resources/flow.md @@ -22,18 +22,7 @@ resource "epilot-automation_flow" "my_flow" { flow_name = "Handle contact form" system_flow = false triggers = [ - { - activity_trigger = { - configuration = { - schema = "submission" - types = [ - "{ \"see\": \"documentation\" }", - ] - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "activity" - } - }, + "{ \"see\": \"documentation\" }", ] version = 2 } @@ -46,7 +35,7 @@ resource "epilot-automation_flow" "my_flow" { - `actions` (List of String) The actions (nodes) of the automation flow - `flow_name` (String) A descriptive name for the Automation -- `triggers` (Attributes List) (see [below for nested schema](#nestedatt--triggers)) +- `triggers` (List of String) ### Optional @@ -61,415 +50,6 @@ resource "epilot-automation_flow" "my_flow" { - `id` (String) Automation Workflow ID - -### Nested Schema for `triggers` - -Optional: - -- `activity_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--activity_trigger)) -- `api_submission_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--api_submission_trigger)) -- `entity_manual_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_manual_trigger)) -- `entity_operation_trigger` (Attributes) - If provides filter_config, executes an automation based on the filtered configuration when an entity event occurs. -- The conditions on a filter follows the event bridge patterns - `https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html` - | Comparison | Example | Rule syntax | - |------------------------|-----------------------------------------------------|----------------------------------------------------------| - | Null | first_name is null | `"first_name": [ null ]` | - | Empty | last_name is empty | `"last_name": [""]` | - | Equals | email is "j.doe@email.com" | `"email": [ "j.doe@email.com" ]` | - | Equals (ignore case) | first_name is "John" | `"first_name": [ { "equals-ignore-case": "john" } ]` | - | And | fist_name is "John" and last_name is "Doe" | `"first_name": [ "John" ], "last_name": ["Doe"]` | - | Or | PaymentType is "Invoice" or "SEPA" | `"PaymentType": [ "invoice", "sepa"]` | - | Or (multiple fields) | first_name is "John", or last_name is "Doe". | `"$or": [ { "first_name": [ "John" ] }, { "last_name": [ "Doe" ] } ]` | - | Not | status is anything but "cancelled" | `"status": [ { "anything-but": [ "cancelled" ] } ]` | - | Numeric (equals) | Price is 100 | `"Price": [ { "numeric": [ "=", 100 ] } ]` | - | Numeric (range) | Price is more than 10, and less than or equal to 20 | `"Price": [ { "numeric": [ ">", 10, "<=", 20 ] } ]` | - | Exists | ProductName exists | `"ProductName": [ { "exists": true } ]` | - | Does not exist | ProductName does not exist | `"ProductName": [ { "exists": false } ]` | - | Begins with | OpportunityNumber starts with OPP- | `"opportunity_number": [ { "prefix": "OPP-" } ]` | - | Ends with | FileName ends with a .png extension | `"filename": [ { "suffix": ".png" } ]` | - | Wildcard | search a string using a wildcard | `"email": [ { "wildcard": "*@doe.com" } ]` | - - To run the execution on all update events - ``` - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "operation": ["updateEntity"] - } - } - } - ``` - - To run the execution only when the updates are from a portal user - ``` - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "operation": ["updateEntity"] - }, - "activity": { - "type": "EntityUpdatedFromPortal" - } - } - } - ``` - - To run the execution only when there is an update on a specific attribute - ``` - Only starts the automation when the email on a contact is changed - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "operation": ["updateEntity"], - "payload": { - "_schema": ["contact"] - }, - "diff": { - "updated": { - "email": [{ "exists": true }] - } - } - } - } - } - ``` - - To run the execution only when a specific attribute is altered(created/updated/deleted) - ``` - Only starts the automation when a price is altered on a contract - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "payload": { - "_schema": ["contract"] - }, - "diff": { - // Whether he first_name has been added, updated, or removed - $or: [ - { - 'added.first_name': [{ exists: true }] - }, - { - 'updated.first_name': [{ exists: true }] - }, - { - 'deleted.first_name': [{ exists: true }] - } - ] - } - } - } - } - ``` - - To run the execution if an attribute is changed from one state to another - ``` - Only starts the automation when the order status changes from `open_for_acceptance` to `placed` - { - "type": "filter_entity_event", - "configuration": { - "operation": { - "operation": ["updateEntity"], - "payload": { - "_schema": ["order"], - "status": ["placed"] - }, - "diff": { - "updated": { - "status": ["open_for_acceptance"] - } - } - } - } - } - ``` (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger)) -- `frontend_submit_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--frontend_submit_trigger)) -- `journey_submit_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--journey_submit_trigger)) -- `received_email_trigger` (Attributes) (see [below for nested schema](#nestedatt--triggers--received_email_trigger)) - - -### Nested Schema for `triggers.activity_trigger` - -Optional: - -- `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--activity_trigger--configuration)) -- `id` (String) -- `type` (String) Not Null; must be one of ["activity"] - - -### Nested Schema for `triggers.activity_trigger.configuration` - -Optional: - -- `schema` (String) -- `types` (List of String) - - - - -### Nested Schema for `triggers.api_submission_trigger` - -Optional: - -- `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--api_submission_trigger--configuration)) -- `id` (String) -- `type` (String) Not Null; must be one of ["api_submission"] - - -### Nested Schema for `triggers.api_submission_trigger.configuration` - -Optional: - -- `source_id` (String) - - - - -### Nested Schema for `triggers.entity_manual_trigger` - -Optional: - -- `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--entity_manual_trigger--configuration)) -- `id` (String) -- `type` (String) Not Null; must be one of ["entity_manual"] - - -### Nested Schema for `triggers.entity_manual_trigger.configuration` - -Optional: - -- `schema` (String) Which entity type can this automation be triggered from - - - - -### Nested Schema for `triggers.entity_operation_trigger` - -Optional: - -- `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration)) -- `id` (String) -- `type` (String) Not Null; must be one of ["entity_operation"] - - -### Nested Schema for `triggers.entity_operation_trigger.configuration` - -Optional: - -- `ecp_config` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--ecp_config)) -- `exclude_activities` (List of String) -- `filter_config` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--filter_config)) -- `include_activities` (List of String) -- `operations` (List of String) -- `schema` (String) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema` - -Optional: - -- `file_config` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--file_config)) -- `origin` (String) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.file_config` - -Optional: - -- `shared_with_end_customer` (Boolean) - - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema` - -Optional: - -- `activity` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity)) -- `operation` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--operation)) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity` - -Optional: - -- `type` (Attributes List) Filter on activity type. If not specified, all activities will be matched on execution. -Example: - 1. Filter the events when an entity is updated from portal - ``` - { - "activity":{ - "type": ["EntityUpdatedFromPortal"] - } - } - ``` - 2. Filter the events when either a doc is uploaded/removed on an entity from a portal - ``` - { - "activity":{ - "type": ["DocUploadedFromPortal", "DocRemovedFromPortal"] - } - } - ``` (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type)) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type` - -Optional: - -- `anything_but_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--anything_but_condition)) -- `equals_ignore_case_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--equals_ignore_case_condition)) -- `exists_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--exists_condition)) -- `prefix_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--prefix_condition)) -- `str` (String) -- `suffix_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--suffix_condition)) -- `wildcard_condition` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--activity--type--wildcard_condition)) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Optional: - -- `anything_but` (List of String) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Optional: - -- `equals_ignore_case` (String) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Optional: - -- `exists` (Boolean) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Optional: - -- `prefix` (String) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Optional: - -- `suffix` (String) - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.activity.type.wildcard_condition` - -Optional: - -- `wildcard` (String) - - - - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.operation` - -Optional: - -- `diff` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--operation--diff)) -- `operation` (List of String) Filter on operation type. If not specified, all operations will be matched on execution. -Example: - 1. Filter all the createEntity/updateEntity operations - ``` - { - "operation":{ - "operation": ["createEntity", "updateEntity"] - } - } - ``` -- `payload` (String) Parsed as JSON. - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.operation.payload` - -Optional: - -- `any` (String) Parsed as JSON. -- `two` (Attributes) Diff to it's prior state when an entity is updated (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration--schema--operation--payload--two)) - - -### Nested Schema for `triggers.entity_operation_trigger.configuration.schema.operation.payload.two` - -Optional: - -- `added` (String) Parsed as JSON. -- `deleted` (String) Parsed as JSON. -- `updated` (String) Parsed as JSON. - - - - - - - - -### Nested Schema for `triggers.frontend_submit_trigger` - -Optional: - -- `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--frontend_submit_trigger--configuration)) -- `id` (String) -- `type` (String) Not Null; must be one of ["frontend_submission"] - - -### Nested Schema for `triggers.frontend_submit_trigger.configuration` - -Optional: - -- `source_id` (String) - - - - -### Nested Schema for `triggers.journey_submit_trigger` - -Optional: - -- `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--journey_submit_trigger--configuration)) -- `id` (String) -- `type` (String) Not Null; must be one of ["journey_submission"] - - -### Nested Schema for `triggers.journey_submit_trigger.configuration` - -Optional: - -- `source_id` (String) Not Null - - - - -### Nested Schema for `triggers.received_email_trigger` - -Optional: - -- `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--received_email_trigger--configuration)) -- `id` (String) -- `type` (String) Not Null; must be one of ["received_email"] - - -### Nested Schema for `triggers.received_email_trigger.configuration` - -Optional: - -- `message_type` (String) must be one of ["RECEIVED"] - - - - ### Nested Schema for `conditions` diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 560a36f..2ac3c45 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { epilot-automation = { source = "epilot-dev/epilot-automation" - version = "0.3.1" + version = "0.3.4" } } } diff --git a/examples/resources/epilot-automation_flow/resource.tf b/examples/resources/epilot-automation_flow/resource.tf index b87535b..bab6bdd 100644 --- a/examples/resources/epilot-automation_flow/resource.tf +++ b/examples/resources/epilot-automation_flow/resource.tf @@ -7,18 +7,7 @@ resource "epilot-automation_flow" "my_flow" { flow_name = "Handle contact form" system_flow = false triggers = [ - { - activity_trigger = { - configuration = { - schema = "submission" - types = [ - "{ \"see\": \"documentation\" }", - ] - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "activity" - } - }, + "{ \"see\": \"documentation\" }", ] version = 2 } \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index f17b668..d883ca4 100755 --- a/gen.yaml +++ b/gen.yaml @@ -12,7 +12,7 @@ generation: sdkFlattening: true telemetryEnabled: false terraform: - version: 0.3.1 + version: 0.3.4 additionalDataSources: [] additionalDependencies: {} additionalResources: [] diff --git a/internal/provider/flow_data_source.go b/internal/provider/flow_data_source.go index 62c9cdf..513fa2d 100644 --- a/internal/provider/flow_data_source.go +++ b/internal/provider/flow_data_source.go @@ -37,7 +37,7 @@ type FlowDataSourceModel struct { ID types.String `tfsdk:"id"` SystemFlow types.Bool `tfsdk:"system_flow"` TriggerConditions []types.String `tfsdk:"trigger_conditions"` - Triggers []tfTypes.AnyTrigger `tfsdk:"triggers"` + Triggers []types.String `tfsdk:"triggers"` Version types.Number `tfsdk:"version"` } @@ -139,439 +139,9 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, ElementType: types.StringType, }, - "triggers": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "activity_trigger": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "schema": schema.StringAttribute{ - Computed: true, - }, - "types": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["activity"]`, - }, - }, - }, - "api_submission_trigger": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "source_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["api_submission"]`, - }, - }, - }, - "entity_manual_trigger": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "schema": schema.StringAttribute{ - Computed: true, - Description: `Which entity type can this automation be triggered from`, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["entity_manual"]`, - }, - }, - }, - "entity_operation_trigger": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "ecp_config": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "file_config": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "shared_with_end_customer": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - "origin": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "exclude_activities": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "filter_config": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "activity": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "type": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "str": schema.StringAttribute{ - Computed: true, - }, - "anything_but_condition": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "anything_but": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - }, - }, - "equals_ignore_case_condition": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "equals_ignore_case": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "exists_condition": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "exists": schema.BoolAttribute{ - Computed: true, - }, - }, - }, - "prefix_condition": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "prefix": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "suffix_condition": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "suffix": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "wildcard_condition": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "wildcard": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - MarkdownDescription: `Filter on activity type. If not specified, all activities will be matched on execution.` + "\n" + - `Example:` + "\n" + - ` 1. Filter the events when an entity is updated from portal` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "activity":{` + "\n" + - ` "type": ["EntityUpdatedFromPortal"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` 2. Filter the events when either a doc is uploaded/removed on an entity from a portal` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "activity":{` + "\n" + - ` "type": ["DocUploadedFromPortal", "DocRemovedFromPortal"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ``, - }, - }, - }, - "operation": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "diff": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "any": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - "two": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "added": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - "deleted": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - "updated": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - }, - Description: `Diff to it's prior state when an entity is updated`, - }, - }, - }, - "operation": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - MarkdownDescription: `Filter on operation type. If not specified, all operations will be matched on execution.` + "\n" + - `Example:` + "\n" + - ` 1. Filter all the createEntity/updateEntity operations` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "operation":{` + "\n" + - ` "operation": ["createEntity", "updateEntity"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ``, - }, - "payload": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - }, - }, - }, - }, - "include_activities": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "operations": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "schema": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["entity_operation"]`, - }, - }, - MarkdownDescription: `- If provides filter_config, executes an automation based on the filtered configuration when an entity event occurs.` + "\n" + - `- The conditions on a filter follows the event bridge patterns - ` + "`" + `https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html` + "`" + `` + "\n" + - ` | Comparison | Example | Rule syntax |` + "\n" + - ` |------------------------|-----------------------------------------------------|----------------------------------------------------------|` + "\n" + - ` | Null | first_name is null | ` + "`" + `"first_name": [ null ]` + "`" + ` |` + "\n" + - ` | Empty | last_name is empty | ` + "`" + `"last_name": [""]` + "`" + ` |` + "\n" + - ` | Equals | email is "j.doe@email.com" | ` + "`" + `"email": [ "j.doe@email.com" ]` + "`" + ` |` + "\n" + - ` | Equals (ignore case) | first_name is "John" | ` + "`" + `"first_name": [ { "equals-ignore-case": "john" } ]` + "`" + ` |` + "\n" + - ` | And | fist_name is "John" and last_name is "Doe" | ` + "`" + `"first_name": [ "John" ], "last_name": ["Doe"]` + "`" + ` |` + "\n" + - ` | Or | PaymentType is "Invoice" or "SEPA" | ` + "`" + `"PaymentType": [ "invoice", "sepa"]` + "`" + ` |` + "\n" + - ` | Or (multiple fields) | first_name is "John", or last_name is "Doe". | ` + "`" + `"$or": [ { "first_name": [ "John" ] }, { "last_name": [ "Doe" ] } ]` + "`" + ` |` + "\n" + - ` | Not | status is anything but "cancelled" | ` + "`" + `"status": [ { "anything-but": [ "cancelled" ] } ]` + "`" + ` |` + "\n" + - ` | Numeric (equals) | Price is 100 | ` + "`" + `"Price": [ { "numeric": [ "=", 100 ] } ]` + "`" + ` |` + "\n" + - ` | Numeric (range) | Price is more than 10, and less than or equal to 20 | ` + "`" + `"Price": [ { "numeric": [ ">", 10, "<=", 20 ] } ]` + "`" + ` |` + "\n" + - ` | Exists | ProductName exists | ` + "`" + `"ProductName": [ { "exists": true } ]` + "`" + ` |` + "\n" + - ` | Does not exist | ProductName does not exist | ` + "`" + `"ProductName": [ { "exists": false } ]` + "`" + ` |` + "\n" + - ` | Begins with | OpportunityNumber starts with OPP- | ` + "`" + `"opportunity_number": [ { "prefix": "OPP-" } ]` + "`" + ` |` + "\n" + - ` | Ends with | FileName ends with a .png extension | ` + "`" + `"filename": [ { "suffix": ".png" } ]` + "`" + ` |` + "\n" + - ` | Wildcard | search a string using a wildcard | ` + "`" + `"email": [ { "wildcard": "*@doe.com" } ]` + "`" + ` |` + "\n" + - ` - To run the execution on all update events` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "operation": ["updateEntity"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` - To run the execution only when the updates are from a portal user` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "operation": ["updateEntity"]` + "\n" + - ` },` + "\n" + - ` "activity": {` + "\n" + - ` "type": "EntityUpdatedFromPortal"` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` - To run the execution only when there is an update on a specific attribute` + "\n" + - ` ` + "```" + `` + "\n" + - ` Only starts the automation when the email on a contact is changed` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "operation": ["updateEntity"],` + "\n" + - ` "payload": {` + "\n" + - ` "_schema": ["contact"]` + "\n" + - ` },` + "\n" + - ` "diff": {` + "\n" + - ` "updated": {` + "\n" + - ` "email": [{ "exists": true }]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` - To run the execution only when a specific attribute is altered(created/updated/deleted)` + "\n" + - ` ` + "```" + `` + "\n" + - ` Only starts the automation when a price is altered on a contract` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "payload": {` + "\n" + - ` "_schema": ["contract"]` + "\n" + - ` },` + "\n" + - ` "diff": {` + "\n" + - ` // Whether he first_name has been added, updated, or removed` + "\n" + - ` $or: [` + "\n" + - ` {` + "\n" + - ` 'added.first_name': [{ exists: true }]` + "\n" + - ` },` + "\n" + - ` {` + "\n" + - ` 'updated.first_name': [{ exists: true }]` + "\n" + - ` },` + "\n" + - ` {` + "\n" + - ` 'deleted.first_name': [{ exists: true }]` + "\n" + - ` }` + "\n" + - ` ]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` - To run the execution if an attribute is changed from one state to another` + "\n" + - ` ` + "```" + `` + "\n" + - ` Only starts the automation when the order status changes from ` + "`" + `open_for_acceptance` + "`" + ` to ` + "`" + `placed` + "`" + `` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "operation": ["updateEntity"],` + "\n" + - ` "payload": {` + "\n" + - ` "_schema": ["order"],` + "\n" + - ` "status": ["placed"]` + "\n" + - ` },` + "\n" + - ` "diff": {` + "\n" + - ` "updated": {` + "\n" + - ` "status": ["open_for_acceptance"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ``, - }, - "frontend_submit_trigger": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "source_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["frontend_submission"]`, - }, - }, - }, - "journey_submit_trigger": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "source_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["journey_submission"]`, - }, - }, - }, - "received_email_trigger": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "message_type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["RECEIVED"]`, - }, - }, - }, - "id": schema.StringAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["received_email"]`, - }, - }, - }, - }, - }, + "triggers": schema.ListAttribute{ + Computed: true, + ElementType: types.StringType, }, "version": schema.NumberAttribute{ Computed: true, @@ -643,8 +213,8 @@ func (r *FlowDataSource) Read(ctx context.Context, req datasource.ReadRequest, r resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.AutomationFlow == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.AutomationFlow != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedAutomationFlow(res.AutomationFlow) diff --git a/internal/provider/flow_data_source_sdk.go b/internal/provider/flow_data_source_sdk.go index d8414c7..df7d396 100644 --- a/internal/provider/flow_data_source_sdk.go +++ b/internal/provider/flow_data_source_sdk.go @@ -92,200 +92,12 @@ func (r *FlowDataSourceModel) RefreshFromSharedAutomationFlow(resp *shared.Autom triggerConditions1 = types.StringValue(string(triggerConditions1Result)) r.TriggerConditions = append(r.TriggerConditions, triggerConditions1) } - r.Triggers = []tfTypes.AnyTrigger{} - if len(r.Triggers) > len(resp.Triggers) { - r.Triggers = r.Triggers[:len(resp.Triggers)] - } - for triggersCount, triggersItem := range resp.Triggers { - var triggers1 tfTypes.AnyTrigger - if triggersItem.ActivityTrigger != nil { - triggers1.ActivityTrigger = &tfTypes.ActivityTrigger{} - triggers1.ActivityTrigger.Configuration.Schema = types.StringPointerValue(triggersItem.ActivityTrigger.Configuration.Schema) - triggers1.ActivityTrigger.Configuration.Types = nil - for _, typesItem := range triggersItem.ActivityTrigger.Configuration.Types { - var types1 types.String - types1Result, _ := json.Marshal(typesItem) - types1 = types.StringValue(string(types1Result)) - triggers1.ActivityTrigger.Configuration.Types = append(triggers1.ActivityTrigger.Configuration.Types, types1) - } - triggers1.ActivityTrigger.ID = types.StringPointerValue(triggersItem.ActivityTrigger.ID) - triggers1.ActivityTrigger.Type = types.StringValue(string(triggersItem.ActivityTrigger.Type)) - } - if triggersItem.APISubmissionTrigger != nil { - triggers1.APISubmissionTrigger = &tfTypes.APISubmissionTrigger{} - triggers1.APISubmissionTrigger.Configuration.SourceID = types.StringPointerValue(triggersItem.APISubmissionTrigger.Configuration.SourceID) - triggers1.APISubmissionTrigger.ID = types.StringPointerValue(triggersItem.APISubmissionTrigger.ID) - triggers1.APISubmissionTrigger.Type = types.StringValue(string(triggersItem.APISubmissionTrigger.Type)) - } - if triggersItem.EntityManualTrigger != nil { - triggers1.EntityManualTrigger = &tfTypes.EntityManualTrigger{} - triggers1.EntityManualTrigger.Configuration.Schema = types.StringPointerValue(triggersItem.EntityManualTrigger.Configuration.Schema) - triggers1.EntityManualTrigger.ID = types.StringPointerValue(triggersItem.EntityManualTrigger.ID) - triggers1.EntityManualTrigger.Type = types.StringValue(string(triggersItem.EntityManualTrigger.Type)) - } - if triggersItem.EntityOperationTrigger != nil { - triggers1.EntityOperationTrigger = &tfTypes.EntityOperationTrigger{} - if triggersItem.EntityOperationTrigger.Configuration.EcpConfig == nil { - triggers1.EntityOperationTrigger.Configuration.EcpConfig = nil - } else { - triggers1.EntityOperationTrigger.Configuration.EcpConfig = &tfTypes.EcpConfig{} - if triggersItem.EntityOperationTrigger.Configuration.EcpConfig.FileConfig == nil { - triggers1.EntityOperationTrigger.Configuration.EcpConfig.FileConfig = nil - } else { - triggers1.EntityOperationTrigger.Configuration.EcpConfig.FileConfig = &tfTypes.FileConfig{} - triggers1.EntityOperationTrigger.Configuration.EcpConfig.FileConfig.SharedWithEndCustomer = types.BoolPointerValue(triggersItem.EntityOperationTrigger.Configuration.EcpConfig.FileConfig.SharedWithEndCustomer) - } - triggers1.EntityOperationTrigger.Configuration.EcpConfig.Origin = types.StringPointerValue(triggersItem.EntityOperationTrigger.Configuration.EcpConfig.Origin) - } - triggers1.EntityOperationTrigger.Configuration.ExcludeActivities = []types.String{} - for _, v := range triggersItem.EntityOperationTrigger.Configuration.ExcludeActivities { - triggers1.EntityOperationTrigger.Configuration.ExcludeActivities = append(triggers1.EntityOperationTrigger.Configuration.ExcludeActivities, types.StringValue(v)) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig = nil - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig = &tfTypes.FilterConfig{} - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Activity == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity = nil - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity = &tfTypes.Activity{} - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type = []tfTypes.EntityOperationTriggerSchemasType{} - for typeVarCount, typeVarItem := range triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type { - var typeVar1 tfTypes.EntityOperationTriggerSchemasType - if typeVarItem.Str != nil { - typeVar1.Str = types.StringPointerValue(typeVarItem.Str) - } - if typeVarItem.AnythingButCondition != nil { - typeVar1.AnythingButCondition = &tfTypes.AnythingButCondition{} - typeVar1.AnythingButCondition.AnythingBut = []types.String{} - for _, v := range typeVarItem.AnythingButCondition.AnythingBut { - typeVar1.AnythingButCondition.AnythingBut = append(typeVar1.AnythingButCondition.AnythingBut, types.StringValue(v)) - } - } - if typeVarItem.EqualsIgnoreCaseCondition != nil { - typeVar1.EqualsIgnoreCaseCondition = &tfTypes.EqualsIgnoreCaseCondition{} - typeVar1.EqualsIgnoreCaseCondition.EqualsIgnoreCase = types.StringPointerValue(typeVarItem.EqualsIgnoreCaseCondition.EqualsIgnoreCase) - } - if typeVarItem.ExistsCondition != nil { - typeVar1.ExistsCondition = &tfTypes.ExistsCondition{} - typeVar1.ExistsCondition.Exists = types.BoolPointerValue(typeVarItem.ExistsCondition.Exists) - } - if typeVarItem.PrefixCondition != nil { - typeVar1.PrefixCondition = &tfTypes.PrefixCondition{} - typeVar1.PrefixCondition.Prefix = types.StringPointerValue(typeVarItem.PrefixCondition.Prefix) - } - if typeVarItem.SuffixCondition != nil { - typeVar1.SuffixCondition = &tfTypes.SuffixCondition{} - typeVar1.SuffixCondition.Suffix = types.StringPointerValue(typeVarItem.SuffixCondition.Suffix) - } - if typeVarItem.WildcardCondition != nil { - typeVar1.WildcardCondition = &tfTypes.WildcardCondition{} - typeVar1.WildcardCondition.Wildcard = types.StringPointerValue(typeVarItem.WildcardCondition.Wildcard) - } - if typeVarCount+1 > len(triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type) { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type = append(triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type, typeVar1) - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].Str = typeVar1.Str - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].AnythingButCondition = typeVar1.AnythingButCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].EqualsIgnoreCaseCondition = typeVar1.EqualsIgnoreCaseCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].ExistsCondition = typeVar1.ExistsCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].PrefixCondition = typeVar1.PrefixCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].SuffixCondition = typeVar1.SuffixCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].WildcardCondition = typeVar1.WildcardCondition - } - } - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation = nil - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation = &tfTypes.EntityOperationTriggerOperation{} - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff = nil - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff = &tfTypes.Diff{} - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Any != nil { - anyResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Any) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Any = types.StringValue(string(anyResult)) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two != nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two = &tfTypes.Two{} - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added = types.StringNull() - } else { - addedResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added = types.StringValue(string(addedResult)) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted = types.StringNull() - } else { - deletedResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted = types.StringValue(string(deletedResult)) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated = types.StringNull() - } else { - updatedResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated = types.StringValue(string(updatedResult)) - } - } - } - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Operation = []types.String{} - for _, v := range triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Operation { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Operation = append(triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Operation, types.StringValue(string(v))) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload = types.StringNull() - } else { - payloadResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload = types.StringValue(string(payloadResult)) - } - } - } - triggers1.EntityOperationTrigger.Configuration.IncludeActivities = []types.String{} - for _, v := range triggersItem.EntityOperationTrigger.Configuration.IncludeActivities { - triggers1.EntityOperationTrigger.Configuration.IncludeActivities = append(triggers1.EntityOperationTrigger.Configuration.IncludeActivities, types.StringValue(v)) - } - triggers1.EntityOperationTrigger.Configuration.Operations = []types.String{} - for _, v := range triggersItem.EntityOperationTrigger.Configuration.Operations { - triggers1.EntityOperationTrigger.Configuration.Operations = append(triggers1.EntityOperationTrigger.Configuration.Operations, types.StringValue(string(v))) - } - triggers1.EntityOperationTrigger.Configuration.Schema = types.StringPointerValue(triggersItem.EntityOperationTrigger.Configuration.Schema) - triggers1.EntityOperationTrigger.ID = types.StringPointerValue(triggersItem.EntityOperationTrigger.ID) - triggers1.EntityOperationTrigger.Type = types.StringValue(string(triggersItem.EntityOperationTrigger.Type)) - } - if triggersItem.FrontendSubmitTrigger != nil { - triggers1.FrontendSubmitTrigger = &tfTypes.FrontendSubmitTrigger{} - triggers1.FrontendSubmitTrigger.Configuration.SourceID = types.StringPointerValue(triggersItem.FrontendSubmitTrigger.Configuration.SourceID) - triggers1.FrontendSubmitTrigger.ID = types.StringPointerValue(triggersItem.FrontendSubmitTrigger.ID) - triggers1.FrontendSubmitTrigger.Type = types.StringValue(string(triggersItem.FrontendSubmitTrigger.Type)) - } - if triggersItem.JourneySubmitTrigger != nil { - triggers1.JourneySubmitTrigger = &tfTypes.JourneySubmitTrigger{} - triggers1.JourneySubmitTrigger.Configuration.SourceID = types.StringValue(triggersItem.JourneySubmitTrigger.Configuration.SourceID) - triggers1.JourneySubmitTrigger.ID = types.StringPointerValue(triggersItem.JourneySubmitTrigger.ID) - triggers1.JourneySubmitTrigger.Type = types.StringValue(string(triggersItem.JourneySubmitTrigger.Type)) - } - if triggersItem.ReceivedEmailTrigger != nil { - triggers1.ReceivedEmailTrigger = &tfTypes.ReceivedEmailTrigger{} - if triggersItem.ReceivedEmailTrigger.Configuration.MessageType != nil { - triggers1.ReceivedEmailTrigger.Configuration.MessageType = types.StringValue(string(*triggersItem.ReceivedEmailTrigger.Configuration.MessageType)) - } else { - triggers1.ReceivedEmailTrigger.Configuration.MessageType = types.StringNull() - } - triggers1.ReceivedEmailTrigger.ID = types.StringPointerValue(triggersItem.ReceivedEmailTrigger.ID) - triggers1.ReceivedEmailTrigger.Type = types.StringValue(string(triggersItem.ReceivedEmailTrigger.Type)) - } - if triggersCount+1 > len(r.Triggers) { - r.Triggers = append(r.Triggers, triggers1) - } else { - r.Triggers[triggersCount].ActivityTrigger = triggers1.ActivityTrigger - r.Triggers[triggersCount].APISubmissionTrigger = triggers1.APISubmissionTrigger - r.Triggers[triggersCount].EntityManualTrigger = triggers1.EntityManualTrigger - r.Triggers[triggersCount].EntityOperationTrigger = triggers1.EntityOperationTrigger - r.Triggers[triggersCount].FrontendSubmitTrigger = triggers1.FrontendSubmitTrigger - r.Triggers[triggersCount].JourneySubmitTrigger = triggers1.JourneySubmitTrigger - r.Triggers[triggersCount].ReceivedEmailTrigger = triggers1.ReceivedEmailTrigger - } + r.Triggers = nil + for _, triggersItem := range resp.Triggers { + var triggers1 types.String + triggers1Result, _ := json.Marshal(triggersItem) + triggers1 = types.StringValue(string(triggers1Result)) + r.Triggers = append(r.Triggers, triggers1) } if resp.Version != nil { r.Version = types.NumberValue(big.NewFloat(float64(*resp.Version))) diff --git a/internal/provider/flow_resource.go b/internal/provider/flow_resource.go index 36edfba..40bc5de 100644 --- a/internal/provider/flow_resource.go +++ b/internal/provider/flow_resource.go @@ -9,10 +9,7 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk" "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/operations" "github.com/epilot-dev/terraform-provider-epilot-automation/internal/validators" - speakeasy_objectvalidators "github.com/epilot-dev/terraform-provider-epilot-automation/internal/validators/objectvalidators" - speakeasy_stringvalidators "github.com/epilot-dev/terraform-provider-epilot-automation/internal/validators/stringvalidators" "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" - "github.com/hashicorp/terraform-plugin-framework-validators/objectvalidator" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -46,7 +43,7 @@ type FlowResourceModel struct { ID types.String `tfsdk:"id"` SystemFlow types.Bool `tfsdk:"system_flow"` TriggerConditions []types.String `tfsdk:"trigger_conditions"` - Triggers []tfTypes.AnyTrigger `tfsdk:"triggers"` + Triggers []types.String `tfsdk:"triggers"` Version types.Number `tfsdk:"version"` } @@ -223,763 +220,11 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r listvalidator.ValueStringsAre(validators.IsValidJSON()), }, }, - "triggers": schema.ListNestedAttribute{ - Required: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "activity_trigger": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "schema": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "types": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Validators: []validator.List{ - listvalidator.ValueStringsAre(validators.IsValidJSON()), - }, - }, - }, - Description: `Not Null`, - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null; must be one of ["activity"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "activity", - ), - }, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("api_submission_trigger"), - path.MatchRelative().AtParent().AtName("entity_manual_trigger"), - path.MatchRelative().AtParent().AtName("entity_operation_trigger"), - path.MatchRelative().AtParent().AtName("frontend_submit_trigger"), - path.MatchRelative().AtParent().AtName("journey_submit_trigger"), - path.MatchRelative().AtParent().AtName("received_email_trigger"), - }...), - }, - }, - "api_submission_trigger": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "source_id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - }, - Description: `Not Null`, - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null; must be one of ["api_submission"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "api_submission", - ), - }, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("activity_trigger"), - path.MatchRelative().AtParent().AtName("entity_manual_trigger"), - path.MatchRelative().AtParent().AtName("entity_operation_trigger"), - path.MatchRelative().AtParent().AtName("frontend_submit_trigger"), - path.MatchRelative().AtParent().AtName("journey_submit_trigger"), - path.MatchRelative().AtParent().AtName("received_email_trigger"), - }...), - }, - }, - "entity_manual_trigger": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "schema": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Which entity type can this automation be triggered from`, - }, - }, - Description: `Not Null`, - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null; must be one of ["entity_manual"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "entity_manual", - ), - }, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("activity_trigger"), - path.MatchRelative().AtParent().AtName("api_submission_trigger"), - path.MatchRelative().AtParent().AtName("entity_operation_trigger"), - path.MatchRelative().AtParent().AtName("frontend_submit_trigger"), - path.MatchRelative().AtParent().AtName("journey_submit_trigger"), - path.MatchRelative().AtParent().AtName("received_email_trigger"), - }...), - }, - }, - "entity_operation_trigger": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "ecp_config": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "file_config": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "shared_with_end_customer": schema.BoolAttribute{ - Computed: true, - Optional: true, - }, - }, - }, - "origin": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - }, - }, - "exclude_activities": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - }, - "filter_config": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "activity": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "type": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "str": schema.StringAttribute{ - Computed: true, - Optional: true, - Validators: []validator.String{ - stringvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("anything_but_condition"), - path.MatchRelative().AtParent().AtName("equals_ignore_case_condition"), - path.MatchRelative().AtParent().AtName("exists_condition"), - path.MatchRelative().AtParent().AtName("prefix_condition"), - path.MatchRelative().AtParent().AtName("suffix_condition"), - path.MatchRelative().AtParent().AtName("wildcard_condition"), - }...), - }, - }, - "anything_but_condition": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "anything_but": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("str"), - path.MatchRelative().AtParent().AtName("equals_ignore_case_condition"), - path.MatchRelative().AtParent().AtName("exists_condition"), - path.MatchRelative().AtParent().AtName("prefix_condition"), - path.MatchRelative().AtParent().AtName("suffix_condition"), - path.MatchRelative().AtParent().AtName("wildcard_condition"), - }...), - }, - }, - "equals_ignore_case_condition": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "equals_ignore_case": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("str"), - path.MatchRelative().AtParent().AtName("anything_but_condition"), - path.MatchRelative().AtParent().AtName("exists_condition"), - path.MatchRelative().AtParent().AtName("prefix_condition"), - path.MatchRelative().AtParent().AtName("suffix_condition"), - path.MatchRelative().AtParent().AtName("wildcard_condition"), - }...), - }, - }, - "exists_condition": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "exists": schema.BoolAttribute{ - Computed: true, - Optional: true, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("str"), - path.MatchRelative().AtParent().AtName("anything_but_condition"), - path.MatchRelative().AtParent().AtName("equals_ignore_case_condition"), - path.MatchRelative().AtParent().AtName("prefix_condition"), - path.MatchRelative().AtParent().AtName("suffix_condition"), - path.MatchRelative().AtParent().AtName("wildcard_condition"), - }...), - }, - }, - "prefix_condition": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "prefix": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("str"), - path.MatchRelative().AtParent().AtName("anything_but_condition"), - path.MatchRelative().AtParent().AtName("equals_ignore_case_condition"), - path.MatchRelative().AtParent().AtName("exists_condition"), - path.MatchRelative().AtParent().AtName("suffix_condition"), - path.MatchRelative().AtParent().AtName("wildcard_condition"), - }...), - }, - }, - "suffix_condition": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "suffix": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("str"), - path.MatchRelative().AtParent().AtName("anything_but_condition"), - path.MatchRelative().AtParent().AtName("equals_ignore_case_condition"), - path.MatchRelative().AtParent().AtName("exists_condition"), - path.MatchRelative().AtParent().AtName("prefix_condition"), - path.MatchRelative().AtParent().AtName("wildcard_condition"), - }...), - }, - }, - "wildcard_condition": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "wildcard": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("str"), - path.MatchRelative().AtParent().AtName("anything_but_condition"), - path.MatchRelative().AtParent().AtName("equals_ignore_case_condition"), - path.MatchRelative().AtParent().AtName("exists_condition"), - path.MatchRelative().AtParent().AtName("prefix_condition"), - path.MatchRelative().AtParent().AtName("suffix_condition"), - }...), - }, - }, - }, - Validators: []validator.Object{ - validators.ExactlyOneChild(), - }, - }, - MarkdownDescription: `Filter on activity type. If not specified, all activities will be matched on execution.` + "\n" + - `Example:` + "\n" + - ` 1. Filter the events when an entity is updated from portal` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "activity":{` + "\n" + - ` "type": ["EntityUpdatedFromPortal"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` 2. Filter the events when either a doc is uploaded/removed on an entity from a portal` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "activity":{` + "\n" + - ` "type": ["DocUploadedFromPortal", "DocRemovedFromPortal"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ``, - }, - }, - }, - "operation": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "diff": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "any": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - stringvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("two"), - }...), - validators.IsValidJSON(), - }, - }, - "two": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "added": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - validators.IsValidJSON(), - }, - }, - "deleted": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - validators.IsValidJSON(), - }, - }, - "updated": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - validators.IsValidJSON(), - }, - }, - }, - Description: `Diff to it's prior state when an entity is updated`, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("any"), - }...), - }, - }, - }, - Validators: []validator.Object{ - validators.ExactlyOneChild(), - }, - }, - "operation": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - MarkdownDescription: `Filter on operation type. If not specified, all operations will be matched on execution.` + "\n" + - `Example:` + "\n" + - ` 1. Filter all the createEntity/updateEntity operations` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "operation":{` + "\n" + - ` "operation": ["createEntity", "updateEntity"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ``, - }, - "payload": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - validators.IsValidJSON(), - }, - }, - }, - }, - }, - }, - "include_activities": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - }, - "operations": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Validators: []validator.List{ - listvalidator.SizeAtLeast(1), - }, - }, - "schema": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - }, - Description: `Not Null`, - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null; must be one of ["entity_operation"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "entity_operation", - ), - }, - }, - }, - MarkdownDescription: `- If provides filter_config, executes an automation based on the filtered configuration when an entity event occurs.` + "\n" + - `- The conditions on a filter follows the event bridge patterns - ` + "`" + `https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html` + "`" + `` + "\n" + - ` | Comparison | Example | Rule syntax |` + "\n" + - ` |------------------------|-----------------------------------------------------|----------------------------------------------------------|` + "\n" + - ` | Null | first_name is null | ` + "`" + `"first_name": [ null ]` + "`" + ` |` + "\n" + - ` | Empty | last_name is empty | ` + "`" + `"last_name": [""]` + "`" + ` |` + "\n" + - ` | Equals | email is "j.doe@email.com" | ` + "`" + `"email": [ "j.doe@email.com" ]` + "`" + ` |` + "\n" + - ` | Equals (ignore case) | first_name is "John" | ` + "`" + `"first_name": [ { "equals-ignore-case": "john" } ]` + "`" + ` |` + "\n" + - ` | And | fist_name is "John" and last_name is "Doe" | ` + "`" + `"first_name": [ "John" ], "last_name": ["Doe"]` + "`" + ` |` + "\n" + - ` | Or | PaymentType is "Invoice" or "SEPA" | ` + "`" + `"PaymentType": [ "invoice", "sepa"]` + "`" + ` |` + "\n" + - ` | Or (multiple fields) | first_name is "John", or last_name is "Doe". | ` + "`" + `"$or": [ { "first_name": [ "John" ] }, { "last_name": [ "Doe" ] } ]` + "`" + ` |` + "\n" + - ` | Not | status is anything but "cancelled" | ` + "`" + `"status": [ { "anything-but": [ "cancelled" ] } ]` + "`" + ` |` + "\n" + - ` | Numeric (equals) | Price is 100 | ` + "`" + `"Price": [ { "numeric": [ "=", 100 ] } ]` + "`" + ` |` + "\n" + - ` | Numeric (range) | Price is more than 10, and less than or equal to 20 | ` + "`" + `"Price": [ { "numeric": [ ">", 10, "<=", 20 ] } ]` + "`" + ` |` + "\n" + - ` | Exists | ProductName exists | ` + "`" + `"ProductName": [ { "exists": true } ]` + "`" + ` |` + "\n" + - ` | Does not exist | ProductName does not exist | ` + "`" + `"ProductName": [ { "exists": false } ]` + "`" + ` |` + "\n" + - ` | Begins with | OpportunityNumber starts with OPP- | ` + "`" + `"opportunity_number": [ { "prefix": "OPP-" } ]` + "`" + ` |` + "\n" + - ` | Ends with | FileName ends with a .png extension | ` + "`" + `"filename": [ { "suffix": ".png" } ]` + "`" + ` |` + "\n" + - ` | Wildcard | search a string using a wildcard | ` + "`" + `"email": [ { "wildcard": "*@doe.com" } ]` + "`" + ` |` + "\n" + - ` - To run the execution on all update events` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "operation": ["updateEntity"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` - To run the execution only when the updates are from a portal user` + "\n" + - ` ` + "```" + `` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "operation": ["updateEntity"]` + "\n" + - ` },` + "\n" + - ` "activity": {` + "\n" + - ` "type": "EntityUpdatedFromPortal"` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` - To run the execution only when there is an update on a specific attribute` + "\n" + - ` ` + "```" + `` + "\n" + - ` Only starts the automation when the email on a contact is changed` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "operation": ["updateEntity"],` + "\n" + - ` "payload": {` + "\n" + - ` "_schema": ["contact"]` + "\n" + - ` },` + "\n" + - ` "diff": {` + "\n" + - ` "updated": {` + "\n" + - ` "email": [{ "exists": true }]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` - To run the execution only when a specific attribute is altered(created/updated/deleted)` + "\n" + - ` ` + "```" + `` + "\n" + - ` Only starts the automation when a price is altered on a contract` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "payload": {` + "\n" + - ` "_schema": ["contract"]` + "\n" + - ` },` + "\n" + - ` "diff": {` + "\n" + - ` // Whether he first_name has been added, updated, or removed` + "\n" + - ` $or: [` + "\n" + - ` {` + "\n" + - ` 'added.first_name': [{ exists: true }]` + "\n" + - ` },` + "\n" + - ` {` + "\n" + - ` 'updated.first_name': [{ exists: true }]` + "\n" + - ` },` + "\n" + - ` {` + "\n" + - ` 'deleted.first_name': [{ exists: true }]` + "\n" + - ` }` + "\n" + - ` ]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ` - To run the execution if an attribute is changed from one state to another` + "\n" + - ` ` + "```" + `` + "\n" + - ` Only starts the automation when the order status changes from ` + "`" + `open_for_acceptance` + "`" + ` to ` + "`" + `placed` + "`" + `` + "\n" + - ` {` + "\n" + - ` "type": "filter_entity_event",` + "\n" + - ` "configuration": {` + "\n" + - ` "operation": {` + "\n" + - ` "operation": ["updateEntity"],` + "\n" + - ` "payload": {` + "\n" + - ` "_schema": ["order"],` + "\n" + - ` "status": ["placed"]` + "\n" + - ` },` + "\n" + - ` "diff": {` + "\n" + - ` "updated": {` + "\n" + - ` "status": ["open_for_acceptance"]` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` }` + "\n" + - ` ` + "```" + `` + "\n" + - ``, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("activity_trigger"), - path.MatchRelative().AtParent().AtName("api_submission_trigger"), - path.MatchRelative().AtParent().AtName("entity_manual_trigger"), - path.MatchRelative().AtParent().AtName("frontend_submit_trigger"), - path.MatchRelative().AtParent().AtName("journey_submit_trigger"), - path.MatchRelative().AtParent().AtName("received_email_trigger"), - }...), - }, - }, - "frontend_submit_trigger": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "source_id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - }, - Description: `Not Null`, - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null; must be one of ["frontend_submission"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "frontend_submission", - ), - }, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("activity_trigger"), - path.MatchRelative().AtParent().AtName("api_submission_trigger"), - path.MatchRelative().AtParent().AtName("entity_manual_trigger"), - path.MatchRelative().AtParent().AtName("entity_operation_trigger"), - path.MatchRelative().AtParent().AtName("journey_submit_trigger"), - path.MatchRelative().AtParent().AtName("received_email_trigger"), - }...), - }, - }, - "journey_submit_trigger": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "source_id": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - }, - Description: `Not Null`, - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null; must be one of ["journey_submission"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "journey_submission", - ), - }, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("activity_trigger"), - path.MatchRelative().AtParent().AtName("api_submission_trigger"), - path.MatchRelative().AtParent().AtName("entity_manual_trigger"), - path.MatchRelative().AtParent().AtName("entity_operation_trigger"), - path.MatchRelative().AtParent().AtName("frontend_submit_trigger"), - path.MatchRelative().AtParent().AtName("received_email_trigger"), - }...), - }, - }, - "received_email_trigger": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "configuration": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "message_type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `must be one of ["RECEIVED"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "RECEIVED", - ), - }, - }, - }, - Description: `Not Null`, - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Not Null; must be one of ["received_email"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "received_email", - ), - }, - }, - }, - Validators: []validator.Object{ - objectvalidator.ConflictsWith(path.Expressions{ - path.MatchRelative().AtParent().AtName("activity_trigger"), - path.MatchRelative().AtParent().AtName("api_submission_trigger"), - path.MatchRelative().AtParent().AtName("entity_manual_trigger"), - path.MatchRelative().AtParent().AtName("entity_operation_trigger"), - path.MatchRelative().AtParent().AtName("frontend_submit_trigger"), - path.MatchRelative().AtParent().AtName("journey_submit_trigger"), - }...), - }, - }, - }, - Validators: []validator.Object{ - validators.ExactlyOneChild(), - }, + "triggers": schema.ListAttribute{ + Required: true, + ElementType: types.StringType, + Validators: []validator.List{ + listvalidator.ValueStringsAre(validators.IsValidJSON()), }, }, "version": schema.NumberAttribute{ @@ -1046,8 +291,8 @@ func (r *FlowResource) Create(ctx context.Context, req resource.CreateRequest, r resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.AutomationFlow == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.AutomationFlow != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedAutomationFlow(res.AutomationFlow) @@ -1099,8 +344,8 @@ func (r *FlowResource) Read(ctx context.Context, req resource.ReadRequest, resp resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.AutomationFlow == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.AutomationFlow != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedAutomationFlow(res.AutomationFlow) @@ -1145,8 +390,8 @@ func (r *FlowResource) Update(ctx context.Context, req resource.UpdateRequest, r resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.AutomationFlow == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.AutomationFlow != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedAutomationFlow(res.AutomationFlow) diff --git a/internal/provider/flow_resource_sdk.go b/internal/provider/flow_resource_sdk.go index cde1f7a..165c309 100644 --- a/internal/provider/flow_resource_sdk.go +++ b/internal/provider/flow_resource_sdk.go @@ -134,391 +134,11 @@ func (r *FlowResourceModel) ToSharedAutomationFlowInput() *shared.AutomationFlow _ = json.Unmarshal([]byte(triggerConditionsItem.ValueString()), &triggerConditionsTmp) triggerConditions = append(triggerConditions, triggerConditionsTmp) } - var triggers []shared.AnyTrigger = []shared.AnyTrigger{} + var triggers []interface{} = []interface{}{} for _, triggersItem := range r.Triggers { - if triggersItem.FrontendSubmitTrigger != nil { - sourceID := new(string) - if !triggersItem.FrontendSubmitTrigger.Configuration.SourceID.IsUnknown() && !triggersItem.FrontendSubmitTrigger.Configuration.SourceID.IsNull() { - *sourceID = triggersItem.FrontendSubmitTrigger.Configuration.SourceID.ValueString() - } else { - sourceID = nil - } - configuration := shared.FrontendSubmitTriggerConfiguration{ - SourceID: sourceID, - } - id3 := new(string) - if !triggersItem.FrontendSubmitTrigger.ID.IsUnknown() && !triggersItem.FrontendSubmitTrigger.ID.IsNull() { - *id3 = triggersItem.FrontendSubmitTrigger.ID.ValueString() - } else { - id3 = nil - } - typeVar := shared.FrontendSubmitTriggerType(triggersItem.FrontendSubmitTrigger.Type.ValueString()) - frontendSubmitTrigger := shared.FrontendSubmitTrigger{ - Configuration: configuration, - ID: id3, - Type: typeVar, - } - triggers = append(triggers, shared.AnyTrigger{ - FrontendSubmitTrigger: &frontendSubmitTrigger, - }) - } - if triggersItem.JourneySubmitTrigger != nil { - sourceId1 := triggersItem.JourneySubmitTrigger.Configuration.SourceID.ValueString() - configuration1 := shared.JourneySubmitTriggerConfiguration{ - SourceID: sourceId1, - } - id4 := new(string) - if !triggersItem.JourneySubmitTrigger.ID.IsUnknown() && !triggersItem.JourneySubmitTrigger.ID.IsNull() { - *id4 = triggersItem.JourneySubmitTrigger.ID.ValueString() - } else { - id4 = nil - } - typeVar1 := shared.JourneySubmitTriggerType(triggersItem.JourneySubmitTrigger.Type.ValueString()) - journeySubmitTrigger := shared.JourneySubmitTrigger{ - Configuration: configuration1, - ID: id4, - Type: typeVar1, - } - triggers = append(triggers, shared.AnyTrigger{ - JourneySubmitTrigger: &journeySubmitTrigger, - }) - } - if triggersItem.APISubmissionTrigger != nil { - sourceId2 := new(string) - if !triggersItem.APISubmissionTrigger.Configuration.SourceID.IsUnknown() && !triggersItem.APISubmissionTrigger.Configuration.SourceID.IsNull() { - *sourceId2 = triggersItem.APISubmissionTrigger.Configuration.SourceID.ValueString() - } else { - sourceId2 = nil - } - configuration2 := shared.APISubmissionTriggerConfiguration{ - SourceID: sourceId2, - } - id5 := new(string) - if !triggersItem.APISubmissionTrigger.ID.IsUnknown() && !triggersItem.APISubmissionTrigger.ID.IsNull() { - *id5 = triggersItem.APISubmissionTrigger.ID.ValueString() - } else { - id5 = nil - } - typeVar2 := shared.APISubmissionTriggerType(triggersItem.APISubmissionTrigger.Type.ValueString()) - apiSubmissionTrigger := shared.APISubmissionTrigger{ - Configuration: configuration2, - ID: id5, - Type: typeVar2, - } - triggers = append(triggers, shared.AnyTrigger{ - APISubmissionTrigger: &apiSubmissionTrigger, - }) - } - if triggersItem.EntityOperationTrigger != nil { - var ecpConfig *shared.EcpConfig - if triggersItem.EntityOperationTrigger.Configuration.EcpConfig != nil { - var fileConfig *shared.FileConfig - if triggersItem.EntityOperationTrigger.Configuration.EcpConfig.FileConfig != nil { - sharedWithEndCustomer := new(bool) - if !triggersItem.EntityOperationTrigger.Configuration.EcpConfig.FileConfig.SharedWithEndCustomer.IsUnknown() && !triggersItem.EntityOperationTrigger.Configuration.EcpConfig.FileConfig.SharedWithEndCustomer.IsNull() { - *sharedWithEndCustomer = triggersItem.EntityOperationTrigger.Configuration.EcpConfig.FileConfig.SharedWithEndCustomer.ValueBool() - } else { - sharedWithEndCustomer = nil - } - fileConfig = &shared.FileConfig{ - SharedWithEndCustomer: sharedWithEndCustomer, - } - } - origin1 := new(string) - if !triggersItem.EntityOperationTrigger.Configuration.EcpConfig.Origin.IsUnknown() && !triggersItem.EntityOperationTrigger.Configuration.EcpConfig.Origin.IsNull() { - *origin1 = triggersItem.EntityOperationTrigger.Configuration.EcpConfig.Origin.ValueString() - } else { - origin1 = nil - } - ecpConfig = &shared.EcpConfig{ - FileConfig: fileConfig, - Origin: origin1, - } - } - var excludeActivities []string = []string{} - for _, excludeActivitiesItem := range triggersItem.EntityOperationTrigger.Configuration.ExcludeActivities { - excludeActivities = append(excludeActivities, excludeActivitiesItem.ValueString()) - } - var filterConfig *shared.FilterConfig - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig != nil { - var activity *shared.Activity - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Activity != nil { - var typeVar3 []shared.EntityOperationTriggerSchemasType = []shared.EntityOperationTriggerSchemasType{} - for _, typeItem := range triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type { - if !typeItem.Str.IsUnknown() && !typeItem.Str.IsNull() { - str := typeItem.Str.ValueString() - typeVar3 = append(typeVar3, shared.EntityOperationTriggerSchemasType{ - Str: &str, - }) - } - if typeItem.EqualsIgnoreCaseCondition != nil { - equalsIgnoreCase := new(string) - if !typeItem.EqualsIgnoreCaseCondition.EqualsIgnoreCase.IsUnknown() && !typeItem.EqualsIgnoreCaseCondition.EqualsIgnoreCase.IsNull() { - *equalsIgnoreCase = typeItem.EqualsIgnoreCaseCondition.EqualsIgnoreCase.ValueString() - } else { - equalsIgnoreCase = nil - } - equalsIgnoreCaseCondition := shared.EqualsIgnoreCaseCondition{ - EqualsIgnoreCase: equalsIgnoreCase, - } - typeVar3 = append(typeVar3, shared.EntityOperationTriggerSchemasType{ - EqualsIgnoreCaseCondition: &equalsIgnoreCaseCondition, - }) - } - if typeItem.AnythingButCondition != nil { - var anythingBut []string = []string{} - for _, anythingButItem := range typeItem.AnythingButCondition.AnythingBut { - anythingBut = append(anythingBut, anythingButItem.ValueString()) - } - anythingButCondition := shared.AnythingButCondition{ - AnythingBut: anythingBut, - } - typeVar3 = append(typeVar3, shared.EntityOperationTriggerSchemasType{ - AnythingButCondition: &anythingButCondition, - }) - } - if typeItem.ExistsCondition != nil { - exists := new(bool) - if !typeItem.ExistsCondition.Exists.IsUnknown() && !typeItem.ExistsCondition.Exists.IsNull() { - *exists = typeItem.ExistsCondition.Exists.ValueBool() - } else { - exists = nil - } - existsCondition := shared.ExistsCondition{ - Exists: exists, - } - typeVar3 = append(typeVar3, shared.EntityOperationTriggerSchemasType{ - ExistsCondition: &existsCondition, - }) - } - if typeItem.PrefixCondition != nil { - prefix := new(string) - if !typeItem.PrefixCondition.Prefix.IsUnknown() && !typeItem.PrefixCondition.Prefix.IsNull() { - *prefix = typeItem.PrefixCondition.Prefix.ValueString() - } else { - prefix = nil - } - prefixCondition := shared.PrefixCondition{ - Prefix: prefix, - } - typeVar3 = append(typeVar3, shared.EntityOperationTriggerSchemasType{ - PrefixCondition: &prefixCondition, - }) - } - if typeItem.SuffixCondition != nil { - suffix := new(string) - if !typeItem.SuffixCondition.Suffix.IsUnknown() && !typeItem.SuffixCondition.Suffix.IsNull() { - *suffix = typeItem.SuffixCondition.Suffix.ValueString() - } else { - suffix = nil - } - suffixCondition := shared.SuffixCondition{ - Suffix: suffix, - } - typeVar3 = append(typeVar3, shared.EntityOperationTriggerSchemasType{ - SuffixCondition: &suffixCondition, - }) - } - if typeItem.WildcardCondition != nil { - wildcard := new(string) - if !typeItem.WildcardCondition.Wildcard.IsUnknown() && !typeItem.WildcardCondition.Wildcard.IsNull() { - *wildcard = typeItem.WildcardCondition.Wildcard.ValueString() - } else { - wildcard = nil - } - wildcardCondition := shared.WildcardCondition{ - Wildcard: wildcard, - } - typeVar3 = append(typeVar3, shared.EntityOperationTriggerSchemasType{ - WildcardCondition: &wildcardCondition, - }) - } - } - activity = &shared.Activity{ - Type: typeVar3, - } - } - var operation1 *shared.EntityOperationTriggerOperation - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation != nil { - var diff *shared.Diff - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff != nil { - var anyVar interface{} - if !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Any.IsUnknown() && !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Any.IsNull() { - _ = json.Unmarshal([]byte(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Any.ValueString()), &anyVar) - } - if anyVar != nil { - diff = &shared.Diff{ - Any: anyVar, - } - } - var two *shared.Two - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two != nil { - var added interface{} - if !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added.IsUnknown() && !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added.IsNull() { - _ = json.Unmarshal([]byte(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added.ValueString()), &added) - } - var deleted interface{} - if !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted.IsUnknown() && !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted.IsNull() { - _ = json.Unmarshal([]byte(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted.ValueString()), &deleted) - } - var updated interface{} - if !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated.IsUnknown() && !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated.IsNull() { - _ = json.Unmarshal([]byte(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated.ValueString()), &updated) - } - two = &shared.Two{ - Added: added, - Deleted: deleted, - Updated: updated, - } - } - if two != nil { - diff = &shared.Diff{ - Two: two, - } - } - } - var operation2 []shared.EntityOperation = []shared.EntityOperation{} - for _, operationItem := range triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Operation { - operation2 = append(operation2, shared.EntityOperation(operationItem.ValueString())) - } - var payload interface{} - if !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload.IsUnknown() && !triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload.IsNull() { - _ = json.Unmarshal([]byte(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload.ValueString()), &payload) - } - operation1 = &shared.EntityOperationTriggerOperation{ - Diff: diff, - Operation: operation2, - Payload: payload, - } - } - filterConfig = &shared.FilterConfig{ - Activity: activity, - Operation: operation1, - } - } - var includeActivities []string = []string{} - for _, includeActivitiesItem := range triggersItem.EntityOperationTrigger.Configuration.IncludeActivities { - includeActivities = append(includeActivities, includeActivitiesItem.ValueString()) - } - var operationsVar []shared.EntityOperation = []shared.EntityOperation{} - for _, operationsItem := range triggersItem.EntityOperationTrigger.Configuration.Operations { - operationsVar = append(operationsVar, shared.EntityOperation(operationsItem.ValueString())) - } - schema1 := new(string) - if !triggersItem.EntityOperationTrigger.Configuration.Schema.IsUnknown() && !triggersItem.EntityOperationTrigger.Configuration.Schema.IsNull() { - *schema1 = triggersItem.EntityOperationTrigger.Configuration.Schema.ValueString() - } else { - schema1 = nil - } - configuration3 := shared.EntityOperationTriggerConfiguration{ - EcpConfig: ecpConfig, - ExcludeActivities: excludeActivities, - FilterConfig: filterConfig, - IncludeActivities: includeActivities, - Operations: operationsVar, - Schema: schema1, - } - id6 := new(string) - if !triggersItem.EntityOperationTrigger.ID.IsUnknown() && !triggersItem.EntityOperationTrigger.ID.IsNull() { - *id6 = triggersItem.EntityOperationTrigger.ID.ValueString() - } else { - id6 = nil - } - typeVar4 := shared.EntityOperationTriggerType(triggersItem.EntityOperationTrigger.Type.ValueString()) - entityOperationTrigger := shared.EntityOperationTrigger{ - Configuration: configuration3, - ID: id6, - Type: typeVar4, - } - triggers = append(triggers, shared.AnyTrigger{ - EntityOperationTrigger: &entityOperationTrigger, - }) - } - if triggersItem.ActivityTrigger != nil { - schema2 := new(string) - if !triggersItem.ActivityTrigger.Configuration.Schema.IsUnknown() && !triggersItem.ActivityTrigger.Configuration.Schema.IsNull() { - *schema2 = triggersItem.ActivityTrigger.Configuration.Schema.ValueString() - } else { - schema2 = nil - } - var types []interface{} = []interface{}{} - for _, typesItem := range triggersItem.ActivityTrigger.Configuration.Types { - var typesTmp interface{} - _ = json.Unmarshal([]byte(typesItem.ValueString()), &typesTmp) - types = append(types, typesTmp) - } - configuration4 := shared.Configuration{ - Schema: schema2, - Types: types, - } - id7 := new(string) - if !triggersItem.ActivityTrigger.ID.IsUnknown() && !triggersItem.ActivityTrigger.ID.IsNull() { - *id7 = triggersItem.ActivityTrigger.ID.ValueString() - } else { - id7 = nil - } - typeVar5 := shared.Type(triggersItem.ActivityTrigger.Type.ValueString()) - activityTrigger := shared.ActivityTrigger{ - Configuration: configuration4, - ID: id7, - Type: typeVar5, - } - triggers = append(triggers, shared.AnyTrigger{ - ActivityTrigger: &activityTrigger, - }) - } - if triggersItem.EntityManualTrigger != nil { - schema3 := new(string) - if !triggersItem.EntityManualTrigger.Configuration.Schema.IsUnknown() && !triggersItem.EntityManualTrigger.Configuration.Schema.IsNull() { - *schema3 = triggersItem.EntityManualTrigger.Configuration.Schema.ValueString() - } else { - schema3 = nil - } - configuration5 := shared.EntityManualTriggerConfiguration{ - Schema: schema3, - } - id8 := new(string) - if !triggersItem.EntityManualTrigger.ID.IsUnknown() && !triggersItem.EntityManualTrigger.ID.IsNull() { - *id8 = triggersItem.EntityManualTrigger.ID.ValueString() - } else { - id8 = nil - } - typeVar6 := shared.EntityManualTriggerType(triggersItem.EntityManualTrigger.Type.ValueString()) - entityManualTrigger := shared.EntityManualTrigger{ - Configuration: configuration5, - ID: id8, - Type: typeVar6, - } - triggers = append(triggers, shared.AnyTrigger{ - EntityManualTrigger: &entityManualTrigger, - }) - } - if triggersItem.ReceivedEmailTrigger != nil { - messageType := new(shared.MessageType) - if !triggersItem.ReceivedEmailTrigger.Configuration.MessageType.IsUnknown() && !triggersItem.ReceivedEmailTrigger.Configuration.MessageType.IsNull() { - *messageType = shared.MessageType(triggersItem.ReceivedEmailTrigger.Configuration.MessageType.ValueString()) - } else { - messageType = nil - } - configuration6 := shared.ReceivedEmailTriggerConfiguration{ - MessageType: messageType, - } - id9 := new(string) - if !triggersItem.ReceivedEmailTrigger.ID.IsUnknown() && !triggersItem.ReceivedEmailTrigger.ID.IsNull() { - *id9 = triggersItem.ReceivedEmailTrigger.ID.ValueString() - } else { - id9 = nil - } - typeVar7 := shared.ReceivedEmailTriggerType(triggersItem.ReceivedEmailTrigger.Type.ValueString()) - receivedEmailTrigger := shared.ReceivedEmailTrigger{ - Configuration: configuration6, - ID: id9, - Type: typeVar7, - } - triggers = append(triggers, shared.AnyTrigger{ - ReceivedEmailTrigger: &receivedEmailTrigger, - }) - } + var triggersTmp interface{} + _ = json.Unmarshal([]byte(triggersItem.ValueString()), &triggersTmp) + triggers = append(triggers, triggersTmp) } version := new(float64) if !r.Version.IsUnknown() && !r.Version.IsNull() { @@ -622,200 +242,12 @@ func (r *FlowResourceModel) RefreshFromSharedAutomationFlow(resp *shared.Automat triggerConditions1 = types.StringValue(string(triggerConditions1Result)) r.TriggerConditions = append(r.TriggerConditions, triggerConditions1) } - r.Triggers = []tfTypes.AnyTrigger{} - if len(r.Triggers) > len(resp.Triggers) { - r.Triggers = r.Triggers[:len(resp.Triggers)] - } - for triggersCount, triggersItem := range resp.Triggers { - var triggers1 tfTypes.AnyTrigger - if triggersItem.ActivityTrigger != nil { - triggers1.ActivityTrigger = &tfTypes.ActivityTrigger{} - triggers1.ActivityTrigger.Configuration.Schema = types.StringPointerValue(triggersItem.ActivityTrigger.Configuration.Schema) - triggers1.ActivityTrigger.Configuration.Types = nil - for _, typesItem := range triggersItem.ActivityTrigger.Configuration.Types { - var types1 types.String - types1Result, _ := json.Marshal(typesItem) - types1 = types.StringValue(string(types1Result)) - triggers1.ActivityTrigger.Configuration.Types = append(triggers1.ActivityTrigger.Configuration.Types, types1) - } - triggers1.ActivityTrigger.ID = types.StringPointerValue(triggersItem.ActivityTrigger.ID) - triggers1.ActivityTrigger.Type = types.StringValue(string(triggersItem.ActivityTrigger.Type)) - } - if triggersItem.APISubmissionTrigger != nil { - triggers1.APISubmissionTrigger = &tfTypes.APISubmissionTrigger{} - triggers1.APISubmissionTrigger.Configuration.SourceID = types.StringPointerValue(triggersItem.APISubmissionTrigger.Configuration.SourceID) - triggers1.APISubmissionTrigger.ID = types.StringPointerValue(triggersItem.APISubmissionTrigger.ID) - triggers1.APISubmissionTrigger.Type = types.StringValue(string(triggersItem.APISubmissionTrigger.Type)) - } - if triggersItem.EntityManualTrigger != nil { - triggers1.EntityManualTrigger = &tfTypes.EntityManualTrigger{} - triggers1.EntityManualTrigger.Configuration.Schema = types.StringPointerValue(triggersItem.EntityManualTrigger.Configuration.Schema) - triggers1.EntityManualTrigger.ID = types.StringPointerValue(triggersItem.EntityManualTrigger.ID) - triggers1.EntityManualTrigger.Type = types.StringValue(string(triggersItem.EntityManualTrigger.Type)) - } - if triggersItem.EntityOperationTrigger != nil { - triggers1.EntityOperationTrigger = &tfTypes.EntityOperationTrigger{} - if triggersItem.EntityOperationTrigger.Configuration.EcpConfig == nil { - triggers1.EntityOperationTrigger.Configuration.EcpConfig = nil - } else { - triggers1.EntityOperationTrigger.Configuration.EcpConfig = &tfTypes.EcpConfig{} - if triggersItem.EntityOperationTrigger.Configuration.EcpConfig.FileConfig == nil { - triggers1.EntityOperationTrigger.Configuration.EcpConfig.FileConfig = nil - } else { - triggers1.EntityOperationTrigger.Configuration.EcpConfig.FileConfig = &tfTypes.FileConfig{} - triggers1.EntityOperationTrigger.Configuration.EcpConfig.FileConfig.SharedWithEndCustomer = types.BoolPointerValue(triggersItem.EntityOperationTrigger.Configuration.EcpConfig.FileConfig.SharedWithEndCustomer) - } - triggers1.EntityOperationTrigger.Configuration.EcpConfig.Origin = types.StringPointerValue(triggersItem.EntityOperationTrigger.Configuration.EcpConfig.Origin) - } - triggers1.EntityOperationTrigger.Configuration.ExcludeActivities = []types.String{} - for _, v := range triggersItem.EntityOperationTrigger.Configuration.ExcludeActivities { - triggers1.EntityOperationTrigger.Configuration.ExcludeActivities = append(triggers1.EntityOperationTrigger.Configuration.ExcludeActivities, types.StringValue(v)) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig = nil - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig = &tfTypes.FilterConfig{} - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Activity == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity = nil - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity = &tfTypes.Activity{} - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type = []tfTypes.EntityOperationTriggerSchemasType{} - for typeVarCount, typeVarItem := range triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type { - var typeVar1 tfTypes.EntityOperationTriggerSchemasType - if typeVarItem.Str != nil { - typeVar1.Str = types.StringPointerValue(typeVarItem.Str) - } - if typeVarItem.AnythingButCondition != nil { - typeVar1.AnythingButCondition = &tfTypes.AnythingButCondition{} - typeVar1.AnythingButCondition.AnythingBut = []types.String{} - for _, v := range typeVarItem.AnythingButCondition.AnythingBut { - typeVar1.AnythingButCondition.AnythingBut = append(typeVar1.AnythingButCondition.AnythingBut, types.StringValue(v)) - } - } - if typeVarItem.EqualsIgnoreCaseCondition != nil { - typeVar1.EqualsIgnoreCaseCondition = &tfTypes.EqualsIgnoreCaseCondition{} - typeVar1.EqualsIgnoreCaseCondition.EqualsIgnoreCase = types.StringPointerValue(typeVarItem.EqualsIgnoreCaseCondition.EqualsIgnoreCase) - } - if typeVarItem.ExistsCondition != nil { - typeVar1.ExistsCondition = &tfTypes.ExistsCondition{} - typeVar1.ExistsCondition.Exists = types.BoolPointerValue(typeVarItem.ExistsCondition.Exists) - } - if typeVarItem.PrefixCondition != nil { - typeVar1.PrefixCondition = &tfTypes.PrefixCondition{} - typeVar1.PrefixCondition.Prefix = types.StringPointerValue(typeVarItem.PrefixCondition.Prefix) - } - if typeVarItem.SuffixCondition != nil { - typeVar1.SuffixCondition = &tfTypes.SuffixCondition{} - typeVar1.SuffixCondition.Suffix = types.StringPointerValue(typeVarItem.SuffixCondition.Suffix) - } - if typeVarItem.WildcardCondition != nil { - typeVar1.WildcardCondition = &tfTypes.WildcardCondition{} - typeVar1.WildcardCondition.Wildcard = types.StringPointerValue(typeVarItem.WildcardCondition.Wildcard) - } - if typeVarCount+1 > len(triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type) { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type = append(triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type, typeVar1) - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].Str = typeVar1.Str - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].AnythingButCondition = typeVar1.AnythingButCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].EqualsIgnoreCaseCondition = typeVar1.EqualsIgnoreCaseCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].ExistsCondition = typeVar1.ExistsCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].PrefixCondition = typeVar1.PrefixCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].SuffixCondition = typeVar1.SuffixCondition - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Activity.Type[typeVarCount].WildcardCondition = typeVar1.WildcardCondition - } - } - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation = nil - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation = &tfTypes.EntityOperationTriggerOperation{} - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff = nil - } else { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff = &tfTypes.Diff{} - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Any != nil { - anyResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Any) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Any = types.StringValue(string(anyResult)) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two != nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two = &tfTypes.Two{} - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added = types.StringNull() - } else { - addedResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Added = types.StringValue(string(addedResult)) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted = types.StringNull() - } else { - deletedResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Deleted = types.StringValue(string(deletedResult)) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated = types.StringNull() - } else { - updatedResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Diff.Two.Updated = types.StringValue(string(updatedResult)) - } - } - } - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Operation = []types.String{} - for _, v := range triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Operation { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Operation = append(triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Operation, types.StringValue(string(v))) - } - if triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload == nil { - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload = types.StringNull() - } else { - payloadResult, _ := json.Marshal(triggersItem.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload) - triggers1.EntityOperationTrigger.Configuration.FilterConfig.Operation.Payload = types.StringValue(string(payloadResult)) - } - } - } - triggers1.EntityOperationTrigger.Configuration.IncludeActivities = []types.String{} - for _, v := range triggersItem.EntityOperationTrigger.Configuration.IncludeActivities { - triggers1.EntityOperationTrigger.Configuration.IncludeActivities = append(triggers1.EntityOperationTrigger.Configuration.IncludeActivities, types.StringValue(v)) - } - triggers1.EntityOperationTrigger.Configuration.Operations = []types.String{} - for _, v := range triggersItem.EntityOperationTrigger.Configuration.Operations { - triggers1.EntityOperationTrigger.Configuration.Operations = append(triggers1.EntityOperationTrigger.Configuration.Operations, types.StringValue(string(v))) - } - triggers1.EntityOperationTrigger.Configuration.Schema = types.StringPointerValue(triggersItem.EntityOperationTrigger.Configuration.Schema) - triggers1.EntityOperationTrigger.ID = types.StringPointerValue(triggersItem.EntityOperationTrigger.ID) - triggers1.EntityOperationTrigger.Type = types.StringValue(string(triggersItem.EntityOperationTrigger.Type)) - } - if triggersItem.FrontendSubmitTrigger != nil { - triggers1.FrontendSubmitTrigger = &tfTypes.FrontendSubmitTrigger{} - triggers1.FrontendSubmitTrigger.Configuration.SourceID = types.StringPointerValue(triggersItem.FrontendSubmitTrigger.Configuration.SourceID) - triggers1.FrontendSubmitTrigger.ID = types.StringPointerValue(triggersItem.FrontendSubmitTrigger.ID) - triggers1.FrontendSubmitTrigger.Type = types.StringValue(string(triggersItem.FrontendSubmitTrigger.Type)) - } - if triggersItem.JourneySubmitTrigger != nil { - triggers1.JourneySubmitTrigger = &tfTypes.JourneySubmitTrigger{} - triggers1.JourneySubmitTrigger.Configuration.SourceID = types.StringValue(triggersItem.JourneySubmitTrigger.Configuration.SourceID) - triggers1.JourneySubmitTrigger.ID = types.StringPointerValue(triggersItem.JourneySubmitTrigger.ID) - triggers1.JourneySubmitTrigger.Type = types.StringValue(string(triggersItem.JourneySubmitTrigger.Type)) - } - if triggersItem.ReceivedEmailTrigger != nil { - triggers1.ReceivedEmailTrigger = &tfTypes.ReceivedEmailTrigger{} - if triggersItem.ReceivedEmailTrigger.Configuration.MessageType != nil { - triggers1.ReceivedEmailTrigger.Configuration.MessageType = types.StringValue(string(*triggersItem.ReceivedEmailTrigger.Configuration.MessageType)) - } else { - triggers1.ReceivedEmailTrigger.Configuration.MessageType = types.StringNull() - } - triggers1.ReceivedEmailTrigger.ID = types.StringPointerValue(triggersItem.ReceivedEmailTrigger.ID) - triggers1.ReceivedEmailTrigger.Type = types.StringValue(string(triggersItem.ReceivedEmailTrigger.Type)) - } - if triggersCount+1 > len(r.Triggers) { - r.Triggers = append(r.Triggers, triggers1) - } else { - r.Triggers[triggersCount].ActivityTrigger = triggers1.ActivityTrigger - r.Triggers[triggersCount].APISubmissionTrigger = triggers1.APISubmissionTrigger - r.Triggers[triggersCount].EntityManualTrigger = triggers1.EntityManualTrigger - r.Triggers[triggersCount].EntityOperationTrigger = triggers1.EntityOperationTrigger - r.Triggers[triggersCount].FrontendSubmitTrigger = triggers1.FrontendSubmitTrigger - r.Triggers[triggersCount].JourneySubmitTrigger = triggers1.JourneySubmitTrigger - r.Triggers[triggersCount].ReceivedEmailTrigger = triggers1.ReceivedEmailTrigger - } + r.Triggers = nil + for _, triggersItem := range resp.Triggers { + var triggers1 types.String + triggers1Result, _ := json.Marshal(triggersItem) + triggers1 = types.StringValue(string(triggers1Result)) + r.Triggers = append(r.Triggers, triggers1) } if resp.Version != nil { r.Version = types.NumberValue(big.NewFloat(float64(*resp.Version))) diff --git a/internal/provider/types/activity.go b/internal/provider/types/activity.go deleted file mode 100644 index 0ec03d2..0000000 --- a/internal/provider/types/activity.go +++ /dev/null @@ -1,7 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -type Activity struct { - Type []EntityOperationTriggerSchemasType `tfsdk:"type"` -} diff --git a/internal/provider/types/activity_trigger.go b/internal/provider/types/activity_trigger.go deleted file mode 100644 index 8612e72..0000000 --- a/internal/provider/types/activity_trigger.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ActivityTrigger struct { - Configuration Configuration `tfsdk:"configuration"` - ID types.String `tfsdk:"id"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/types/any_trigger.go b/internal/provider/types/any_trigger.go deleted file mode 100644 index bb82767..0000000 --- a/internal/provider/types/any_trigger.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -type AnyTrigger struct { - ActivityTrigger *ActivityTrigger `tfsdk:"activity_trigger" tfPlanOnly:"true"` - APISubmissionTrigger *APISubmissionTrigger `tfsdk:"api_submission_trigger" tfPlanOnly:"true"` - EntityManualTrigger *EntityManualTrigger `tfsdk:"entity_manual_trigger" tfPlanOnly:"true"` - EntityOperationTrigger *EntityOperationTrigger `tfsdk:"entity_operation_trigger" tfPlanOnly:"true"` - FrontendSubmitTrigger *FrontendSubmitTrigger `tfsdk:"frontend_submit_trigger" tfPlanOnly:"true"` - JourneySubmitTrigger *JourneySubmitTrigger `tfsdk:"journey_submit_trigger" tfPlanOnly:"true"` - ReceivedEmailTrigger *ReceivedEmailTrigger `tfsdk:"received_email_trigger" tfPlanOnly:"true"` -} diff --git a/internal/provider/types/anything_but_condition.go b/internal/provider/types/anything_but_condition.go deleted file mode 100644 index a2d2e3d..0000000 --- a/internal/provider/types/anything_but_condition.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type AnythingButCondition struct { - AnythingBut []types.String `tfsdk:"anything_but"` -} diff --git a/internal/provider/types/api_submission_trigger.go b/internal/provider/types/api_submission_trigger.go deleted file mode 100644 index f79420c..0000000 --- a/internal/provider/types/api_submission_trigger.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type APISubmissionTrigger struct { - Configuration APISubmissionTriggerConfiguration `tfsdk:"configuration"` - ID types.String `tfsdk:"id"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/types/api_submission_trigger_configuration.go b/internal/provider/types/api_submission_trigger_configuration.go deleted file mode 100644 index 5c557cb..0000000 --- a/internal/provider/types/api_submission_trigger_configuration.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type APISubmissionTriggerConfiguration struct { - SourceID types.String `tfsdk:"source_id"` -} diff --git a/internal/provider/types/configuration.go b/internal/provider/types/configuration.go deleted file mode 100644 index dc250e1..0000000 --- a/internal/provider/types/configuration.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Configuration struct { - Schema types.String `tfsdk:"schema"` - Types []types.String `tfsdk:"types"` -} diff --git a/internal/provider/types/diff.go b/internal/provider/types/diff.go deleted file mode 100644 index 44823f3..0000000 --- a/internal/provider/types/diff.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Diff struct { - Any types.String `tfsdk:"any" tfPlanOnly:"true"` - Two *Two `tfsdk:"two" tfPlanOnly:"true"` -} diff --git a/internal/provider/types/ecp_config.go b/internal/provider/types/ecp_config.go deleted file mode 100644 index e66c176..0000000 --- a/internal/provider/types/ecp_config.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EcpConfig struct { - FileConfig *FileConfig `tfsdk:"file_config"` - Origin types.String `tfsdk:"origin"` -} diff --git a/internal/provider/types/entity_manual_trigger.go b/internal/provider/types/entity_manual_trigger.go deleted file mode 100644 index ae06c4a..0000000 --- a/internal/provider/types/entity_manual_trigger.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EntityManualTrigger struct { - Configuration EntityManualTriggerConfiguration `tfsdk:"configuration"` - ID types.String `tfsdk:"id"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/types/entity_manual_trigger_configuration.go b/internal/provider/types/entity_manual_trigger_configuration.go deleted file mode 100644 index d1f6f4e..0000000 --- a/internal/provider/types/entity_manual_trigger_configuration.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EntityManualTriggerConfiguration struct { - Schema types.String `tfsdk:"schema"` -} diff --git a/internal/provider/types/entity_operation_trigger.go b/internal/provider/types/entity_operation_trigger.go deleted file mode 100644 index 32fa12c..0000000 --- a/internal/provider/types/entity_operation_trigger.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EntityOperationTrigger struct { - Configuration EntityOperationTriggerConfiguration `tfsdk:"configuration"` - ID types.String `tfsdk:"id"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/types/entity_operation_trigger_configuration.go b/internal/provider/types/entity_operation_trigger_configuration.go deleted file mode 100644 index d39ac05..0000000 --- a/internal/provider/types/entity_operation_trigger_configuration.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EntityOperationTriggerConfiguration struct { - EcpConfig *EcpConfig `tfsdk:"ecp_config"` - ExcludeActivities []types.String `tfsdk:"exclude_activities"` - FilterConfig *FilterConfig `tfsdk:"filter_config"` - IncludeActivities []types.String `tfsdk:"include_activities"` - Operations []types.String `tfsdk:"operations"` - Schema types.String `tfsdk:"schema"` -} diff --git a/internal/provider/types/entity_operation_trigger_operation.go b/internal/provider/types/entity_operation_trigger_operation.go deleted file mode 100644 index 787d08f..0000000 --- a/internal/provider/types/entity_operation_trigger_operation.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EntityOperationTriggerOperation struct { - Diff *Diff `tfsdk:"diff"` - Operation []types.String `tfsdk:"operation"` - Payload types.String `tfsdk:"payload"` -} diff --git a/internal/provider/types/entity_operation_trigger_schemas_type.go b/internal/provider/types/entity_operation_trigger_schemas_type.go deleted file mode 100644 index adb8b10..0000000 --- a/internal/provider/types/entity_operation_trigger_schemas_type.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EntityOperationTriggerSchemasType struct { - Str types.String `tfsdk:"str" tfPlanOnly:"true"` - AnythingButCondition *AnythingButCondition `tfsdk:"anything_but_condition" tfPlanOnly:"true"` - EqualsIgnoreCaseCondition *EqualsIgnoreCaseCondition `tfsdk:"equals_ignore_case_condition" tfPlanOnly:"true"` - ExistsCondition *ExistsCondition `tfsdk:"exists_condition" tfPlanOnly:"true"` - PrefixCondition *PrefixCondition `tfsdk:"prefix_condition" tfPlanOnly:"true"` - SuffixCondition *SuffixCondition `tfsdk:"suffix_condition" tfPlanOnly:"true"` - WildcardCondition *WildcardCondition `tfsdk:"wildcard_condition" tfPlanOnly:"true"` -} diff --git a/internal/provider/types/equals_ignore_case_condition.go b/internal/provider/types/equals_ignore_case_condition.go deleted file mode 100644 index 4fffddf..0000000 --- a/internal/provider/types/equals_ignore_case_condition.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EqualsIgnoreCaseCondition struct { - EqualsIgnoreCase types.String `tfsdk:"equals_ignore_case"` -} diff --git a/internal/provider/types/exists_condition.go b/internal/provider/types/exists_condition.go deleted file mode 100644 index 8267d56..0000000 --- a/internal/provider/types/exists_condition.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ExistsCondition struct { - Exists types.Bool `tfsdk:"exists"` -} diff --git a/internal/provider/types/file_config.go b/internal/provider/types/file_config.go deleted file mode 100644 index 84c243a..0000000 --- a/internal/provider/types/file_config.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type FileConfig struct { - SharedWithEndCustomer types.Bool `tfsdk:"shared_with_end_customer"` -} diff --git a/internal/provider/types/filter_config.go b/internal/provider/types/filter_config.go deleted file mode 100644 index 04c580a..0000000 --- a/internal/provider/types/filter_config.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -type FilterConfig struct { - Activity *Activity `tfsdk:"activity"` - Operation *EntityOperationTriggerOperation `tfsdk:"operation"` -} diff --git a/internal/provider/types/frontend_submit_trigger.go b/internal/provider/types/frontend_submit_trigger.go deleted file mode 100644 index 0b06a07..0000000 --- a/internal/provider/types/frontend_submit_trigger.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type FrontendSubmitTrigger struct { - Configuration APISubmissionTriggerConfiguration `tfsdk:"configuration"` - ID types.String `tfsdk:"id"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/types/journey_submit_trigger.go b/internal/provider/types/journey_submit_trigger.go deleted file mode 100644 index db8716d..0000000 --- a/internal/provider/types/journey_submit_trigger.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type JourneySubmitTrigger struct { - Configuration JourneySubmitTriggerConfiguration `tfsdk:"configuration"` - ID types.String `tfsdk:"id"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/types/journey_submit_trigger_configuration.go b/internal/provider/types/journey_submit_trigger_configuration.go deleted file mode 100644 index aaafa83..0000000 --- a/internal/provider/types/journey_submit_trigger_configuration.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type JourneySubmitTriggerConfiguration struct { - SourceID types.String `tfsdk:"source_id"` -} diff --git a/internal/provider/types/prefix_condition.go b/internal/provider/types/prefix_condition.go deleted file mode 100644 index 37a93af..0000000 --- a/internal/provider/types/prefix_condition.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type PrefixCondition struct { - Prefix types.String `tfsdk:"prefix"` -} diff --git a/internal/provider/types/received_email_trigger.go b/internal/provider/types/received_email_trigger.go deleted file mode 100644 index b4a8a35..0000000 --- a/internal/provider/types/received_email_trigger.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ReceivedEmailTrigger struct { - Configuration ReceivedEmailTriggerConfiguration `tfsdk:"configuration"` - ID types.String `tfsdk:"id"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/types/received_email_trigger_configuration.go b/internal/provider/types/received_email_trigger_configuration.go deleted file mode 100644 index 3bbff2f..0000000 --- a/internal/provider/types/received_email_trigger_configuration.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ReceivedEmailTriggerConfiguration struct { - MessageType types.String `tfsdk:"message_type"` -} diff --git a/internal/provider/types/suffix_condition.go b/internal/provider/types/suffix_condition.go deleted file mode 100644 index 8a51bb7..0000000 --- a/internal/provider/types/suffix_condition.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type SuffixCondition struct { - Suffix types.String `tfsdk:"suffix"` -} diff --git a/internal/provider/types/two.go b/internal/provider/types/two.go deleted file mode 100644 index 7af77f6..0000000 --- a/internal/provider/types/two.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Two struct { - Added types.String `tfsdk:"added"` - Deleted types.String `tfsdk:"deleted"` - Updated types.String `tfsdk:"updated"` -} diff --git a/internal/provider/types/wildcard_condition.go b/internal/provider/types/wildcard_condition.go deleted file mode 100644 index a910347..0000000 --- a/internal/provider/types/wildcard_condition.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type WildcardCondition struct { - Wildcard types.String `tfsdk:"wildcard"` -} diff --git a/internal/sdk/models/shared/activitytrigger.go b/internal/sdk/models/shared/activitytrigger.go deleted file mode 100644 index cd8fab0..0000000 --- a/internal/sdk/models/shared/activitytrigger.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type Configuration struct { - Schema *string `json:"schema,omitempty"` - Types []any `json:"types,omitempty"` -} - -func (o *Configuration) GetSchema() *string { - if o == nil { - return nil - } - return o.Schema -} - -func (o *Configuration) GetTypes() []any { - if o == nil { - return nil - } - return o.Types -} - -type Type string - -const ( - TypeActivity Type = "activity" -) - -func (e Type) ToPointer() *Type { - return &e -} -func (e *Type) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "activity": - *e = Type(v) - return nil - default: - return fmt.Errorf("invalid value for Type: %v", v) - } -} - -type ActivityTrigger struct { - Configuration Configuration `json:"configuration"` - ID *string `json:"id,omitempty"` - Type Type `json:"type"` -} - -func (o *ActivityTrigger) GetConfiguration() Configuration { - if o == nil { - return Configuration{} - } - return o.Configuration -} - -func (o *ActivityTrigger) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ActivityTrigger) GetType() Type { - if o == nil { - return Type("") - } - return o.Type -} diff --git a/internal/sdk/models/shared/anyaction.go b/internal/sdk/models/shared/anyaction.go index 18deafd..0bcf7e4 100644 --- a/internal/sdk/models/shared/anyaction.go +++ b/internal/sdk/models/shared/anyaction.go @@ -98,49 +98,49 @@ func CreateAnyActionAutomationAction(automationAction AutomationAction) AnyActio func (u *AnyAction) UnmarshalJSON(data []byte) error { var mapEntityAction MapEntityAction = MapEntityAction{} - if err := utils.UnmarshalJSON(data, &mapEntityAction, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &mapEntityAction, "", true, false); err == nil { u.MapEntityAction = &mapEntityAction u.Type = AnyActionTypeMapEntityAction return nil } var triggerWorkflowAction TriggerWorkflowAction = TriggerWorkflowAction{} - if err := utils.UnmarshalJSON(data, &triggerWorkflowAction, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &triggerWorkflowAction, "", true, false); err == nil { u.TriggerWorkflowAction = &triggerWorkflowAction u.Type = AnyActionTypeTriggerWorkflowAction return nil } var triggerWebhookAction TriggerWebhookAction = TriggerWebhookAction{} - if err := utils.UnmarshalJSON(data, &triggerWebhookAction, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &triggerWebhookAction, "", true, false); err == nil { u.TriggerWebhookAction = &triggerWebhookAction u.Type = AnyActionTypeTriggerWebhookAction return nil } var createDocumentAction CreateDocumentAction = CreateDocumentAction{} - if err := utils.UnmarshalJSON(data, &createDocumentAction, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &createDocumentAction, "", true, false); err == nil { u.CreateDocumentAction = &createDocumentAction u.Type = AnyActionTypeCreateDocumentAction return nil } var sendEmailAction SendEmailAction = SendEmailAction{} - if err := utils.UnmarshalJSON(data, &sendEmailAction, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &sendEmailAction, "", true, false); err == nil { u.SendEmailAction = &sendEmailAction u.Type = AnyActionTypeSendEmailAction return nil } var cartCheckoutAction CartCheckoutAction = CartCheckoutAction{} - if err := utils.UnmarshalJSON(data, &cartCheckoutAction, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &cartCheckoutAction, "", true, false); err == nil { u.CartCheckoutAction = &cartCheckoutAction u.Type = AnyActionTypeCartCheckoutAction return nil } var automationAction AutomationAction = AutomationAction{} - if err := utils.UnmarshalJSON(data, &automationAction, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &automationAction, "", true, false); err == nil { u.AutomationAction = &automationAction u.Type = AnyActionTypeAutomationAction return nil diff --git a/internal/sdk/models/shared/anythingbutcondition.go b/internal/sdk/models/shared/anythingbutcondition.go deleted file mode 100644 index a44792e..0000000 --- a/internal/sdk/models/shared/anythingbutcondition.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type AnythingButCondition struct { - AnythingBut []string `json:"anything-but,omitempty"` -} - -func (o *AnythingButCondition) GetAnythingBut() []string { - if o == nil { - return nil - } - return o.AnythingBut -} diff --git a/internal/sdk/models/shared/anytrigger.go b/internal/sdk/models/shared/anytrigger.go deleted file mode 100644 index c90379d..0000000 --- a/internal/sdk/models/shared/anytrigger.go +++ /dev/null @@ -1,182 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "errors" - "fmt" - "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/internal/utils" -) - -type AnyTriggerType string - -const ( - AnyTriggerTypeFrontendSubmitTrigger AnyTriggerType = "FrontendSubmitTrigger" - AnyTriggerTypeJourneySubmitTrigger AnyTriggerType = "JourneySubmitTrigger" - AnyTriggerTypeAPISubmissionTrigger AnyTriggerType = "ApiSubmissionTrigger" - AnyTriggerTypeEntityOperationTrigger AnyTriggerType = "EntityOperationTrigger" - AnyTriggerTypeActivityTrigger AnyTriggerType = "ActivityTrigger" - AnyTriggerTypeEntityManualTrigger AnyTriggerType = "EntityManualTrigger" - AnyTriggerTypeReceivedEmailTrigger AnyTriggerType = "ReceivedEmailTrigger" -) - -type AnyTrigger struct { - FrontendSubmitTrigger *FrontendSubmitTrigger - JourneySubmitTrigger *JourneySubmitTrigger - APISubmissionTrigger *APISubmissionTrigger - EntityOperationTrigger *EntityOperationTrigger - ActivityTrigger *ActivityTrigger - EntityManualTrigger *EntityManualTrigger - ReceivedEmailTrigger *ReceivedEmailTrigger - - Type AnyTriggerType -} - -func CreateAnyTriggerFrontendSubmitTrigger(frontendSubmitTrigger FrontendSubmitTrigger) AnyTrigger { - typ := AnyTriggerTypeFrontendSubmitTrigger - - return AnyTrigger{ - FrontendSubmitTrigger: &frontendSubmitTrigger, - Type: typ, - } -} - -func CreateAnyTriggerJourneySubmitTrigger(journeySubmitTrigger JourneySubmitTrigger) AnyTrigger { - typ := AnyTriggerTypeJourneySubmitTrigger - - return AnyTrigger{ - JourneySubmitTrigger: &journeySubmitTrigger, - Type: typ, - } -} - -func CreateAnyTriggerAPISubmissionTrigger(apiSubmissionTrigger APISubmissionTrigger) AnyTrigger { - typ := AnyTriggerTypeAPISubmissionTrigger - - return AnyTrigger{ - APISubmissionTrigger: &apiSubmissionTrigger, - Type: typ, - } -} - -func CreateAnyTriggerEntityOperationTrigger(entityOperationTrigger EntityOperationTrigger) AnyTrigger { - typ := AnyTriggerTypeEntityOperationTrigger - - return AnyTrigger{ - EntityOperationTrigger: &entityOperationTrigger, - Type: typ, - } -} - -func CreateAnyTriggerActivityTrigger(activityTrigger ActivityTrigger) AnyTrigger { - typ := AnyTriggerTypeActivityTrigger - - return AnyTrigger{ - ActivityTrigger: &activityTrigger, - Type: typ, - } -} - -func CreateAnyTriggerEntityManualTrigger(entityManualTrigger EntityManualTrigger) AnyTrigger { - typ := AnyTriggerTypeEntityManualTrigger - - return AnyTrigger{ - EntityManualTrigger: &entityManualTrigger, - Type: typ, - } -} - -func CreateAnyTriggerReceivedEmailTrigger(receivedEmailTrigger ReceivedEmailTrigger) AnyTrigger { - typ := AnyTriggerTypeReceivedEmailTrigger - - return AnyTrigger{ - ReceivedEmailTrigger: &receivedEmailTrigger, - Type: typ, - } -} - -func (u *AnyTrigger) UnmarshalJSON(data []byte) error { - - var frontendSubmitTrigger FrontendSubmitTrigger = FrontendSubmitTrigger{} - if err := utils.UnmarshalJSON(data, &frontendSubmitTrigger, "", true, true); err == nil { - u.FrontendSubmitTrigger = &frontendSubmitTrigger - u.Type = AnyTriggerTypeFrontendSubmitTrigger - return nil - } - - var journeySubmitTrigger JourneySubmitTrigger = JourneySubmitTrigger{} - if err := utils.UnmarshalJSON(data, &journeySubmitTrigger, "", true, true); err == nil { - u.JourneySubmitTrigger = &journeySubmitTrigger - u.Type = AnyTriggerTypeJourneySubmitTrigger - return nil - } - - var apiSubmissionTrigger APISubmissionTrigger = APISubmissionTrigger{} - if err := utils.UnmarshalJSON(data, &apiSubmissionTrigger, "", true, true); err == nil { - u.APISubmissionTrigger = &apiSubmissionTrigger - u.Type = AnyTriggerTypeAPISubmissionTrigger - return nil - } - - var entityOperationTrigger EntityOperationTrigger = EntityOperationTrigger{} - if err := utils.UnmarshalJSON(data, &entityOperationTrigger, "", true, true); err == nil { - u.EntityOperationTrigger = &entityOperationTrigger - u.Type = AnyTriggerTypeEntityOperationTrigger - return nil - } - - var activityTrigger ActivityTrigger = ActivityTrigger{} - if err := utils.UnmarshalJSON(data, &activityTrigger, "", true, true); err == nil { - u.ActivityTrigger = &activityTrigger - u.Type = AnyTriggerTypeActivityTrigger - return nil - } - - var entityManualTrigger EntityManualTrigger = EntityManualTrigger{} - if err := utils.UnmarshalJSON(data, &entityManualTrigger, "", true, true); err == nil { - u.EntityManualTrigger = &entityManualTrigger - u.Type = AnyTriggerTypeEntityManualTrigger - return nil - } - - var receivedEmailTrigger ReceivedEmailTrigger = ReceivedEmailTrigger{} - if err := utils.UnmarshalJSON(data, &receivedEmailTrigger, "", true, true); err == nil { - u.ReceivedEmailTrigger = &receivedEmailTrigger - u.Type = AnyTriggerTypeReceivedEmailTrigger - return nil - } - - return fmt.Errorf("could not unmarshal `%s` into any supported union types for AnyTrigger", string(data)) -} - -func (u AnyTrigger) MarshalJSON() ([]byte, error) { - if u.FrontendSubmitTrigger != nil { - return utils.MarshalJSON(u.FrontendSubmitTrigger, "", true) - } - - if u.JourneySubmitTrigger != nil { - return utils.MarshalJSON(u.JourneySubmitTrigger, "", true) - } - - if u.APISubmissionTrigger != nil { - return utils.MarshalJSON(u.APISubmissionTrigger, "", true) - } - - if u.EntityOperationTrigger != nil { - return utils.MarshalJSON(u.EntityOperationTrigger, "", true) - } - - if u.ActivityTrigger != nil { - return utils.MarshalJSON(u.ActivityTrigger, "", true) - } - - if u.EntityManualTrigger != nil { - return utils.MarshalJSON(u.EntityManualTrigger, "", true) - } - - if u.ReceivedEmailTrigger != nil { - return utils.MarshalJSON(u.ReceivedEmailTrigger, "", true) - } - - return nil, errors.New("could not marshal union type AnyTrigger: all fields are null") -} diff --git a/internal/sdk/models/shared/apisubmissiontrigger.go b/internal/sdk/models/shared/apisubmissiontrigger.go deleted file mode 100644 index a761bb4..0000000 --- a/internal/sdk/models/shared/apisubmissiontrigger.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type APISubmissionTriggerConfiguration struct { - SourceID *string `json:"source_id,omitempty"` -} - -func (o *APISubmissionTriggerConfiguration) GetSourceID() *string { - if o == nil { - return nil - } - return o.SourceID -} - -type APISubmissionTriggerType string - -const ( - APISubmissionTriggerTypeAPISubmission APISubmissionTriggerType = "api_submission" -) - -func (e APISubmissionTriggerType) ToPointer() *APISubmissionTriggerType { - return &e -} -func (e *APISubmissionTriggerType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "api_submission": - *e = APISubmissionTriggerType(v) - return nil - default: - return fmt.Errorf("invalid value for APISubmissionTriggerType: %v", v) - } -} - -type APISubmissionTrigger struct { - Configuration APISubmissionTriggerConfiguration `json:"configuration"` - ID *string `json:"id,omitempty"` - Type APISubmissionTriggerType `json:"type"` -} - -func (o *APISubmissionTrigger) GetConfiguration() APISubmissionTriggerConfiguration { - if o == nil { - return APISubmissionTriggerConfiguration{} - } - return o.Configuration -} - -func (o *APISubmissionTrigger) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *APISubmissionTrigger) GetType() APISubmissionTriggerType { - if o == nil { - return APISubmissionTriggerType("") - } - return o.Type -} diff --git a/internal/sdk/models/shared/automationexecution.go b/internal/sdk/models/shared/automationexecution.go index 09aba7f..0b83de5 100644 --- a/internal/sdk/models/shared/automationexecution.go +++ b/internal/sdk/models/shared/automationexecution.go @@ -55,21 +55,21 @@ func CreateTriggerEventTriggerEventEntityOperation(triggerEventEntityOperation T func (u *TriggerEvent) UnmarshalJSON(data []byte) error { var triggerEventManual TriggerEventManual = TriggerEventManual{} - if err := utils.UnmarshalJSON(data, &triggerEventManual, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &triggerEventManual, "", true, false); err == nil { u.TriggerEventManual = &triggerEventManual u.Type = TriggerEventTypeTriggerEventManual return nil } var triggerEventEntityActivity TriggerEventEntityActivity = TriggerEventEntityActivity{} - if err := utils.UnmarshalJSON(data, &triggerEventEntityActivity, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &triggerEventEntityActivity, "", true, false); err == nil { u.TriggerEventEntityActivity = &triggerEventEntityActivity u.Type = TriggerEventTypeTriggerEventEntityActivity return nil } var triggerEventEntityOperation TriggerEventEntityOperation = TriggerEventEntityOperation{} - if err := utils.UnmarshalJSON(data, &triggerEventEntityOperation, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &triggerEventEntityOperation, "", true, false); err == nil { u.TriggerEventEntityOperation = &triggerEventEntityOperation u.Type = TriggerEventTypeTriggerEventEntityOperation return nil diff --git a/internal/sdk/models/shared/automationflow.go b/internal/sdk/models/shared/automationflow.go index fa34979..66f37cd 100644 --- a/internal/sdk/models/shared/automationflow.go +++ b/internal/sdk/models/shared/automationflow.go @@ -18,9 +18,9 @@ type AutomationFlow struct { FlowName string `json:"flow_name"` ID *string `json:"id,omitempty"` // Determines if the flow is a system generated flow - SystemFlow *bool `json:"system_flow,omitempty"` - TriggerConditions []any `json:"trigger_conditions,omitempty"` - Triggers []AnyTrigger `json:"triggers"` + SystemFlow *bool `json:"system_flow,omitempty"` + TriggerConditions []any `json:"trigger_conditions,omitempty"` + Triggers []any `json:"triggers"` // Version of the flow Version *float64 `json:"version,omitempty"` } @@ -92,9 +92,9 @@ func (o *AutomationFlow) GetTriggerConditions() []any { return o.TriggerConditions } -func (o *AutomationFlow) GetTriggers() []AnyTrigger { +func (o *AutomationFlow) GetTriggers() []any { if o == nil { - return []AnyTrigger{} + return []any{} } return o.Triggers } diff --git a/internal/sdk/models/shared/automationflowinput.go b/internal/sdk/models/shared/automationflowinput.go index 01ae4d9..e49e1c5 100644 --- a/internal/sdk/models/shared/automationflowinput.go +++ b/internal/sdk/models/shared/automationflowinput.go @@ -17,9 +17,9 @@ type AutomationFlowInput struct { // A descriptive name for the Automation FlowName string `json:"flow_name"` // Determines if the flow is a system generated flow - SystemFlow *bool `json:"system_flow,omitempty"` - TriggerConditions []any `json:"trigger_conditions,omitempty"` - Triggers []AnyTrigger `json:"triggers"` + SystemFlow *bool `json:"system_flow,omitempty"` + TriggerConditions []any `json:"trigger_conditions,omitempty"` + Triggers []any `json:"triggers"` // Version of the flow Version *float64 `json:"version,omitempty"` } @@ -84,9 +84,9 @@ func (o *AutomationFlowInput) GetTriggerConditions() []any { return o.TriggerConditions } -func (o *AutomationFlowInput) GetTriggers() []AnyTrigger { +func (o *AutomationFlowInput) GetTriggers() []any { if o == nil { - return []AnyTrigger{} + return []any{} } return o.Triggers } diff --git a/internal/sdk/models/shared/cartcheckoutaction.go b/internal/sdk/models/shared/cartcheckoutaction.go index 7e1a166..b676bcd 100644 --- a/internal/sdk/models/shared/cartcheckoutaction.go +++ b/internal/sdk/models/shared/cartcheckoutaction.go @@ -28,26 +28,26 @@ func (o *CartCheckoutActionReason) GetPayload() map[string]any { return o.Payload } -type CartCheckoutActionType string +type Type string const ( - CartCheckoutActionTypeCartCheckout CartCheckoutActionType = "cart-checkout" + TypeCartCheckout Type = "cart-checkout" ) -func (e CartCheckoutActionType) ToPointer() *CartCheckoutActionType { +func (e Type) ToPointer() *Type { return &e } -func (e *CartCheckoutActionType) UnmarshalJSON(data []byte) error { +func (e *Type) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case "cart-checkout": - *e = CartCheckoutActionType(v) + *e = Type(v) return nil default: - return fmt.Errorf("invalid value for CartCheckoutActionType: %v", v) + return fmt.Errorf("invalid value for Type: %v", v) } } @@ -70,10 +70,10 @@ type CartCheckoutAction struct { Outputs map[string]any `json:"outputs,omitempty"` Reason *CartCheckoutActionReason `json:"reason,omitempty"` // different behaviors for retrying failed execution actions. - RetryStrategy *RetryStrategy `json:"retry_strategy,omitempty"` - StartedAt *string `json:"started_at,omitempty"` - Type *CartCheckoutActionType `json:"type,omitempty"` - UpdatedAt *string `json:"updated_at,omitempty"` + RetryStrategy *RetryStrategy `json:"retry_strategy,omitempty"` + StartedAt *string `json:"started_at,omitempty"` + Type *Type `json:"type,omitempty"` + UpdatedAt *string `json:"updated_at,omitempty"` } func (o *CartCheckoutAction) GetAllowFailure() *bool { @@ -174,7 +174,7 @@ func (o *CartCheckoutAction) GetStartedAt() *string { return o.StartedAt } -func (o *CartCheckoutAction) GetType() *CartCheckoutActionType { +func (o *CartCheckoutAction) GetType() *Type { if o == nil { return nil } diff --git a/internal/sdk/models/shared/cartcheckoutconfig.go b/internal/sdk/models/shared/cartcheckoutconfig.go index 116bceb..ad77840 100644 --- a/internal/sdk/models/shared/cartcheckoutconfig.go +++ b/internal/sdk/models/shared/cartcheckoutconfig.go @@ -43,14 +43,14 @@ func CreateMappingAttributesMappingAttribute(mappingAttribute MappingAttribute) func (u *MappingAttributes) UnmarshalJSON(data []byte) error { var mappingAttributeV2 MappingAttributeV2 = MappingAttributeV2{} - if err := utils.UnmarshalJSON(data, &mappingAttributeV2, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &mappingAttributeV2, "", true, false); err == nil { u.MappingAttributeV2 = &mappingAttributeV2 u.Type = MappingAttributesTypeMappingAttributeV2 return nil } var mappingAttribute MappingAttribute = MappingAttribute{} - if err := utils.UnmarshalJSON(data, &mappingAttribute, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &mappingAttribute, "", true, false); err == nil { u.MappingAttribute = &mappingAttribute u.Type = MappingAttributesTypeMappingAttribute return nil diff --git a/internal/sdk/models/shared/entitymanualtrigger.go b/internal/sdk/models/shared/entitymanualtrigger.go deleted file mode 100644 index bba09a3..0000000 --- a/internal/sdk/models/shared/entitymanualtrigger.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type EntityManualTriggerConfiguration struct { - // Which entity type can this automation be triggered from - Schema *string `json:"schema,omitempty"` -} - -func (o *EntityManualTriggerConfiguration) GetSchema() *string { - if o == nil { - return nil - } - return o.Schema -} - -type EntityManualTriggerType string - -const ( - EntityManualTriggerTypeEntityManual EntityManualTriggerType = "entity_manual" -) - -func (e EntityManualTriggerType) ToPointer() *EntityManualTriggerType { - return &e -} -func (e *EntityManualTriggerType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "entity_manual": - *e = EntityManualTriggerType(v) - return nil - default: - return fmt.Errorf("invalid value for EntityManualTriggerType: %v", v) - } -} - -type EntityManualTrigger struct { - Configuration EntityManualTriggerConfiguration `json:"configuration"` - ID *string `json:"id,omitempty"` - Type EntityManualTriggerType `json:"type"` -} - -func (o *EntityManualTrigger) GetConfiguration() EntityManualTriggerConfiguration { - if o == nil { - return EntityManualTriggerConfiguration{} - } - return o.Configuration -} - -func (o *EntityManualTrigger) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *EntityManualTrigger) GetType() EntityManualTriggerType { - if o == nil { - return EntityManualTriggerType("") - } - return o.Type -} diff --git a/internal/sdk/models/shared/entityoperationtrigger.go b/internal/sdk/models/shared/entityoperationtrigger.go deleted file mode 100644 index 05b1be0..0000000 --- a/internal/sdk/models/shared/entityoperationtrigger.go +++ /dev/null @@ -1,605 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "errors" - "fmt" - "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/internal/utils" -) - -type FileConfig struct { - SharedWithEndCustomer *bool `json:"shared_with_end_customer,omitempty"` -} - -func (o *FileConfig) GetSharedWithEndCustomer() *bool { - if o == nil { - return nil - } - return o.SharedWithEndCustomer -} - -type EcpConfig struct { - FileConfig *FileConfig `json:"file_config,omitempty"` - Origin *string `json:"origin,omitempty"` -} - -func (o *EcpConfig) GetFileConfig() *FileConfig { - if o == nil { - return nil - } - return o.FileConfig -} - -func (o *EcpConfig) GetOrigin() *string { - if o == nil { - return nil - } - return o.Origin -} - -type EntityOperationTriggerSchemasTypeType string - -const ( - EntityOperationTriggerSchemasTypeTypeStr EntityOperationTriggerSchemasTypeType = "str" - EntityOperationTriggerSchemasTypeTypeEqualsIgnoreCaseCondition EntityOperationTriggerSchemasTypeType = "EqualsIgnoreCaseCondition" - EntityOperationTriggerSchemasTypeTypeAnythingButCondition EntityOperationTriggerSchemasTypeType = "AnythingButCondition" - EntityOperationTriggerSchemasTypeTypeExistsCondition EntityOperationTriggerSchemasTypeType = "ExistsCondition" - EntityOperationTriggerSchemasTypeTypePrefixCondition EntityOperationTriggerSchemasTypeType = "PrefixCondition" - EntityOperationTriggerSchemasTypeTypeSuffixCondition EntityOperationTriggerSchemasTypeType = "SuffixCondition" - EntityOperationTriggerSchemasTypeTypeWildcardCondition EntityOperationTriggerSchemasTypeType = "WildcardCondition" -) - -type EntityOperationTriggerSchemasType struct { - Str *string - EqualsIgnoreCaseCondition *EqualsIgnoreCaseCondition - AnythingButCondition *AnythingButCondition - ExistsCondition *ExistsCondition - PrefixCondition *PrefixCondition - SuffixCondition *SuffixCondition - WildcardCondition *WildcardCondition - - Type EntityOperationTriggerSchemasTypeType -} - -func CreateEntityOperationTriggerSchemasTypeStr(str string) EntityOperationTriggerSchemasType { - typ := EntityOperationTriggerSchemasTypeTypeStr - - return EntityOperationTriggerSchemasType{ - Str: &str, - Type: typ, - } -} - -func CreateEntityOperationTriggerSchemasTypeEqualsIgnoreCaseCondition(equalsIgnoreCaseCondition EqualsIgnoreCaseCondition) EntityOperationTriggerSchemasType { - typ := EntityOperationTriggerSchemasTypeTypeEqualsIgnoreCaseCondition - - return EntityOperationTriggerSchemasType{ - EqualsIgnoreCaseCondition: &equalsIgnoreCaseCondition, - Type: typ, - } -} - -func CreateEntityOperationTriggerSchemasTypeAnythingButCondition(anythingButCondition AnythingButCondition) EntityOperationTriggerSchemasType { - typ := EntityOperationTriggerSchemasTypeTypeAnythingButCondition - - return EntityOperationTriggerSchemasType{ - AnythingButCondition: &anythingButCondition, - Type: typ, - } -} - -func CreateEntityOperationTriggerSchemasTypeExistsCondition(existsCondition ExistsCondition) EntityOperationTriggerSchemasType { - typ := EntityOperationTriggerSchemasTypeTypeExistsCondition - - return EntityOperationTriggerSchemasType{ - ExistsCondition: &existsCondition, - Type: typ, - } -} - -func CreateEntityOperationTriggerSchemasTypePrefixCondition(prefixCondition PrefixCondition) EntityOperationTriggerSchemasType { - typ := EntityOperationTriggerSchemasTypeTypePrefixCondition - - return EntityOperationTriggerSchemasType{ - PrefixCondition: &prefixCondition, - Type: typ, - } -} - -func CreateEntityOperationTriggerSchemasTypeSuffixCondition(suffixCondition SuffixCondition) EntityOperationTriggerSchemasType { - typ := EntityOperationTriggerSchemasTypeTypeSuffixCondition - - return EntityOperationTriggerSchemasType{ - SuffixCondition: &suffixCondition, - Type: typ, - } -} - -func CreateEntityOperationTriggerSchemasTypeWildcardCondition(wildcardCondition WildcardCondition) EntityOperationTriggerSchemasType { - typ := EntityOperationTriggerSchemasTypeTypeWildcardCondition - - return EntityOperationTriggerSchemasType{ - WildcardCondition: &wildcardCondition, - Type: typ, - } -} - -func (u *EntityOperationTriggerSchemasType) UnmarshalJSON(data []byte) error { - - var equalsIgnoreCaseCondition EqualsIgnoreCaseCondition = EqualsIgnoreCaseCondition{} - if err := utils.UnmarshalJSON(data, &equalsIgnoreCaseCondition, "", true, true); err == nil { - u.EqualsIgnoreCaseCondition = &equalsIgnoreCaseCondition - u.Type = EntityOperationTriggerSchemasTypeTypeEqualsIgnoreCaseCondition - return nil - } - - var anythingButCondition AnythingButCondition = AnythingButCondition{} - if err := utils.UnmarshalJSON(data, &anythingButCondition, "", true, true); err == nil { - u.AnythingButCondition = &anythingButCondition - u.Type = EntityOperationTriggerSchemasTypeTypeAnythingButCondition - return nil - } - - var existsCondition ExistsCondition = ExistsCondition{} - if err := utils.UnmarshalJSON(data, &existsCondition, "", true, true); err == nil { - u.ExistsCondition = &existsCondition - u.Type = EntityOperationTriggerSchemasTypeTypeExistsCondition - return nil - } - - var prefixCondition PrefixCondition = PrefixCondition{} - if err := utils.UnmarshalJSON(data, &prefixCondition, "", true, true); err == nil { - u.PrefixCondition = &prefixCondition - u.Type = EntityOperationTriggerSchemasTypeTypePrefixCondition - return nil - } - - var suffixCondition SuffixCondition = SuffixCondition{} - if err := utils.UnmarshalJSON(data, &suffixCondition, "", true, true); err == nil { - u.SuffixCondition = &suffixCondition - u.Type = EntityOperationTriggerSchemasTypeTypeSuffixCondition - return nil - } - - var wildcardCondition WildcardCondition = WildcardCondition{} - if err := utils.UnmarshalJSON(data, &wildcardCondition, "", true, true); err == nil { - u.WildcardCondition = &wildcardCondition - u.Type = EntityOperationTriggerSchemasTypeTypeWildcardCondition - return nil - } - - var str string = "" - if err := utils.UnmarshalJSON(data, &str, "", true, true); err == nil { - u.Str = &str - u.Type = EntityOperationTriggerSchemasTypeTypeStr - return nil - } - - return fmt.Errorf("could not unmarshal `%s` into any supported union types for EntityOperationTriggerSchemasType", string(data)) -} - -func (u EntityOperationTriggerSchemasType) MarshalJSON() ([]byte, error) { - if u.Str != nil { - return utils.MarshalJSON(u.Str, "", true) - } - - if u.EqualsIgnoreCaseCondition != nil { - return utils.MarshalJSON(u.EqualsIgnoreCaseCondition, "", true) - } - - if u.AnythingButCondition != nil { - return utils.MarshalJSON(u.AnythingButCondition, "", true) - } - - if u.ExistsCondition != nil { - return utils.MarshalJSON(u.ExistsCondition, "", true) - } - - if u.PrefixCondition != nil { - return utils.MarshalJSON(u.PrefixCondition, "", true) - } - - if u.SuffixCondition != nil { - return utils.MarshalJSON(u.SuffixCondition, "", true) - } - - if u.WildcardCondition != nil { - return utils.MarshalJSON(u.WildcardCondition, "", true) - } - - return nil, errors.New("could not marshal union type EntityOperationTriggerSchemasType: all fields are null") -} - -type Activity struct { - // Filter on activity type. If not specified, all activities will be matched on execution. - // Example: - // 1. Filter the events when an entity is updated from portal - // ``` - // { - // "activity":{ - // "type": ["EntityUpdatedFromPortal"] - // } - // } - // ``` - // 2. Filter the events when either a doc is uploaded/removed on an entity from a portal - // ``` - // { - // "activity":{ - // "type": ["DocUploadedFromPortal", "DocRemovedFromPortal"] - // } - // } - // ``` - // - Type []EntityOperationTriggerSchemasType `json:"type,omitempty"` -} - -func (o *Activity) GetType() []EntityOperationTriggerSchemasType { - if o == nil { - return nil - } - return o.Type -} - -// Two - Diff to it's prior state when an entity is updated -type Two struct { - Added any `json:"added,omitempty"` - Deleted any `json:"deleted,omitempty"` - Updated any `json:"updated,omitempty"` -} - -func (o *Two) GetAdded() any { - if o == nil { - return nil - } - return o.Added -} - -func (o *Two) GetDeleted() any { - if o == nil { - return nil - } - return o.Deleted -} - -func (o *Two) GetUpdated() any { - if o == nil { - return nil - } - return o.Updated -} - -type DiffType string - -const ( - DiffTypeAny DiffType = "any" - DiffTypeTwo DiffType = "2" -) - -type Diff struct { - Any any - Two *Two - - Type DiffType -} - -func CreateDiffAny(any any) Diff { - typ := DiffTypeAny - - return Diff{ - Any: any, - Type: typ, - } -} - -func CreateDiffTwo(two Two) Diff { - typ := DiffTypeTwo - - return Diff{ - Two: &two, - Type: typ, - } -} - -func (u *Diff) UnmarshalJSON(data []byte) error { - - var two Two = Two{} - if err := utils.UnmarshalJSON(data, &two, "", true, true); err == nil { - u.Two = &two - u.Type = DiffTypeTwo - return nil - } - - var any any = nil - if err := utils.UnmarshalJSON(data, &any, "", true, true); err == nil { - u.Any = any - u.Type = DiffTypeAny - return nil - } - - return fmt.Errorf("could not unmarshal `%s` into any supported union types for Diff", string(data)) -} - -func (u Diff) MarshalJSON() ([]byte, error) { - if u.Any != nil { - return utils.MarshalJSON(u.Any, "", true) - } - - if u.Two != nil { - return utils.MarshalJSON(u.Two, "", true) - } - - return nil, errors.New("could not marshal union type Diff: all fields are null") -} - -type EntityOperationTriggerOperation struct { - Diff *Diff `json:"diff,omitempty"` - // Filter on operation type. If not specified, all operations will be matched on execution. - // Example: - // 1. Filter all the createEntity/updateEntity operations - // ``` - // { - // "operation":{ - // "operation": ["createEntity", "updateEntity"] - // } - // } - // ``` - // - Operation []EntityOperation `json:"operation,omitempty"` - Payload any `json:"payload,omitempty"` -} - -func (o *EntityOperationTriggerOperation) GetDiff() *Diff { - if o == nil { - return nil - } - return o.Diff -} - -func (o *EntityOperationTriggerOperation) GetOperation() []EntityOperation { - if o == nil { - return nil - } - return o.Operation -} - -func (o *EntityOperationTriggerOperation) GetPayload() any { - if o == nil { - return nil - } - return o.Payload -} - -type FilterConfig struct { - Activity *Activity `json:"activity,omitempty"` - Operation *EntityOperationTriggerOperation `json:"operation,omitempty"` -} - -func (o *FilterConfig) GetActivity() *Activity { - if o == nil { - return nil - } - return o.Activity -} - -func (o *FilterConfig) GetOperation() *EntityOperationTriggerOperation { - if o == nil { - return nil - } - return o.Operation -} - -type EntityOperationTriggerConfiguration struct { - EcpConfig *EcpConfig `json:"ecp_config,omitempty"` - ExcludeActivities []string `json:"exclude_activities,omitempty"` - FilterConfig *FilterConfig `json:"filter_config,omitempty"` - IncludeActivities []string `json:"include_activities,omitempty"` - Operations []EntityOperation `json:"operations,omitempty"` - Schema *string `json:"schema,omitempty"` -} - -func (o *EntityOperationTriggerConfiguration) GetEcpConfig() *EcpConfig { - if o == nil { - return nil - } - return o.EcpConfig -} - -func (o *EntityOperationTriggerConfiguration) GetExcludeActivities() []string { - if o == nil { - return nil - } - return o.ExcludeActivities -} - -func (o *EntityOperationTriggerConfiguration) GetFilterConfig() *FilterConfig { - if o == nil { - return nil - } - return o.FilterConfig -} - -func (o *EntityOperationTriggerConfiguration) GetIncludeActivities() []string { - if o == nil { - return nil - } - return o.IncludeActivities -} - -func (o *EntityOperationTriggerConfiguration) GetOperations() []EntityOperation { - if o == nil { - return nil - } - return o.Operations -} - -func (o *EntityOperationTriggerConfiguration) GetSchema() *string { - if o == nil { - return nil - } - return o.Schema -} - -type EntityOperationTriggerType string - -const ( - EntityOperationTriggerTypeEntityOperation EntityOperationTriggerType = "entity_operation" -) - -func (e EntityOperationTriggerType) ToPointer() *EntityOperationTriggerType { - return &e -} -func (e *EntityOperationTriggerType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "entity_operation": - *e = EntityOperationTriggerType(v) - return nil - default: - return fmt.Errorf("invalid value for EntityOperationTriggerType: %v", v) - } -} - -// EntityOperationTrigger - - If provides filter_config, executes an automation based on the filtered configuration when an entity event occurs. -// - The conditions on a filter follows the event bridge patterns - `https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html` -// | Comparison | Example | Rule syntax | -// |------------------------|-----------------------------------------------------|----------------------------------------------------------| -// | Null | first_name is null | `"first_name": [ null ]` | -// | Empty | last_name is empty | `"last_name": [""]` | -// | Equals | email is "j.doe@email.com" | `"email": [ "j.doe@email.com" ]` | -// | Equals (ignore case) | first_name is "John" | `"first_name": [ { "equals-ignore-case": "john" } ]` | -// | And | fist_name is "John" and last_name is "Doe" | `"first_name": [ "John" ], "last_name": ["Doe"]` | -// | Or | PaymentType is "Invoice" or "SEPA" | `"PaymentType": [ "invoice", "sepa"]` | -// | Or (multiple fields) | first_name is "John", or last_name is "Doe". | `"$or": [ { "first_name": [ "John" ] }, { "last_name": [ "Doe" ] } ]` | -// | Not | status is anything but "cancelled" | `"status": [ { "anything-but": [ "cancelled" ] } ]` | -// | Numeric (equals) | Price is 100 | `"Price": [ { "numeric": [ "=", 100 ] } ]` | -// | Numeric (range) | Price is more than 10, and less than or equal to 20 | `"Price": [ { "numeric": [ ">", 10, "<=", 20 ] } ]` | -// | Exists | ProductName exists | `"ProductName": [ { "exists": true } ]` | -// | Does not exist | ProductName does not exist | `"ProductName": [ { "exists": false } ]` | -// | Begins with | OpportunityNumber starts with OPP- | `"opportunity_number": [ { "prefix": "OPP-" } ]` | -// | Ends with | FileName ends with a .png extension | `"filename": [ { "suffix": ".png" } ]` | -// | Wildcard | search a string using a wildcard | `"email": [ { "wildcard": "*@doe.com" } ]` | -// - To run the execution on all update events -// ``` -// { -// "type": "filter_entity_event", -// "configuration": { -// "operation": { -// "operation": ["updateEntity"] -// } -// } -// } -// ``` -// - To run the execution only when the updates are from a portal user -// ``` -// { -// "type": "filter_entity_event", -// "configuration": { -// "operation": { -// "operation": ["updateEntity"] -// }, -// "activity": { -// "type": "EntityUpdatedFromPortal" -// } -// } -// } -// ``` -// - To run the execution only when there is an update on a specific attribute -// ``` -// Only starts the automation when the email on a contact is changed -// { -// "type": "filter_entity_event", -// "configuration": { -// "operation": { -// "operation": ["updateEntity"], -// "payload": { -// "_schema": ["contact"] -// }, -// "diff": { -// "updated": { -// "email": [{ "exists": true }] -// } -// } -// } -// } -// } -// ``` -// - To run the execution only when a specific attribute is altered(created/updated/deleted) -// ``` -// Only starts the automation when a price is altered on a contract -// { -// "type": "filter_entity_event", -// "configuration": { -// "operation": { -// "payload": { -// "_schema": ["contract"] -// }, -// "diff": { -// // Whether he first_name has been added, updated, or removed -// $or: [ -// { -// 'added.first_name': [{ exists: true }] -// }, -// { -// 'updated.first_name': [{ exists: true }] -// }, -// { -// 'deleted.first_name': [{ exists: true }] -// } -// ] -// } -// } -// } -// } -// ``` -// - To run the execution if an attribute is changed from one state to another -// ``` -// Only starts the automation when the order status changes from `open_for_acceptance` to `placed` -// { -// "type": "filter_entity_event", -// "configuration": { -// "operation": { -// "operation": ["updateEntity"], -// "payload": { -// "_schema": ["order"], -// "status": ["placed"] -// }, -// "diff": { -// "updated": { -// "status": ["open_for_acceptance"] -// } -// } -// } -// } -// } -// ``` -type EntityOperationTrigger struct { - Configuration EntityOperationTriggerConfiguration `json:"configuration"` - ID *string `json:"id,omitempty"` - Type EntityOperationTriggerType `json:"type"` -} - -func (o *EntityOperationTrigger) GetConfiguration() EntityOperationTriggerConfiguration { - if o == nil { - return EntityOperationTriggerConfiguration{} - } - return o.Configuration -} - -func (o *EntityOperationTrigger) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *EntityOperationTrigger) GetType() EntityOperationTriggerType { - if o == nil { - return EntityOperationTriggerType("") - } - return o.Type -} diff --git a/internal/sdk/models/shared/equalsignorecasecondition.go b/internal/sdk/models/shared/equalsignorecasecondition.go deleted file mode 100644 index 140c6ff..0000000 --- a/internal/sdk/models/shared/equalsignorecasecondition.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type EqualsIgnoreCaseCondition struct { - EqualsIgnoreCase *string `json:"equals-ignore-case,omitempty"` -} - -func (o *EqualsIgnoreCaseCondition) GetEqualsIgnoreCase() *string { - if o == nil { - return nil - } - return o.EqualsIgnoreCase -} diff --git a/internal/sdk/models/shared/existscondition.go b/internal/sdk/models/shared/existscondition.go deleted file mode 100644 index d7dc706..0000000 --- a/internal/sdk/models/shared/existscondition.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type ExistsCondition struct { - Exists *bool `json:"exists,omitempty"` -} - -func (o *ExistsCondition) GetExists() *bool { - if o == nil { - return nil - } - return o.Exists -} diff --git a/internal/sdk/models/shared/frontendsubmittrigger.go b/internal/sdk/models/shared/frontendsubmittrigger.go deleted file mode 100644 index 37e7ce6..0000000 --- a/internal/sdk/models/shared/frontendsubmittrigger.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type FrontendSubmitTriggerConfiguration struct { - SourceID *string `json:"source_id,omitempty"` -} - -func (o *FrontendSubmitTriggerConfiguration) GetSourceID() *string { - if o == nil { - return nil - } - return o.SourceID -} - -type FrontendSubmitTriggerType string - -const ( - FrontendSubmitTriggerTypeFrontendSubmission FrontendSubmitTriggerType = "frontend_submission" -) - -func (e FrontendSubmitTriggerType) ToPointer() *FrontendSubmitTriggerType { - return &e -} -func (e *FrontendSubmitTriggerType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "frontend_submission": - *e = FrontendSubmitTriggerType(v) - return nil - default: - return fmt.Errorf("invalid value for FrontendSubmitTriggerType: %v", v) - } -} - -type FrontendSubmitTrigger struct { - Configuration FrontendSubmitTriggerConfiguration `json:"configuration"` - ID *string `json:"id,omitempty"` - Type FrontendSubmitTriggerType `json:"type"` -} - -func (o *FrontendSubmitTrigger) GetConfiguration() FrontendSubmitTriggerConfiguration { - if o == nil { - return FrontendSubmitTriggerConfiguration{} - } - return o.Configuration -} - -func (o *FrontendSubmitTrigger) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *FrontendSubmitTrigger) GetType() FrontendSubmitTriggerType { - if o == nil { - return FrontendSubmitTriggerType("") - } - return o.Type -} diff --git a/internal/sdk/models/shared/journeysubmittrigger.go b/internal/sdk/models/shared/journeysubmittrigger.go deleted file mode 100644 index e601ca9..0000000 --- a/internal/sdk/models/shared/journeysubmittrigger.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type JourneySubmitTriggerConfiguration struct { - SourceID string `json:"source_id"` -} - -func (o *JourneySubmitTriggerConfiguration) GetSourceID() string { - if o == nil { - return "" - } - return o.SourceID -} - -type JourneySubmitTriggerType string - -const ( - JourneySubmitTriggerTypeJourneySubmission JourneySubmitTriggerType = "journey_submission" -) - -func (e JourneySubmitTriggerType) ToPointer() *JourneySubmitTriggerType { - return &e -} -func (e *JourneySubmitTriggerType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "journey_submission": - *e = JourneySubmitTriggerType(v) - return nil - default: - return fmt.Errorf("invalid value for JourneySubmitTriggerType: %v", v) - } -} - -type JourneySubmitTrigger struct { - Configuration JourneySubmitTriggerConfiguration `json:"configuration"` - ID *string `json:"id,omitempty"` - Type JourneySubmitTriggerType `json:"type"` -} - -func (o *JourneySubmitTrigger) GetConfiguration() JourneySubmitTriggerConfiguration { - if o == nil { - return JourneySubmitTriggerConfiguration{} - } - return o.Configuration -} - -func (o *JourneySubmitTrigger) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *JourneySubmitTrigger) GetType() JourneySubmitTriggerType { - if o == nil { - return JourneySubmitTriggerType("") - } - return o.Type -} diff --git a/internal/sdk/models/shared/mapentityconfig.go b/internal/sdk/models/shared/mapentityconfig.go index 32d20a1..4dedcce 100644 --- a/internal/sdk/models/shared/mapentityconfig.go +++ b/internal/sdk/models/shared/mapentityconfig.go @@ -43,14 +43,14 @@ func CreateMapEntityConfigMappingAttributesMappingAttribute(mappingAttribute Map func (u *MapEntityConfigMappingAttributes) UnmarshalJSON(data []byte) error { var mappingAttributeV2 MappingAttributeV2 = MappingAttributeV2{} - if err := utils.UnmarshalJSON(data, &mappingAttributeV2, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &mappingAttributeV2, "", true, false); err == nil { u.MappingAttributeV2 = &mappingAttributeV2 u.Type = MapEntityConfigMappingAttributesTypeMappingAttributeV2 return nil } var mappingAttribute MappingAttribute = MappingAttribute{} - if err := utils.UnmarshalJSON(data, &mappingAttribute, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &mappingAttribute, "", true, false); err == nil { u.MappingAttribute = &mappingAttribute u.Type = MapEntityConfigMappingAttributesTypeMappingAttribute return nil diff --git a/internal/sdk/models/shared/mappingattribute.go b/internal/sdk/models/shared/mappingattribute.go index 00187e9..a89944c 100644 --- a/internal/sdk/models/shared/mappingattribute.go +++ b/internal/sdk/models/shared/mappingattribute.go @@ -54,21 +54,21 @@ func CreateMappingAttributeAppendValueMapper(appendValueMapper AppendValueMapper func (u *MappingAttribute) UnmarshalJSON(data []byte) error { var setValueMapper SetValueMapper = SetValueMapper{} - if err := utils.UnmarshalJSON(data, &setValueMapper, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &setValueMapper, "", true, false); err == nil { u.SetValueMapper = &setValueMapper u.Type = MappingAttributeTypeSetValueMapper return nil } var copyValueMapper CopyValueMapper = CopyValueMapper{} - if err := utils.UnmarshalJSON(data, ©ValueMapper, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, ©ValueMapper, "", true, false); err == nil { u.CopyValueMapper = ©ValueMapper u.Type = MappingAttributeTypeCopyValueMapper return nil } var appendValueMapper AppendValueMapper = AppendValueMapper{} - if err := utils.UnmarshalJSON(data, &appendValueMapper, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &appendValueMapper, "", true, false); err == nil { u.AppendValueMapper = &appendValueMapper u.Type = MappingAttributeTypeAppendValueMapper return nil diff --git a/internal/sdk/models/shared/operationnode.go b/internal/sdk/models/shared/operationnode.go index 87e48b0..21d6796 100644 --- a/internal/sdk/models/shared/operationnode.go +++ b/internal/sdk/models/shared/operationnode.go @@ -44,14 +44,14 @@ func CreateOperationNodeAny(any any) OperationNode { func (u *OperationNode) UnmarshalJSON(data []byte) error { var operationObjectNode OperationObjectNode = OperationObjectNode{} - if err := utils.UnmarshalJSON(data, &operationObjectNode, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &operationObjectNode, "", true, false); err == nil { u.OperationObjectNode = &operationObjectNode u.Type = OperationNodeTypeOperationObjectNode return nil } var any any = nil - if err := utils.UnmarshalJSON(data, &any, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &any, "", true, false); err == nil { u.Any = any u.Type = OperationNodeTypeAny return nil diff --git a/internal/sdk/models/shared/operationobjectnode.go b/internal/sdk/models/shared/operationobjectnode.go index b82fbd8..9660200 100644 --- a/internal/sdk/models/shared/operationobjectnode.go +++ b/internal/sdk/models/shared/operationobjectnode.go @@ -44,14 +44,14 @@ func CreateUniqArrayOfStr(arrayOfStr []string) Uniq { func (u *Uniq) UnmarshalJSON(data []byte) error { var boolean bool = false - if err := utils.UnmarshalJSON(data, &boolean, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &boolean, "", true, false); err == nil { u.Boolean = &boolean u.Type = UniqTypeBoolean return nil } var arrayOfStr []string = []string{} - if err := utils.UnmarshalJSON(data, &arrayOfStr, "", true, true); err == nil { + if err := utils.UnmarshalJSON(data, &arrayOfStr, "", true, false); err == nil { u.ArrayOfStr = arrayOfStr u.Type = UniqTypeArrayOfStr return nil @@ -88,7 +88,7 @@ func (o OperationObjectNode) MarshalJSON() ([]byte, error) { } func (o *OperationObjectNode) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &o, "", false, true); err != nil { + if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { return err } return nil diff --git a/internal/sdk/models/shared/prefixcondition.go b/internal/sdk/models/shared/prefixcondition.go deleted file mode 100644 index c63151b..0000000 --- a/internal/sdk/models/shared/prefixcondition.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type PrefixCondition struct { - Prefix *string `json:"prefix,omitempty"` -} - -func (o *PrefixCondition) GetPrefix() *string { - if o == nil { - return nil - } - return o.Prefix -} diff --git a/internal/sdk/models/shared/receivedemailtrigger.go b/internal/sdk/models/shared/receivedemailtrigger.go deleted file mode 100644 index 15f6af9..0000000 --- a/internal/sdk/models/shared/receivedemailtrigger.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "encoding/json" - "fmt" -) - -type MessageType string - -const ( - MessageTypeReceived MessageType = "RECEIVED" -) - -func (e MessageType) ToPointer() *MessageType { - return &e -} -func (e *MessageType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "RECEIVED": - *e = MessageType(v) - return nil - default: - return fmt.Errorf("invalid value for MessageType: %v", v) - } -} - -type ReceivedEmailTriggerConfiguration struct { - MessageType *MessageType `json:"message_type,omitempty"` -} - -func (o *ReceivedEmailTriggerConfiguration) GetMessageType() *MessageType { - if o == nil { - return nil - } - return o.MessageType -} - -type ReceivedEmailTriggerType string - -const ( - ReceivedEmailTriggerTypeReceivedEmail ReceivedEmailTriggerType = "received_email" -) - -func (e ReceivedEmailTriggerType) ToPointer() *ReceivedEmailTriggerType { - return &e -} -func (e *ReceivedEmailTriggerType) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "received_email": - *e = ReceivedEmailTriggerType(v) - return nil - default: - return fmt.Errorf("invalid value for ReceivedEmailTriggerType: %v", v) - } -} - -type ReceivedEmailTrigger struct { - Configuration ReceivedEmailTriggerConfiguration `json:"configuration"` - ID *string `json:"id,omitempty"` - Type ReceivedEmailTriggerType `json:"type"` -} - -func (o *ReceivedEmailTrigger) GetConfiguration() ReceivedEmailTriggerConfiguration { - if o == nil { - return ReceivedEmailTriggerConfiguration{} - } - return o.Configuration -} - -func (o *ReceivedEmailTrigger) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *ReceivedEmailTrigger) GetType() ReceivedEmailTriggerType { - if o == nil { - return ReceivedEmailTriggerType("") - } - return o.Type -} diff --git a/internal/sdk/models/shared/suffixcondition.go b/internal/sdk/models/shared/suffixcondition.go deleted file mode 100644 index 84615d9..0000000 --- a/internal/sdk/models/shared/suffixcondition.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type SuffixCondition struct { - Suffix *string `json:"suffix,omitempty"` -} - -func (o *SuffixCondition) GetSuffix() *string { - if o == nil { - return nil - } - return o.Suffix -} diff --git a/internal/sdk/models/shared/wildcardcondition.go b/internal/sdk/models/shared/wildcardcondition.go deleted file mode 100644 index bc643a9..0000000 --- a/internal/sdk/models/shared/wildcardcondition.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type WildcardCondition struct { - Wildcard *string `json:"wildcard,omitempty"` -} - -func (o *WildcardCondition) GetWildcard() *string { - if o == nil { - return nil - } - return o.Wildcard -} diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go index dcf6f80..6cd72db 100644 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -139,8 +139,8 @@ func New(opts ...SDKOption) *SDK { Language: "go", OpenAPIDocVersion: "1.0.0", SDKVersion: "0.0.1", - GenVersion: "2.339.1", - UserAgent: "speakeasy-sdk/go 0.0.1 2.339.1 1.0.0 github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk", + GenVersion: "2.340.2", + UserAgent: "speakeasy-sdk/go 0.0.1 2.340.2 1.0.0 github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk", Hooks: hooks.New(), }, } diff --git a/overlay.yaml b/overlay.yaml index 6a83a6f..4af2171 100644 --- a/overlay.yaml +++ b/overlay.yaml @@ -49,6 +49,10 @@ actions: remove: true - target: $["components"]["schemas"]["OrConditionForDiff"] remove: true + - target: $["components"]["schemas"]["ActivityTrigger"] + remove: true + - target: $["components"]["schemas"]["AnyTrigger"] + remove: true - target: $["components"]["schemas"] update: FilterConditionOnEvent: {} @@ -56,7 +60,8 @@ actions: TriggerCondition: {} OrCondition: {} OrConditionForDiff: {} - JourneySubmitTrigger: {} # @Todo: switch back to allOfs after speakeasy fixes a way to deal with unknown properties in anyOfs/allOfs + ActivityTrigger: {} # @Todo: switch back to allOfs after speakeasy fixes a way to deal with unknown properties in anyOfs/allOfs + AnyTrigger: {} - target: $["components"]["schemas"]["AutomationFlow"]["properties"]["actions"]["readOnly"] remove: true - target: $["components"]["schemas"]["AutomationFlow"]["properties"]["actions"]["items"]