From 31e3b8c54f851155fff469025dd8639fa3a8e2ad Mon Sep 17 00:00:00 2001 From: Nishu Goel Date: Mon, 23 Sep 2024 19:04:22 +0200 Subject: [PATCH] jsonencode logics --- .speakeasy/gen.lock | 15 +++-- README.md | 57 +++++++++++++---- docs/data-sources/journey.md | 12 +--- docs/index.md | 2 +- docs/resources/journey.md | 32 ++-------- examples/provider/provider.tf | 2 +- .../epilot-journey_journey/import.sh | 1 + .../epilot-journey_journey/resource.tf | 63 +++++++++++++++++++ gen.yaml | 2 +- internal/provider/journey_data_source.go | 22 ++----- internal/provider/journey_data_source_sdk.go | 27 ++------ internal/provider/journey_resource.go | 40 +++--------- internal/provider/journey_resource_sdk.go | 51 +++------------ .../journey_creation_request_v2_logics.go | 11 ---- internal/sdk/models/shared/journey.go | 8 +++ .../models/shared/journeycreationrequest.go | 8 +++ .../models/shared/journeycreationrequestv2.go | 31 +-------- internal/sdk/sdk.go | 7 ++- internal/sdk/types/pointers.go | 1 + overlay.yaml | 7 ++- 20 files changed, 180 insertions(+), 219 deletions(-) create mode 100644 examples/resources/epilot-journey_journey/import.sh create mode 100644 examples/resources/epilot-journey_journey/resource.tf delete mode 100644 internal/provider/types/journey_creation_request_v2_logics.go diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index dd45583..3c5f4ee 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 1afd37bc-cea9-4679-ac40-35ad5de414fc management: - docChecksum: df07a1414838ec1c3035cc68f0a2f119 + docChecksum: 0e536dabf767327b63b4963c5df07654 docVersion: 1.0.0 - speakeasyVersion: 1.393.2 - generationVersion: 2.413.0 - releaseVersion: 0.5.1 - configChecksum: 65e21fddd4b20ebd767c1d1cb13406f9 + speakeasyVersion: 1.401.3 + generationVersion: 2.421.3 + releaseVersion: 0.5.2 + configChecksum: e27f5aa24995ecaf812736d1da66d22a repoURL: https://github.com/epilot-dev/terraform-provider-epilot-journey.git repoSubDirectory: . published: true @@ -15,7 +15,7 @@ features: additionalDependencies: 0.1.0 additionalProperties: 0.1.2 constsAndDefaults: 0.1.4 - core: 3.24.9 + core: 3.24.12 deprecations: 2.81.1 envVarSecurityUsage: 0.1.0 globalSecurity: 2.81.8 @@ -67,7 +67,6 @@ generatedFiles: - internal/provider/types/journey_creation_request_v2_context_schema.go - internal/provider/types/journey_creation_request_v2_design.go - internal/provider/types/journey_creation_request_v2_embed_options.go - - internal/provider/types/journey_creation_request_v2_logics.go - internal/provider/types/journey_creation_request_v2_rules.go - internal/provider/types/journey_creation_request_v2_settings.go - internal/provider/utils.go @@ -155,7 +154,7 @@ examples: application/json: {"file_id": "1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p", "language": "de"} responses: "200": - application/json: {"docx_output": {"output_document": {"filename": "my-template-OR-001.docx", "s3ref": {"bucket": "document-api-preview-prod", "key": "preview/my-template.docx"}}, "preview_url": "https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx"}, "pdf_output": {"output_document": {"filename": "my-template-OR-001.pdf", "s3ref": {"bucket": "document-api-preview-prod", "key": "preview/my-template.pdf"}}, "preview_url": "https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf"}, "template_settings": {"custom_margins": {"bottom": 2.54, "top": 2.54}, "display_margin_guidelines": true, "enable_data_table_margin_autofix": false, "enabled_template_settings_persistence": false, "file_entity_id": "1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p", "misconfigured_margins": false, "suggested_margins": {"bottom": 2.54, "top": 2.54}, "template_with_datatable": false}} + application/json: {"docx_output": {"output_document": {"filename": "my-template-OR-001.docx", "s3ref": {"bucket": "document-api-prod", "key": "uploads/my-template.pdf"}}, "preview_url": "https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx"}, "pdf_output": {"output_document": {"filename": "my-template-OR-001.pdf", "s3ref": {"bucket": "document-api-prod", "key": "uploads/my-template.pdf"}}, "preview_url": "https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf"}, "template_settings": {"custom_margins": {"bottom": 2.54, "top": 2.54}, "display_margin_guidelines": true, "enable_data_table_margin_autofix": false, "enabled_template_settings_persistence": false, "file_entity_id": "1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p", "misconfigured_margins": false, "suggested_margins": {"bottom": 2.54, "top": 2.54}, "template_with_datatable": false}} getJourney: speakeasy-default-get-journey: parameters: diff --git a/README.md b/README.md index 68724e6..8235d54 100755 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ - -## SDK Installation + +## 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-journey = { source = "epilot-dev/epilot-journey" - version = "0.5.1" + version = "0.5.2" } } } @@ -27,19 +27,17 @@ provider "epilot-journey" { # Configuration options } ``` - + - -## SDK Example Usage + +## Testing the provider locally -### Testing the provider locally +#### Local Provider 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 @@ -48,7 +46,30 @@ 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-journey` +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-journey" = "" + } + + # 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 {} +} +``` + ## Summary @@ -59,10 +80,22 @@ Journey API: API to configure journeys ## Table of Contents -* [SDK Installation](#sdk-installation) -* [SDK Example Usage](#sdk-example-usage) +* [Installation](#installation) +* [Available Resources and Data Sources](#available-resources-and-data-sources) +* [Testing the provider locally](#testing-the-provider-locally) + +## Available Resources and Data Sources + +### Resources + +* [epilot-journey_journey](docs/resources/journey.md) +### Data Sources + +* [epilot-journey_journey](docs/data-sources/journey.md) + + diff --git a/docs/data-sources/journey.md b/docs/data-sources/journey.md index 308ae32..2e5638a 100644 --- a/docs/data-sources/journey.md +++ b/docs/data-sources/journey.md @@ -26,7 +26,7 @@ data "epilot-journey_journey" "my_journey" { - `context_schema` (Attributes List) (see [below for nested schema](#nestedatt--context_schema)) - `design` (Attributes) (see [below for nested schema](#nestedatt--design)) - `journey_id` (String) -- `logics` (Attributes List) (see [below for nested schema](#nestedatt--logics)) +- `logics` (String) Parsed as JSON. - `manifest` (List of String) Manifest/Blueprint ID used to create/update the entity - `name` (String) - `rules` (Attributes List) (see [below for nested schema](#nestedatt--rules)) @@ -53,16 +53,6 @@ Read-Only: - `theme` (Map of String) - -### Nested Schema for `logics` - -Read-Only: - -- `actions` (List of String) -- `auto_generated_id` (String) -- `conditions` (List of String) - - ### Nested Schema for `rules` diff --git a/docs/index.md b/docs/index.md index 24386e1..9d4de7e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,7 @@ terraform { required_providers { epilot-journey = { source = "epilot-dev/epilot-journey" - version = "0.5.1" + version = "0.5.2" } } } diff --git a/docs/resources/journey.md b/docs/resources/journey.md index ea8d195..6c8b9e4 100644 --- a/docs/resources/journey.md +++ b/docs/resources/journey.md @@ -17,7 +17,7 @@ resource "epilot-journey_journey" "my_journey" { brand_id = "...my_brand_id..." context_schema = [ { - is_required = false + is_required = true param_key = "...my_param_key..." should_load_entity = false type = "...my_type..." @@ -30,17 +30,7 @@ resource "epilot-journey_journey" "my_journey" { } } journey_id = "...my_journey_id..." - logics = [ - { - actions = [ - "..." - ] - auto_generated_id = "...my_auto_generated_id..." - conditions = [ - "..." - ] - } - ] + logics = "{ \"see\": \"documentation\" }" manifest = [ "123e4567-e89b-12d3-a456-426614174000" ] @@ -65,8 +55,8 @@ resource "epilot-journey_journey" "my_journey" { } lang = "en" mode = "inline" - scroll_to_top = false - top_bar = false + scroll_to_top = true + top_bar = true width = "...my_width..." } entity_id = "...my_entity_id..." @@ -80,7 +70,7 @@ resource "epilot-journey_journey" "my_journey" { runtime_entities = [ "ORDER" ] - safe_mode_automation = false + safe_mode_automation = true targeted_customer = "...my_targeted_customer..." template_id = "...my_template_id..." } @@ -102,7 +92,7 @@ resource "epilot-journey_journey" "my_journey" { - `context_schema` (Attributes List) (see [below for nested schema](#nestedatt--context_schema)) - `design` (Attributes) (see [below for nested schema](#nestedatt--design)) - `journey_id` (String) -- `logics` (Attributes List) (see [below for nested schema](#nestedatt--logics)) +- `logics` (String) Parsed as JSON. - `manifest` (List of String) Manifest/Blueprint ID used to create/update the entity - `rules` (Attributes List) (see [below for nested schema](#nestedatt--rules)) - `settings` (Attributes) (see [below for nested schema](#nestedatt--settings)) @@ -127,16 +117,6 @@ Optional: - `theme` (Map of String) - -### Nested Schema for `logics` - -Optional: - -- `actions` (List of String) Not Null -- `auto_generated_id` (String) -- `conditions` (List of String) Not Null - - ### Nested Schema for `rules` diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 41d097f..1423e92 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { epilot-journey = { source = "epilot-dev/epilot-journey" - version = "0.5.1" + version = "0.5.2" } } } diff --git a/examples/resources/epilot-journey_journey/import.sh b/examples/resources/epilot-journey_journey/import.sh new file mode 100644 index 0000000..25340c9 --- /dev/null +++ b/examples/resources/epilot-journey_journey/import.sh @@ -0,0 +1 @@ +terraform import epilot-journey_journey.my_epilot-journey_journey "" diff --git a/examples/resources/epilot-journey_journey/resource.tf b/examples/resources/epilot-journey_journey/resource.tf new file mode 100644 index 0000000..02c6a0b --- /dev/null +++ b/examples/resources/epilot-journey_journey/resource.tf @@ -0,0 +1,63 @@ +resource "epilot-journey_journey" "my_journey" { + brand_id = "...my_brand_id..." + context_schema = [ + { + is_required = true + param_key = "...my_param_key..." + should_load_entity = false + type = "...my_type..." + } + ] + design = { + logo_url = "...my_logo_url..." + theme = { + "see" : jsonencode("documentation"), + } + } + journey_id = "...my_journey_id..." + logics = "{ \"see\": \"documentation\" }" + manifest = [ + "123e4567-e89b-12d3-a456-426614174000" + ] + name = "...my_name..." + rules = [ + { + source = "...my_source..." + source_type = "step" + target = "...my_target..." + type = "inject" + } + ] + settings = { + address_suggestions_file_id = "...my_address_suggestions_file_id..." + address_suggestions_file_url = "...my_address_suggestions_file_url..." + description = "...my_description..." + design_id = "...my_design_id..." + embed_options = { + button = { + align = "center" + text = "...my_text..." + } + lang = "en" + mode = "inline" + scroll_to_top = true + top_bar = true + width = "...my_width..." + } + entity_id = "...my_entity_id..." + entity_tags = [ + "..." + ] + file_purposes = [ + "..." + ] + mappings_automation_id = "...my_mappings_automation_id..." + runtime_entities = [ + "ORDER" + ] + safe_mode_automation = true + targeted_customer = "...my_targeted_customer..." + template_id = "...my_template_id..." + } + steps = "{ \"see\": \"documentation\" }" +} \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index 0346ec5..e93bca1 100755 --- a/gen.yaml +++ b/gen.yaml @@ -12,7 +12,7 @@ generation: sdkFlattening: true telemetryEnabled: false terraform: - version: 0.5.1 + version: 0.5.2 additionalDataSources: [] additionalDependencies: {} additionalResources: [] diff --git a/internal/provider/journey_data_source.go b/internal/provider/journey_data_source.go index 23fd2b4..00a7076 100644 --- a/internal/provider/journey_data_source.go +++ b/internal/provider/journey_data_source.go @@ -33,7 +33,7 @@ type JourneyDataSourceModel struct { ContextSchema []tfTypes.JourneyCreationRequestV2ContextSchema `tfsdk:"context_schema"` Design *tfTypes.JourneyCreationRequestV2Design `tfsdk:"design"` JourneyID types.String `tfsdk:"journey_id"` - Logics []tfTypes.JourneyCreationRequestV2Logics `tfsdk:"logics"` + Logics types.String `tfsdk:"logics"` Manifest []types.String `tfsdk:"manifest"` Name types.String `tfsdk:"name"` Rules []tfTypes.JourneyCreationRequestV2Rules `tfsdk:"rules"` @@ -89,23 +89,9 @@ func (r *JourneyDataSource) Schema(ctx context.Context, req datasource.SchemaReq "journey_id": schema.StringAttribute{ Computed: true, }, - "logics": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "actions": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "auto_generated_id": schema.StringAttribute{ - Computed: true, - }, - "conditions": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - }, - }, + "logics": schema.StringAttribute{ + Computed: true, + Description: `Parsed as JSON.`, }, "manifest": schema.ListAttribute{ Computed: true, diff --git a/internal/provider/journey_data_source_sdk.go b/internal/provider/journey_data_source_sdk.go index f9301f9..d9a7a10 100644 --- a/internal/provider/journey_data_source_sdk.go +++ b/internal/provider/journey_data_source_sdk.go @@ -49,28 +49,11 @@ func (r *JourneyDataSourceModel) RefreshFromSharedJourneyCreationRequestV2(resp } } r.JourneyID = types.StringPointerValue(resp.JourneyID) - r.Logics = []tfTypes.JourneyCreationRequestV2Logics{} - if len(r.Logics) > len(resp.Logics) { - r.Logics = r.Logics[:len(resp.Logics)] - } - for logicsCount, logicsItem := range resp.Logics { - var logics1 tfTypes.JourneyCreationRequestV2Logics - logics1.Actions = []types.String{} - for _, v := range logicsItem.Actions { - logics1.Actions = append(logics1.Actions, types.StringValue(v)) - } - logics1.AutoGeneratedID = types.StringPointerValue(logicsItem.AutoGeneratedID) - logics1.Conditions = []types.String{} - for _, v := range logicsItem.Conditions { - logics1.Conditions = append(logics1.Conditions, types.StringValue(v)) - } - if logicsCount+1 > len(r.Logics) { - r.Logics = append(r.Logics, logics1) - } else { - r.Logics[logicsCount].Actions = logics1.Actions - r.Logics[logicsCount].AutoGeneratedID = logics1.AutoGeneratedID - r.Logics[logicsCount].Conditions = logics1.Conditions - } + if resp.Logics == nil { + r.Logics = types.StringNull() + } else { + logicsResult, _ := json.Marshal(resp.Logics) + r.Logics = types.StringValue(string(logicsResult)) } r.Name = types.StringValue(resp.Name) r.Rules = []tfTypes.JourneyCreationRequestV2Rules{} diff --git a/internal/provider/journey_resource.go b/internal/provider/journey_resource.go index 564e33a..3f2ead6 100644 --- a/internal/provider/journey_resource.go +++ b/internal/provider/journey_resource.go @@ -9,7 +9,6 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-journey/internal/sdk" "github.com/epilot-dev/terraform-provider-epilot-journey/internal/sdk/models/operations" "github.com/epilot-dev/terraform-provider-epilot-journey/internal/validators" - speakeasy_listvalidators "github.com/epilot-dev/terraform-provider-epilot-journey/internal/validators/listvalidators" speakeasy_objectvalidators "github.com/epilot-dev/terraform-provider-epilot-journey/internal/validators/objectvalidators" speakeasy_stringvalidators "github.com/epilot-dev/terraform-provider-epilot-journey/internal/validators/stringvalidators" "github.com/hashicorp/terraform-plugin-framework-validators/mapvalidator" @@ -41,7 +40,7 @@ type JourneyResourceModel struct { ContextSchema []tfTypes.JourneyCreationRequestV2ContextSchema `tfsdk:"context_schema"` Design *tfTypes.JourneyCreationRequestV2Design `tfsdk:"design"` JourneyID types.String `tfsdk:"journey_id"` - Logics []tfTypes.JourneyCreationRequestV2Logics `tfsdk:"logics"` + Logics types.String `tfsdk:"logics"` Manifest []types.String `tfsdk:"manifest"` Name types.String `tfsdk:"name"` Rules []tfTypes.JourneyCreationRequestV2Rules `tfsdk:"rules"` @@ -118,37 +117,12 @@ func (r *JourneyResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, Optional: true, }, - "logics": schema.ListNestedAttribute{ - Computed: true, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - }, - Attributes: map[string]schema.Attribute{ - "actions": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Description: `Not Null`, - Validators: []validator.List{ - speakeasy_listvalidators.NotNull(), - }, - }, - "auto_generated_id": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "conditions": schema.ListAttribute{ - Computed: true, - Optional: true, - ElementType: types.StringType, - Description: `Not Null`, - Validators: []validator.List{ - speakeasy_listvalidators.NotNull(), - }, - }, - }, + "logics": schema.StringAttribute{ + Computed: true, + Optional: true, + Description: `Parsed as JSON.`, + Validators: []validator.String{ + validators.IsValidJSON(), }, }, "manifest": schema.ListAttribute{ diff --git a/internal/provider/journey_resource_sdk.go b/internal/provider/journey_resource_sdk.go index 826ca5d..7c44a80 100644 --- a/internal/provider/journey_resource_sdk.go +++ b/internal/provider/journey_resource_sdk.go @@ -72,27 +72,9 @@ func (r *JourneyResourceModel) ToSharedJourneyCreationRequestV2() *shared.Journe } else { journeyID = nil } - var logics []shared.JourneyCreationRequestV2Logics = []shared.JourneyCreationRequestV2Logics{} - for _, logicsItem := range r.Logics { - var actions []string = []string{} - for _, actionsItem := range logicsItem.Actions { - actions = append(actions, actionsItem.ValueString()) - } - autoGeneratedID := new(string) - if !logicsItem.AutoGeneratedID.IsUnknown() && !logicsItem.AutoGeneratedID.IsNull() { - *autoGeneratedID = logicsItem.AutoGeneratedID.ValueString() - } else { - autoGeneratedID = nil - } - var conditions []string = []string{} - for _, conditionsItem := range logicsItem.Conditions { - conditions = append(conditions, conditionsItem.ValueString()) - } - logics = append(logics, shared.JourneyCreationRequestV2Logics{ - Actions: actions, - AutoGeneratedID: autoGeneratedID, - Conditions: conditions, - }) + var logics interface{} + if !r.Logics.IsUnknown() && !r.Logics.IsNull() { + _ = json.Unmarshal([]byte(r.Logics.ValueString()), &logics) } var name string name = r.Name.ValueString() @@ -315,28 +297,11 @@ func (r *JourneyResourceModel) RefreshFromSharedJourneyCreationRequestV2(resp *s } } r.JourneyID = types.StringPointerValue(resp.JourneyID) - r.Logics = []tfTypes.JourneyCreationRequestV2Logics{} - if len(r.Logics) > len(resp.Logics) { - r.Logics = r.Logics[:len(resp.Logics)] - } - for logicsCount, logicsItem := range resp.Logics { - var logics1 tfTypes.JourneyCreationRequestV2Logics - logics1.Actions = []types.String{} - for _, v := range logicsItem.Actions { - logics1.Actions = append(logics1.Actions, types.StringValue(v)) - } - logics1.AutoGeneratedID = types.StringPointerValue(logicsItem.AutoGeneratedID) - logics1.Conditions = []types.String{} - for _, v := range logicsItem.Conditions { - logics1.Conditions = append(logics1.Conditions, types.StringValue(v)) - } - if logicsCount+1 > len(r.Logics) { - r.Logics = append(r.Logics, logics1) - } else { - r.Logics[logicsCount].Actions = logics1.Actions - r.Logics[logicsCount].AutoGeneratedID = logics1.AutoGeneratedID - r.Logics[logicsCount].Conditions = logics1.Conditions - } + if resp.Logics == nil { + r.Logics = types.StringNull() + } else { + logicsResult, _ := json.Marshal(resp.Logics) + r.Logics = types.StringValue(string(logicsResult)) } r.Name = types.StringValue(resp.Name) r.Rules = []tfTypes.JourneyCreationRequestV2Rules{} diff --git a/internal/provider/types/journey_creation_request_v2_logics.go b/internal/provider/types/journey_creation_request_v2_logics.go deleted file mode 100644 index 3d396a5..0000000 --- a/internal/provider/types/journey_creation_request_v2_logics.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type JourneyCreationRequestV2Logics struct { - Actions []types.String `tfsdk:"actions"` - AutoGeneratedID types.String `tfsdk:"auto_generated_id"` - Conditions []types.String `tfsdk:"conditions"` -} diff --git a/internal/sdk/models/shared/journey.go b/internal/sdk/models/shared/journey.go index 3b4297e..cc9364e 100644 --- a/internal/sdk/models/shared/journey.go +++ b/internal/sdk/models/shared/journey.go @@ -404,6 +404,7 @@ type Settings struct { PublicToken *string `json:"publicToken,omitempty"` RuntimeEntities []RuntimeEntities `json:"runtimeEntities,omitempty"` SafeModeAutomation *bool `json:"safeModeAutomation,omitempty"` + Status *string `json:"status,omitempty"` TargetedCustomer *string `json:"targetedCustomer,omitempty"` TemplateID *string `json:"templateId,omitempty"` UseNewDesign *bool `json:"useNewDesign,omitempty"` @@ -514,6 +515,13 @@ func (o *Settings) GetSafeModeAutomation() *bool { return o.SafeModeAutomation } +func (o *Settings) GetStatus() *string { + if o == nil { + return nil + } + return o.Status +} + func (o *Settings) GetTargetedCustomer() *string { if o == nil { return nil diff --git a/internal/sdk/models/shared/journeycreationrequest.go b/internal/sdk/models/shared/journeycreationrequest.go index ee3573d..042057a 100644 --- a/internal/sdk/models/shared/journeycreationrequest.go +++ b/internal/sdk/models/shared/journeycreationrequest.go @@ -404,6 +404,7 @@ type JourneyCreationRequestSettings struct { PublicToken *string `json:"publicToken,omitempty"` RuntimeEntities []JourneyCreationRequestRuntimeEntities `json:"runtimeEntities,omitempty"` SafeModeAutomation *bool `json:"safeModeAutomation,omitempty"` + Status *string `json:"status,omitempty"` TargetedCustomer *string `json:"targetedCustomer,omitempty"` TemplateID *string `json:"templateId,omitempty"` UseNewDesign *bool `json:"useNewDesign,omitempty"` @@ -514,6 +515,13 @@ func (o *JourneyCreationRequestSettings) GetSafeModeAutomation() *bool { return o.SafeModeAutomation } +func (o *JourneyCreationRequestSettings) GetStatus() *string { + if o == nil { + return nil + } + return o.Status +} + func (o *JourneyCreationRequestSettings) GetTargetedCustomer() *string { if o == nil { return nil diff --git a/internal/sdk/models/shared/journeycreationrequestv2.go b/internal/sdk/models/shared/journeycreationrequestv2.go index 2cbcf3b..b32ed61 100644 --- a/internal/sdk/models/shared/journeycreationrequestv2.go +++ b/internal/sdk/models/shared/journeycreationrequestv2.go @@ -61,33 +61,6 @@ func (o *JourneyCreationRequestV2Design) GetTheme() map[string]any { return o.Theme } -type JourneyCreationRequestV2Logics struct { - Actions []string `json:"actions"` - AutoGeneratedID *string `json:"autoGeneratedId,omitempty"` - Conditions []string `json:"conditions"` -} - -func (o *JourneyCreationRequestV2Logics) GetActions() []string { - if o == nil { - return []string{} - } - return o.Actions -} - -func (o *JourneyCreationRequestV2Logics) GetAutoGeneratedID() *string { - if o == nil { - return nil - } - return o.AutoGeneratedID -} - -func (o *JourneyCreationRequestV2Logics) GetConditions() []string { - if o == nil { - return []string{} - } - return o.Conditions -} - type JourneyCreationRequestV2SourceType string const ( @@ -475,7 +448,7 @@ type JourneyCreationRequestV2 struct { ContextSchema []JourneyCreationRequestV2ContextSchema `json:"contextSchema,omitempty"` Design *JourneyCreationRequestV2Design `json:"design,omitempty"` JourneyID *string `json:"journeyId,omitempty"` - Logics []JourneyCreationRequestV2Logics `json:"logics,omitempty"` + Logics any `json:"logics,omitempty"` Name string `json:"name"` Rules []JourneyCreationRequestV2Rules `json:"rules,omitempty"` Settings *JourneyCreationRequestV2Settings `json:"settings,omitempty"` @@ -517,7 +490,7 @@ func (o *JourneyCreationRequestV2) GetJourneyID() *string { return o.JourneyID } -func (o *JourneyCreationRequestV2) GetLogics() []JourneyCreationRequestV2Logics { +func (o *JourneyCreationRequestV2) GetLogics() any { if o == nil { return nil } diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go index bbd262b..720d34e 100644 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -41,6 +41,9 @@ 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) @@ -146,8 +149,8 @@ func New(opts ...SDKOption) *SDK { Language: "go", OpenAPIDocVersion: "1.0.0", SDKVersion: "0.0.1", - GenVersion: "2.413.0", - UserAgent: "speakeasy-sdk/go 0.0.1 2.413.0 1.0.0 github.com/epilot-dev/terraform-provider-epilot-journey/internal/sdk", + GenVersion: "2.421.3", + UserAgent: "speakeasy-sdk/go 0.0.1 2.421.3 1.0.0 github.com/epilot-dev/terraform-provider-epilot-journey/internal/sdk", Hooks: hooks.New(), }, } diff --git a/internal/sdk/types/pointers.go b/internal/sdk/types/pointers.go index 950d6a3..35c439d 100644 --- a/internal/sdk/types/pointers.go +++ b/internal/sdk/types/pointers.go @@ -8,3 +8,4 @@ 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/overlay.yaml b/overlay.yaml index 0d8230a..310362f 100644 --- a/overlay.yaml +++ b/overlay.yaml @@ -68,4 +68,9 @@ actions: remove: true - target: $["components"]["schemas"]["JourneyCreationRequestV2"]["properties"] update: - steps: {} \ No newline at end of file + steps: {} + - target: $["components"]["schemas"]["JourneyCreationRequestV2"]["properties"]["logics"] + remove: true + - target: $["components"]["schemas"]["JourneyCreationRequestV2"]["properties"] + update: + logics: {} \ No newline at end of file