From f9b3e27e4c16686e9769e2ae982f1c0cd07d4078 Mon Sep 17 00:00:00 2001 From: Viljami Date: Tue, 17 Dec 2024 12:21:18 +0100 Subject: [PATCH] Correct error handling & delete response --- .speakeasy/gen.lock | 1206 ++++++++++++++--- README.md | 52 +- docs/data-sources/flow.md | 41 +- docs/index.md | 2 +- docs/resources/flow.md | 175 +-- .../epilot-automation_flow/data-source.tf | 1 + examples/provider/provider.tf | 2 +- .../epilot-automation_flow/generated.tf | 74 + .../epilot-automation_flow/provider.tf | 12 + .../epilot-automation_flow/resource.tf | 149 +- gen.yaml | 3 +- go.mod | 26 +- go.sum | 46 +- internal/provider/flow_data_source.go | 74 +- internal/provider/flow_data_source_sdk.go | 8 + internal/provider/flow_resource.go | 108 +- internal/provider/flow_resource_sdk.go | 18 + internal/provider/provider.go | 5 +- internal/provider/reflect/helpers.go | 2 +- internal/provider/types/disable_details.go | 10 + internal/provider/utils.go | 182 --- internal/sdk/bulk.go | 89 +- internal/sdk/executions.go | 176 ++- internal/sdk/flows.go | 134 +- internal/sdk/internal/utils/json.go | 25 +- internal/sdk/internal/utils/requestbody.go | 27 +- internal/sdk/internal/utils/security.go | 12 +- internal/sdk/internal/utils/utils.go | 14 - .../operations/bulktriggerexecutions.go | 31 + .../sdk/models/operations/cancelexecution.go | 31 + internal/sdk/models/operations/createflow.go | 31 + internal/sdk/models/operations/deleteflow.go | 41 +- internal/sdk/models/operations/getbulkjob.go | 31 + .../sdk/models/operations/getexecution.go | 31 + .../sdk/models/operations/getexecutions.go | 31 + internal/sdk/models/operations/getflow.go | 31 + internal/sdk/models/operations/options.go | 31 +- .../sdk/models/operations/patchbulkjob.go | 31 + internal/sdk/models/operations/putflow.go | 31 + .../operations/resumeexecutionwithtoken.go | 31 + .../sdk/models/operations/retriggeraction.go | 31 + .../sdk/models/operations/startexecution.go | 31 + internal/sdk/models/shared/automationflow.go | 193 ++- .../sdk/models/shared/automationflowinput.go | 116 -- internal/sdk/sdk.go | 7 +- internal/sdk/types/pointers.go | 1 - openapi.yml | 122 +- 47 files changed, 2334 insertions(+), 1222 deletions(-) create mode 100644 examples/resources/epilot-automation_flow/generated.tf create mode 100644 examples/resources/epilot-automation_flow/provider.tf create mode 100644 internal/provider/types/disable_details.go delete mode 100644 internal/sdk/models/shared/automationflowinput.go diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index f36aa89..1a8838c 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,101 +1,38 @@ lockVersion: 2.0.0 id: 6df5dec4-6d34-4c07-99f4-b36e64bbb781 management: - docChecksum: 841b3de1a62f45370aab97319e21658d + docChecksum: 620a8c67a66b9b52ca0b397988a98c78 docVersion: 1.0.0 - speakeasyVersion: 1.440.1 - generationVersion: 2.460.1 - releaseVersion: 0.6.0 - configChecksum: 00b965a4b84a04f5d2b91e0450b7f7e6 + speakeasyVersion: 1.366.0 + generationVersion: 2.396.0 + releaseVersion: 0.6.1 + configChecksum: 80eea49ee795ba5358a7f2f7fd755911 features: terraform: additionalDependencies: 0.1.0 additionalProperties: 0.1.2 - constsAndDefaults: 0.2.0 - core: 3.26.3 + constsAndDefaults: 0.1.4 + core: 3.24.6 deprecations: 2.81.1 envVarSecurityUsage: 0.1.0 - globalSecurity: 2.81.9 + globalSecurity: 2.81.8 globalServerURLs: 2.82.1 inputOutputModels: 2.83.0 nullables: 0.0.0 retries: 2.81.1 - unions: 2.81.17 + unions: 2.81.16 generatedFiles: - - .gitattributes - - USAGE.md - - examples/README.md - - examples/data-sources/epilot-automation_flow/data-source.tf - - examples/provider/provider.tf - - examples/resources/epilot-automation_flow/import.sh - - examples/resources/epilot-automation_flow/resource.tf - - go.mod - - go.sum - - internal/planmodifiers/boolplanmodifier/suppress_diff.go - - internal/planmodifiers/float64planmodifier/suppress_diff.go - - internal/planmodifiers/int64planmodifier/suppress_diff.go - - internal/planmodifiers/listplanmodifier/suppress_diff.go - - internal/planmodifiers/mapplanmodifier/suppress_diff.go - - internal/planmodifiers/numberplanmodifier/suppress_diff.go - - internal/planmodifiers/objectplanmodifier/suppress_diff.go - - internal/planmodifiers/setplanmodifier/suppress_diff.go - - internal/planmodifiers/stringplanmodifier/suppress_diff.go - - internal/planmodifiers/utils/state_check.go - - internal/provider/flow_data_source.go - - internal/provider/flow_data_source_sdk.go - - internal/provider/flow_resource.go - - internal/provider/flow_resource_sdk.go - - internal/provider/provider.go - - internal/provider/reflect/diags.go - - internal/provider/reflect/doc.go - - internal/provider/reflect/generic_attr_value.go - - internal/provider/reflect/helpers.go - - internal/provider/reflect/interfaces.go - - internal/provider/reflect/into.go - - internal/provider/reflect/map.go - - internal/provider/reflect/number.go - - internal/provider/reflect/options.go - - internal/provider/reflect/outof.go - - internal/provider/reflect/pointer.go - - internal/provider/reflect/primitive.go - - internal/provider/reflect/slice.go - - internal/provider/reflect/struct.go - - internal/provider/types/action_condition.go - - internal/provider/types/action_schedule.go - - internal/provider/types/action_schedule_source.go - - internal/provider/types/activity.go - - internal/provider/types/any_trigger.go - - internal/provider/types/anything_but_condition.go - - internal/provider/types/api_submission_trigger.go - - internal/provider/types/condition_statement.go - - internal/provider/types/configuration.go - - internal/provider/types/ecp_config.go - - internal/provider/types/entity_manual_trigger.go - - internal/provider/types/entity_manual_trigger_configuration.go - - internal/provider/types/entity_operation_trigger.go - - internal/provider/types/entity_operation_trigger_configuration.go - - internal/provider/types/entity_operation_trigger_operation.go - - internal/provider/types/entity_operation_trigger_schemas_type.go - - internal/provider/types/equals_ignore_case_condition.go - - internal/provider/types/exists_condition.go - - internal/provider/types/file_config.go - - internal/provider/types/filter_config.go - - internal/provider/types/frontend_submit_trigger.go - - internal/provider/types/journey_submit_trigger.go - - internal/provider/types/journey_submit_trigger_configuration.go - - internal/provider/types/prefix_condition.go - - internal/provider/types/received_email_trigger.go - - internal/provider/types/received_email_trigger_configuration.go - - internal/provider/types/source.go - - internal/provider/types/suffix_condition.go - - internal/provider/types/wildcard_condition.go - - internal/provider/utils.go - - internal/sdk/.gitattributes - - internal/sdk/.gitignore - - internal/sdk/bulk.go - internal/sdk/executions.go + - internal/sdk/bulk.go - internal/sdk/flows.go - - internal/sdk/internal/hooks/hooks.go + - internal/sdk/sdk.go + - internal/sdk/models/errors/sdkerror.go + - internal/sdk/retry/config.go + - internal/sdk/types/bigint.go + - internal/sdk/types/date.go + - internal/sdk/types/datetime.go + - internal/sdk/types/decimal.go + - internal/sdk/types/pointers.go - internal/sdk/internal/utils/contenttype.go - internal/sdk/internal/utils/form.go - internal/sdk/internal/utils/headers.go @@ -106,97 +43,119 @@ generatedFiles: - internal/sdk/internal/utils/retries.go - internal/sdk/internal/utils/security.go - internal/sdk/internal/utils/utils.go - - internal/sdk/models/errors/sdkerror.go - - internal/sdk/models/operations/bulktriggerexecutions.go - internal/sdk/models/operations/cancelexecution.go - - internal/sdk/models/operations/createflow.go - - internal/sdk/models/operations/deleteflow.go - - internal/sdk/models/operations/getbulkjob.go - internal/sdk/models/operations/getexecution.go - internal/sdk/models/operations/getexecutions.go - - internal/sdk/models/operations/getflow.go - - internal/sdk/models/operations/options.go - - internal/sdk/models/operations/patchbulkjob.go - - internal/sdk/models/operations/putflow.go - internal/sdk/models/operations/resumeexecutionwithtoken.go - internal/sdk/models/operations/retriggeraction.go - - internal/sdk/models/operations/searchflows.go - internal/sdk/models/operations/startexecution.go - - internal/sdk/models/shared/actioncondition.go + - internal/sdk/models/operations/bulktriggerexecutions.go + - internal/sdk/models/operations/getbulkjob.go + - internal/sdk/models/operations/patchbulkjob.go + - internal/sdk/models/operations/createflow.go + - internal/sdk/models/operations/deleteflow.go + - internal/sdk/models/operations/getflow.go + - internal/sdk/models/operations/putflow.go + - internal/sdk/models/operations/searchflows.go + - internal/sdk/models/shared/automationexecution.go + - internal/sdk/models/shared/triggereventmanual.go + - internal/sdk/models/shared/apicallercontext.go + - internal/sdk/models/shared/triggerevententityactivity.go + - internal/sdk/models/shared/triggerevententityoperation.go + - internal/sdk/models/shared/entityoperation.go - internal/sdk/models/shared/actionschedule.go - internal/sdk/models/shared/actionschedulesource.go + - internal/sdk/models/shared/executionstatus.go + - internal/sdk/models/shared/entityitemsnapshot.go + - internal/sdk/models/shared/actioncondition.go + - internal/sdk/models/shared/conditionstatement.go - internal/sdk/models/shared/anyaction.go - - internal/sdk/models/shared/anythingbutcondition.go - - internal/sdk/models/shared/anytrigger.go - - internal/sdk/models/shared/apicallercontext.go - - internal/sdk/models/shared/apisubmissiontrigger.go + - internal/sdk/models/shared/mapentityaction.go + - internal/sdk/models/shared/retrystrategy.go + - internal/sdk/models/shared/erroroutput.go + - internal/sdk/models/shared/errordetail.go + - internal/sdk/models/shared/errorcode.go + - internal/sdk/models/shared/mapentityconfig.go + - internal/sdk/models/shared/relationattribute.go + - internal/sdk/models/shared/mappingconfigref.go + - internal/sdk/models/shared/mappingattributev2.go + - internal/sdk/models/shared/operationnode.go + - internal/sdk/models/shared/operationobjectnode.go + - internal/sdk/models/shared/mappingattribute.go + - internal/sdk/models/shared/setvaluemapper.go + - internal/sdk/models/shared/mappingattributemode.go + - internal/sdk/models/shared/copyvaluemapper.go - internal/sdk/models/shared/appendvaluemapper.go + - internal/sdk/models/shared/triggerworkflowaction.go + - internal/sdk/models/shared/triggerworkflowconfig.go - internal/sdk/models/shared/assignuserstostep.go + - internal/sdk/models/shared/triggerwebhookaction.go + - internal/sdk/models/shared/triggerwebhookconfig.go + - internal/sdk/models/shared/createdocumentaction.go + - internal/sdk/models/shared/createdocumentconfig.go + - internal/sdk/models/shared/sendemailaction.go + - internal/sdk/models/shared/sendemailconfig.go + - internal/sdk/models/shared/cartcheckoutaction.go + - internal/sdk/models/shared/cartcheckoutconfig.go - internal/sdk/models/shared/automationaction.go - - internal/sdk/models/shared/automationexecution.go - - internal/sdk/models/shared/automationflow.go - - internal/sdk/models/shared/automationflowinput.go + - internal/sdk/models/shared/getexecutionsresp.go + - internal/sdk/models/shared/resumeresp.go + - internal/sdk/models/shared/resumereq.go + - internal/sdk/models/shared/retryreq.go + - internal/sdk/models/shared/startexecutionrequest.go - internal/sdk/models/shared/bulktriggerjob.go + - internal/sdk/models/shared/execitem.go - internal/sdk/models/shared/bulktriggerrequest.go - - internal/sdk/models/shared/cartcheckoutaction.go - - internal/sdk/models/shared/cartcheckoutconfig.go - - internal/sdk/models/shared/conditionstatement.go - - internal/sdk/models/shared/copyvaluemapper.go - - internal/sdk/models/shared/createdocumentaction.go - - internal/sdk/models/shared/createdocumentconfig.go - - internal/sdk/models/shared/entityitemsnapshot.go - - internal/sdk/models/shared/entitymanualtrigger.go - - internal/sdk/models/shared/entityoperation.go - - internal/sdk/models/shared/entityoperationtrigger.go - internal/sdk/models/shared/entityref.go - - internal/sdk/models/shared/equalsignorecasecondition.go - - internal/sdk/models/shared/errorcode.go - - internal/sdk/models/shared/errordetail.go - - internal/sdk/models/shared/erroroutput.go - - internal/sdk/models/shared/execitem.go - - internal/sdk/models/shared/executionstatus.go - - internal/sdk/models/shared/existscondition.go + - internal/sdk/models/shared/patchbulkjobrequest.go + - internal/sdk/models/shared/automationflow.go + - internal/sdk/models/shared/anytrigger.go - internal/sdk/models/shared/frontendsubmittrigger.go - - internal/sdk/models/shared/getexecutionsresp.go - internal/sdk/models/shared/journeysubmittrigger.go - - internal/sdk/models/shared/mapentityaction.go - - internal/sdk/models/shared/mapentityconfig.go - - internal/sdk/models/shared/mappingattribute.go - - internal/sdk/models/shared/mappingattributemode.go - - internal/sdk/models/shared/mappingattributev2.go - - internal/sdk/models/shared/mappingconfigref.go - - internal/sdk/models/shared/operationnode.go - - internal/sdk/models/shared/operationobjectnode.go - - internal/sdk/models/shared/patchbulkjobrequest.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/entitymanualtrigger.go - internal/sdk/models/shared/receivedemailtrigger.go - - internal/sdk/models/shared/relationattribute.go - - internal/sdk/models/shared/resumereq.go - - internal/sdk/models/shared/resumeresp.go - - internal/sdk/models/shared/retryreq.go - - internal/sdk/models/shared/retrystrategy.go - internal/sdk/models/shared/searchautomationsresp.go - internal/sdk/models/shared/security.go - - internal/sdk/models/shared/sendemailaction.go - - internal/sdk/models/shared/sendemailconfig.go - - internal/sdk/models/shared/setvaluemapper.go - - internal/sdk/models/shared/startexecutionrequest.go - - internal/sdk/models/shared/suffixcondition.go - - internal/sdk/models/shared/triggerevententityactivity.go - - internal/sdk/models/shared/triggerevententityoperation.go - - internal/sdk/models/shared/triggereventmanual.go - - internal/sdk/models/shared/triggerwebhookaction.go - - internal/sdk/models/shared/triggerwebhookconfig.go - - internal/sdk/models/shared/triggerworkflowaction.go - - internal/sdk/models/shared/triggerworkflowconfig.go - - internal/sdk/models/shared/wildcardcondition.go - - internal/sdk/retry/config.go - - internal/sdk/sdk.go - - internal/sdk/types/bigint.go - - internal/sdk/types/date.go - - internal/sdk/types/datetime.go - - internal/sdk/types/decimal.go - - internal/sdk/types/pointers.go + - internal/sdk/.gitignore + - internal/sdk/models/operations/options.go + - internal/sdk/.gitattributes + - internal/sdk/internal/hooks/hooks.go + - examples/README.md + - go.mod + - go.sum + - internal/planmodifiers/boolplanmodifier/suppress_diff.go + - internal/planmodifiers/float64planmodifier/suppress_diff.go + - internal/planmodifiers/int64planmodifier/suppress_diff.go + - internal/planmodifiers/listplanmodifier/suppress_diff.go + - internal/planmodifiers/mapplanmodifier/suppress_diff.go + - internal/planmodifiers/numberplanmodifier/suppress_diff.go + - internal/planmodifiers/objectplanmodifier/suppress_diff.go + - internal/planmodifiers/setplanmodifier/suppress_diff.go + - internal/planmodifiers/stringplanmodifier/suppress_diff.go + - internal/planmodifiers/utils/state_check.go + - internal/provider/reflect/diags.go + - internal/provider/reflect/doc.go + - internal/provider/reflect/generic_attr_value.go + - internal/provider/reflect/helpers.go + - internal/provider/reflect/interfaces.go + - internal/provider/reflect/into.go + - internal/provider/reflect/map.go + - internal/provider/reflect/number.go + - internal/provider/reflect/options.go + - internal/provider/reflect/outof.go + - internal/provider/reflect/pointer.go + - internal/provider/reflect/primitive.go + - internal/provider/reflect/slice.go + - internal/provider/reflect/struct.go + - internal/provider/utils.go - internal/validators/DateValidator.go - internal/validators/ExactlyOneChild.go - internal/validators/JSONParseValidator.go @@ -213,115 +172,998 @@ generatedFiles: - main.go - terraform-registry-manifest.json - tools/tools.go + - internal/provider/types/source.go + - internal/provider/types/condition_statement.go + - internal/provider/types/action_condition.go + - internal/provider/types/disable_details.go + - internal/provider/types/action_schedule_source.go + - internal/provider/types/action_schedule.go + - internal/provider/types/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/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 + - examples/resources/epilot-automation_flow/import.sh + - internal/provider/flow_resource.go + - internal/provider/flow_resource_sdk.go + - examples/resources/epilot-automation_flow/resource.tf + - internal/provider/flow_data_source.go + - internal/provider/flow_data_source_sdk.go + - examples/data-sources/epilot-automation_flow/data-source.tf + - .gitattributes examples: bulkTriggerExecutions: "": requestBody: - application/json: {"entities_refs": [{"entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_schema": ""}, {"entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_schema": ""}]} + application/json: + entities_refs: + - entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_schema: + - entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_schema: responses: "202": - application/json: {"created_at": "2022-08-25T22:08:56.556Z", "created_by": "1234", "execution_summary": [], "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "job_id": "8c086140-f33e-4bb7-a993-50c0f2402c7b", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "status": "failed", "task_token": "8c086140-f33e-4bb7-a993-50c0f2402c7b", "updated_at": "2022-11-13T20:13:52.960Z"} + application/json: + created_at: "2022-08-25T22:08:56.556Z" + created_by: "1234" + execution_summary: [] + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + job_id: 8c086140-f33e-4bb7-a993-50c0f2402c7b + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + status: failed + task_token: 8c086140-f33e-4bb7-a993-50c0f2402c7b + updated_at: "2022-11-13T20:13:52.960Z" cancelExecution: speakeasy-default-cancel-execution: parameters: path: - execution_id: "9baf184f-bc81-4128-bca3-d974c90a12c4" + execution_id: 9baf184f-bc81-4128-bca3-d974c90a12c4 responses: "200": - application/json: {"actions": [{"config": {"mapping_attributes": [{"mode": "append_if_exists", "target": "", "value": ""}, {"operation": {"_append": ["new", "tags"], "_copy": "contact.first_name", "_uniq": true}, "target": "_tags"}, {"operation": {"_append": ["new", "tags"], "_copy": "contact.first_name", "_uniq": true}, "target": "_tags"}], "target_schema": ""}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}, {"config": {"mapping_attributes": [{"operation": {"_append": ["new", "tags"], "_copy": "contact.first_name", "_uniq": true}, "target": "_tags"}, {"operation": {"_append": ["new", "tags"], "_copy": "contact.first_name", "_uniq": true}, "target": "_tags"}], "target_schema": ""}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}, {"config": {"attachments": [{"source_filter": {"attribute": "_files", "filename_regex": ".*", "limit": 1, "relation_tag": "contract"}}, {"source_filter": {"attribute": "_files", "filename_regex": ".*", "limit": 1, "relation_tag": "contract"}}, {"source_filter": {"attribute": "_files", "filename_regex": ".*", "limit": 1, "relation_tag": "contract"}}]}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}], "activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "conditions": [{"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}], "current_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_snapshot": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "_created_at": "2023-09-03T18:21:10.476Z", "_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "_org": "", "_schema": "", "_title": "", "_updated_at": "2024-10-01T15:48:32.172Z"}, "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "flow_name": "Handle contact form", "id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "resume_token": "eyJraWQiOiJrZXkifQ==", "trigger_event": {"caller": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "EpilotAuth": {"claims": {"cognito:username": "example@epilot.cloud", "custom:ivy_user_id": "10006129", "email": "example@epilot.cloud", "sub": "476e9b48-42f4-4234-a2b0-4668b34626ce", "userId": "10006129"}, "organizationId": "739224", "token": "eyJraWQiOi...", "userId": "10006129"}}, "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "org_id": "123"}, "version": 2} + application/json: + actions: + - config: + mapping_attributes: + - mode: append_if_exists + target: + value: + - operation: + _append: + - new + - tags + _copy: contact.first_name + _uniq: true + target: _tags + - operation: + _append: + - new + - tags + _copy: contact.first_name + _uniq: true + target: _tags + target_schema: + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action + - config: + mapping_attributes: + - operation: + _append: + - new + - tags + _copy: contact.first_name + _uniq: true + target: _tags + - operation: + _append: + - new + - tags + _copy: contact.first_name + _uniq: true + target: _tags + target_schema: + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action + - config: + attachments: + - source_filter: + attribute: _files + filename_regex: .* + limit: 1 + relation_tag: contract + - source_filter: + attribute: _files + filename_regex: .* + limit: 1 + relation_tag: contract + - source_filter: + attribute: _files + filename_regex: .* + limit: 1 + relation_tag: contract + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + conditions: + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + current_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_snapshot: + _created_at: "2023-09-03T18:21:10.476Z" + _id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + _org: + _schema: + _title: + _updated_at: "2024-10-01T15:48:32.172Z" + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + flow_name: Handle contact form + id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + resume_token: eyJraWQiOiJrZXkifQ== + trigger_event: + caller: + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + EpilotAuth: + claims: + cognito:username: example@epilot.cloud + custom:ivy_user_id: "10006129" + email: example@epilot.cloud + sub: 476e9b48-42f4-4234-a2b0-4668b34626ce + userId: "10006129" + organizationId: "739224" + token: eyJraWQiOi... + userId: "10006129" + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + org_id: "123" + version: 2 createFlow: speakeasy-default-create-flow: requestBody: - application/json: {"_manifest": ["123e4567-e89b-12d3-a456-426614174000"], "actions": [], "conditions": [{"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}], "entity_schema": "submission", "flow_name": "Handle contact form", "triggers": [{"id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "received_email"}, {"configuration": {"schema": "submission"}, "id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "entity_manual"}, {"configuration": {"source_id": "83bc4369-781d-433f-b28d-d336efe9a018"}, "id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "journey_submission"}], "version": 2} + application/json: + _manifest: + - 123e4567-e89b-12d3-a456-426614174000 + actions: [] + conditions: + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + entity_schema: submission + flow_name: Handle contact form + triggers: + - id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: received_email + - configuration: + schema: submission + id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: entity_manual + - configuration: + source_id: 83bc4369-781d-433f-b28d-d336efe9a018 + id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: journey_submission + version: 2 responses: "201": - application/json: {"_manifest": ["123e4567-e89b-12d3-a456-426614174000"], "actions": ["", ""], "conditions": [{"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}], "entity_schema": "submission", "flow_name": "Handle contact form", "id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "triggers": [], "version": 2} + application/json: + _manifest: + - 123e4567-e89b-12d3-a456-426614174000 + actions: + - + - + conditions: + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + entity_schema: submission + flow_name: Handle contact form + id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + triggers: [] + version: 2 deleteFlow: speakeasy-default-delete-flow: parameters: path: - flow_id: "7791b04a-16d2-44a2-9af9-2d59c25c512f" + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f responses: "200": - application/json: {"_manifest": ["123e4567-e89b-12d3-a456-426614174000"], "actions": ["", ""], "conditions": [{"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}], "entity_schema": "submission", "flow_name": "Handle contact form", "id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "triggers": [{"configuration": {"source_id": "99"}, "id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "frontend_submission"}, {"id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "received_email"}], "version": 2} + application/json: + _manifest: + - 123e4567-e89b-12d3-a456-426614174000 + actions: + - + - + conditions: + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + entity_schema: submission + flow_name: Handle contact form + id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + triggers: + - configuration: + source_id: "99" + id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: frontend_submission + - id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: received_email + version: 2 getBulkJob: speakeasy-default-get-bulk-job: parameters: path: - job_id: "8c086140-f33e-4bb7-a993-50c0f2402c7b" + job_id: 8c086140-f33e-4bb7-a993-50c0f2402c7b responses: "200": - application/json: {"created_at": "2022-10-20T07:12:52.689Z", "created_by": "1234", "execution_summary": [{"entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "execution_id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "execution_status": "in_progress"}, {"entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "execution_id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "execution_status": "scheduled"}], "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "job_id": "8c086140-f33e-4bb7-a993-50c0f2402c7b", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "status": "cancelled", "task_token": "8c086140-f33e-4bb7-a993-50c0f2402c7b", "updated_at": "2022-12-07T03:34:02.948Z"} + application/json: + created_at: "2022-10-20T07:12:52.689Z" + created_by: "1234" + execution_summary: + - entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + execution_id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + execution_status: in_progress + - entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + execution_id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + execution_status: scheduled + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + job_id: 8c086140-f33e-4bb7-a993-50c0f2402c7b + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + status: cancelled + task_token: 8c086140-f33e-4bb7-a993-50c0f2402c7b + updated_at: "2022-12-07T03:34:02.948Z" getExecution: speakeasy-default-get-execution: parameters: path: - execution_id: "9baf184f-bc81-4128-bca3-d974c90a12c4" + execution_id: 9baf184f-bc81-4128-bca3-d974c90a12c4 responses: "200": - application/json: {"actions": [{"config": {}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}, {"config": {"attachments": [{"source_filter": {"attribute": "_files", "filename_regex": ".*", "limit": 1, "relation_tag": "contract"}}]}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}], "activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "conditions": [], "current_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_snapshot": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "_created_at": "2022-07-06T20:33:41.402Z", "_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "_org": "", "_schema": "", "_title": "", "_updated_at": "2023-08-07T20:59:34.519Z"}, "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "flow_name": "Handle contact form", "id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "resume_token": "eyJraWQiOiJrZXkifQ==", "trigger_event": {"activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "operation_type": "deleteEntity", "org_id": "123"}, "version": 2} + application/json: + actions: + - config: {} + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action + - config: + attachments: + - source_filter: + attribute: _files + filename_regex: .* + limit: 1 + relation_tag: contract + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + conditions: [] + current_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_snapshot: + _created_at: "2022-07-06T20:33:41.402Z" + _id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + _org: + _schema: + _title: + _updated_at: "2023-08-07T20:59:34.519Z" + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + flow_name: Handle contact form + id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + resume_token: eyJraWQiOiJrZXkifQ== + trigger_event: + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + operation_type: deleteEntity + org_id: "123" + version: 2 getExecutions: speakeasy-default-get-executions: parameters: query: - entity_id: "e3d3ebac-baab-4395-abf4-50b5bf1f8b74" + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 responses: "200": - application/json: {"results": [{"actions": [{"config": {"mapping_attributes": [{"mode": "append_if_exists", "target": "", "value_json": ""}, {"operation": {"_append": ["new", "tags"], "_copy": "contact.first_name", "_uniq": true}, "target": "_tags"}, {"operation": {"_append": ["new", "tags"], "_copy": "contact.first_name", "_uniq": true}, "target": "_tags"}], "target_schema": ""}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}, {"config": {"mapping_attributes": [], "target_schema": ""}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}], "activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "conditions": [], "current_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_snapshot": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "_created_at": "2022-07-18T20:33:24.247Z", "_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "_org": "", "_schema": "", "_title": "", "_updated_at": "2022-01-28T09:12:23.189Z"}, "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "flow_name": "Handle contact form", "id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "resume_token": "eyJraWQiOiJrZXkifQ==", "trigger_event": {"caller": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "EpilotAuth": {"claims": {"cognito:username": "example@epilot.cloud", "custom:ivy_user_id": "10006129", "email": "example@epilot.cloud", "sub": "476e9b48-42f4-4234-a2b0-4668b34626ce", "userId": "10006129"}, "organizationId": "739224", "token": "eyJraWQiOi...", "userId": "10006129"}}, "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "org_id": "123"}, "version": 2}, {"actions": [{"config": {}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}, {"config": {"mapping_attributes": [{"mode": "append_if_exists", "target": "", "value": ""}], "target_schema": ""}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}], "activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "conditions": [{"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}], "current_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_snapshot": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "_created_at": "2023-11-08T11:03:18.230Z", "_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "_org": "", "_schema": "", "_title": "", "_updated_at": "2022-06-28T23:51:46.186Z"}, "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "flow_name": "Handle contact form", "id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "resume_token": "eyJraWQiOiJrZXkifQ==", "trigger_event": {"activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "activity_type": "", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "org_id": "123"}, "version": 2}, {"actions": [], "activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "conditions": [], "current_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_snapshot": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "_created_at": "2022-06-13T00:14:35.579Z", "_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "_org": "", "_schema": "", "_title": "", "_updated_at": "2024-05-25T16:51:41.394Z"}, "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "flow_name": "Handle contact form", "id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "resume_token": "eyJraWQiOiJrZXkifQ==", "trigger_event": {"caller": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "EpilotAuth": {"claims": {"cognito:username": "example@epilot.cloud", "custom:ivy_user_id": "10006129", "email": "example@epilot.cloud", "sub": "476e9b48-42f4-4234-a2b0-4668b34626ce", "userId": "10006129"}, "organizationId": "739224", "token": "eyJraWQiOi...", "userId": "10006129"}}, "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "org_id": "123"}, "version": 2}], "total": "9816.03"} + application/json: + results: + - actions: + - config: + mapping_attributes: + - mode: append_if_exists + target: + value_json: + - operation: + _append: + - new + - tags + _copy: contact.first_name + _uniq: true + target: _tags + - operation: + _append: + - new + - tags + _copy: contact.first_name + _uniq: true + target: _tags + target_schema: + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action + - config: + mapping_attributes: [] + target_schema: + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + conditions: [] + current_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_snapshot: + _created_at: "2022-07-18T20:33:24.247Z" + _id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + _org: + _schema: + _title: + _updated_at: "2022-01-28T09:12:23.189Z" + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + flow_name: Handle contact form + id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + resume_token: eyJraWQiOiJrZXkifQ== + trigger_event: + caller: + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + EpilotAuth: + claims: + cognito:username: example@epilot.cloud + custom:ivy_user_id: "10006129" + email: example@epilot.cloud + sub: 476e9b48-42f4-4234-a2b0-4668b34626ce + userId: "10006129" + organizationId: "739224" + token: eyJraWQiOi... + userId: "10006129" + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + org_id: "123" + version: 2 + - actions: + - config: {} + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action + - config: + mapping_attributes: + - mode: append_if_exists + target: + value: + target_schema: + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + conditions: + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + current_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_snapshot: + _created_at: "2023-11-08T11:03:18.230Z" + _id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + _org: + _schema: + _title: + _updated_at: "2022-06-28T23:51:46.186Z" + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + flow_name: Handle contact form + id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + resume_token: eyJraWQiOiJrZXkifQ== + trigger_event: + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + activity_type: + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + org_id: "123" + version: 2 + - actions: [] + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + conditions: [] + current_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_snapshot: + _created_at: "2022-06-13T00:14:35.579Z" + _id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + _org: + _schema: + _title: + _updated_at: "2024-05-25T16:51:41.394Z" + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + flow_name: Handle contact form + id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + resume_token: eyJraWQiOiJrZXkifQ== + trigger_event: + caller: + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + EpilotAuth: + claims: + cognito:username: example@epilot.cloud + custom:ivy_user_id: "10006129" + email: example@epilot.cloud + sub: 476e9b48-42f4-4234-a2b0-4668b34626ce + userId: "10006129" + organizationId: "739224" + token: eyJraWQiOi... + userId: "10006129" + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + org_id: "123" + version: 2 + total: "9816.03" getFlow: speakeasy-default-get-flow: parameters: path: - flow_id: "7791b04a-16d2-44a2-9af9-2d59c25c512f" + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f responses: "200": - application/json: {"_manifest": ["123e4567-e89b-12d3-a456-426614174000"], "actions": [""], "conditions": [{"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}], "entity_schema": "submission", "flow_name": "Handle contact form", "id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "triggers": [{"configuration": {"ecp_config": {"file_config": {"shared_with_end_customer": true}, "origin": "END_CUSTOMER_PORTAL"}, "exclude_activities": ["[\"SyncEntity\"]"], "filter_config": {"activity": {"type": ["EntityUpdatedFromPortal", "EntityUpdated", "DocUploadedFromPortal"]}}, "include_activities": ["[\"CreateEntity\"]"], "schema": "submission"}, "id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "entity_operation"}, {"configuration": {"ecp_config": {"file_config": {"shared_with_end_customer": true}, "origin": "END_CUSTOMER_PORTAL"}, "exclude_activities": ["[\"SyncEntity\"]"], "filter_config": {"activity": {"type": ["EntityUpdatedFromPortal", "EntityUpdated", "DocUploadedFromPortal"]}}, "include_activities": ["[\"CreateEntity\"]"], "schema": "submission"}, "id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "entity_operation"}, {"configuration": {"source_id": "c56064b6-a744-424c-9cbf-0f49e353dd8a"}, "id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "journey_submission"}], "version": 2} + application/json: + _manifest: + - 123e4567-e89b-12d3-a456-426614174000 + actions: + - + conditions: + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + entity_schema: submission + flow_name: Handle contact form + id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + triggers: + - configuration: + ecp_config: + file_config: + shared_with_end_customer: true + origin: END_CUSTOMER_PORTAL + exclude_activities: + - '["SyncEntity"]' + filter_config: + activity: + type: + - EntityUpdatedFromPortal + - EntityUpdated + - DocUploadedFromPortal + include_activities: + - '["CreateEntity"]' + schema: submission + id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: entity_operation + - configuration: + ecp_config: + file_config: + shared_with_end_customer: true + origin: END_CUSTOMER_PORTAL + exclude_activities: + - '["SyncEntity"]' + filter_config: + activity: + type: + - EntityUpdatedFromPortal + - EntityUpdated + - DocUploadedFromPortal + include_activities: + - '["CreateEntity"]' + schema: submission + id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: entity_operation + - configuration: + source_id: c56064b6-a744-424c-9cbf-0f49e353dd8a + id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: journey_submission + version: 2 patchBulkJob: "": parameters: path: - job_id: "8c086140-f33e-4bb7-a993-50c0f2402c7b" + job_id: 8c086140-f33e-4bb7-a993-50c0f2402c7b requestBody: - application/json: {"action": "APPROVE", "task_token": "b35a6c51-2a15-4ef1-9623-20db37b0744f"} + application/json: + action: APPROVE + task_token: b35a6c51-2a15-4ef1-9623-20db37b0744f responses: "200": - application/json: {"created_at": "2023-07-22T04:56:17.349Z", "created_by": "1234", "execution_summary": [{"entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "execution_id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "execution_status": "in_progress"}], "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "job_id": "8c086140-f33e-4bb7-a993-50c0f2402c7b", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "status": "approval", "task_token": "8c086140-f33e-4bb7-a993-50c0f2402c7b", "updated_at": "2023-09-11T13:29:03.417Z"} + application/json: + created_at: "2023-07-22T04:56:17.349Z" + created_by: "1234" + execution_summary: + - entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + execution_id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + execution_status: in_progress + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + job_id: 8c086140-f33e-4bb7-a993-50c0f2402c7b + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + status: approval + task_token: 8c086140-f33e-4bb7-a993-50c0f2402c7b + updated_at: "2023-09-11T13:29:03.417Z" putFlow: speakeasy-default-put-flow: parameters: path: - flow_id: "7791b04a-16d2-44a2-9af9-2d59c25c512f" + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f requestBody: - application/json: {"_manifest": ["123e4567-e89b-12d3-a456-426614174000"], "actions": ["", ""], "conditions": [], "entity_schema": "submission", "flow_name": "Handle contact form", "triggers": [], "version": 2} + application/json: + _manifest: + - 123e4567-e89b-12d3-a456-426614174000 + actions: + - + - + conditions: [] + entity_schema: submission + flow_name: Handle contact form + triggers: [] + version: 2 responses: "200": - application/json: {"_manifest": ["123e4567-e89b-12d3-a456-426614174000"], "actions": [""], "conditions": [{"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}], "entity_schema": "submission", "flow_name": "Handle contact form", "id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "triggers": [{"configuration": {"ecp_config": {"file_config": {"shared_with_end_customer": true}, "origin": "END_CUSTOMER_PORTAL"}, "exclude_activities": ["[\"SyncEntity\"]"], "filter_config": {"activity": {"type": ["EntityUpdatedFromPortal", "EntityUpdated", "DocUploadedFromPortal"]}}, "include_activities": ["[\"CreateEntity\"]"], "schema": "submission"}, "id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "entity_operation"}, {"configuration": {"schema": "submission"}, "id": "12d4f45a-1883-4841-a94c-5928cb338a94", "type": "entity_manual"}], "version": 2} + application/json: + _manifest: + - 123e4567-e89b-12d3-a456-426614174000 + actions: + - + conditions: + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + entity_schema: submission + flow_name: Handle contact form + id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + triggers: + - configuration: + ecp_config: + file_config: + shared_with_end_customer: true + origin: END_CUSTOMER_PORTAL + exclude_activities: + - '["SyncEntity"]' + filter_config: + activity: + type: + - EntityUpdatedFromPortal + - EntityUpdated + - DocUploadedFromPortal + include_activities: + - '["CreateEntity"]' + schema: submission + id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: entity_operation + - configuration: + schema: submission + id: 12d4f45a-1883-4841-a94c-5928cb338a94 + type: entity_manual + version: 2 resumeExecutionWithToken: speakeasy-default-resume-execution-with-token: requestBody: - application/json: {"resume_token": "eyJraWQiOiJrZXkifQ=="} + application/json: + resume_token: eyJraWQiOiJrZXkifQ== responses: "200": - application/json: {"execution": {"actions": [], "activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "conditions": [], "current_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_snapshot": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "_created_at": "2022-08-17T01:44:25.239Z", "_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "_org": "", "_schema": "", "_title": "", "_updated_at": "2024-07-29T22:57:28.447Z"}, "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "flow_name": "Handle contact form", "id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "resume_token": "eyJraWQiOiJrZXkifQ==", "trigger_event": {"activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "operation_type": "createEntity", "org_id": "123"}, "version": 2}, "resumedAction": {"config": {"mapping_attributes": [], "target_schema": ""}, "flow_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "outputs": {}, "reason": {"message": "There are no registered portal users for the given emails, hence skipping the action"}}} + application/json: + execution: + actions: [] + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + conditions: [] + current_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_snapshot: + _created_at: "2022-08-17T01:44:25.239Z" + _id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + _org: + _schema: + _title: + _updated_at: "2024-07-29T22:57:28.447Z" + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + flow_name: Handle contact form + id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + resume_token: eyJraWQiOiJrZXkifQ== + trigger_event: + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + operation_type: createEntity + org_id: "123" + version: 2 + resumedAction: + config: + mapping_attributes: [] + target_schema: + flow_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + id: 9ec3711b-db63-449c-b894-54d5bb622a8f + outputs: {} + reason: + message: There are no registered portal users for the given emails, hence skipping the action retriggerAction: speakeasy-default-retrigger-action: parameters: path: - action_id: "9ec3711b-db63-449c-b894-54d5bb622a8f" - execution_id: "9baf184f-bc81-4128-bca3-d974c90a12c4" + action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + execution_id: 9baf184f-bc81-4128-bca3-d974c90a12c4 searchFlows: speakeasy-default-search-flows: parameters: query: - schema: "submission" - trigger_source_id: "600945fe-212e-4b97-acf7-391d64648384" + schema: submission + trigger_source_id: 600945fe-212e-4b97-acf7-391d64648384 responses: "200": - application/json: {"results": [{"_manifest": ["123e4567-e89b-12d3-a456-426614174000"], "actions": [""], "conditions": [], "entity_schema": "submission", "flow_name": "Handle contact form", "id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "triggers": [], "version": 2}], "total": "9940.16"} + application/json: + results: + - _manifest: + - 123e4567-e89b-12d3-a456-426614174000 + actions: + - + conditions: [] + entity_schema: submission + flow_name: Handle contact form + id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + triggers: [] + version: 2 + total: "9940.16" startExecution: speakeasy-default-start-execution: requestBody: - application/json: {"entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74"} + application/json: + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 responses: "201": - application/json: {"actions": [], "activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "conditions": [{"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}, {"statements": [{"id": "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d", "operation": "equals", "source": {"attribute": "email", "attributeType": "text", "id": "trigger-id", "origin": "trigger", "originType": "entity", "schema": "contact"}, "values": ["hello@epilot.cloud"]}]}], "current_action_id": "9ec3711b-db63-449c-b894-54d5bb622a8f", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_snapshot": {"0": "<", "1": "v", "2": "a", "3": "l", "4": "u", "5": "e", "6": ">", "_created_at": "2023-07-13T03:06:46.168Z", "_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "_org": "", "_schema": "", "_title": "", "_updated_at": "2022-02-10T03:00:29.598Z"}, "flow_id": "7791b04a-16d2-44a2-9af9-2d59c25c512f", "flow_name": "Handle contact form", "id": "9baf184f-bc81-4128-bca3-d974c90a12c4", "org_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "resume_token": "eyJraWQiOiJrZXkifQ==", "trigger_event": {"activity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "entity_id": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74", "operation_type": "createEntity", "org_id": "123"}, "version": 2} + application/json: + actions: [] + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + conditions: + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + - statements: + - id: 1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d + operation: equals + source: + attribute: email + attributeType: text + id: trigger-id + origin: trigger + originType: entity + schema: contact + values: + - hello@epilot.cloud + current_action_id: 9ec3711b-db63-449c-b894-54d5bb622a8f + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_snapshot: + _created_at: "2023-07-13T03:06:46.168Z" + _id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + _org: + _schema: + _title: + _updated_at: "2022-02-10T03:00:29.598Z" + "0": < + "1": v + "2": a + "3": l + "4": u + "5": e + "6": '>' + flow_id: 7791b04a-16d2-44a2-9af9-2d59c25c512f + flow_name: Handle contact form + id: 9baf184f-bc81-4128-bca3-d974c90a12c4 + org_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + resume_token: eyJraWQiOiJrZXkifQ== + trigger_event: + activity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + entity_id: e3d3ebac-baab-4395-abf4-50b5bf1f8b74 + operation_type: createEntity + org_id: "123" + version: 2 diff --git a/README.md b/README.md index 32bc974..3bd2b1f 100755 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ - -## Installation + +## SDK Installation To install this provider, copy and paste this code into your Terraform configuration. Then, run `terraform init`. @@ -18,7 +18,7 @@ terraform { required_providers { epilot-automation = { source = "epilot-dev/epilot-automation" - version = "0.6.0" + version = "0.6.1" } } } @@ -27,17 +27,19 @@ provider "epilot-automation" { # Configuration options } ``` - + - -## Testing the provider locally + +## SDK Example Usage -#### Local Provider +### Testing the provider locally Should you want to validate a change locally, the `--debug` flag allows you to execute the provider against a terraform instance locally. This also allows for debuggers (e.g. delve) to be attached to the provider. +### Example + ```sh go run main.go --debug # Copy the TF_REATTACH_PROVIDERS env var @@ -46,41 +48,13 @@ cd examples/your-example TF_REATTACH_PROVIDERS=... terraform init TF_REATTACH_PROVIDERS=... terraform apply ``` + -#### Compiled Provider - -Terraform allows you to use local provider builds by setting a `dev_overrides` block in a configuration file called `.terraformrc`. This block overrides all other configured installation methods. - -1. Execute `go build` to construct a binary called `terraform-provider-epilot-automation` -2. Ensure that the `.terraformrc` file is configured with a `dev_overrides` section such that your local copy of terraform can see the provider binary - -Terraform searches for the `.terraformrc` file in your home directory and applies any configuration settings you set. - -``` -provider_installation { - - dev_overrides { - "registry.terraform.io/epilot-dev/epilot-automation" = "" - } - - # For all other providers, install them directly from their origin provider - # registries as normal. If you omit this, Terraform will _only_ use - # the dev_overrides block, and so no other providers will be available. - direct {} -} -``` - - - -## Available Resources and Data Sources - -### Resources + +## Available Resources and Operations -* [epilot-automation_flow](docs/resources/flow.md) -### Data Sources -* [epilot-automation_flow](docs/data-sources/flow.md) - + ## Summary diff --git a/docs/data-sources/flow.md b/docs/data-sources/flow.md index b64fd97..f52a300 100644 --- a/docs/data-sources/flow.md +++ b/docs/data-sources/flow.md @@ -14,6 +14,7 @@ Flow DataSource ```terraform data "epilot-automation_flow" "my_flow" { + flow_id = "7791b04a-16d2-44a2-9af9-2d59c25c512f" } ``` @@ -24,6 +25,7 @@ data "epilot-automation_flow" "my_flow" { - `actions` (List of String) The actions (nodes) of the automation flow - `conditions` (Attributes List) (see [below for nested schema](#nestedatt--conditions)) +- `disable_details` (Attributes) (see [below for nested schema](#nestedatt--disable_details)) - `enabled` (Boolean) Whether the automation is enabled or not - `entity_schema` (String) The triggering entity schema - `flow_name` (String) A descriptive name for the Automation @@ -51,7 +53,7 @@ Read-Only: Read-Only: - `id` (String) -- `operation` (String) +- `operation` (String) must be one of ["equals", "not_equals", "any_of", "none_of", "contains", "not_contains", "starts_with", "ends_with", "greater_than", "less_than", "greater_than_or_equals", "less_than_or_equals", "is_empty", "is_not_empty"] - `source` (Attributes) (see [below for nested schema](#nestedatt--conditions--statements--source)) - `values` (List of String) @@ -61,17 +63,26 @@ Read-Only: Read-Only: - `attribute` (String) -- `attribute_operation` (String) +- `attribute_operation` (String) must be one of ["all", "updated", "added", "deleted"] - `attribute_repeatable` (Boolean) -- `attribute_type` (String) +- `attribute_type` (String) must be one of ["string", "text", "number", "boolean", "date", "datetime", "tags", "country", "email", "phone", "product", "price", "status", "relation", "multiselect", "select", "radio", "relation_user", "purpose", "label"] - `id` (String) The id of the action or trigger -- `origin` (String) -- `origin_type` (String) +- `origin` (String) must be one of ["trigger", "action"] +- `origin_type` (String) must be one of ["entity", "workflow", "journey_block"] - `schema` (String) + +### Nested Schema for `disable_details` + +Read-Only: + +- `disabled_at` (String) When the flow was disabled +- `disabled_by` (String) Who disabled the flow (system or user). must be one of ["system", "user"] + + ### Nested Schema for `schedules` @@ -81,8 +92,8 @@ Read-Only: - `number_of_units` (Number) - `schedule_api_id` (String) The id of the configured scheduler which will be added on automation triggered - `source` (Attributes) The source of the schedule_at timestamp that will be used to schedule the action (see [below for nested schema](#nestedatt--schedules--source)) -- `time_period` (String) -- `time_relation` (String) +- `time_period` (String) must be one of ["minutes", "hours", "days", "weeks", "months"] +- `time_relation` (String) must be one of ["after", "before"] ### Nested Schema for `schedules.source` @@ -91,7 +102,7 @@ Read-Only: - `attribute` (String) - `id` (String) The id of the action or trigger -- `origin` (String) +- `origin` (String) must be one of ["trigger", "action", "action_task", "automation"] - `schema` (String) @@ -228,7 +239,7 @@ Read-Only: - `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--api_submission_trigger--configuration)) - `id` (String) -- `type` (String) +- `type` (String) must be one of ["api_submission"] ### Nested Schema for `triggers.api_submission_trigger.configuration` @@ -246,7 +257,7 @@ Read-Only: - `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_manual_trigger--configuration)) - `id` (String) -- `type` (String) +- `type` (String) must be one of ["entity_manual"] ### Nested Schema for `triggers.entity_manual_trigger.configuration` @@ -264,7 +275,7 @@ Read-Only: - `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration)) - `id` (String) -- `type` (String) +- `type` (String) must be one of ["entity_operation"] ### Nested Schema for `triggers.entity_operation_trigger.configuration` @@ -419,7 +430,7 @@ Read-Only: - `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--frontend_submit_trigger--configuration)) - `id` (String) -- `type` (String) +- `type` (String) must be one of ["frontend_submission"] ### Nested Schema for `triggers.frontend_submit_trigger.configuration` @@ -437,7 +448,7 @@ Read-Only: - `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--journey_submit_trigger--configuration)) - `id` (String) -- `type` (String) +- `type` (String) must be one of ["journey_submission"] ### Nested Schema for `triggers.journey_submit_trigger.configuration` @@ -455,11 +466,11 @@ Read-Only: - `configuration` (Attributes) (see [below for nested schema](#nestedatt--triggers--received_email_trigger--configuration)) - `id` (String) -- `type` (String) +- `type` (String) must be one of ["received_email"] ### Nested Schema for `triggers.received_email_trigger.configuration` Read-Only: -- `message_type` (String) +- `message_type` (String) must be one of ["RECEIVED"] diff --git a/docs/index.md b/docs/index.md index 0018ff6..5fd928b 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.6.0" + version = "0.6.1" } } } diff --git a/docs/resources/flow.md b/docs/resources/flow.md index c93f0e7..95da0da 100644 --- a/docs/resources/flow.md +++ b/docs/resources/flow.md @@ -15,156 +15,17 @@ Flow Resource ```terraform resource "epilot-automation_flow" "my_flow" { actions = [ - "{ \"see\": \"documentation\" }" + "{ \"see\": \"documentation\" }", ] - conditions = [ - { - evaluation_result = true - id = "...my_id..." - schedule_id = "...my_schedule_id..." - statements = [ - { - id = "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d" - operation = "greater_than_or_equals" - source = { - attribute = "...my_attribute..." - attribute_operation = "deleted" - attribute_repeatable = true - attribute_type = "email" - id = "...my_id..." - origin = "action" - origin_type = "journey_block" - schema = "...my_schema..." - } - values = [ - "..." - ] - } - ] - } - ] - enabled = true + enabled = false entity_schema = "submission" + flow_id = "7791b04a-16d2-44a2-9af9-2d59c25c512f" flow_name = "Handle contact form" - manifest = [ - "123e4567-e89b-12d3-a456-426614174000" - ] - schedules = [ - { - id = "...my_id..." - number_of_units = 1.88 - schedule_api_id = "...my_schedule_api_id..." - source = { - attribute = "...my_attribute..." - id = "...my_id..." - origin = "action_task" - schema = "...my_schema..." - } - time_period = "weeks" - time_relation = "after" - } - ] - system_flow = true - trigger_conditions = [ - "{ \"see\": \"documentation\" }" - ] + system_flow = false triggers = [ { any = "{ \"see\": \"documentation\" }" - api_submission_trigger = { - configuration = { - source_id = "...my_source_id..." - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "api_submission" - } - entity_manual_trigger = { - configuration = { - schema = "submission" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "entity_manual" - } - entity_operation_trigger = { - configuration = { - ecp_config = { - file_config = { - shared_with_end_customer = true - } - origin = "END_CUSTOMER_PORTAL" - } - exclude_activities = [ - ["SyncEntity"] - ] - filter_config = { - activity = { - type = [ - { - anything_but_condition = { - anything_but = [ - "..." - ] - } - equals_ignore_case_condition = { - equals_ignore_case = "...my_equals_ignore_case..." - } - exists_condition = { - exists = false - } - prefix_condition = { - prefix = "...my_prefix..." - } - str = "...my_str..." - suffix_condition = { - suffix = "...my_suffix..." - } - wildcard_condition = { - wildcard = "...my_wildcard..." - } - } - ] - } - operation = { - diff = "{ \"see\": \"documentation\" }" - operation = [ - "updateEntity" - ] - payload = "{ \"see\": \"documentation\" }" - } - } - include_activities = [ - ["CreateEntity"] - ] - operations = [ - "createEntity" - ] - schema = "submission" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "entity_operation" - } - frontend_submit_trigger = { - configuration = { - source_id = "99" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "frontend_submission" - } - journey_submit_trigger = { - configuration = { - source_id = "36ccf21c-051d-4bb7-84ad-d0eb26b2da79" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "journey_submission" - } - received_email_trigger = { - configuration = { - message_type = "RECEIVED" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "received_email" - } - } + }, ] version = 2 } @@ -182,7 +43,8 @@ resource "epilot-automation_flow" "my_flow" { ### Optional - `conditions` (Attributes List) (see [below for nested schema](#nestedatt--conditions)) -- `enabled` (Boolean) Whether the automation is enabled or not. Default: true +- `disable_details` (Attributes) (see [below for nested schema](#nestedatt--disable_details)) +- `enabled` (Boolean) Whether the automation is enabled or not - `entity_schema` (String) The triggering entity schema - `manifest` (List of String) Source blueprint/manifest ID used when automation is created via blueprints. - `schedules` (Attributes List) (see [below for nested schema](#nestedatt--schedules)) @@ -326,7 +188,7 @@ Optional: - `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--api_submission_trigger--configuration)) - `id` (String) -- `type` (String) Not Null; must be "api_submission" +- `type` (String) Not Null; must be one of ["api_submission"] ### Nested Schema for `triggers.api_submission_trigger.configuration` @@ -344,7 +206,7 @@ Optional: - `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--entity_manual_trigger--configuration)) - `id` (String) -- `type` (String) Not Null; must be "entity_manual" +- `type` (String) Not Null; must be one of ["entity_manual"] ### Nested Schema for `triggers.entity_manual_trigger.configuration` @@ -362,7 +224,7 @@ Optional: - `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--entity_operation_trigger--configuration)) - `id` (String) -- `type` (String) Not Null; must be "entity_operation" +- `type` (String) Not Null; must be one of ["entity_operation"] ### Nested Schema for `triggers.entity_operation_trigger.configuration` @@ -517,7 +379,7 @@ Optional: - `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--frontend_submit_trigger--configuration)) - `id` (String) -- `type` (String) Not Null; must be "frontend_submission" +- `type` (String) Not Null; must be one of ["frontend_submission"] ### Nested Schema for `triggers.frontend_submit_trigger.configuration` @@ -535,7 +397,7 @@ Optional: - `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--journey_submit_trigger--configuration)) - `id` (String) -- `type` (String) Not Null; must be "journey_submission" +- `type` (String) Not Null; must be one of ["journey_submission"] ### Nested Schema for `triggers.journey_submit_trigger.configuration` @@ -553,14 +415,14 @@ Optional: - `configuration` (Attributes) Not Null (see [below for nested schema](#nestedatt--triggers--received_email_trigger--configuration)) - `id` (String) -- `type` (String) Not Null; must be "received_email" +- `type` (String) Not Null; must be one of ["received_email"] ### Nested Schema for `triggers.received_email_trigger.configuration` Optional: -- `message_type` (String) must be "RECEIVED" +- `message_type` (String) must be one of ["RECEIVED"] @@ -602,6 +464,15 @@ Optional: + +### Nested Schema for `disable_details` + +Optional: + +- `disabled_at` (String) When the flow was disabled. Not Null +- `disabled_by` (String) Who disabled the flow (system or user). Not Null; must be one of ["system", "user"] + + ### Nested Schema for `schedules` diff --git a/examples/data-sources/epilot-automation_flow/data-source.tf b/examples/data-sources/epilot-automation_flow/data-source.tf index 801396a..c752d78 100644 --- a/examples/data-sources/epilot-automation_flow/data-source.tf +++ b/examples/data-sources/epilot-automation_flow/data-source.tf @@ -1,2 +1,3 @@ data "epilot-automation_flow" "my_flow" { + flow_id = "7791b04a-16d2-44a2-9af9-2d59c25c512f" } \ No newline at end of file diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 081d804..f146de1 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.6.0" + version = "0.6.1" } } } diff --git a/examples/resources/epilot-automation_flow/generated.tf b/examples/resources/epilot-automation_flow/generated.tf new file mode 100644 index 0000000..5b3808d --- /dev/null +++ b/examples/resources/epilot-automation_flow/generated.tf @@ -0,0 +1,74 @@ +# __generated__ by Terraform +# Please review these resources and move them into your main configuration files. + +# __generated__ by Terraform from "96cd208b-9424-4397-8aad-e5e47804965f" +resource "epilot-automation_flow" "test_flow" { + actions = ["{\"condition_id\":\"17aee949-8986-4e1d-b3a9-89ac4e0f072e\",\"config\":{\"email_template_id\":\"db80a5f6-9b9b-4775-b95f-87f1340289c3\",\"language_code\":\"de\"},\"created_automatically\":false,\"id\":\"27513422-4b02-4be5-877c-d0bad6dcfb96\",\"name\":\"Send Email\",\"type\":\"send-email\"}"] + conditions = [ + { + evaluation_result = null + id = "17aee949-8986-4e1d-b3a9-89ac4e0f072e" + schedule_id = null + statements = [ + { + id = null + operation = "contains" + source = { + attribute = "_purpose" + attribute_operation = null + attribute_repeatable = true + attribute_type = "purpose" + id = "c8f0be11-295d-4a12-aaa5-9eb1b5050b19" + origin = "trigger" + origin_type = "entity" + schema = "opportunity" + } + values = ["1bb2ffff-b19d-4fc9-becc-77e320c6f844"] + }, + ] + }, + ] + enabled = true + entity_schema = "opportunity" + flow_name = "Wärmepumpe - Terminbestätigung 2. Vor-Ort-Termin (Partner)" + schedules = [ + ] + system_flow = null + trigger_conditions = null + triggers = [ + { + any = null + api_submission_trigger = null + entity_manual_trigger = null + entity_operation_trigger = { + configuration = { + ecp_config = null + exclude_activities = ["SyncActivity", "UpdateConsent"] + filter_config = { + activity = null + operation = { + diff = jsonencode({ + "*.datum_2_vororttermin" = [{ + exists = true + }] + }) + operation = ["updateEntity"] + payload = jsonencode({ + _schema = ["opportunity"] + }) + } + } + include_activities = [] + operations = ["updateEntity"] + schema = "opportunity" + } + id = "c8f0be11-295d-4a12-aaa5-9eb1b5050b19" + type = "entity_operation" + } + frontend_submit_trigger = null + journey_submit_trigger = null + received_email_trigger = null + }, + ] + version = null +} diff --git a/examples/resources/epilot-automation_flow/provider.tf b/examples/resources/epilot-automation_flow/provider.tf new file mode 100644 index 0000000..ba62e2b --- /dev/null +++ b/examples/resources/epilot-automation_flow/provider.tf @@ -0,0 +1,12 @@ +terraform { + required_providers { + epilot-automation = { + source = "epilot-dev/epilot-automation" + version = "0.5.3" + } + } +} + +provider "epilot-automation" { + epilot_auth = "eyJraWQiOiIxSWd6SVE3VXdwcENyeGdiOXZUem9XV25uUTZlRVZVaVpwUk40UTZxeUxjPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJlMzc0NTgzMi00MDIxLTcwY2EtZWQzYy04MTQwYTAxYWFhMjUiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLmV1LWNlbnRyYWwtMS5hbWF6b25hd3MuY29tXC9ldS1jZW50cmFsLTFfdmdCdllub1E5IiwiY3VzdG9tOml2eV9vcmdfaWQiOiIxNjU4MjAzMiIsImNvZ25pdG86dXNlcm5hbWUiOiJibHVlcHJpbnRzYWxlc0B0ZXN0dXNlci5lcGlsb3QuY2xvdWQiLCJhZG1pbl9lbWFpbCI6InYua3Vvc21hbmVuQGVwaWxvdC5jbG91ZCIsImN1c3RvbTppdnlfdXNlcl9pZCI6IjE1OTI4NiIsIm9yaWdpbl9qdGkiOiJmMzMwZTQ0My1kNjBhLTRiODYtYTA4OC1mNzNlZDE1Zjk4NmUiLCJhdWQiOiIyYWQ1MTBua3RiY284Y3JiajVtbGF2NzNlcyIsImV2ZW50X2lkIjoiODU2ZjhmMDgtMzZkOC00Y2YwLTg4MGMtYjcwMDA2NWJjNGFjIiwidG9rZW5fdXNlIjoiaWQiLCJhdXRoX3RpbWUiOjE3MzI2Mjk0NDEsImV4cCI6MTczMjYzNDU4NCwiaWF0IjoxNzMyNjMwOTg0LCJqdGkiOiI5ZWE5ZjA3Zi00MGUyLTQzNTYtOWNlZi0xODZmNDM0ZjQ3N2QiLCJlbWFpbCI6ImJsdWVwcmludHNhbGVzQHRlc3R1c2VyLmVwaWxvdC5jbG91ZCJ9.gw4RGhsp4rltn7NEbXpT8HRrDd59bQmaCXNIyEVsEyCvAUMXvu7FjxZ_6U2rML7gULI9RDn41By3Y8UE2O3nKEdEO8TPKhptPmiV30CXVOeqeUcEbMbkbMEeweeapAoWHhSyIiCQ8HwgyytjF9snuzE-w7OVXepobUh_f3omtvEmMqzHrk-j9C2_PCxcT-BRHjRPY9mr7aCxRl1z1IjXKP96WkiHIky97D7yRcU1C8pXsJlyum1F3Cn5uzPvD3djDpIZb9XBY2uRU_jqZWTWXsxR7XPwun3ckDvoOobj5ZvkaSq8UKiab_ZE7veZWBYkKJTpbqcuwUQW1S4EIW8FCw" +} diff --git a/examples/resources/epilot-automation_flow/resource.tf b/examples/resources/epilot-automation_flow/resource.tf index c1a54df..957d920 100644 --- a/examples/resources/epilot-automation_flow/resource.tf +++ b/examples/resources/epilot-automation_flow/resource.tf @@ -1,155 +1,16 @@ resource "epilot-automation_flow" "my_flow" { actions = [ - "{ \"see\": \"documentation\" }" + "{ \"see\": \"documentation\" }", ] - conditions = [ - { - evaluation_result = true - id = "...my_id..." - schedule_id = "...my_schedule_id..." - statements = [ - { - id = "1c8d3d9c-6d4c-4a83-aa22-aa0d630cbc2d" - operation = "greater_than_or_equals" - source = { - attribute = "...my_attribute..." - attribute_operation = "deleted" - attribute_repeatable = true - attribute_type = "email" - id = "...my_id..." - origin = "action" - origin_type = "journey_block" - schema = "...my_schema..." - } - values = [ - "..." - ] - } - ] - } - ] - enabled = true + enabled = false entity_schema = "submission" + flow_id = "7791b04a-16d2-44a2-9af9-2d59c25c512f" flow_name = "Handle contact form" - manifest = [ - "123e4567-e89b-12d3-a456-426614174000" - ] - schedules = [ - { - id = "...my_id..." - number_of_units = 1.88 - schedule_api_id = "...my_schedule_api_id..." - source = { - attribute = "...my_attribute..." - id = "...my_id..." - origin = "action_task" - schema = "...my_schema..." - } - time_period = "weeks" - time_relation = "after" - } - ] - system_flow = true - trigger_conditions = [ - "{ \"see\": \"documentation\" }" - ] + system_flow = false triggers = [ { any = "{ \"see\": \"documentation\" }" - api_submission_trigger = { - configuration = { - source_id = "...my_source_id..." - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "api_submission" - } - entity_manual_trigger = { - configuration = { - schema = "submission" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "entity_manual" - } - entity_operation_trigger = { - configuration = { - ecp_config = { - file_config = { - shared_with_end_customer = true - } - origin = "END_CUSTOMER_PORTAL" - } - exclude_activities = [ - ["SyncEntity"] - ] - filter_config = { - activity = { - type = [ - { - anything_but_condition = { - anything_but = [ - "..." - ] - } - equals_ignore_case_condition = { - equals_ignore_case = "...my_equals_ignore_case..." - } - exists_condition = { - exists = false - } - prefix_condition = { - prefix = "...my_prefix..." - } - str = "...my_str..." - suffix_condition = { - suffix = "...my_suffix..." - } - wildcard_condition = { - wildcard = "...my_wildcard..." - } - } - ] - } - operation = { - diff = "{ \"see\": \"documentation\" }" - operation = [ - "updateEntity" - ] - payload = "{ \"see\": \"documentation\" }" - } - } - include_activities = [ - ["CreateEntity"] - ] - operations = [ - "createEntity" - ] - schema = "submission" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "entity_operation" - } - frontend_submit_trigger = { - configuration = { - source_id = "99" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "frontend_submission" - } - journey_submit_trigger = { - configuration = { - source_id = "36ccf21c-051d-4bb7-84ad-d0eb26b2da79" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "journey_submission" - } - received_email_trigger = { - configuration = { - message_type = "RECEIVED" - } - id = "12d4f45a-1883-4841-a94c-5928cb338a94" - type = "received_email" - } - } + }, ] version = 2 } \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index bfc8bee..9ec444b 100755 --- a/gen.yaml +++ b/gen.yaml @@ -9,11 +9,10 @@ generation: requestResponseComponentNamesFeb2024: false auth: oAuth2ClientCredentialsEnabled: false - oAuth2PasswordEnabled: false sdkFlattening: true telemetryEnabled: false terraform: - version: 0.6.0 + version: 0.6.1 additionalDataSources: [] additionalDependencies: {} additionalResources: [] diff --git a/go.mod b/go.mod index 73f5812..54a142e 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,14 @@ module github.com/epilot-dev/terraform-provider-epilot-automation -go 1.22.0 +go 1.21 require ( github.com/cenkalti/backoff/v4 v4.2.0 github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 - github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/terraform-plugin-docs v0.19.4 - github.com/hashicorp/terraform-plugin-framework v1.12.0 + github.com/hashicorp/terraform-plugin-framework v1.10.0 github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 - github.com/hashicorp/terraform-plugin-go v0.24.0 - github.com/hashicorp/terraform-plugin-log v0.9.0 + github.com/hashicorp/terraform-plugin-go v0.23.0 ) require ( @@ -34,11 +32,13 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.6.1 // indirect + github.com/hashicorp/go-plugin v1.6.0 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/hc-install v0.7.0 // indirect github.com/hashicorp/terraform-exec v0.21.0 // indirect github.com/hashicorp/terraform-json v0.22.1 // indirect + github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect @@ -60,15 +60,15 @@ require ( github.com/yuin/goldmark-meta v1.1.0 // indirect github.com/zclconf/go-cty v1.14.4 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect - golang.org/x/crypto v0.24.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect - google.golang.org/protobuf v1.34.2 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/grpc v1.63.2 // indirect + google.golang.org/protobuf v1.34.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index f9e8505..2d68f29 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= -github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -87,12 +87,12 @@ github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7 github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSeyEljqjH3G39w28JK4c= github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA= -github.com/hashicorp/terraform-plugin-framework v1.12.0 h1:7HKaueHPaikX5/7cbC1r9d1m12iYHY+FlNZEGxQ42CQ= -github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE= +github.com/hashicorp/terraform-plugin-framework v1.10.0 h1:xXhICE2Fns1RYZxEQebwkB2+kXouLC932Li9qelozrc= +github.com/hashicorp/terraform-plugin-framework v1.10.0/go.mod h1:qBXLDn69kM97NNVi/MQ9qgd1uWWsVftGSnygYG1tImM= github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E= github.com/hashicorp/terraform-plugin-framework-validators v0.13.0/go.mod h1:wGeI02gEhj9nPANU62F2jCaHjXulejm/X+af4PdZaNo= -github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U= -github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg= +github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co= +github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= @@ -180,8 +180,8 @@ go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -191,12 +191,10 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -210,8 +208,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -219,20 +217,20 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= +google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= diff --git a/internal/provider/flow_data_source.go b/internal/provider/flow_data_source.go index e80b483..fcf9325 100644 --- a/internal/provider/flow_data_source.go +++ b/internal/provider/flow_data_source.go @@ -31,6 +31,7 @@ type FlowDataSource struct { type FlowDataSourceModel struct { Actions []types.String `tfsdk:"actions"` Conditions []tfTypes.ActionCondition `tfsdk:"conditions"` + DisableDetails *tfTypes.DisableDetails `tfsdk:"disable_details"` Enabled types.Bool `tfsdk:"enabled"` EntitySchema types.String `tfsdk:"entity_schema"` FlowName types.String `tfsdk:"flow_name"` @@ -82,7 +83,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, }, "operation": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["equals", "not_equals", "any_of", "none_of", "contains", "not_contains", "starts_with", "ends_with", "greater_than", "less_than", "greater_than_or_equals", "less_than_or_equals", "is_empty", "is_not_empty"]`, }, "source": schema.SingleNestedAttribute{ Computed: true, @@ -91,23 +93,27 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, }, "attribute_operation": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["all", "updated", "added", "deleted"]`, }, "attribute_repeatable": schema.BoolAttribute{ Computed: true, }, "attribute_type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["string", "text", "number", "boolean", "date", "datetime", "tags", "country", "email", "phone", "product", "price", "status", "relation", "multiselect", "select", "radio", "relation_user", "purpose", "label"]`, }, "id": schema.StringAttribute{ Computed: true, Description: `The id of the action or trigger`, }, "origin": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["trigger", "action"]`, }, "origin_type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["entity", "workflow", "journey_block"]`, }, "schema": schema.StringAttribute{ Computed: true, @@ -124,6 +130,19 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques }, }, }, + "disable_details": schema.SingleNestedAttribute{ + Computed: true, + Attributes: map[string]schema.Attribute{ + "disabled_at": schema.StringAttribute{ + Computed: true, + Description: `When the flow was disabled`, + }, + "disabled_by": schema.StringAttribute{ + Computed: true, + Description: `Who disabled the flow (system or user). must be one of ["system", "user"]`, + }, + }, + }, "enabled": schema.BoolAttribute{ Computed: true, Description: `Whether the automation is enabled or not`, @@ -170,7 +189,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Description: `The id of the action or trigger`, }, "origin": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["trigger", "action", "action_task", "automation"]`, }, "schema": schema.StringAttribute{ Computed: true, @@ -179,10 +199,12 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Description: `The source of the schedule_at timestamp that will be used to schedule the action`, }, "time_period": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["minutes", "hours", "days", "weeks", "months"]`, }, "time_relation": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["after", "before"]`, }, }, }, @@ -218,7 +240,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, }, "type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["api_submission"]`, }, }, }, @@ -238,7 +261,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, }, "type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["entity_manual"]`, }, }, }, @@ -278,6 +302,9 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques 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{ @@ -311,9 +338,6 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques }, }, }, - "str": schema.StringAttribute{ - Computed: true, - }, "suffix_condition": schema.SingleNestedAttribute{ Computed: true, Attributes: map[string]schema.Attribute{ @@ -349,7 +373,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques ` "type": ["DocUploadedFromPortal", "DocRemovedFromPortal"]` + "\n" + ` }` + "\n" + ` }` + "\n" + - ` ` + "```" + ``, + ` ` + "```" + `` + "\n" + + ``, }, }, }, @@ -372,7 +397,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques ` "operation": ["createEntity", "updateEntity"]` + "\n" + ` }` + "\n" + ` }` + "\n" + - ` ` + "```" + ``, + ` ` + "```" + `` + "\n" + + ``, }, "payload": schema.StringAttribute{ Computed: true, @@ -399,7 +425,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, }, "type": schema.StringAttribute{ - Computed: true, + 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" + @@ -514,7 +541,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques ` }` + "\n" + ` }` + "\n" + ` }` + "\n" + - ` ` + "```" + ``, + ` ` + "```" + `` + "\n" + + ``, }, "frontend_submit_trigger": schema.SingleNestedAttribute{ Computed: true, @@ -531,7 +559,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, }, "type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["frontend_submission"]`, }, }, }, @@ -550,7 +579,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, }, "type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["journey_submission"]`, }, }, }, @@ -561,7 +591,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, Attributes: map[string]schema.Attribute{ "message_type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["RECEIVED"]`, }, }, }, @@ -569,7 +600,8 @@ func (r *FlowDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, }, "type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: `must be one of ["received_email"]`, }, }, }, diff --git a/internal/provider/flow_data_source_sdk.go b/internal/provider/flow_data_source_sdk.go index 0193937..517a30a 100644 --- a/internal/provider/flow_data_source_sdk.go +++ b/internal/provider/flow_data_source_sdk.go @@ -8,6 +8,7 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" "math/big" + "time" ) func (r *FlowDataSourceModel) RefreshFromSharedAutomationFlow(resp *shared.AutomationFlow) { @@ -92,6 +93,13 @@ func (r *FlowDataSourceModel) RefreshFromSharedAutomationFlow(resp *shared.Autom r.Conditions[conditionsCount].Statements = conditions1.Statements } } + if resp.DisableDetails == nil { + r.DisableDetails = nil + } else { + r.DisableDetails = &tfTypes.DisableDetails{} + r.DisableDetails.DisabledAt = types.StringValue(resp.DisableDetails.DisabledAt.Format(time.RFC3339Nano)) + r.DisableDetails.DisabledBy = types.StringValue(string(resp.DisableDetails.DisabledBy)) + } r.Enabled = types.BoolPointerValue(resp.Enabled) r.EntitySchema = types.StringPointerValue(resp.EntitySchema) r.FlowName = types.StringValue(resp.FlowName) diff --git a/internal/provider/flow_resource.go b/internal/provider/flow_resource.go index d06c374..c9954ed 100644 --- a/internal/provider/flow_resource.go +++ b/internal/provider/flow_resource.go @@ -17,7 +17,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" @@ -40,6 +39,7 @@ type FlowResource struct { type FlowResourceModel struct { Actions []types.String `tfsdk:"actions"` Conditions []tfTypes.ActionCondition `tfsdk:"conditions"` + DisableDetails *tfTypes.DisableDetails `tfsdk:"disable_details"` Enabled types.Bool `tfsdk:"enabled"` EntitySchema types.String `tfsdk:"entity_schema"` FlowName types.String `tfsdk:"flow_name"` @@ -72,9 +72,6 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r Computed: true, Optional: true, NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, Attributes: map[string]schema.Attribute{ "evaluation_result": schema.BoolAttribute{ Computed: true, @@ -94,9 +91,6 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r Computed: true, Optional: true, NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, @@ -224,11 +218,37 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r }, }, }, + "disable_details": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "disabled_at": schema.StringAttribute{ + Computed: true, + Optional: true, + Description: `When the flow was disabled. Not Null`, + Validators: []validator.String{ + speakeasy_stringvalidators.NotNull(), + validators.IsRFC3339(), + }, + }, + "disabled_by": schema.StringAttribute{ + Computed: true, + Optional: true, + Description: `Who disabled the flow (system or user). Not Null; must be one of ["system", "user"]`, + Validators: []validator.String{ + speakeasy_stringvalidators.NotNull(), + stringvalidator.OneOf( + "system", + "user", + ), + }, + }, + }, + }, "enabled": schema.BoolAttribute{ Computed: true, Optional: true, - Default: booldefault.StaticBool(true), - Description: `Whether the automation is enabled or not. Default: true`, + Description: `Whether the automation is enabled or not`, }, "entity_schema": schema.StringAttribute{ Computed: true, @@ -252,9 +272,6 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r Computed: true, Optional: true, NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, @@ -365,9 +382,6 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r "triggers": schema.ListNestedAttribute{ Required: true, NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, Attributes: map[string]schema.Attribute{ "any": schema.StringAttribute{ Computed: true, @@ -410,7 +424,7 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r "type": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be "api_submission"`, + Description: `Not Null; must be one of ["api_submission"]`, Validators: []validator.String{ speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( @@ -456,7 +470,7 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r "type": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be "entity_manual"`, + Description: `Not Null; must be one of ["entity_manual"]`, Validators: []validator.String{ speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( @@ -521,10 +535,21 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r Computed: true, Optional: true, NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, 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, @@ -606,20 +631,6 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r }...), }, }, - "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"), - }...), - }, - }, "suffix_condition": schema.SingleNestedAttribute{ Computed: true, Optional: true, @@ -661,6 +672,9 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r }, }, }, + Validators: []validator.Object{ + validators.ExactlyOneChild(), + }, }, MarkdownDescription: `Filter on activity type. If not specified, all activities will be matched on execution.` + "\n" + `Example:` + "\n" + @@ -679,7 +693,8 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r ` "type": ["DocUploadedFromPortal", "DocRemovedFromPortal"]` + "\n" + ` }` + "\n" + ` }` + "\n" + - ` ` + "```" + ``, + ` ` + "```" + `` + "\n" + + ``, }, }, }, @@ -708,7 +723,8 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r ` "operation": ["createEntity", "updateEntity"]` + "\n" + ` }` + "\n" + ` }` + "\n" + - ` ` + "```" + ``, + ` ` + "```" + `` + "\n" + + ``, }, "payload": schema.StringAttribute{ Computed: true, @@ -752,7 +768,7 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r "type": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be "entity_operation"`, + Description: `Not Null; must be one of ["entity_operation"]`, Validators: []validator.String{ speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( @@ -873,7 +889,8 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r ` }` + "\n" + ` }` + "\n" + ` }` + "\n" + - ` ` + "```" + ``, + ` ` + "```" + `` + "\n" + + ``, Validators: []validator.Object{ objectvalidator.ConflictsWith(path.Expressions{ path.MatchRelative().AtParent().AtName("any"), @@ -910,7 +927,7 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r "type": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be "frontend_submission"`, + Description: `Not Null; must be one of ["frontend_submission"]`, Validators: []validator.String{ speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( @@ -959,7 +976,7 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r "type": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be "journey_submission"`, + Description: `Not Null; must be one of ["journey_submission"]`, Validators: []validator.String{ speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( @@ -990,9 +1007,11 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r "message_type": schema.StringAttribute{ Computed: true, Optional: true, - Description: `must be "RECEIVED"`, + Description: `must be one of ["RECEIVED"]`, Validators: []validator.String{ - stringvalidator.OneOf("RECEIVED"), + stringvalidator.OneOf( + "RECEIVED", + ), }, }, }, @@ -1008,7 +1027,7 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r "type": schema.StringAttribute{ Computed: true, Optional: true, - Description: `Not Null; must be "received_email"`, + Description: `Not Null; must be one of ["received_email"]`, Validators: []validator.String{ speakeasy_stringvalidators.NotNull(), stringvalidator.OneOf( @@ -1029,6 +1048,9 @@ func (r *FlowResource) Schema(ctx context.Context, req resource.SchemaRequest, r }, }, }, + Validators: []validator.Object{ + validators.ExactlyOneChild(), + }, }, }, "version": schema.NumberAttribute{ diff --git a/internal/provider/flow_resource_sdk.go b/internal/provider/flow_resource_sdk.go index e95b921..c0b4d81 100644 --- a/internal/provider/flow_resource_sdk.go +++ b/internal/provider/flow_resource_sdk.go @@ -8,6 +8,7 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" "math/big" + "time" ) func (r *FlowResourceModel) ToSharedAutomationFlowInput() *shared.AutomationFlowInput { @@ -134,6 +135,15 @@ func (r *FlowResourceModel) ToSharedAutomationFlowInput() *shared.AutomationFlow Statements: statements, }) } + var disableDetails *shared.DisableDetails + if r.DisableDetails != nil { + disabledAt, _ := time.Parse(time.RFC3339Nano, r.DisableDetails.DisabledAt.ValueString()) + disabledBy := shared.DisabledBy(r.DisableDetails.DisabledBy.ValueString()) + disableDetails = &shared.DisableDetails{ + DisabledAt: disabledAt, + DisabledBy: disabledBy, + } + } enabled := new(bool) if !r.Enabled.IsUnknown() && !r.Enabled.IsNull() { *enabled = r.Enabled.ValueBool() @@ -556,6 +566,7 @@ func (r *FlowResourceModel) ToSharedAutomationFlowInput() *shared.AutomationFlow Manifest: manifest, Actions: actions, Conditions: conditions, + DisableDetails: disableDetails, Enabled: enabled, EntitySchema: entitySchema, FlowName: flowName, @@ -650,6 +661,13 @@ func (r *FlowResourceModel) RefreshFromSharedAutomationFlow(resp *shared.Automat r.Conditions[conditionsCount].Statements = conditions1.Statements } } + if resp.DisableDetails == nil { + r.DisableDetails = nil + } else { + r.DisableDetails = &tfTypes.DisableDetails{} + r.DisableDetails.DisabledAt = types.StringValue(resp.DisableDetails.DisabledAt.Format(time.RFC3339Nano)) + r.DisableDetails.DisabledBy = types.StringValue(string(resp.DisableDetails.DisabledBy)) + } r.Enabled = types.BoolPointerValue(resp.Enabled) r.EntitySchema = types.StringPointerValue(resp.EntitySchema) r.FlowName = types.StringValue(resp.FlowName) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index d03a966..b74746d 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -76,13 +76,10 @@ func (p *EpilotAutomationProvider) Configure(ctx context.Context, req provider.C EpilotAuth: epilotAuth, } - httpClient := http.DefaultClient - httpClient.Transport = NewLoggingHTTPTransport(http.DefaultTransport) - opts := []sdk.SDKOption{ sdk.WithServerURL(ServerURL), sdk.WithSecurity(security), - sdk.WithClient(httpClient), + sdk.WithClient(http.DefaultClient), } client := sdk.New(opts...) diff --git a/internal/provider/reflect/helpers.go b/internal/provider/reflect/helpers.go index 8085789..b17719d 100644 --- a/internal/provider/reflect/helpers.go +++ b/internal/provider/reflect/helpers.go @@ -46,7 +46,7 @@ func commaSeparatedString(in []string) string { // getStructTags returns a map of Terraform field names to their position in // the tags of the struct `in`. `in` must be a struct. -func getStructTags(_ context.Context, in reflect.Value, path path.Path, _ Options) (map[string]int, error) { +func getStructTags(_ context.Context, in reflect.Value, path path.Path, opts Options) (map[string]int, error) { tags := map[string]int{} typ := trueReflectValue(in).Type() if typ.Kind() != reflect.Struct { diff --git a/internal/provider/types/disable_details.go b/internal/provider/types/disable_details.go new file mode 100644 index 0000000..36dc7ac --- /dev/null +++ b/internal/provider/types/disable_details.go @@ -0,0 +1,10 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package types + +import "github.com/hashicorp/terraform-plugin-framework/types" + +type DisableDetails struct { + DisabledAt types.String `tfsdk:"disabled_at"` + DisabledBy types.String `tfsdk:"disabled_by"` +} diff --git a/internal/provider/utils.go b/internal/provider/utils.go index 5266a3d..d2edd1f 100644 --- a/internal/provider/utils.go +++ b/internal/provider/utils.go @@ -3,25 +3,17 @@ package provider import ( - "bufio" - "bytes" "context" "encoding/json" - "errors" "fmt" tfReflect "github.com/epilot-dev/terraform-provider-epilot-automation/internal/provider/reflect" - "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-log/tflog" - "io" "net/http" "net/http/httputil" - "net/textproto" "reflect" - "strings" ) func debugResponse(response *http.Response) string { @@ -99,177 +91,3 @@ func refreshPlan(ctx context.Context, plan types.Object, target interface{}, dia SourceType: tfReflect.SourceTypePlan, }, path.Empty())...) } - -// Note: this is taken as a more minimal/specific version of https://github.com/hashicorp/terraform-plugin-sdk/blob/main/helper/logging/logging_http_transport.go -func NewLoggingHTTPTransport(t http.RoundTripper) *loggingHttpTransport { - return &loggingHttpTransport{t} -} - -const ( - FieldHttpOperationType = "tf_http_op_type" - OperationHttpRequest = "request" - OperationHttpResponse = "response" - FieldHttpRequestMethod = "tf_http_req_method" - FieldHttpRequestUri = "tf_http_req_uri" - FieldHttpRequestProtoVersion = "tf_http_req_version" - FieldHttpRequestBody = "tf_http_req_body" - FieldHttpResponseProtoVersion = "tf_http_res_version" - FieldHttpResponseStatusCode = "tf_http_res_status_code" - FieldHttpResponseStatusReason = "tf_http_res_status_reason" - FieldHttpResponseBody = "tf_http_res_body" - FieldHttpTransactionId = "tf_http_trans_id" -) - -type loggingHttpTransport struct { - transport http.RoundTripper -} - -func (t *loggingHttpTransport) RoundTrip(req *http.Request) (*http.Response, error) { - ctx := req.Context() - ctx = t.addTransactionIdField(ctx) - - // Decompose the request bytes in a message (HTTP body) and fields (HTTP headers), then log it - fields, err := decomposeRequestForLogging(req) - if err != nil { - tflog.Error(ctx, "Failed to parse request bytes for logging", []map[string]interface{}{map[string]interface{}{ - "error": err, - }}...) - } else { - tflog.Debug(ctx, "Sending HTTP Request", []map[string]interface{}{fields}...) - } - - // Invoke the wrapped RoundTrip now - res, err := t.transport.RoundTrip(req) - if err != nil { - return res, err - } - - // Decompose the response bytes in a message (HTTP body) and fields (HTTP headers), then log it - fields, err = decomposeResponseForLogging(res) - if err != nil { - tflog.Error(ctx, "Failed to parse response bytes for logging", []map[string]interface{}{map[string]interface{}{ - "error": err, - }}...) - } else { - tflog.Debug(ctx, "Received HTTP Response", []map[string]interface{}{fields}...) - } - - return res, nil -} - -func (t *loggingHttpTransport) addTransactionIdField(ctx context.Context) context.Context { - tId, err := uuid.GenerateUUID() - - if err != nil { - tId = "Unable to assign Transaction ID: " + err.Error() - } - - return tflog.SetField(ctx, FieldHttpTransactionId, tId) -} - -func decomposeRequestForLogging(req *http.Request) (map[string]interface{}, error) { - fields := make(map[string]interface{}, len(req.Header)+4) - fields[FieldHttpOperationType] = OperationHttpRequest - - fields[FieldHttpRequestMethod] = req.Method - fields[FieldHttpRequestUri] = req.URL.RequestURI() - fields[FieldHttpRequestProtoVersion] = req.Proto - - // Get the full body of the request, including headers appended by http.Transport: - // this is necessary because the http.Request at this stage doesn't contain - // all the headers that will be eventually sent. - // We rely on `httputil.DumpRequestOut` to obtain the actual bytes that will be sent out. - reqBytes, err := httputil.DumpRequestOut(req, true) - if err != nil { - return nil, err - } - - // Create a reader around the request full body - reqReader := textproto.NewReader(bufio.NewReader(bytes.NewReader(reqBytes))) - - err = fieldHeadersFromRequestReader(reqReader, fields) - if err != nil { - return nil, err - } - - // Read the rest of the body content - fields[FieldHttpRequestBody] = bodyFromRestOfRequestReader(reqReader) - return fields, nil -} - -func fieldHeadersFromRequestReader(reader *textproto.Reader, fields map[string]interface{}) error { - // Ignore the first line: it contains non-header content - // that we have already captured. - // Skipping this step, would cause the following call to `ReadMIMEHeader()` - // to fail as it cannot parse the first line. - _, err := reader.ReadLine() - if err != nil { - return err - } - - // Read the MIME-style headers - mimeHeader, err := reader.ReadMIMEHeader() - if err != nil { - return err - } - - // Set the headers as fields to log - for k, v := range mimeHeader { - if len(v) == 1 { - fields[k] = v[0] - } else { - fields[k] = v - } - } - if _, ok := fields["Authorization"]; ok { - fields["Authorization"] = "(sensitive)" - } - - return nil -} - -func bodyFromRestOfRequestReader(reader *textproto.Reader) string { - var builder strings.Builder - for { - line, err := reader.ReadContinuedLine() - if errors.Is(err, io.EOF) { - break - } - builder.WriteString(line) - } - - return builder.String() -} - -func decomposeResponseForLogging(res *http.Response) (map[string]interface{}, error) { - fields := make(map[string]interface{}, len(res.Header)+4) - fields[FieldHttpOperationType] = OperationHttpResponse - - fields[FieldHttpResponseProtoVersion] = res.Proto - fields[FieldHttpResponseStatusCode] = res.StatusCode - fields[FieldHttpResponseStatusReason] = res.Status - - // Set the headers as fields to log - for k, v := range res.Header { - if len(v) == 1 { - fields[k] = v[0] - } else { - fields[k] = v - } - } - - // Read the whole response body - resBody, err := io.ReadAll(res.Body) - if err != nil { - return nil, err - } - - // Wrap the bytes from the response body, back into an io.ReadCloser, - // to respect the interface of http.Response, as expected by users of the - // http.Client - res.Body = io.NopCloser(bytes.NewBuffer(resBody)) - - fields[FieldHttpResponseBody] = string(resBody) - - return fields, nil -} diff --git a/internal/sdk/bulk.go b/internal/sdk/bulk.go index 8fd5208..ddc5c69 100644 --- a/internal/sdk/bulk.go +++ b/internal/sdk/bulk.go @@ -13,6 +13,7 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/operations" "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/shared" "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/retry" + "io" "net/http" "net/url" ) @@ -181,15 +182,17 @@ func (s *Bulk) BulkTriggerExecutions(ctx context.Context, request *shared.BulkTr RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 202: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.BulkTriggerJob if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -197,17 +200,21 @@ func (s *Bulk) BulkTriggerExecutions(ctx context.Context, request *shared.BulkTr res.BulkTriggerJob = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.BulkTriggerExecutionsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -362,15 +369,17 @@ func (s *Bulk) GetBulkJob(ctx context.Context, request operations.GetBulkJobRequ RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.BulkTriggerJob if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -378,17 +387,23 @@ func (s *Bulk) GetBulkJob(ctx context.Context, request operations.GetBulkJobRequ res.BulkTriggerJob = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.GetBulkJobResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -549,15 +564,17 @@ func (s *Bulk) PatchBulkJob(ctx context.Context, request operations.PatchBulkJob RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.BulkTriggerJob if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -565,17 +582,23 @@ func (s *Bulk) PatchBulkJob(ctx context.Context, request operations.PatchBulkJob res.BulkTriggerJob = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.PatchBulkJobResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/internal/sdk/executions.go b/internal/sdk/executions.go index f47d06b..8260339 100644 --- a/internal/sdk/executions.go +++ b/internal/sdk/executions.go @@ -13,6 +13,7 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/operations" "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/shared" "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/retry" + "io" "net/http" "net/url" ) @@ -175,15 +176,17 @@ func (s *Executions) CancelExecution(ctx context.Context, request operations.Can RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.AutomationExecution if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -191,17 +194,23 @@ func (s *Executions) CancelExecution(ctx context.Context, request operations.Can res.AutomationExecution = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.CancelExecutionResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -356,15 +365,17 @@ func (s *Executions) GetExecution(ctx context.Context, request operations.GetExe RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.AutomationExecution if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -372,17 +383,23 @@ func (s *Executions) GetExecution(ctx context.Context, request operations.GetExe res.AutomationExecution = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.GetExecutionResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -541,15 +558,17 @@ func (s *Executions) GetExecutions(ctx context.Context, request operations.GetEx RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.GetExecutionsResp if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -557,17 +576,21 @@ func (s *Executions) GetExecutions(ctx context.Context, request operations.GetEx res.GetExecutionsResp = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.GetExecutionsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -728,15 +751,17 @@ func (s *Executions) ResumeExecutionWithToken(ctx context.Context, request *shar RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.ResumeResp if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -744,18 +769,24 @@ func (s *Executions) ResumeExecutionWithToken(ctx context.Context, request *shar res.ResumeResp = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.ResumeExecutionWithTokenResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - case httpRes.StatusCode == 400: default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -811,7 +842,7 @@ func (s *Executions) RetriggerAction(ctx context.Context, request operations.Ret if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "*/*") + req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -916,13 +947,30 @@ func (s *Executions) RetriggerAction(ctx context.Context, request operations.Ret RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.RetriggerActionResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -1083,15 +1131,17 @@ func (s *Executions) StartExecution(ctx context.Context, request *shared.StartEx RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.AutomationExecution if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -1099,17 +1149,21 @@ func (s *Executions) StartExecution(ctx context.Context, request *shared.StartEx res.AutomationExecution = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.StartExecutionResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/internal/sdk/flows.go b/internal/sdk/flows.go index 06d0e71..25bf075 100644 --- a/internal/sdk/flows.go +++ b/internal/sdk/flows.go @@ -13,6 +13,7 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/operations" "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/shared" "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/retry" + "io" "net/http" "net/url" ) @@ -181,15 +182,17 @@ func (s *Flows) CreateFlow(ctx context.Context, request *shared.AutomationFlowIn RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.AutomationFlow if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -197,17 +200,21 @@ func (s *Flows) CreateFlow(ctx context.Context, request *shared.AutomationFlowIn res.AutomationFlow = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.CreateFlowResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -362,33 +369,30 @@ func (s *Flows) DeleteFlow(ctx context.Context, request operations.DeleteFlowReq RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out shared.AutomationFlow + var out operations.DeleteFlowResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.AutomationFlow = &out + res.Object = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -543,15 +547,17 @@ func (s *Flows) GetFlow(ctx context.Context, request operations.GetFlowRequest, RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.AutomationFlow if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -559,17 +565,23 @@ func (s *Flows) GetFlow(ctx context.Context, request operations.GetFlowRequest, res.AutomationFlow = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.GetFlowResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -730,15 +742,17 @@ func (s *Flows) PutFlow(ctx context.Context, request operations.PutFlowRequest, RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.AutomationFlow if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -746,17 +760,21 @@ func (s *Flows) PutFlow(ctx context.Context, request operations.PutFlowRequest, res.AutomationFlow = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out operations.PutFlowResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } + + res.Object = &out + default: return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -915,15 +933,17 @@ func (s *Flows) SearchFlows(ctx context.Context, request operations.SearchFlowsR RawResponse: httpRes, } + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - var out shared.SearchAutomationsResp if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -931,17 +951,9 @@ func (s *Flows) SearchFlows(ctx context.Context, request operations.SearchFlowsR res.SearchAutomationsResp = &out default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/internal/sdk/internal/utils/json.go b/internal/sdk/internal/utils/json.go index 71e052c..0d8a6df 100644 --- a/internal/sdk/internal/utils/json.go +++ b/internal/sdk/internal/utils/json.go @@ -487,29 +487,30 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa v.Set(m) return nil case reflect.Slice, reflect.Array: - var unmarshaled []json.RawMessage + if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { + if v.CanAddr() { + return json.Unmarshal(value, v.Addr().Interface()) + } else { + return json.Unmarshal(value, v.Interface()) + } + } + + var unmarhsaled []json.RawMessage - if err := json.Unmarshal(value, &unmarshaled); err != nil { + if err := json.Unmarshal(value, &unmarhsaled); err != nil { return err } - arrVal := reflect.MakeSlice(typ, len(unmarshaled), len(unmarshaled)) + arrVal := v - for index, value := range unmarshaled { + for _, value := range unmarhsaled { itemVal := reflect.New(typ.Elem()) if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { return err } - arrVal.Index(index).Set(itemVal.Elem()) - } - - if v.Kind() == reflect.Pointer { - if v.IsNil() { - v.Set(reflect.New(typ)) - } - v = v.Elem() + arrVal = reflect.Append(arrVal, itemVal.Elem()) } v.Set(arrVal) diff --git a/internal/sdk/internal/utils/requestbody.go b/internal/sdk/internal/utils/requestbody.go index 000226e..0fd33cf 100644 --- a/internal/sdk/internal/utils/requestbody.go +++ b/internal/sdk/internal/utils/requestbody.go @@ -66,16 +66,15 @@ func serializeRequestBody(request interface{}, nullable, optional bool, requestF if tag != nil { // request object (non-flattened) requestVal := requestValType.FieldByName(requestFieldName) - val := reflect.ValueOf(requestVal.Interface()) if isNil(requestField.Type, requestVal) { if !nullable && optional { return nil, "", nil } - return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) + return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) } - return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) + return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) } } @@ -83,7 +82,7 @@ func serializeRequestBody(request interface{}, nullable, optional bool, requestF return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], reflect.ValueOf(request), tag) } -func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (io.Reader, string, error) { +func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (*bytes.Buffer, string, error) { buf := &bytes.Buffer{} if isNil(val.Type(), val) { @@ -117,8 +116,6 @@ func serializeContentType(fieldName string, mediaType string, val reflect.Value, if err := encodeFormData(fieldName, buf, val.Interface()); err != nil { return nil, "", err } - case val.Type().Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()): - return val.Interface().(io.Reader), mediaType, nil default: val = reflect.Indirect(val) @@ -127,8 +124,8 @@ func serializeContentType(fieldName string, mediaType string, val reflect.Value, if _, err := buf.WriteString(valToString(val.Interface())); err != nil { return nil, "", err } - case reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)): - if _, err := buf.Write(val.Interface().([]byte)); err != nil { + case val.Type() == reflect.TypeOf([]byte(nil)): + if _, err := buf.Write(val.Bytes()); err != nil { return nil, "", err } default: @@ -218,7 +215,7 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va var fieldName string var fileName string - var reader io.Reader + var content []byte for i := 0; i < fieldType.NumField(); i++ { field := fieldType.Field(i) @@ -229,19 +226,15 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va continue } - if tag.Content && val.CanInterface() { - if reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)) { - reader = bytes.NewReader(val.Interface().([]byte)) - } else if reflect.TypeOf(val.Interface()).Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()) { - reader = val.Interface().(io.Reader) - } + if tag.Content { + content = val.Bytes() } else { fieldName = tag.Name fileName = val.String() } } - if fieldName == "" || fileName == "" || reader == nil { + if fieldName == "" || fileName == "" || content == nil { return fmt.Errorf("invalid multipart/form-data file") } @@ -249,7 +242,7 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va if err != nil { return err } - if _, err := io.Copy(fw, reader); err != nil { + if _, err := fw.Write(content); err != nil { return err } diff --git a/internal/sdk/internal/utils/security.go b/internal/sdk/internal/utils/security.go index 19dfa6f..c8503f9 100644 --- a/internal/sdk/internal/utils/security.go +++ b/internal/sdk/internal/utils/security.go @@ -119,14 +119,9 @@ func parseSecurityScheme(headers, queryParams map[string]string, schemeTag *secu } if schemeType.Kind() == reflect.Struct { - if schemeTag.Type == "http" { - switch schemeTag.SubType { - case "basic": - handleBasicAuthScheme(headers, schemeVal.Interface()) - return - case "custom": - return - } + if schemeTag.Type == "http" && schemeTag.SubType == "basic" { + handleBasicAuthScheme(headers, schemeVal.Interface()) + return } for i := 0; i < schemeType.NumField(); i++ { @@ -176,7 +171,6 @@ func parseSecuritySchemeValue(headers, queryParams map[string]string, schemeTag switch schemeTag.SubType { case "bearer": headers[secTag.Name] = prefixBearer(valToString(val)) - case "custom": default: panic("not supported") } diff --git a/internal/sdk/internal/utils/utils.go b/internal/sdk/internal/utils/utils.go index f1ff9e0..adb2f70 100644 --- a/internal/sdk/internal/utils/utils.go +++ b/internal/sdk/internal/utils/utils.go @@ -3,12 +3,10 @@ package utils import ( - "bytes" "context" "fmt" "io" "math/big" - "net/http" "reflect" "regexp" "strconv" @@ -230,15 +228,3 @@ func contains(arr []string, str string) bool { } return false } - -func ConsumeRawBody(res *http.Response) ([]byte, error) { - rawBody, err := io.ReadAll(res.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - - res.Body.Close() - res.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - - return rawBody, nil -} diff --git a/internal/sdk/models/operations/bulktriggerexecutions.go b/internal/sdk/models/operations/bulktriggerexecutions.go index f61bcb0..a082a33 100644 --- a/internal/sdk/models/operations/bulktriggerexecutions.go +++ b/internal/sdk/models/operations/bulktriggerexecutions.go @@ -7,6 +7,28 @@ import ( "net/http" ) +// BulkTriggerExecutionsResponseBody - The requested resource is forbidden +type BulkTriggerExecutionsResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *BulkTriggerExecutionsResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *BulkTriggerExecutionsResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type BulkTriggerExecutionsResponse struct { // Trigger Executions Job Info BulkTriggerJob *shared.BulkTriggerJob @@ -16,6 +38,8 @@ type BulkTriggerExecutionsResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *BulkTriggerExecutionsResponseBody } func (o *BulkTriggerExecutionsResponse) GetBulkTriggerJob() *shared.BulkTriggerJob { @@ -45,3 +69,10 @@ func (o *BulkTriggerExecutionsResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *BulkTriggerExecutionsResponse) GetObject() *BulkTriggerExecutionsResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/cancelexecution.go b/internal/sdk/models/operations/cancelexecution.go index aa5edb4..85bcc96 100644 --- a/internal/sdk/models/operations/cancelexecution.go +++ b/internal/sdk/models/operations/cancelexecution.go @@ -18,6 +18,28 @@ func (o *CancelExecutionRequest) GetExecutionID() string { return o.ExecutionID } +// CancelExecutionResponseBody - The requested resource is forbidden +type CancelExecutionResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *CancelExecutionResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *CancelExecutionResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type CancelExecutionResponse struct { // The cancelled execution AutomationExecution *shared.AutomationExecution @@ -27,6 +49,8 @@ type CancelExecutionResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *CancelExecutionResponseBody } func (o *CancelExecutionResponse) GetAutomationExecution() *shared.AutomationExecution { @@ -56,3 +80,10 @@ func (o *CancelExecutionResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *CancelExecutionResponse) GetObject() *CancelExecutionResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/createflow.go b/internal/sdk/models/operations/createflow.go index 6d24932..773f794 100644 --- a/internal/sdk/models/operations/createflow.go +++ b/internal/sdk/models/operations/createflow.go @@ -7,6 +7,28 @@ import ( "net/http" ) +// CreateFlowResponseBody - The requested resource is forbidden +type CreateFlowResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *CreateFlowResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *CreateFlowResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type CreateFlowResponse struct { // The created automation flow AutomationFlow *shared.AutomationFlow @@ -16,6 +38,8 @@ type CreateFlowResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *CreateFlowResponseBody } func (o *CreateFlowResponse) GetAutomationFlow() *shared.AutomationFlow { @@ -45,3 +69,10 @@ func (o *CreateFlowResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *CreateFlowResponse) GetObject() *CreateFlowResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/deleteflow.go b/internal/sdk/models/operations/deleteflow.go index 40ae922..2a6bd2d 100644 --- a/internal/sdk/models/operations/deleteflow.go +++ b/internal/sdk/models/operations/deleteflow.go @@ -3,7 +3,6 @@ package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/models/shared" "net/http" ) @@ -19,22 +18,37 @@ func (o *DeleteFlowRequest) GetFlowID() string { return o.FlowID } +// DeleteFlowResponseBody - The requested resource is forbidden +type DeleteFlowResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *DeleteFlowResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *DeleteFlowResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type DeleteFlowResponse struct { - // The deleted automation flow - AutomationFlow *shared.AutomationFlow // HTTP response content type for this operation ContentType string // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response -} - -func (o *DeleteFlowResponse) GetAutomationFlow() *shared.AutomationFlow { - if o == nil { - return nil - } - return o.AutomationFlow + // The requested resource is forbidden + Object *DeleteFlowResponseBody } func (o *DeleteFlowResponse) GetContentType() string { @@ -57,3 +71,10 @@ func (o *DeleteFlowResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *DeleteFlowResponse) GetObject() *DeleteFlowResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/getbulkjob.go b/internal/sdk/models/operations/getbulkjob.go index e9b8204..426a023 100644 --- a/internal/sdk/models/operations/getbulkjob.go +++ b/internal/sdk/models/operations/getbulkjob.go @@ -18,6 +18,28 @@ func (o *GetBulkJobRequest) GetJobID() string { return o.JobID } +// GetBulkJobResponseBody - The requested resource is forbidden +type GetBulkJobResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *GetBulkJobResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *GetBulkJobResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type GetBulkJobResponse struct { // Bulk Job Info BulkTriggerJob *shared.BulkTriggerJob @@ -27,6 +49,8 @@ type GetBulkJobResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *GetBulkJobResponseBody } func (o *GetBulkJobResponse) GetBulkTriggerJob() *shared.BulkTriggerJob { @@ -56,3 +80,10 @@ func (o *GetBulkJobResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *GetBulkJobResponse) GetObject() *GetBulkJobResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/getexecution.go b/internal/sdk/models/operations/getexecution.go index acbfac9..2fa62ff 100644 --- a/internal/sdk/models/operations/getexecution.go +++ b/internal/sdk/models/operations/getexecution.go @@ -18,6 +18,28 @@ func (o *GetExecutionRequest) GetExecutionID() string { return o.ExecutionID } +// GetExecutionResponseBody - The requested resource is forbidden +type GetExecutionResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *GetExecutionResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *GetExecutionResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type GetExecutionResponse struct { // The returned execution AutomationExecution *shared.AutomationExecution @@ -27,6 +49,8 @@ type GetExecutionResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *GetExecutionResponseBody } func (o *GetExecutionResponse) GetAutomationExecution() *shared.AutomationExecution { @@ -56,3 +80,10 @@ func (o *GetExecutionResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *GetExecutionResponse) GetObject() *GetExecutionResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/getexecutions.go b/internal/sdk/models/operations/getexecutions.go index 4238195..4094c05 100644 --- a/internal/sdk/models/operations/getexecutions.go +++ b/internal/sdk/models/operations/getexecutions.go @@ -48,6 +48,28 @@ func (o *GetExecutionsRequest) GetSize() *int64 { return o.Size } +// GetExecutionsResponseBody - The requested resource is forbidden +type GetExecutionsResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *GetExecutionsResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *GetExecutionsResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type GetExecutionsResponse struct { // HTTP response content type for this operation ContentType string @@ -57,6 +79,8 @@ type GetExecutionsResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *GetExecutionsResponseBody } func (o *GetExecutionsResponse) GetContentType() string { @@ -86,3 +110,10 @@ func (o *GetExecutionsResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *GetExecutionsResponse) GetObject() *GetExecutionsResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/getflow.go b/internal/sdk/models/operations/getflow.go index a49dd2f..8862d3e 100644 --- a/internal/sdk/models/operations/getflow.go +++ b/internal/sdk/models/operations/getflow.go @@ -19,6 +19,28 @@ func (o *GetFlowRequest) GetFlowID() string { return o.FlowID } +// GetFlowResponseBody - The requested resource is forbidden +type GetFlowResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *GetFlowResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *GetFlowResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type GetFlowResponse struct { // The returned automation flow AutomationFlow *shared.AutomationFlow @@ -28,6 +50,8 @@ type GetFlowResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *GetFlowResponseBody } func (o *GetFlowResponse) GetAutomationFlow() *shared.AutomationFlow { @@ -57,3 +81,10 @@ func (o *GetFlowResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *GetFlowResponse) GetObject() *GetFlowResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/options.go b/internal/sdk/models/operations/options.go index b644d9a..c2ff088 100644 --- a/internal/sdk/models/operations/options.go +++ b/internal/sdk/models/operations/options.go @@ -19,23 +19,11 @@ const ( SupportedOptionURLOverride = "urlOverride" ) -type AcceptHeaderEnum string - -const ( - AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json" - AcceptHeaderEnumWildcardWildcard AcceptHeaderEnum = "*/*" -) - -func (e AcceptHeaderEnum) ToPointer() *AcceptHeaderEnum { - return &e -} - type Options struct { - ServerURL *string - Retries *retry.Config - Timeout *time.Duration - AcceptHeaderOverride *AcceptHeaderEnum - URLOverride *string + ServerURL *string + Retries *retry.Config + Timeout *time.Duration + URLOverride *string } type Option func(*Options, ...string) error @@ -92,17 +80,6 @@ func WithOperationTimeout(timeout time.Duration) Option { } } -func WithAcceptHeaderOverride(acceptHeaderOverride AcceptHeaderEnum) Option { - return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionAcceptHeaderOverride) { - return ErrUnsupportedOption - } - - opts.AcceptHeaderOverride = &acceptHeaderOverride - return nil - } -} - // WithURLOverride allows overriding the URL. func WithURLOverride(urlOverride string) Option { return func(opts *Options, supportedOptions ...string) error { diff --git a/internal/sdk/models/operations/patchbulkjob.go b/internal/sdk/models/operations/patchbulkjob.go index 2c83211..552e0df 100644 --- a/internal/sdk/models/operations/patchbulkjob.go +++ b/internal/sdk/models/operations/patchbulkjob.go @@ -26,6 +26,28 @@ func (o *PatchBulkJobRequest) GetJobID() string { return o.JobID } +// PatchBulkJobResponseBody - The requested resource is forbidden +type PatchBulkJobResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *PatchBulkJobResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *PatchBulkJobResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type PatchBulkJobResponse struct { // Bulk Job Info BulkTriggerJob *shared.BulkTriggerJob @@ -35,6 +57,8 @@ type PatchBulkJobResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *PatchBulkJobResponseBody } func (o *PatchBulkJobResponse) GetBulkTriggerJob() *shared.BulkTriggerJob { @@ -64,3 +88,10 @@ func (o *PatchBulkJobResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *PatchBulkJobResponse) GetObject() *PatchBulkJobResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/putflow.go b/internal/sdk/models/operations/putflow.go index e78e752..cc3878b 100644 --- a/internal/sdk/models/operations/putflow.go +++ b/internal/sdk/models/operations/putflow.go @@ -28,6 +28,28 @@ func (o *PutFlowRequest) GetFlowID() string { return o.FlowID } +// PutFlowResponseBody - The requested resource is forbidden +type PutFlowResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *PutFlowResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *PutFlowResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type PutFlowResponse struct { // The updated automation flow AutomationFlow *shared.AutomationFlow @@ -37,6 +59,8 @@ type PutFlowResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *PutFlowResponseBody } func (o *PutFlowResponse) GetAutomationFlow() *shared.AutomationFlow { @@ -66,3 +90,10 @@ func (o *PutFlowResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *PutFlowResponse) GetObject() *PutFlowResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/resumeexecutionwithtoken.go b/internal/sdk/models/operations/resumeexecutionwithtoken.go index c639108..8c0cea8 100644 --- a/internal/sdk/models/operations/resumeexecutionwithtoken.go +++ b/internal/sdk/models/operations/resumeexecutionwithtoken.go @@ -7,6 +7,28 @@ import ( "net/http" ) +// ResumeExecutionWithTokenResponseBody - The requested resource is forbidden +type ResumeExecutionWithTokenResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *ResumeExecutionWithTokenResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *ResumeExecutionWithTokenResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type ResumeExecutionWithTokenResponse struct { // HTTP response content type for this operation ContentType string @@ -16,6 +38,8 @@ type ResumeExecutionWithTokenResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *ResumeExecutionWithTokenResponseBody } func (o *ResumeExecutionWithTokenResponse) GetContentType() string { @@ -45,3 +69,10 @@ func (o *ResumeExecutionWithTokenResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *ResumeExecutionWithTokenResponse) GetObject() *ResumeExecutionWithTokenResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/retriggeraction.go b/internal/sdk/models/operations/retriggeraction.go index 9681e43..f9f0d54 100644 --- a/internal/sdk/models/operations/retriggeraction.go +++ b/internal/sdk/models/operations/retriggeraction.go @@ -37,6 +37,28 @@ func (o *RetriggerActionRequest) GetExecutionID() string { return o.ExecutionID } +// RetriggerActionResponseBody - The requested resource is forbidden +type RetriggerActionResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *RetriggerActionResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *RetriggerActionResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type RetriggerActionResponse struct { // HTTP response content type for this operation ContentType string @@ -44,6 +66,8 @@ type RetriggerActionResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *RetriggerActionResponseBody } func (o *RetriggerActionResponse) GetContentType() string { @@ -66,3 +90,10 @@ func (o *RetriggerActionResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *RetriggerActionResponse) GetObject() *RetriggerActionResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/operations/startexecution.go b/internal/sdk/models/operations/startexecution.go index 494bc7b..44289fc 100644 --- a/internal/sdk/models/operations/startexecution.go +++ b/internal/sdk/models/operations/startexecution.go @@ -7,6 +7,28 @@ import ( "net/http" ) +// StartExecutionResponseBody - The requested resource is forbidden +type StartExecutionResponseBody struct { + // The error message + Error *string `json:"error,omitempty"` + // The HTTP status code of the error + Status *int64 `json:"status,omitempty"` +} + +func (o *StartExecutionResponseBody) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *StartExecutionResponseBody) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + type StartExecutionResponse struct { // The created execution AutomationExecution *shared.AutomationExecution @@ -16,6 +38,8 @@ type StartExecutionResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // The requested resource is forbidden + Object *StartExecutionResponseBody } func (o *StartExecutionResponse) GetAutomationExecution() *shared.AutomationExecution { @@ -45,3 +69,10 @@ func (o *StartExecutionResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *StartExecutionResponse) GetObject() *StartExecutionResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/internal/sdk/models/shared/automationflow.go b/internal/sdk/models/shared/automationflow.go index f698fa7..aa233dd 100644 --- a/internal/sdk/models/shared/automationflow.go +++ b/internal/sdk/models/shared/automationflow.go @@ -3,17 +3,80 @@ package shared import ( + "encoding/json" + "fmt" "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/internal/utils" + "time" ) +// DisabledBy - Who disabled the flow (system or user) +type DisabledBy string + +const ( + DisabledBySystem DisabledBy = "system" + DisabledByUser DisabledBy = "user" +) + +func (e DisabledBy) ToPointer() *DisabledBy { + return &e +} +func (e *DisabledBy) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "system": + fallthrough + case "user": + *e = DisabledBy(v) + return nil + default: + return fmt.Errorf("invalid value for DisabledBy: %v", v) + } +} + +type DisableDetails struct { + // When the flow was disabled + DisabledAt time.Time `json:"disabled_at"` + // Who disabled the flow (system or user) + DisabledBy DisabledBy `json:"disabled_by"` +} + +func (d DisableDetails) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DisableDetails) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DisableDetails) GetDisabledAt() time.Time { + if o == nil { + return time.Time{} + } + return o.DisabledAt +} + +func (o *DisableDetails) GetDisabledBy() DisabledBy { + if o == nil { + return DisabledBy("") + } + return o.DisabledBy +} + type AutomationFlow struct { // Source blueprint/manifest ID used when automation is created via blueprints. Manifest []string `json:"_manifest,omitempty"` // The actions (nodes) of the automation flow - Actions []any `json:"actions"` - Conditions []ActionCondition `json:"conditions,omitempty"` + Actions []any `json:"actions"` + Conditions []ActionCondition `json:"conditions,omitempty"` + DisableDetails *DisableDetails `json:"disable_details,omitempty"` // Whether the automation is enabled or not - Enabled *bool `default:"true" json:"enabled"` + Enabled *bool `json:"enabled,omitempty"` // The triggering entity schema EntitySchema *string `json:"entity_schema,omitempty"` // A descriptive name for the Automation @@ -28,17 +91,6 @@ type AutomationFlow struct { Version *float64 `json:"version,omitempty"` } -func (a AutomationFlow) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(a, "", false) -} - -func (a *AutomationFlow) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { - return err - } - return nil -} - func (o *AutomationFlow) GetManifest() []string { if o == nil { return nil @@ -60,6 +112,13 @@ func (o *AutomationFlow) GetConditions() []ActionCondition { return o.Conditions } +func (o *AutomationFlow) GetDisableDetails() *DisableDetails { + if o == nil { + return nil + } + return o.DisableDetails +} + func (o *AutomationFlow) GetEnabled() *bool { if o == nil { return nil @@ -122,3 +181,109 @@ func (o *AutomationFlow) GetVersion() *float64 { } return o.Version } + +type AutomationFlowInput struct { + // Source blueprint/manifest ID used when automation is created via blueprints. + Manifest []string `json:"_manifest,omitempty"` + // The actions (nodes) of the automation flow + Actions []any `json:"actions"` + Conditions []ActionCondition `json:"conditions,omitempty"` + DisableDetails *DisableDetails `json:"disable_details,omitempty"` + // Whether the automation is enabled or not + Enabled *bool `json:"enabled,omitempty"` + // The triggering entity schema + EntitySchema *string `json:"entity_schema,omitempty"` + // A descriptive name for the Automation + FlowName string `json:"flow_name"` + Schedules []ActionSchedule `json:"schedules,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"` + // Version of the flow + Version *float64 `json:"version,omitempty"` +} + +func (o *AutomationFlowInput) GetManifest() []string { + if o == nil { + return nil + } + return o.Manifest +} + +func (o *AutomationFlowInput) GetActions() []any { + if o == nil { + return []any{} + } + return o.Actions +} + +func (o *AutomationFlowInput) GetConditions() []ActionCondition { + if o == nil { + return nil + } + return o.Conditions +} + +func (o *AutomationFlowInput) GetDisableDetails() *DisableDetails { + if o == nil { + return nil + } + return o.DisableDetails +} + +func (o *AutomationFlowInput) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} + +func (o *AutomationFlowInput) GetEntitySchema() *string { + if o == nil { + return nil + } + return o.EntitySchema +} + +func (o *AutomationFlowInput) GetFlowName() string { + if o == nil { + return "" + } + return o.FlowName +} + +func (o *AutomationFlowInput) GetSchedules() []ActionSchedule { + if o == nil { + return nil + } + return o.Schedules +} + +func (o *AutomationFlowInput) GetSystemFlow() *bool { + if o == nil { + return nil + } + return o.SystemFlow +} + +func (o *AutomationFlowInput) GetTriggerConditions() []any { + if o == nil { + return nil + } + return o.TriggerConditions +} + +func (o *AutomationFlowInput) GetTriggers() []AnyTrigger { + if o == nil { + return []AnyTrigger{} + } + return o.Triggers +} + +func (o *AutomationFlowInput) GetVersion() *float64 { + if o == nil { + return nil + } + return o.Version +} diff --git a/internal/sdk/models/shared/automationflowinput.go b/internal/sdk/models/shared/automationflowinput.go deleted file mode 100644 index 08a9a95..0000000 --- a/internal/sdk/models/shared/automationflowinput.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package shared - -import ( - "github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk/internal/utils" -) - -type AutomationFlowInput struct { - // Source blueprint/manifest ID used when automation is created via blueprints. - Manifest []string `json:"_manifest,omitempty"` - // The actions (nodes) of the automation flow - Actions []any `json:"actions"` - Conditions []ActionCondition `json:"conditions,omitempty"` - // Whether the automation is enabled or not - Enabled *bool `default:"true" json:"enabled"` - // The triggering entity schema - EntitySchema *string `json:"entity_schema,omitempty"` - // A descriptive name for the Automation - FlowName string `json:"flow_name"` - Schedules []ActionSchedule `json:"schedules,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"` - // Version of the flow - Version *float64 `json:"version,omitempty"` -} - -func (a AutomationFlowInput) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(a, "", false) -} - -func (a *AutomationFlowInput) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { - return err - } - return nil -} - -func (o *AutomationFlowInput) GetManifest() []string { - if o == nil { - return nil - } - return o.Manifest -} - -func (o *AutomationFlowInput) GetActions() []any { - if o == nil { - return []any{} - } - return o.Actions -} - -func (o *AutomationFlowInput) GetConditions() []ActionCondition { - if o == nil { - return nil - } - return o.Conditions -} - -func (o *AutomationFlowInput) GetEnabled() *bool { - if o == nil { - return nil - } - return o.Enabled -} - -func (o *AutomationFlowInput) GetEntitySchema() *string { - if o == nil { - return nil - } - return o.EntitySchema -} - -func (o *AutomationFlowInput) GetFlowName() string { - if o == nil { - return "" - } - return o.FlowName -} - -func (o *AutomationFlowInput) GetSchedules() []ActionSchedule { - if o == nil { - return nil - } - return o.Schedules -} - -func (o *AutomationFlowInput) GetSystemFlow() *bool { - if o == nil { - return nil - } - return o.SystemFlow -} - -func (o *AutomationFlowInput) GetTriggerConditions() []any { - if o == nil { - return nil - } - return o.TriggerConditions -} - -func (o *AutomationFlowInput) GetTriggers() []AnyTrigger { - if o == nil { - return []AnyTrigger{} - } - return o.Triggers -} - -func (o *AutomationFlowInput) GetVersion() *float64 { - if o == nil { - return nil - } - return o.Version -} diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go index 8625d91..089c122 100644 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -41,9 +41,6 @@ func Float32(f float32) *float32 { return &f } // Float64 provides a helper function to return a pointer to a float64 func Float64(f float64) *float64 { return &f } -// Pointer provides a helper function to return a pointer to a type -func Pointer[T any](v T) *T { return &v } - type sdkConfiguration struct { Client HTTPClient Security func(context.Context) (interface{}, error) @@ -153,8 +150,8 @@ func New(opts ...SDKOption) *SDK { Language: "go", OpenAPIDocVersion: "1.0.0", SDKVersion: "0.0.1", - GenVersion: "2.460.1", - UserAgent: "speakeasy-sdk/go 0.0.1 2.460.1 1.0.0 github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk", + GenVersion: "2.396.0", + UserAgent: "speakeasy-sdk/go 0.0.1 2.396.0 1.0.0 github.com/epilot-dev/terraform-provider-epilot-automation/internal/sdk", Hooks: hooks.New(), }, } diff --git a/internal/sdk/types/pointers.go b/internal/sdk/types/pointers.go index 35c439d..950d6a3 100644 --- a/internal/sdk/types/pointers.go +++ b/internal/sdk/types/pointers.go @@ -8,4 +8,3 @@ func Int(i int) *int { return &i } func Int64(i int64) *int64 { return &i } func Float32(f float32) *float32 { return &f } func Float64(f float64) *float64 { return &f } -func Pointer[T any](v T) *T { return &v } diff --git a/openapi.yml b/openapi.yml index 4461325..0de4d57 100644 --- a/openapi.yml +++ b/openapi.yml @@ -72,6 +72,8 @@ paths: application/json: schema: $ref: "#/components/schemas/AutomationFlow" + "403": + $ref: "#/components/responses/ForbiddenError" "/v1/automation/flows/{flow_id}": get: operationId: getFlow @@ -93,6 +95,10 @@ paths: application/json: schema: $ref: "#/components/schemas/AutomationFlow" + "403": + $ref: "#/components/responses/ForbiddenError" + "404": + $ref: "#/components/responses/NotFoundError" put: operationId: putFlow summary: putFlow @@ -119,6 +125,8 @@ paths: application/json: schema: $ref: "#/components/schemas/AutomationFlow" + "403": + $ref: "#/components/responses/ForbiddenError" delete: operationId: deleteFlow summary: deleteFlow @@ -134,11 +142,12 @@ paths: $ref: "#/components/schemas/AutomationFlowId" responses: "200": - description: The deleted automation flow - content: - application/json: - schema: - $ref: "#/components/schemas/AutomationFlow" + description: Flow deleted successfully + "403": + $ref: "#/components/responses/ForbiddenError" + "404": + $ref: "#/components/responses/NotFoundError" + "/v1/automation/executions": get: operationId: getExecutions @@ -164,12 +173,14 @@ paths: tags: - executions responses: - 200: + "200": description: List of automation executions content: application/json: schema: $ref: "#/components/schemas/GetExecutionsResp" + "403": + $ref: "#/components/responses/ForbiddenError" post: operationId: startExecution summary: startExecution @@ -183,12 +194,14 @@ paths: tags: - executions responses: - 201: + "201": description: The created execution content: application/json: schema: $ref: "#/components/schemas/AutomationExecution" + "403": + $ref: "#/components/responses/ForbiddenError" "/v1/automation/executions/bulk-jobs": post: operationId: bulkTriggerExecutions @@ -208,12 +221,14 @@ paths: tags: - bulk responses: - 202: + "202": description: Trigger Executions Job Info content: application/json: schema: $ref: "#/components/schemas/BulkTriggerJob" + "403": + $ref: "#/components/responses/ForbiddenError" "/v1/automation/executions/bulk-jobs/{job_id}": get: operationId: getBulkJob @@ -228,12 +243,16 @@ paths: tags: - bulk responses: - 200: + "200": description: Bulk Job Info content: application/json: schema: $ref: "#/components/schemas/BulkTriggerJob" + "403": + $ref: "#/components/responses/ForbiddenError" + "404": + $ref: "#/components/responses/NotFoundError" patch: operationId: patchBulkJob summary: patchBulkJob @@ -255,12 +274,16 @@ paths: tags: - bulk responses: - 200: + "200": description: Bulk Job Info content: application/json: schema: $ref: "#/components/schemas/BulkTriggerJob" + "403": + $ref: "#/components/responses/ForbiddenError" + "404": + $ref: "#/components/responses/NotFoundError" "/v1/automation/executions/{execution_id}": get: @@ -276,12 +299,16 @@ paths: tags: - executions responses: - 200: + "200": description: The returned execution content: application/json: schema: $ref: "#/components/schemas/AutomationExecution" + "403": + $ref: "#/components/responses/ForbiddenError" + "404": + $ref: "#/components/responses/NotFoundError" delete: operationId: cancelExecution summary: cancelExecution @@ -295,12 +322,16 @@ paths: tags: - executions responses: - 200: + "200": description: The cancelled execution content: application/json: schema: $ref: "#/components/schemas/AutomationExecution" + "403": + $ref: "#/components/responses/ForbiddenError" + "404": + $ref: "#/components/responses/NotFoundError" /v1/automation/executions/{execution_id}/{action_id}/retrigger: post: operationId: retriggerAction @@ -329,8 +360,12 @@ paths: schema: $ref: "#/components/schemas/RetryReq" responses: - 200: + "200": description: action re-triggered with success + "403": + $ref: "#/components/responses/ForbiddenError" + "404": + $ref: "#/components/responses/NotFoundError" /v1/automation/public/executions:resume: post: operationId: resumeExecutionWithToken @@ -351,14 +386,18 @@ paths: schema: $ref: "#/components/schemas/ResumeReq" responses: - 200: + "200": description: execution resumed with success content: application/json: schema: $ref: "#/components/schemas/ResumeResp" - 400: + "400": description: execution could not be resumed + "403": + $ref: "#/components/responses/ForbiddenError" + "404": + $ref: "#/components/responses/NotFoundError" components: securitySchemes: @@ -389,7 +428,20 @@ components: enabled: type: boolean description: Whether the automation is enabled or not - default: true + disable_details: + type: object + properties: + disabled_at: + type: string + format: date-time + description: When the flow was disabled + disabled_by: + type: string + enum: [system, user] + description: Who disabled the flow (system or user) + required: + - disabled_at + - disabled_by triggers: type: array items: @@ -1209,7 +1261,7 @@ components: items: $ref: "#/components/schemas/AssignUsersToStep" filter_with_purposes: - type: boolean + type: boolean TriggerWorkflowCondition: allOf: @@ -2385,5 +2437,39 @@ components: required: - execution - resumedAction + + ErrorObject: + type: object + properties: + status: + type: integer + description: The HTTP status code of the error + example: 400 + error: + type: string + description: The error message + + responses: + NotFoundError: + description: The requested resource was not found + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/ErrorObject" + - example: + status: 404 + error: Not Found + ForbiddenError: + description: The requested resource is forbidden + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/ErrorObject" + - example: + status: 403 + error: Forbidden + servers: -- url: https://automation.sls.epilot.io \ No newline at end of file +- url: https://automation.sls.epilot.io