From d34e1a25a870dd7f8af19916b9015e2b296e8737 Mon Sep 17 00:00:00 2001 From: Nishu Goel Date: Mon, 18 Mar 2024 15:44:26 +0100 Subject: [PATCH] chore: regen TF entitymapping --- .speakeasy/gen.lock | 42 +- README.md | 2 +- docs/data-sources/entity_mapping.md | 240 ---- docs/index.md | 2 +- docs/resources/entity_mapping.md | 313 ----- .../data-source.tf | 3 - examples/provider/provider.tf | 2 +- .../resource.tf | 86 +- gen.yaml | 2 +- go.mod | 3 +- go.sum | 2 + .../provider/entitymapping_data_source.go | 449 ------- .../provider/entitymapping_data_source_sdk.go | 233 ---- internal/provider/entitymapping_resource.go | 1095 ----------------- .../provider/entitymapping_resource_sdk.go | 640 ---------- internal/provider/provider.go | 8 +- internal/provider/type_append_value_mapper.go | 13 - internal/provider/type_config.go | 8 - internal/provider/type_copy_value_mapper.go | 11 - internal/provider/type_entity_ref.go | 10 - internal/provider/type_journey_ref.go | 9 - internal/provider/type_mapping_attribute.go | 9 - .../provider/type_mapping_attribute_v2.go | 11 - internal/provider/type_mapping_attributes.go | 8 - internal/provider/type_one.go | 9 - internal/provider/type_operation_node.go | 10 - .../provider/type_operation_object_node.go | 15 - internal/provider/type_random_operation.go | 8 - internal/provider/type_relation_attribute.go | 15 - internal/provider/type_set_value_mapper.go | 11 - internal/provider/type_source_config.go | 10 - internal/provider/type_source_filter.go | 14 - internal/provider/type_target_config.go | 19 - internal/provider/type_two.go | 11 - internal/provider/type_uniq.go | 10 - internal/sdk/mappings.go | 70 -- .../sdk/pkg/models/shared/mappingconfig.go | 58 +- .../pkg/models/shared/operationobjectnode.go | 22 +- internal/sdk/pkg/models/shared/owner.go | 62 + .../sdk/pkg/models/shared/randomoperation.go | 42 +- .../sdk/pkg/models/shared/sourceconfig.go | 20 +- internal/sdk/pkg/utils/json.go | 2 +- internal/sdk/pkg/utils/security.go | 4 +- internal/sdk/sdk.go | 6 +- main.go | 2 +- overlay.yaml | 6 +- 46 files changed, 206 insertions(+), 3421 deletions(-) delete mode 100644 docs/data-sources/entity_mapping.md delete mode 100644 docs/resources/entity_mapping.md delete mode 100644 examples/data-sources/epilot-entitymapping_entity_mapping/data-source.tf delete mode 100644 internal/provider/entitymapping_data_source.go delete mode 100644 internal/provider/entitymapping_data_source_sdk.go delete mode 100644 internal/provider/entitymapping_resource.go delete mode 100644 internal/provider/entitymapping_resource_sdk.go delete mode 100644 internal/provider/type_append_value_mapper.go delete mode 100644 internal/provider/type_config.go delete mode 100644 internal/provider/type_copy_value_mapper.go delete mode 100644 internal/provider/type_entity_ref.go delete mode 100644 internal/provider/type_journey_ref.go delete mode 100644 internal/provider/type_mapping_attribute.go delete mode 100644 internal/provider/type_mapping_attribute_v2.go delete mode 100644 internal/provider/type_mapping_attributes.go delete mode 100644 internal/provider/type_one.go delete mode 100644 internal/provider/type_operation_node.go delete mode 100644 internal/provider/type_operation_object_node.go delete mode 100644 internal/provider/type_random_operation.go delete mode 100644 internal/provider/type_relation_attribute.go delete mode 100644 internal/provider/type_set_value_mapper.go delete mode 100644 internal/provider/type_source_config.go delete mode 100644 internal/provider/type_source_filter.go delete mode 100644 internal/provider/type_target_config.go delete mode 100644 internal/provider/type_two.go delete mode 100644 internal/provider/type_uniq.go create mode 100644 internal/sdk/pkg/models/shared/owner.go diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 6bd49e0..ec4e484 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,25 +1,25 @@ lockVersion: 2.0.0 id: a76d605f-5242-4bd3-8bd6-56a119e8eec5 management: - docChecksum: 9831faf457882e4b7bc0b7c48f868243 + docChecksum: c4a1c7dbe4bb723c700940bbcaa52687 docVersion: 1.0.0 speakeasyVersion: internal - generationVersion: 2.277.0 - releaseVersion: 0.4.0 - configChecksum: fb45ccd414fc5968746be04cae188174 + generationVersion: 2.230.1 + releaseVersion: 0.4.1 + configChecksum: 66173a018b51a35513bfadec473b23fc repoURL: https://github.com/epilot-dev/terraform-provider-epilot-entitymapping.git repoSubDirectory: . published: true features: terraform: additionalProperties: 0.1.2 - constsAndDefaults: 0.1.4 - core: 3.10.2 + constsAndDefaults: 0.1.2 + core: 3.8.1 deprecations: 2.81.1 - globalSecurity: 2.81.5 + globalSecurity: 2.81.2 globalServerURLs: 2.82.1 retries: 2.81.1 - unions: 2.81.9 + unions: 2.81.7 generatedFiles: - internal/sdk/mappings.go - internal/sdk/sdk.go @@ -109,6 +109,7 @@ generatedFiles: - internal/sdk/pkg/models/shared/sourceconfig.go - internal/sdk/pkg/models/shared/journeyref.go - internal/sdk/pkg/models/shared/entityref.go + - internal/sdk/pkg/models/shared/owner.go - internal/sdk/pkg/models/shared/executemappingresp.go - internal/sdk/pkg/models/shared/mappingwarning.go - internal/sdk/pkg/models/shared/mappingfailure.go @@ -122,33 +123,8 @@ generatedFiles: - internal/sdk/pkg/models/shared/mappinghistoryentry.go - internal/sdk/pkg/models/shared/searchmappingreq.go - internal/sdk/pkg/models/shared/security.go - - internal/provider/type_entity_ref.go - - internal/provider/type_journey_ref.go - - internal/provider/type_config.go - - internal/provider/type_source_config.go - - internal/provider/type_append_value_mapper.go - - internal/provider/type_copy_value_mapper.go - - internal/provider/type_set_value_mapper.go - - internal/provider/type_mapping_attribute.go - - internal/provider/type_one.go - - internal/provider/type_two.go - - internal/provider/type_random_operation.go - - internal/provider/type_uniq.go - - internal/provider/type_operation_object_node.go - - internal/provider/type_operation_node.go - - internal/provider/type_mapping_attribute_v2.go - - internal/provider/type_mapping_attributes.go - - internal/provider/type_source_filter.go - - internal/provider/type_relation_attribute.go - - internal/provider/type_target_config.go - USAGE.md - internal/provider/provider.go - examples/provider/provider.tf - - internal/provider/entitymapping_resource.go - - internal/provider/entitymapping_resource_sdk.go - - examples/resources/epilot-entitymapping_entity_mapping/resource.tf - - internal/provider/entitymapping_data_source.go - - internal/provider/entitymapping_data_source_sdk.go - - examples/data-sources/epilot-entitymapping_entity_mapping/data-source.tf - internal/sdk/pkg/models/operations/options.go - .gitattributes diff --git a/README.md b/README.md index 5247d4b..2cf6d24 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ terraform { required_providers { epilot-entitymapping = { source = "epilot-dev/epilot-entitymapping" - version = "0.4.0" + version = "0.4.1" } } } diff --git a/docs/data-sources/entity_mapping.md b/docs/data-sources/entity_mapping.md deleted file mode 100644 index b4f15a1..0000000 --- a/docs/data-sources/entity_mapping.md +++ /dev/null @@ -1,240 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "epilot-entitymapping_entity_mapping Data Source - terraform-provider-epilot-entitymapping" -subcategory: "" -description: |- - EntityMapping DataSource ---- - -# epilot-entitymapping_entity_mapping (Data Source) - -EntityMapping DataSource - -## Example Usage - -```terraform -data "epilot-entitymapping_entity_mapping" "my_entitymapping" { - id = "uuidv4" -} -``` - - -## Schema - -### Required - -- `id` (String) Mapping Config Id - -### Read-Only - -- `org_id` (String) -- `source` (Attributes) (see [below for nested schema](#nestedatt--source)) -- `targets` (Attributes List) (see [below for nested schema](#nestedatt--targets)) -- `version` (Number) - - -### Nested Schema for `source` - -Read-Only: - -- `config` (Attributes) (see [below for nested schema](#nestedatt--source--config)) -- `type` (String) must be one of ["journey", "entity"] - - -### Nested Schema for `source.config` - -Read-Only: - -- `entity_ref` (Attributes) (see [below for nested schema](#nestedatt--source--config--entity_ref)) -- `journey_ref` (Attributes) (see [below for nested schema](#nestedatt--source--config--journey_ref)) - - -### Nested Schema for `source.config.entity_ref` - -Read-Only: - -- `entity_id` (String) id of the source entity to be mapped -- `entity_schema` (String) schema of the source entity - - - -### Nested Schema for `source.config.journey_ref` - -Read-Only: - -- `journey_id` (String) - - - - - -### Nested Schema for `targets` - -Read-Only: - -- `allow_failure` (Boolean) Pass it as true, when you don't want failures to interrupt the mapping process. -- `condition_mode` (String) Parsed as JSON. -- `conditions` (String) Parsed as JSON. -- `id` (String) Identifier for target configuration. Useful for later usages when trying to identify which target config to map to. -- `linkback_relation_attribute` (String) Relation attribute on the main entity where the target entity will be linked. Set to false to disable linkback -- `linkback_relation_tags` (List of String) Relation tags (labels) to include in main entity linkback relation attribute -- `mapping_attributes` (Attributes List) Attribute mappings (see [below for nested schema](#nestedatt--targets--mapping_attributes)) -- `name` (String) A name for this configuration -- `relation_attributes` (Attributes List) Relation mappings (see [below for nested schema](#nestedatt--targets--relation_attributes)) -- `target_schema` (String) Schema of target entity -- `target_unique` (List of String) Unique key for target entity (see upsertEntity of Entity API) - - -### Nested Schema for `targets.mapping_attributes` - -Read-Only: - -- `mapping_attribute` (Attributes) (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute)) -- `mapping_attribute_v2` (Attributes) (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute` - -Read-Only: - -- `append_value_mapper` (Attributes) (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute--append_value_mapper)) -- `copy_value_mapper` (Attributes) (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute--copy_value_mapper)) -- `set_value_mapper` (Attributes) (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute--set_value_mapper)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute.set_value_mapper` - -Read-Only: - -- `mode` (String) - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property. - -must be one of ["copy_if_exists", "append_if_exists", "set_value"] -- `source` (String) JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price -- `target` (String) JSON like target path for the attribute. Eg. last_name -- `target_unique` (List of String) Array of keys which should be used when checking for uniqueness. Eg: [country, city, postal_code] -- `value_json` (String) To be provided only when mapping json objects into a target attribute. Eg array of addresses. - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute.set_value_mapper` - -Read-Only: - -- `mode` (String) - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property. - -must be one of ["copy_if_exists", "append_if_exists", "set_value"] -- `source` (String) JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price -- `target` (String) JSON like target path for the attribute. Eg. last_name - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute.set_value_mapper` - -Read-Only: - -- `mode` (String) - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property. - -must be one of ["copy_if_exists", "append_if_exists", "set_value"] -- `target` (String) JSON like target path for the attribute. Eg. last_name -- `value` (String) Any value to be set: string, number, string[], number[], JSON object, etc. It will override existing values, if any. - -Parsed as JSON. - - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2` - -Read-Only: - -- `operation` (Attributes) Mapping operation nodes are either primitive values or operation node objects (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--operation)) -- `origin` (String) Origin of an attribute. must be one of ["system_recommendation", "user_manually"] -- `target` (String) Target JSON path for the attribute to set - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target` - -Read-Only: - -- `any` (String) Parsed as JSON. -- `operation_object_node` (Attributes) (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node` - -Read-Only: - -- `additional_properties` (String) Parsed as JSON. -- `append` (List of String) Append to array -- `copy` (String) Copy JSONPath value from source entity context -- `random` (Attributes) (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node--random)) -- `set` (String) Parsed as JSON. -- `template` (String) Define handlebars template to output a string -- `uniq` (Attributes) Unique array (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node--uniq)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node.uniq` - -Read-Only: - -- `one` (Attributes) (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node--uniq--one)) -- `two` (Attributes) (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node--uniq--two)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node.uniq.two` - -Read-Only: - -- `type` (String) must be one of ["uuid", "nanoid"] - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node.uniq.two` - -Read-Only: - -- `max` (Number) -- `min` (Number) -- `type` (String) must be one of ["number"] - - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node.uniq` - -Read-Only: - -- `array_of_str` (List of String) -- `boolean` (Boolean) - - - - - - - -### Nested Schema for `targets.relation_attributes` - -Read-Only: - -- `mode` (String) must be one of ["append", "prepend", "set"] -- `origin` (String) Origin of an attribute. must be one of ["system_recommendation", "user_manually"] -- `related_to` (Map of String) -- `source_filter` (Attributes) A filter to identify which source entities to pick as relations from main entity (see [below for nested schema](#nestedatt--targets--relation_attributes--source_filter)) -- `target` (String) Target attribute to store the relation in -- `target_tags` (List of String) Relation tags (labels) to set for the stored relations -- `target_tags_include_source` (Boolean) Include all relation tags (labels) present on the main entity relation - - -### Nested Schema for `targets.relation_attributes.source_filter` - -Read-Only: - -- `attribute` (String) Filter by a specific relation attribute on the main entity -- `limit` (Number) Limit relations to maximum number (default, all matched relations) -- `relation_tag` (String) Filter by relation tag (label) on the main entity -- `schema` (String) Filter by specific schema -- `self` (Boolean) Picks main entity as relation (overrides other filters) -- `tag` (String) Filter by a specific tag on the related entity - - diff --git a/docs/index.md b/docs/index.md index c2a6d42..73f0649 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,7 @@ terraform { required_providers { epilot-entitymapping = { source = "epilot-dev/epilot-entitymapping" - version = "0.4.0" + version = "0.4.1" } } } diff --git a/docs/resources/entity_mapping.md b/docs/resources/entity_mapping.md deleted file mode 100644 index 1333a1b..0000000 --- a/docs/resources/entity_mapping.md +++ /dev/null @@ -1,313 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "epilot-entitymapping_entity_mapping Resource - terraform-provider-epilot-entitymapping" -subcategory: "" -description: |- - EntityMapping Resource ---- - -# epilot-entitymapping_entity_mapping (Resource) - -EntityMapping Resource - -## Example Usage - -```terraform -resource "epilot-entitymapping_entity_mapping" "my_entitymapping" { - id = "20fec022-fdfb-42b1-b545-9c73d2673f99" - org_id = "...my_org_id..." - source = { - config = { - entity_ref = { - entity_id = "...my_entity_id..." - entity_schema = "submission" - } - } - type = "journey" - } - targets = [ - { - allow_failure = false - condition_mode = "{ \"see\": \"documentation\" }" - conditions = "{ \"see\": \"documentation\" }" - id = "cd4d3a54-7d70-4901-810e-0737604f94fa" - linkback_relation_attribute = "...my_linkback_relation_attribute..." - linkback_relation_tags = [ - "...", - ] - mapping_attributes = [ - { - mapping_attribute = { - append_value_mapper = { - mode = "set_value" - source = "...my_source..." - target = "...my_target..." - target_unique = [ - "...", - ] - value_json = "...my_value_json..." - } - } - }, - ] - name = "Terence Wehner" - relation_attributes = [ - { - mode = "append" - origin = "system_recommendation" - related_to = { - "Future" = "{ \"see\": \"documentation\" }" - "Pickup" = "{ \"see\": \"documentation\" }" - } - source_filter = { - attribute = "...my_attribute..." - limit = 4 - relation_tag = "...my_relation_tag..." - schema = "...my_schema..." - self = true - tag = "...my_tag..." - } - target = "...my_target..." - target_tags = [ - "...", - ] - target_tags_include_source = false - }, - ] - target_schema = "...my_target_schema..." - target_unique = [ - "...", - ] - }, - ] - version = 34.53 -} -``` - - -## Schema - -### Required - -- `id` (String) Mapping Config Id. Requires replacement if changed. -- `org_id` (String) Requires replacement if changed. -- `source` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--source)) -- `targets` (Attributes List) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets)) -- `version` (Number) Requires replacement if changed. - - -### Nested Schema for `source` - -Optional: - -- `config` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--source--config)) -- `type` (String) Requires replacement if changed. ; must be one of ["journey", "entity"] - - -### Nested Schema for `source.config` - -Optional: - -- `entity_ref` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--source--config--entity_ref)) -- `journey_ref` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--source--config--journey_ref)) - - -### Nested Schema for `source.config.entity_ref` - -Optional: - -- `entity_id` (String) id of the source entity to be mapped. Requires replacement if changed. ; Not Null -- `entity_schema` (String) schema of the source entity. Requires replacement if changed. - - - -### Nested Schema for `source.config.journey_ref` - -Optional: - -- `journey_id` (String) Requires replacement if changed. - - - - - -### Nested Schema for `targets` - -Optional: - -- `allow_failure` (Boolean) Pass it as true, when you don't want failures to interrupt the mapping process. Requires replacement if changed. -- `condition_mode` (String) Parsed as JSON. -- `conditions` (String) Parsed as JSON. -- `id` (String) Identifier for target configuration. Useful for later usages when trying to identify which target config to map to. Requires replacement if changed. -- `linkback_relation_attribute` (String) Relation attribute on the main entity where the target entity will be linked. Set to false to disable linkback - -Requires replacement if changed. ; Default: "mapped_entities" -- `linkback_relation_tags` (List of String) Relation tags (labels) to include in main entity linkback relation attribute. Requires replacement if changed. -- `mapping_attributes` (Attributes List) Attribute mappings. Requires replacement if changed. ; Not Null (see [below for nested schema](#nestedatt--targets--mapping_attributes)) -- `name` (String) A name for this configuration. Requires replacement if changed. -- `relation_attributes` (Attributes List) Relation mappings. Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--relation_attributes)) -- `target_schema` (String) Schema of target entity. Requires replacement if changed. ; Not Null -- `target_unique` (List of String) Unique key for target entity (see upsertEntity of Entity API). Requires replacement if changed. - - -### Nested Schema for `targets.mapping_attributes` - -Optional: - -- `mapping_attribute` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute)) -- `mapping_attribute_v2` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute` - -Optional: - -- `append_value_mapper` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute--append_value_mapper)) -- `copy_value_mapper` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute--copy_value_mapper)) -- `set_value_mapper` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute--set_value_mapper)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute.set_value_mapper` - -Optional: - -- `mode` (String) - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property. - -Requires replacement if changed. ; Not Null; must be one of ["copy_if_exists", "append_if_exists", "set_value"] -- `source` (String) JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price - -Requires replacement if changed. -- `target` (String) JSON like target path for the attribute. Eg. last_name. Requires replacement if changed. ; Not Null -- `target_unique` (List of String) Array of keys which should be used when checking for uniqueness. Eg: [country, city, postal_code] - -Requires replacement if changed. -- `value_json` (String) To be provided only when mapping json objects into a target attribute. Eg array of addresses. - -Requires replacement if changed. ; Not Null - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute.set_value_mapper` - -Optional: - -- `mode` (String) - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property. - -Requires replacement if changed. ; Not Null; must be one of ["copy_if_exists", "append_if_exists", "set_value"] -- `source` (String) JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price - -Requires replacement if changed. ; Not Null -- `target` (String) JSON like target path for the attribute. Eg. last_name. Requires replacement if changed. ; Not Null - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute.set_value_mapper` - -Optional: - -- `mode` (String) - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property. - -Requires replacement if changed. ; Not Null; must be one of ["copy_if_exists", "append_if_exists", "set_value"] -- `target` (String) JSON like target path for the attribute. Eg. last_name. Requires replacement if changed. ; Not Null -- `value` (String) Any value to be set: string, number, string[], number[], JSON object, etc. It will override existing values, if any. - -Parsed as JSON. - - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2` - -Optional: - -- `operation` (Attributes) Mapping operation nodes are either primitive values or operation node objects. Requires replacement if changed. ; Not Null (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--operation)) -- `origin` (String) Origin of an attribute. Requires replacement if changed. ; must be one of ["system_recommendation", "user_manually"] -- `target` (String) Target JSON path for the attribute to set. Requires replacement if changed. ; Not Null - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target` - -Optional: - -- `any` (String) Parsed as JSON. -- `operation_object_node` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node` - -Optional: - -- `additional_properties` (String) Parsed as JSON. -- `append` (List of String) Append to array. Requires replacement if changed. -- `copy` (String) Copy JSONPath value from source entity context. Requires replacement if changed. -- `random` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node--random)) -- `set` (String) Parsed as JSON. -- `template` (String) Define handlebars template to output a string. Requires replacement if changed. -- `uniq` (Attributes) Unique array. Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node--uniq)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node.uniq` - -Optional: - -- `one` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node--uniq--one)) -- `two` (Attributes) Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--mapping_attributes--mapping_attribute_v2--target--operation_object_node--uniq--two)) - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node.uniq.two` - -Optional: - -- `type` (String) Requires replacement if changed. ; Not Null; must be one of ["uuid", "nanoid"] - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node.uniq.two` - -Optional: - -- `max` (Number) Requires replacement if changed. ; Default: 1 -- `min` (Number) Requires replacement if changed. ; Default: 0 -- `type` (String) Requires replacement if changed. ; Not Null; must be one of ["number"] - - - - -### Nested Schema for `targets.mapping_attributes.mapping_attribute_v2.target.operation_object_node.uniq` - -Optional: - -- `array_of_str` (List of String) Requires replacement if changed. -- `boolean` (Boolean) Requires replacement if changed. - - - - - - - -### Nested Schema for `targets.relation_attributes` - -Optional: - -- `mode` (String) Requires replacement if changed. ; Not Null; must be one of ["append", "prepend", "set"] -- `origin` (String) Origin of an attribute. Requires replacement if changed. ; must be one of ["system_recommendation", "user_manually"] -- `related_to` (Map of String) Requires replacement if changed. -- `source_filter` (Attributes) A filter to identify which source entities to pick as relations from main entity. Requires replacement if changed. (see [below for nested schema](#nestedatt--targets--relation_attributes--source_filter)) -- `target` (String) Target attribute to store the relation in. Requires replacement if changed. ; Not Null -- `target_tags` (List of String) Relation tags (labels) to set for the stored relations. Requires replacement if changed. -- `target_tags_include_source` (Boolean) Include all relation tags (labels) present on the main entity relation. Requires replacement if changed. ; Default: false - - -### Nested Schema for `targets.relation_attributes.source_filter` - -Optional: - -- `attribute` (String) Filter by a specific relation attribute on the main entity. Requires replacement if changed. -- `limit` (Number) Limit relations to maximum number (default, all matched relations). Requires replacement if changed. -- `relation_tag` (String) Filter by relation tag (label) on the main entity. Requires replacement if changed. -- `schema` (String) Filter by specific schema. Requires replacement if changed. -- `self` (Boolean) Picks main entity as relation (overrides other filters). Requires replacement if changed. ; Default: false -- `tag` (String) Filter by a specific tag on the related entity. Requires replacement if changed. - - diff --git a/examples/data-sources/epilot-entitymapping_entity_mapping/data-source.tf b/examples/data-sources/epilot-entitymapping_entity_mapping/data-source.tf deleted file mode 100644 index c113301..0000000 --- a/examples/data-sources/epilot-entitymapping_entity_mapping/data-source.tf +++ /dev/null @@ -1,3 +0,0 @@ -data "epilot-entitymapping_entity_mapping" "my_entitymapping" { - id = "uuidv4" -} \ No newline at end of file diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index f981afd..2a47978 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { epilot-entitymapping = { source = "epilot-dev/epilot-entitymapping" - version = "0.4.0" + version = "0.4.1" } } } diff --git a/examples/resources/epilot-entitymapping_entity_mapping/resource.tf b/examples/resources/epilot-entitymapping_entity_mapping/resource.tf index c9e1042..cf8af15 100644 --- a/examples/resources/epilot-entitymapping_entity_mapping/resource.tf +++ b/examples/resources/epilot-entitymapping_entity_mapping/resource.tf @@ -1,69 +1,23 @@ -resource "epilot-entitymapping_entity_mapping" "my_entitymapping" { - id = "20fec022-fdfb-42b1-b545-9c73d2673f99" - org_id = "...my_org_id..." - source = { - config = { - entity_ref = { - entity_id = "...my_entity_id..." - entity_schema = "submission" - } +terraform { + required_providers { + epilot-entitymapping = { + source = "epilot-dev/epilot-entitymapping" + version = "0.4.1" } - type = "journey" } - targets = [ - { - allow_failure = false - condition_mode = "{ \"see\": \"documentation\" }" - conditions = "{ \"see\": \"documentation\" }" - id = "cd4d3a54-7d70-4901-810e-0737604f94fa" - linkback_relation_attribute = "...my_linkback_relation_attribute..." - linkback_relation_tags = [ - "...", - ] - mapping_attributes = [ - { - mapping_attribute = { - append_value_mapper = { - mode = "set_value" - source = "...my_source..." - target = "...my_target..." - target_unique = [ - "...", - ] - value_json = "...my_value_json..." - } - } - }, - ] - name = "Terence Wehner" - relation_attributes = [ - { - mode = "append" - origin = "system_recommendation" - related_to = { - "Future" = "{ \"see\": \"documentation\" }" - "Pickup" = "{ \"see\": \"documentation\" }" - } - source_filter = { - attribute = "...my_attribute..." - limit = 4 - relation_tag = "...my_relation_tag..." - schema = "...my_schema..." - self = true - tag = "...my_tag..." - } - target = "...my_target..." - target_tags = [ - "...", - ] - target_tags_include_source = false - }, - ] - target_schema = "...my_target_schema..." - target_unique = [ - "...", - ] - }, - ] - version = 34.53 +} + + +variable "epilot_auth" { + type = string +} + +provider "epilot-entitymapping" { + # Configuration options + epilot_auth = var.epilot_auth +} + + +resource "epilot-entitymapping_entity_mapping" "new_mapping" { + # Configuration options } \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index 88bdb7c..a363647 100755 --- a/gen.yaml +++ b/gen.yaml @@ -13,7 +13,7 @@ generation: sdkFlattening: true telemetryEnabled: false terraform: - version: 0.4.0 + version: 0.4.1 author: epilot-dev imports: option: openapi diff --git a/go.mod b/go.mod index 4e53a6b..fae7fdd 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,13 @@ module github.com/epilot-dev/terraform-provider-epilot-entitymapping -go 1.20 +go 1.18 require ( github.com/cenkalti/backoff/v4 v4.2.0 github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 github.com/hashicorp/terraform-plugin-framework v1.3.5 github.com/hashicorp/terraform-plugin-go v0.18.0 + github.com/spyzhov/ajson v0.9.0 ) require ( diff --git a/go.sum b/go.sum index 3638012..853448b 100644 --- a/go.sum +++ b/go.sum @@ -171,6 +171,8 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spyzhov/ajson v0.9.0 h1:tF46gJGOenYVj+k9K1U1XpCxVWhmiyY5PsVCAs1+OJ0= +github.com/spyzhov/ajson v0.9.0/go.mod h1:a6oSw0MMb7Z5aD2tPoPO+jq11ETKgXUr2XktHdT8Wt8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= diff --git a/internal/provider/entitymapping_data_source.go b/internal/provider/entitymapping_data_source.go deleted file mode 100644 index 80b9de4..0000000 --- a/internal/provider/entitymapping_data_source.go +++ /dev/null @@ -1,449 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/sdk" - "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/sdk/pkg/models/operations" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ datasource.DataSource = &EntityMappingDataSource{} -var _ datasource.DataSourceWithConfigure = &EntityMappingDataSource{} - -func NewEntityMappingDataSource() datasource.DataSource { - return &EntityMappingDataSource{} -} - -// EntityMappingDataSource is the data source implementation. -type EntityMappingDataSource struct { - client *sdk.SDK -} - -// EntityMappingDataSourceModel describes the data model. -type EntityMappingDataSourceModel struct { - ID types.String `tfsdk:"id"` - OrgID types.String `tfsdk:"org_id"` - Source SourceConfig `tfsdk:"source"` - Targets []TargetConfig `tfsdk:"targets"` - Version types.Number `tfsdk:"version"` -} - -// Metadata returns the data source type name. -func (r *EntityMappingDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_entity_mapping" -} - -// Schema defines the schema for the data source. -func (r *EntityMappingDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "EntityMapping DataSource", - - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Required: true, - Description: `Mapping Config Id`, - }, - "org_id": schema.StringAttribute{ - Computed: true, - }, - "source": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "config": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "entity_ref": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "entity_id": schema.StringAttribute{ - Computed: true, - Description: `id of the source entity to be mapped`, - }, - "entity_schema": schema.StringAttribute{ - Computed: true, - Description: `schema of the source entity`, - }, - }, - }, - "journey_ref": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "journey_id": schema.StringAttribute{ - Computed: true, - }, - }, - }, - }, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["journey", "entity"]`, - }, - }, - }, - "targets": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "allow_failure": schema.BoolAttribute{ - Computed: true, - Description: `Pass it as true, when you don't want failures to interrupt the mapping process.`, - }, - "condition_mode": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - "conditions": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - "id": schema.StringAttribute{ - Computed: true, - Description: `Identifier for target configuration. Useful for later usages when trying to identify which target config to map to.`, - }, - "linkback_relation_attribute": schema.StringAttribute{ - Computed: true, - MarkdownDescription: `Relation attribute on the main entity where the target entity will be linked. Set to false to disable linkback` + "\n" + - ``, - }, - "linkback_relation_tags": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `Relation tags (labels) to include in main entity linkback relation attribute`, - }, - "mapping_attributes": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "mapping_attribute": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "append_value_mapper": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "mode": schema.StringAttribute{ - Computed: true, - MarkdownDescription: `- copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.` + "\n" + - `` + "\n" + - `must be one of ["copy_if_exists", "append_if_exists", "set_value"]`, - }, - "source": schema.StringAttribute{ - Computed: true, - MarkdownDescription: `JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price` + "\n" + - ``, - }, - "target": schema.StringAttribute{ - Computed: true, - Description: `JSON like target path for the attribute. Eg. last_name`, - }, - "target_unique": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - MarkdownDescription: `Array of keys which should be used when checking for uniqueness. Eg: [country, city, postal_code]` + "\n" + - ``, - }, - "value_json": schema.StringAttribute{ - Computed: true, - MarkdownDescription: `To be provided only when mapping json objects into a target attribute. Eg array of addresses.` + "\n" + - ``, - }, - }, - }, - "copy_value_mapper": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "mode": schema.StringAttribute{ - Computed: true, - MarkdownDescription: `- copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.` + "\n" + - `` + "\n" + - `must be one of ["copy_if_exists", "append_if_exists", "set_value"]`, - }, - "source": schema.StringAttribute{ - Computed: true, - MarkdownDescription: `JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price` + "\n" + - ``, - }, - "target": schema.StringAttribute{ - Computed: true, - Description: `JSON like target path for the attribute. Eg. last_name`, - }, - }, - }, - "set_value_mapper": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "mode": schema.StringAttribute{ - Computed: true, - MarkdownDescription: `- copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.` + "\n" + - `` + "\n" + - `must be one of ["copy_if_exists", "append_if_exists", "set_value"]`, - }, - "target": schema.StringAttribute{ - Computed: true, - Description: `JSON like target path for the attribute. Eg. last_name`, - }, - "value": schema.StringAttribute{ - Computed: true, - MarkdownDescription: `Any value to be set: string, number, string[], number[], JSON object, etc. It will override existing values, if any.` + "\n" + - `` + "\n" + - `Parsed as JSON.`, - }, - }, - }, - }, - }, - "mapping_attribute_v2": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "operation": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "any": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - "operation_object_node": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "append": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `Append to array`, - }, - "copy": schema.StringAttribute{ - Computed: true, - Description: `Copy JSONPath value from source entity context`, - }, - "random": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "one": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["uuid", "nanoid"]`, - }, - }, - }, - "two": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "max": schema.NumberAttribute{ - Computed: true, - }, - "min": schema.NumberAttribute{ - Computed: true, - }, - "type": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["number"]`, - }, - }, - }, - }, - }, - "set": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - "template": schema.StringAttribute{ - Computed: true, - Description: `Define handlebars template to output a string`, - }, - "uniq": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "boolean": schema.BoolAttribute{ - Computed: true, - }, - "array_of_str": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - }, - Description: `Unique array`, - }, - "additional_properties": schema.StringAttribute{ - Computed: true, - Description: `Parsed as JSON.`, - }, - }, - }, - }, - Description: `Mapping operation nodes are either primitive values or operation node objects`, - }, - "origin": schema.StringAttribute{ - Computed: true, - Description: `Origin of an attribute. must be one of ["system_recommendation", "user_manually"]`, - }, - "target": schema.StringAttribute{ - Computed: true, - Description: `Target JSON path for the attribute to set`, - }, - }, - }, - }, - }, - Description: `Attribute mappings`, - }, - "name": schema.StringAttribute{ - Computed: true, - Description: `A name for this configuration`, - }, - "relation_attributes": schema.ListNestedAttribute{ - Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "mode": schema.StringAttribute{ - Computed: true, - Description: `must be one of ["append", "prepend", "set"]`, - }, - "origin": schema.StringAttribute{ - Computed: true, - Description: `Origin of an attribute. must be one of ["system_recommendation", "user_manually"]`, - }, - "related_to": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "source_filter": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "attribute": schema.StringAttribute{ - Computed: true, - Description: `Filter by a specific relation attribute on the main entity`, - }, - "limit": schema.Int64Attribute{ - Computed: true, - Description: `Limit relations to maximum number (default, all matched relations)`, - }, - "relation_tag": schema.StringAttribute{ - Computed: true, - Description: `Filter by relation tag (label) on the main entity`, - }, - "schema": schema.StringAttribute{ - Computed: true, - Description: `Filter by specific schema`, - }, - "self": schema.BoolAttribute{ - Computed: true, - Description: `Picks main entity as relation (overrides other filters)`, - }, - "tag": schema.StringAttribute{ - Computed: true, - Description: `Filter by a specific tag on the related entity`, - }, - }, - Description: `A filter to identify which source entities to pick as relations from main entity`, - }, - "target": schema.StringAttribute{ - Computed: true, - Description: `Target attribute to store the relation in`, - }, - "target_tags": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `Relation tags (labels) to set for the stored relations`, - }, - "target_tags_include_source": schema.BoolAttribute{ - Computed: true, - Description: `Include all relation tags (labels) present on the main entity relation`, - }, - }, - }, - Description: `Relation mappings`, - }, - "target_schema": schema.StringAttribute{ - Computed: true, - Description: `Schema of target entity`, - }, - "target_unique": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - Description: `Unique key for target entity (see upsertEntity of Entity API)`, - }, - }, - }, - }, - "version": schema.NumberAttribute{ - Computed: true, - }, - }, - } -} - -func (r *EntityMappingDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.SDK) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected DataSource Configure Type", - fmt.Sprintf("Expected *sdk.SDK, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *EntityMappingDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var data *EntityMappingDataSourceModel - var item types.Object - - resp.Diagnostics.Append(req.Config.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - id := data.ID.ValueString() - request := operations.GetConfigRequest{ - ID: id, - } - res, err := r.client.Mappings.GetConfig(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if res.MappingConfig == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedMappingConfig(res.MappingConfig) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} diff --git a/internal/provider/entitymapping_data_source_sdk.go b/internal/provider/entitymapping_data_source_sdk.go deleted file mode 100644 index 87cad86..0000000 --- a/internal/provider/entitymapping_data_source_sdk.go +++ /dev/null @@ -1,233 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import ( - "encoding/json" - "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/sdk/pkg/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "math/big" -) - -func (r *EntityMappingDataSourceModel) RefreshFromSharedMappingConfig(resp *shared.MappingConfig) { - r.ID = types.StringValue(resp.ID) - r.OrgID = types.StringValue(resp.OrgID) - if resp.Source.Config == nil { - r.Source.Config = nil - } else { - r.Source.Config = &Config{} - if resp.Source.Config.EntityRef != nil { - r.Source.Config.EntityRef = &EntityRef{} - r.Source.Config.EntityRef.EntityID = types.StringValue(resp.Source.Config.EntityRef.EntityID) - r.Source.Config.EntityRef.EntitySchema = types.StringPointerValue(resp.Source.Config.EntityRef.EntitySchema) - } - if resp.Source.Config.JourneyRef != nil { - r.Source.Config.JourneyRef = &JourneyRef{} - r.Source.Config.JourneyRef.JourneyID = types.StringPointerValue(resp.Source.Config.JourneyRef.JourneyID) - } - } - if resp.Source.Type != nil { - r.Source.Type = types.StringValue(string(*resp.Source.Type)) - } else { - r.Source.Type = types.StringNull() - } - if len(r.Targets) > len(resp.Targets) { - r.Targets = r.Targets[:len(resp.Targets)] - } - for targetsCount, targetsItem := range resp.Targets { - var targets1 TargetConfig - targets1.AllowFailure = types.BoolPointerValue(targetsItem.AllowFailure) - if targetsItem.ConditionMode == nil { - targets1.ConditionMode = types.StringNull() - } else { - conditionModeResult, _ := json.Marshal(targetsItem.ConditionMode) - targets1.ConditionMode = types.StringValue(string(conditionModeResult)) - } - if targetsItem.Conditions == nil { - targets1.Conditions = types.StringNull() - } else { - conditionsResult, _ := json.Marshal(targetsItem.Conditions) - targets1.Conditions = types.StringValue(string(conditionsResult)) - } - targets1.ID = types.StringPointerValue(targetsItem.ID) - targets1.LinkbackRelationAttribute = types.StringPointerValue(targetsItem.LinkbackRelationAttribute) - targets1.LinkbackRelationTags = nil - for _, v := range targetsItem.LinkbackRelationTags { - targets1.LinkbackRelationTags = append(targets1.LinkbackRelationTags, types.StringValue(v)) - } - for mappingAttributesCount, mappingAttributesItem := range targetsItem.MappingAttributes { - var mappingAttributes1 MappingAttributes - if mappingAttributesItem.MappingAttribute != nil { - mappingAttributes1.MappingAttribute = &MappingAttribute{} - if mappingAttributesItem.MappingAttribute.AppendValueMapper != nil { - mappingAttributes1.MappingAttribute.AppendValueMapper = &AppendValueMapper{} - mappingAttributes1.MappingAttribute.AppendValueMapper.Mode = types.StringValue(string(mappingAttributesItem.MappingAttribute.AppendValueMapper.Mode)) - mappingAttributes1.MappingAttribute.AppendValueMapper.Source = types.StringPointerValue(mappingAttributesItem.MappingAttribute.AppendValueMapper.Source) - mappingAttributes1.MappingAttribute.AppendValueMapper.Target = types.StringValue(mappingAttributesItem.MappingAttribute.AppendValueMapper.Target) - mappingAttributes1.MappingAttribute.AppendValueMapper.TargetUnique = nil - for _, v := range mappingAttributesItem.MappingAttribute.AppendValueMapper.TargetUnique { - mappingAttributes1.MappingAttribute.AppendValueMapper.TargetUnique = append(mappingAttributes1.MappingAttribute.AppendValueMapper.TargetUnique, types.StringValue(v)) - } - mappingAttributes1.MappingAttribute.AppendValueMapper.ValueJSON = types.StringValue(mappingAttributesItem.MappingAttribute.AppendValueMapper.ValueJSON) - } - if mappingAttributesItem.MappingAttribute.CopyValueMapper != nil { - mappingAttributes1.MappingAttribute.CopyValueMapper = &CopyValueMapper{} - mappingAttributes1.MappingAttribute.CopyValueMapper.Mode = types.StringValue(string(mappingAttributesItem.MappingAttribute.CopyValueMapper.Mode)) - mappingAttributes1.MappingAttribute.CopyValueMapper.Source = types.StringValue(mappingAttributesItem.MappingAttribute.CopyValueMapper.Source) - mappingAttributes1.MappingAttribute.CopyValueMapper.Target = types.StringValue(mappingAttributesItem.MappingAttribute.CopyValueMapper.Target) - } - if mappingAttributesItem.MappingAttribute.SetValueMapper != nil { - mappingAttributes1.MappingAttribute.SetValueMapper = &SetValueMapper{} - mappingAttributes1.MappingAttribute.SetValueMapper.Mode = types.StringValue(string(mappingAttributesItem.MappingAttribute.SetValueMapper.Mode)) - mappingAttributes1.MappingAttribute.SetValueMapper.Target = types.StringValue(mappingAttributesItem.MappingAttribute.SetValueMapper.Target) - valueResult, _ := json.Marshal(mappingAttributesItem.MappingAttribute.SetValueMapper.Value) - mappingAttributes1.MappingAttribute.SetValueMapper.Value = types.StringValue(string(valueResult)) - } - } - if mappingAttributesItem.MappingAttributeV2 != nil { - mappingAttributes1.MappingAttributeV2 = &MappingAttributeV2{} - if mappingAttributesItem.MappingAttributeV2.Operation.Any != nil { - anyResult, _ := json.Marshal(mappingAttributesItem.MappingAttributeV2.Operation.Any) - mappingAttributes1.MappingAttributeV2.Operation.Any = types.StringValue(string(anyResult)) - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode = &OperationObjectNode{} - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Append = nil - for _, appendItem := range mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Append { - var append2 types.String - append2Result, _ := json.Marshal(appendItem) - append2 = types.StringValue(string(append2Result)) - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Append = append(mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Append, append2) - } - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Copy = types.StringPointerValue(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Copy) - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random == nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random = nil - } else { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random = &RandomOperation{} - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.One != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.One = &One{} - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.One.Type = types.StringValue(string(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.One.Type)) - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two = &Two{} - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max = types.NumberValue(big.NewFloat(float64(*mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max))) - } else { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max = types.NumberNull() - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min = types.NumberValue(big.NewFloat(float64(*mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min))) - } else { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min = types.NumberNull() - } - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Type = types.StringValue(string(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Type)) - } - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Set == nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Set = types.StringNull() - } else { - setResult, _ := json.Marshal(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Set) - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Set = types.StringValue(string(setResult)) - } - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Template = types.StringPointerValue(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Template) - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq == nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq = nil - } else { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq = &Uniq{} - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.Boolean != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq.Boolean = types.BoolPointerValue(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.Boolean) - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr = nil - for _, v := range mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr = append(mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr, types.StringValue(v)) - } - } - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties == nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties = types.StringNull() - } else { - additionalPropertiesResult, _ := json.Marshal(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties) - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties = types.StringValue(string(additionalPropertiesResult)) - } - } - if mappingAttributesItem.MappingAttributeV2.Origin != nil { - mappingAttributes1.MappingAttributeV2.Origin = types.StringValue(string(*mappingAttributesItem.MappingAttributeV2.Origin)) - } else { - mappingAttributes1.MappingAttributeV2.Origin = types.StringNull() - } - mappingAttributes1.MappingAttributeV2.Target = types.StringValue(mappingAttributesItem.MappingAttributeV2.Target) - } - if mappingAttributesCount+1 > len(targets1.MappingAttributes) { - targets1.MappingAttributes = append(targets1.MappingAttributes, mappingAttributes1) - } else { - } - } - targets1.Name = types.StringPointerValue(targetsItem.Name) - for relationAttributesCount, relationAttributesItem := range targetsItem.RelationAttributes { - var relationAttributes1 RelationAttribute - relationAttributes1.Mode = types.StringValue(string(relationAttributesItem.Mode)) - if relationAttributesItem.Origin != nil { - relationAttributes1.Origin = types.StringValue(string(*relationAttributesItem.Origin)) - } else { - relationAttributes1.Origin = types.StringNull() - } - if len(relationAttributesItem.RelatedTo) > 0 { - relationAttributes1.RelatedTo = make(map[string]types.String) - for key, value1 := range relationAttributesItem.RelatedTo { - result, _ := json.Marshal(value1) - relationAttributes1.RelatedTo[key] = types.StringValue(string(result)) - } - } - if relationAttributesItem.SourceFilter == nil { - relationAttributes1.SourceFilter = nil - } else { - relationAttributes1.SourceFilter = &SourceFilter{} - relationAttributes1.SourceFilter.Attribute = types.StringPointerValue(relationAttributesItem.SourceFilter.Attribute) - relationAttributes1.SourceFilter.Limit = types.Int64PointerValue(relationAttributesItem.SourceFilter.Limit) - relationAttributes1.SourceFilter.RelationTag = types.StringPointerValue(relationAttributesItem.SourceFilter.RelationTag) - relationAttributes1.SourceFilter.Schema = types.StringPointerValue(relationAttributesItem.SourceFilter.Schema) - relationAttributes1.SourceFilter.Self = types.BoolPointerValue(relationAttributesItem.SourceFilter.Self) - relationAttributes1.SourceFilter.Tag = types.StringPointerValue(relationAttributesItem.SourceFilter.Tag) - } - relationAttributes1.Target = types.StringValue(relationAttributesItem.Target) - relationAttributes1.TargetTags = nil - for _, v := range relationAttributesItem.TargetTags { - relationAttributes1.TargetTags = append(relationAttributes1.TargetTags, types.StringValue(v)) - } - relationAttributes1.TargetTagsIncludeSource = types.BoolPointerValue(relationAttributesItem.TargetTagsIncludeSource) - if relationAttributesCount+1 > len(targets1.RelationAttributes) { - targets1.RelationAttributes = append(targets1.RelationAttributes, relationAttributes1) - } else { - targets1.RelationAttributes[relationAttributesCount].Mode = relationAttributes1.Mode - targets1.RelationAttributes[relationAttributesCount].Origin = relationAttributes1.Origin - targets1.RelationAttributes[relationAttributesCount].RelatedTo = relationAttributes1.RelatedTo - targets1.RelationAttributes[relationAttributesCount].SourceFilter = relationAttributes1.SourceFilter - targets1.RelationAttributes[relationAttributesCount].Target = relationAttributes1.Target - targets1.RelationAttributes[relationAttributesCount].TargetTags = relationAttributes1.TargetTags - targets1.RelationAttributes[relationAttributesCount].TargetTagsIncludeSource = relationAttributes1.TargetTagsIncludeSource - } - } - targets1.TargetSchema = types.StringValue(targetsItem.TargetSchema) - targets1.TargetUnique = nil - for _, v := range targetsItem.TargetUnique { - targets1.TargetUnique = append(targets1.TargetUnique, types.StringValue(v)) - } - if targetsCount+1 > len(r.Targets) { - r.Targets = append(r.Targets, targets1) - } else { - r.Targets[targetsCount].AllowFailure = targets1.AllowFailure - r.Targets[targetsCount].ConditionMode = targets1.ConditionMode - r.Targets[targetsCount].Conditions = targets1.Conditions - r.Targets[targetsCount].ID = targets1.ID - r.Targets[targetsCount].LinkbackRelationAttribute = targets1.LinkbackRelationAttribute - r.Targets[targetsCount].LinkbackRelationTags = targets1.LinkbackRelationTags - r.Targets[targetsCount].MappingAttributes = targets1.MappingAttributes - r.Targets[targetsCount].Name = targets1.Name - r.Targets[targetsCount].RelationAttributes = targets1.RelationAttributes - r.Targets[targetsCount].TargetSchema = targets1.TargetSchema - r.Targets[targetsCount].TargetUnique = targets1.TargetUnique - } - } - r.Version = types.NumberValue(big.NewFloat(float64(resp.Version))) -} diff --git a/internal/provider/entitymapping_resource.go b/internal/provider/entitymapping_resource.go deleted file mode 100644 index c12b99d..0000000 --- a/internal/provider/entitymapping_resource.go +++ /dev/null @@ -1,1095 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import ( - "context" - "fmt" - speakeasy_boolplanmodifier "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/planmodifiers/boolplanmodifier" - speakeasy_int64planmodifier "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/planmodifiers/int64planmodifier" - speakeasy_listplanmodifier "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/planmodifiers/listplanmodifier" - speakeasy_mapplanmodifier "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/planmodifiers/mapplanmodifier" - speakeasy_numberplanmodifier "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/planmodifiers/numberplanmodifier" - speakeasy_objectplanmodifier "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/planmodifiers/objectplanmodifier" - speakeasy_stringplanmodifier "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/planmodifiers/stringplanmodifier" - "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/sdk" - "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/sdk/pkg/models/operations" - "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/validators" - speakeasy_listvalidators "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/validators/listvalidators" - speakeasy_objectvalidators "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/validators/objectvalidators" - speakeasy_stringvalidators "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/validators/stringvalidators" - "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" - "github.com/hashicorp/terraform-plugin-framework-validators/mapvalidator" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "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/resource/schema/boolplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/mapplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/numberdefault" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/numberplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "math/big" -) - -// Ensure provider defined types fully satisfy framework interfaces. -var _ resource.Resource = &EntityMappingResource{} -var _ resource.ResourceWithImportState = &EntityMappingResource{} - -func NewEntityMappingResource() resource.Resource { - return &EntityMappingResource{} -} - -// EntityMappingResource defines the resource implementation. -type EntityMappingResource struct { - client *sdk.SDK -} - -// EntityMappingResourceModel describes the resource data model. -type EntityMappingResourceModel struct { - ID types.String `tfsdk:"id"` - OrgID types.String `tfsdk:"org_id"` - Source SourceConfig `tfsdk:"source"` - Targets []TargetConfig `tfsdk:"targets"` - Version types.Number `tfsdk:"version"` -} - -func (r *EntityMappingResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_entity_mapping" -} - -func (r *EntityMappingResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ - MarkdownDescription: "EntityMapping Resource", - - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Required: true, - Description: `Mapping Config Id. Requires replacement if changed. `, - }, - "org_id": schema.StringAttribute{ - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Required: true, - Description: `Requires replacement if changed. `, - }, - "source": schema.SingleNestedAttribute{ - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Required: true, - Attributes: map[string]schema.Attribute{ - "config": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "entity_ref": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "entity_id": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `id of the source entity to be mapped. Requires replacement if changed. ; Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "entity_schema": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `schema of the source entity. Requires replacement if changed. `, - }, - }, - Description: `Requires replacement if changed. `, - }, - "journey_ref": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "journey_id": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Requires replacement if changed. `, - }, - }, - Description: `Requires replacement if changed. `, - }, - }, - Description: `Requires replacement if changed. `, - Validators: []validator.Object{ - validators.ExactlyOneChild(), - }, - }, - "type": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Requires replacement if changed. ; must be one of ["journey", "entity"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "journey", - "entity", - ), - }, - }, - }, - Description: `Requires replacement if changed. `, - }, - "targets": schema.ListNestedAttribute{ - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_listplanmodifier.SuppressDiff(speakeasy_listplanmodifier.ExplicitSuppress), - }, - Required: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "allow_failure": schema.BoolAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Bool{ - boolplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_boolplanmodifier.SuppressDiff(speakeasy_boolplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Pass it as true, when you don't want failures to interrupt the mapping process. Requires replacement if changed. `, - }, - "condition_mode": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - validators.IsValidJSON(), - }, - }, - "conditions": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - validators.IsValidJSON(), - }, - }, - "id": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Identifier for target configuration. Useful for later usages when trying to identify which target config to map to. Requires replacement if changed. `, - }, - "linkback_relation_attribute": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Default: stringdefault.StaticString("mapped_entities"), - MarkdownDescription: `Relation attribute on the main entity where the target entity will be linked. Set to false to disable linkback` + "\n" + - `` + "\n" + - `Requires replacement if changed. ; Default: "mapped_entities"`, - }, - "linkback_relation_tags": schema.ListAttribute{ - Computed: true, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_listplanmodifier.SuppressDiff(speakeasy_listplanmodifier.ExplicitSuppress), - }, - Optional: true, - ElementType: types.StringType, - Description: `Relation tags (labels) to include in main entity linkback relation attribute. Requires replacement if changed. `, - }, - "mapping_attributes": schema.ListNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_listplanmodifier.SuppressDiff(speakeasy_listplanmodifier.ExplicitSuppress), - }, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "mapping_attribute": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "append_value_mapper": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "mode": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - MarkdownDescription: `- copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.` + "\n" + - `` + "\n" + - `Requires replacement if changed. ; Not Null; must be one of ["copy_if_exists", "append_if_exists", "set_value"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "copy_if_exists", - "append_if_exists", - "set_value", - ), - }, - }, - "source": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - MarkdownDescription: `JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price` + "\n" + - `` + "\n" + - `Requires replacement if changed. `, - }, - "target": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `JSON like target path for the attribute. Eg. last_name. Requires replacement if changed. ; Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "target_unique": schema.ListAttribute{ - Computed: true, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_listplanmodifier.SuppressDiff(speakeasy_listplanmodifier.ExplicitSuppress), - }, - Optional: true, - ElementType: types.StringType, - MarkdownDescription: `Array of keys which should be used when checking for uniqueness. Eg: [country, city, postal_code]` + "\n" + - `` + "\n" + - `Requires replacement if changed. `, - }, - "value_json": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - MarkdownDescription: `To be provided only when mapping json objects into a target attribute. Eg array of addresses.` + "\n" + - `` + "\n" + - `Requires replacement if changed. ; Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - }, - Description: `Requires replacement if changed. `, - }, - "copy_value_mapper": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "mode": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - MarkdownDescription: `- copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.` + "\n" + - `` + "\n" + - `Requires replacement if changed. ; Not Null; must be one of ["copy_if_exists", "append_if_exists", "set_value"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "copy_if_exists", - "append_if_exists", - "set_value", - ), - }, - }, - "source": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - MarkdownDescription: `JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price` + "\n" + - `` + "\n" + - `Requires replacement if changed. ; Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "target": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `JSON like target path for the attribute. Eg. last_name. Requires replacement if changed. ; Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - }, - Description: `Requires replacement if changed. `, - }, - "set_value_mapper": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "mode": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - MarkdownDescription: `- copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.` + "\n" + - `` + "\n" + - `Requires replacement if changed. ; Not Null; must be one of ["copy_if_exists", "append_if_exists", "set_value"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "copy_if_exists", - "append_if_exists", - "set_value", - ), - }, - }, - "target": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `JSON like target path for the attribute. Eg. last_name. Requires replacement if changed. ; Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "value": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - MarkdownDescription: `Any value to be set: string, number, string[], number[], JSON object, etc. It will override existing values, if any.` + "\n" + - `` + "\n" + - `Parsed as JSON.`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - validators.IsValidJSON(), - }, - }, - }, - Description: `Requires replacement if changed. `, - }, - }, - Description: `Requires replacement if changed. `, - Validators: []validator.Object{ - validators.ExactlyOneChild(), - }, - }, - "mapping_attribute_v2": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "operation": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "any": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - validators.IsValidJSON(), - }, - }, - "operation_object_node": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "append": schema.ListAttribute{ - Computed: true, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_listplanmodifier.SuppressDiff(speakeasy_listplanmodifier.ExplicitSuppress), - }, - Optional: true, - ElementType: types.StringType, - Description: `Append to array. Requires replacement if changed. `, - Validators: []validator.List{ - listvalidator.ValueStringsAre(validators.IsValidJSON()), - }, - }, - "copy": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Copy JSONPath value from source entity context. Requires replacement if changed. `, - }, - "random": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "one": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "type": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Requires replacement if changed. ; Not Null; must be one of ["uuid", "nanoid"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "uuid", - "nanoid", - ), - }, - }, - }, - Description: `Requires replacement if changed. `, - }, - "two": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "max": schema.NumberAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Number{ - numberplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_numberplanmodifier.SuppressDiff(speakeasy_numberplanmodifier.ExplicitSuppress), - }, - Optional: true, - Default: numberdefault.StaticBigFloat(big.NewFloat(1)), - Description: `Requires replacement if changed. ; Default: 1`, - }, - "min": schema.NumberAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Number{ - numberplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_numberplanmodifier.SuppressDiff(speakeasy_numberplanmodifier.ExplicitSuppress), - }, - Optional: true, - Default: numberdefault.StaticBigFloat(big.NewFloat(0)), - Description: `Requires replacement if changed. ; Default: 0`, - }, - "type": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Requires replacement if changed. ; Not Null; must be one of ["number"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "number", - ), - }, - }, - }, - Description: `Requires replacement if changed. `, - }, - }, - Description: `Requires replacement if changed. `, - Validators: []validator.Object{ - validators.ExactlyOneChild(), - }, - }, - "set": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - validators.IsValidJSON(), - }, - }, - "template": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Define handlebars template to output a string. Requires replacement if changed. `, - }, - "uniq": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "boolean": schema.BoolAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Bool{ - boolplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_boolplanmodifier.SuppressDiff(speakeasy_boolplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Requires replacement if changed. `, - }, - "array_of_str": schema.ListAttribute{ - Computed: true, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_listplanmodifier.SuppressDiff(speakeasy_listplanmodifier.ExplicitSuppress), - }, - Optional: true, - ElementType: types.StringType, - Description: `Requires replacement if changed. `, - }, - }, - Description: `Unique array. Requires replacement if changed. `, - Validators: []validator.Object{ - validators.ExactlyOneChild(), - }, - }, - "additional_properties": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Parsed as JSON.`, - Validators: []validator.String{ - validators.IsValidJSON(), - }, - }, - }, - Description: `Requires replacement if changed. `, - }, - }, - Description: `Mapping operation nodes are either primitive values or operation node objects. Requires replacement if changed. ; Not Null`, - Validators: []validator.Object{ - speakeasy_objectvalidators.NotNull(), - validators.ExactlyOneChild(), - }, - }, - "origin": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Origin of an attribute. Requires replacement if changed. ; must be one of ["system_recommendation", "user_manually"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "system_recommendation", - "user_manually", - ), - }, - }, - "target": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Target JSON path for the attribute to set. Requires replacement if changed. ; Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - }, - Description: `Requires replacement if changed. `, - }, - }, - Validators: []validator.Object{ - validators.ExactlyOneChild(), - }, - }, - Description: `Attribute mappings. Requires replacement if changed. ; Not Null`, - Validators: []validator.List{ - speakeasy_listvalidators.NotNull(), - }, - }, - "name": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `A name for this configuration. Requires replacement if changed. `, - }, - "relation_attributes": schema.ListNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_listplanmodifier.SuppressDiff(speakeasy_listplanmodifier.ExplicitSuppress), - }, - Optional: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "mode": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Requires replacement if changed. ; Not Null; must be one of ["append", "prepend", "set"]`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - stringvalidator.OneOf( - "append", - "prepend", - "set", - ), - }, - }, - "origin": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Origin of an attribute. Requires replacement if changed. ; must be one of ["system_recommendation", "user_manually"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "system_recommendation", - "user_manually", - ), - }, - }, - "related_to": schema.MapAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Map{ - mapplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_mapplanmodifier.SuppressDiff(speakeasy_mapplanmodifier.ExplicitSuppress), - }, - Optional: true, - ElementType: types.StringType, - Description: `Requires replacement if changed. `, - Validators: []validator.Map{ - mapvalidator.ValueStringsAre(validators.IsValidJSON()), - }, - }, - "source_filter": schema.SingleNestedAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Object{ - objectplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_objectplanmodifier.SuppressDiff(speakeasy_objectplanmodifier.ExplicitSuppress), - }, - Optional: true, - Attributes: map[string]schema.Attribute{ - "attribute": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Filter by a specific relation attribute on the main entity. Requires replacement if changed. `, - }, - "limit": schema.Int64Attribute{ - Computed: true, - PlanModifiers: []planmodifier.Int64{ - int64planmodifier.RequiresReplaceIfConfigured(), - speakeasy_int64planmodifier.SuppressDiff(speakeasy_int64planmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Limit relations to maximum number (default, all matched relations). Requires replacement if changed. `, - }, - "relation_tag": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Filter by relation tag (label) on the main entity. Requires replacement if changed. `, - }, - "schema": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Filter by specific schema. Requires replacement if changed. `, - }, - "self": schema.BoolAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Bool{ - boolplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_boolplanmodifier.SuppressDiff(speakeasy_boolplanmodifier.ExplicitSuppress), - }, - Optional: true, - Default: booldefault.StaticBool(false), - Description: `Picks main entity as relation (overrides other filters). Requires replacement if changed. ; Default: false`, - }, - "tag": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Filter by a specific tag on the related entity. Requires replacement if changed. `, - }, - }, - Description: `A filter to identify which source entities to pick as relations from main entity. Requires replacement if changed. `, - }, - "target": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Target attribute to store the relation in. Requires replacement if changed. ; Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "target_tags": schema.ListAttribute{ - Computed: true, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_listplanmodifier.SuppressDiff(speakeasy_listplanmodifier.ExplicitSuppress), - }, - Optional: true, - ElementType: types.StringType, - Description: `Relation tags (labels) to set for the stored relations. Requires replacement if changed. `, - }, - "target_tags_include_source": schema.BoolAttribute{ - Computed: true, - PlanModifiers: []planmodifier.Bool{ - boolplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_boolplanmodifier.SuppressDiff(speakeasy_boolplanmodifier.ExplicitSuppress), - }, - Optional: true, - Default: booldefault.StaticBool(false), - Description: `Include all relation tags (labels) present on the main entity relation. Requires replacement if changed. ; Default: false`, - }, - }, - }, - Description: `Relation mappings. Requires replacement if changed. `, - }, - "target_schema": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), - }, - Optional: true, - Description: `Schema of target entity. Requires replacement if changed. ; Not Null`, - Validators: []validator.String{ - speakeasy_stringvalidators.NotNull(), - }, - }, - "target_unique": schema.ListAttribute{ - Computed: true, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_listplanmodifier.SuppressDiff(speakeasy_listplanmodifier.ExplicitSuppress), - }, - Optional: true, - ElementType: types.StringType, - Description: `Unique key for target entity (see upsertEntity of Entity API). Requires replacement if changed. `, - }, - }, - }, - Description: `Requires replacement if changed. `, - }, - "version": schema.NumberAttribute{ - PlanModifiers: []planmodifier.Number{ - numberplanmodifier.RequiresReplaceIfConfigured(), - speakeasy_numberplanmodifier.SuppressDiff(speakeasy_numberplanmodifier.ExplicitSuppress), - }, - Required: true, - Description: `Requires replacement if changed. `, - }, - }, - } -} - -func (r *EntityMappingResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - // Prevent panic if the provider has not been configured. - if req.ProviderData == nil { - return - } - - client, ok := req.ProviderData.(*sdk.SDK) - - if !ok { - resp.Diagnostics.AddError( - "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.SDK, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - r.client = client -} - -func (r *EntityMappingResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var data *EntityMappingResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(plan.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - mappingConfig := data.ToSharedMappingConfig() - id := data.ID.ValueString() - request := operations.StoreNewVersionRequest{ - MappingConfig: mappingConfig, - ID: id, - } - res, err := r.client.Mappings.StoreNewVersion(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if res.MappingConfig == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedMappingConfig(res.MappingConfig) - refreshPlan(ctx, plan, &data, resp.Diagnostics) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *EntityMappingResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var data *EntityMappingResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - id := data.ID.ValueString() - request := operations.GetConfigRequest{ - ID: id, - } - res, err := r.client.Mappings.GetConfig(ctx, request) - if err != nil { - resp.Diagnostics.AddError("failure to invoke API", err.Error()) - if res != nil && res.RawResponse != nil { - resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) - } - return - } - if res == nil { - resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) - return - } - if res.StatusCode != 200 { - resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) - return - } - if res.MappingConfig == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) - return - } - data.RefreshFromSharedMappingConfig(res.MappingConfig) - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *EntityMappingResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var data *EntityMappingResourceModel - var plan types.Object - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { - return - } - - merge(ctx, req, resp, &data) - if resp.Diagnostics.HasError() { - return - } - - // Not Implemented; all attributes marked as RequiresReplace - - // Save updated data into Terraform state - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} - -func (r *EntityMappingResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var data *EntityMappingResourceModel - var item types.Object - - resp.Diagnostics.Append(req.State.Get(ctx, &item)...) - if resp.Diagnostics.HasError() { - return - } - - resp.Diagnostics.Append(item.As(ctx, &data, basetypes.ObjectAsOptions{ - UnhandledNullAsEmpty: true, - UnhandledUnknownAsEmpty: true, - })...) - - if resp.Diagnostics.HasError() { - return - } - - // Not Implemented; entity does not have a configured DELETE operation -} - -func (r *EntityMappingResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) -} diff --git a/internal/provider/entitymapping_resource_sdk.go b/internal/provider/entitymapping_resource_sdk.go deleted file mode 100644 index e9fe9f8..0000000 --- a/internal/provider/entitymapping_resource_sdk.go +++ /dev/null @@ -1,640 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import ( - "encoding/json" - "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/sdk/pkg/models/shared" - "github.com/hashicorp/terraform-plugin-framework/types" - "math/big" -) - -func (r *EntityMappingResourceModel) ToSharedMappingConfig() *shared.MappingConfig { - id := r.ID.ValueString() - orgID := r.OrgID.ValueString() - var config *shared.Config - if r.Source.Config != nil { - var journeyRef *shared.JourneyRef - if r.Source.Config.JourneyRef != nil { - journeyID := new(string) - if !r.Source.Config.JourneyRef.JourneyID.IsUnknown() && !r.Source.Config.JourneyRef.JourneyID.IsNull() { - *journeyID = r.Source.Config.JourneyRef.JourneyID.ValueString() - } else { - journeyID = nil - } - journeyRef = &shared.JourneyRef{ - JourneyID: journeyID, - } - } - if journeyRef != nil { - config = &shared.Config{ - JourneyRef: journeyRef, - } - } - var entityRef *shared.EntityRef - if r.Source.Config.EntityRef != nil { - entityID := r.Source.Config.EntityRef.EntityID.ValueString() - entitySchema := new(string) - if !r.Source.Config.EntityRef.EntitySchema.IsUnknown() && !r.Source.Config.EntityRef.EntitySchema.IsNull() { - *entitySchema = r.Source.Config.EntityRef.EntitySchema.ValueString() - } else { - entitySchema = nil - } - entityRef = &shared.EntityRef{ - EntityID: entityID, - EntitySchema: entitySchema, - } - } - if entityRef != nil { - config = &shared.Config{ - EntityRef: entityRef, - } - } - } - typeVar := new(shared.Type) - if !r.Source.Type.IsUnknown() && !r.Source.Type.IsNull() { - *typeVar = shared.Type(r.Source.Type.ValueString()) - } else { - typeVar = nil - } - source := shared.SourceConfig{ - Config: config, - Type: typeVar, - } - var targets []shared.TargetConfig = nil - for _, targetsItem := range r.Targets { - allowFailure := new(bool) - if !targetsItem.AllowFailure.IsUnknown() && !targetsItem.AllowFailure.IsNull() { - *allowFailure = targetsItem.AllowFailure.ValueBool() - } else { - allowFailure = nil - } - var conditionMode interface{} - if !targetsItem.ConditionMode.IsUnknown() && !targetsItem.ConditionMode.IsNull() { - _ = json.Unmarshal([]byte(targetsItem.ConditionMode.ValueString()), &conditionMode) - } - var conditions interface{} - if !targetsItem.Conditions.IsUnknown() && !targetsItem.Conditions.IsNull() { - _ = json.Unmarshal([]byte(targetsItem.Conditions.ValueString()), &conditions) - } - id1 := new(string) - if !targetsItem.ID.IsUnknown() && !targetsItem.ID.IsNull() { - *id1 = targetsItem.ID.ValueString() - } else { - id1 = nil - } - linkbackRelationAttribute := new(string) - if !targetsItem.LinkbackRelationAttribute.IsUnknown() && !targetsItem.LinkbackRelationAttribute.IsNull() { - *linkbackRelationAttribute = targetsItem.LinkbackRelationAttribute.ValueString() - } else { - linkbackRelationAttribute = nil - } - var linkbackRelationTags []string = nil - for _, linkbackRelationTagsItem := range targetsItem.LinkbackRelationTags { - linkbackRelationTags = append(linkbackRelationTags, linkbackRelationTagsItem.ValueString()) - } - var mappingAttributes []shared.MappingAttributes = nil - for _, mappingAttributesItem := range targetsItem.MappingAttributes { - if mappingAttributesItem.MappingAttributeV2 != nil { - var operation shared.OperationNode - var operationObjectNode *shared.OperationObjectNode - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode != nil { - var additionalProperties interface{} - if !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties.IsUnknown() && !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties.IsNull() { - _ = json.Unmarshal([]byte(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties.ValueString()), &additionalProperties) - } - var append1 []interface{} = nil - for _, appendItem := range mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Append { - var appendTmp interface{} - _ = json.Unmarshal([]byte(appendItem.ValueString()), &appendTmp) - append1 = append(append1, appendTmp) - } - copy := new(string) - if !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Copy.IsUnknown() && !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Copy.IsNull() { - *copy = mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Copy.ValueString() - } else { - copy = nil - } - var random *shared.RandomOperation - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random != nil { - var one *shared.One - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.One != nil { - typeVar1 := shared.RandomOperationSchemasType(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.One.Type.ValueString()) - one = &shared.One{ - Type: typeVar1, - } - } - if one != nil { - random = &shared.RandomOperation{ - One: one, - } - } - var two *shared.Two - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two != nil { - max := new(float64) - if !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max.IsUnknown() && !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max.IsNull() { - *max, _ = mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max.ValueBigFloat().Float64() - } else { - max = nil - } - min := new(float64) - if !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min.IsUnknown() && !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min.IsNull() { - *min, _ = mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min.ValueBigFloat().Float64() - } else { - min = nil - } - typeVar2 := shared.RandomOperationType(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Type.ValueString()) - two = &shared.Two{ - Max: max, - Min: min, - Type: typeVar2, - } - } - if two != nil { - random = &shared.RandomOperation{ - Two: two, - } - } - } - var set interface{} - if !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Set.IsUnknown() && !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Set.IsNull() { - _ = json.Unmarshal([]byte(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Set.ValueString()), &set) - } - template := new(string) - if !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Template.IsUnknown() && !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Template.IsNull() { - *template = mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Template.ValueString() - } else { - template = nil - } - var uniq *shared.Uniq - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq != nil { - boolean := new(bool) - if !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.Boolean.IsUnknown() && !mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.Boolean.IsNull() { - *boolean = mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.Boolean.ValueBool() - } else { - boolean = nil - } - if boolean != nil { - uniq = &shared.Uniq{ - Boolean: boolean, - } - } - var arrayOfStr []string = nil - for _, arrayOfStrItem := range mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr { - arrayOfStr = append(arrayOfStr, arrayOfStrItem.ValueString()) - } - if arrayOfStr != nil { - uniq = &shared.Uniq{ - ArrayOfStr: arrayOfStr, - } - } - } - operationObjectNode = &shared.OperationObjectNode{ - AdditionalProperties: additionalProperties, - Append: append1, - Copy: copy, - Random: random, - Set: set, - Template: template, - Uniq: uniq, - } - } - if operationObjectNode != nil { - operation = shared.OperationNode{ - OperationObjectNode: operationObjectNode, - } - } - var any interface{} - if !mappingAttributesItem.MappingAttributeV2.Operation.Any.IsUnknown() && !mappingAttributesItem.MappingAttributeV2.Operation.Any.IsNull() { - _ = json.Unmarshal([]byte(mappingAttributesItem.MappingAttributeV2.Operation.Any.ValueString()), &any) - } - if any != nil { - operation = shared.OperationNode{ - Any: any, - } - } - origin := new(shared.AttributeOrigin) - if !mappingAttributesItem.MappingAttributeV2.Origin.IsUnknown() && !mappingAttributesItem.MappingAttributeV2.Origin.IsNull() { - *origin = shared.AttributeOrigin(mappingAttributesItem.MappingAttributeV2.Origin.ValueString()) - } else { - origin = nil - } - target := mappingAttributesItem.MappingAttributeV2.Target.ValueString() - mappingAttributeV2 := shared.MappingAttributeV2{ - Operation: operation, - Origin: origin, - Target: target, - } - mappingAttributes = append(mappingAttributes, shared.MappingAttributes{ - MappingAttributeV2: &mappingAttributeV2, - }) - } - if mappingAttributesItem.MappingAttribute != nil { - var mappingAttribute shared.MappingAttribute - var setValueMapper *shared.SetValueMapper - if mappingAttributesItem.MappingAttribute.SetValueMapper != nil { - mode := shared.MappingAttributeMode(mappingAttributesItem.MappingAttribute.SetValueMapper.Mode.ValueString()) - target1 := mappingAttributesItem.MappingAttribute.SetValueMapper.Target.ValueString() - var value interface{} - _ = json.Unmarshal([]byte(mappingAttributesItem.MappingAttribute.SetValueMapper.Value.ValueString()), &value) - setValueMapper = &shared.SetValueMapper{ - Mode: mode, - Target: target1, - Value: value, - } - } - if setValueMapper != nil { - mappingAttribute = shared.MappingAttribute{ - SetValueMapper: setValueMapper, - } - } - var copyValueMapper *shared.CopyValueMapper - if mappingAttributesItem.MappingAttribute.CopyValueMapper != nil { - mode1 := shared.MappingAttributeMode(mappingAttributesItem.MappingAttribute.CopyValueMapper.Mode.ValueString()) - source1 := mappingAttributesItem.MappingAttribute.CopyValueMapper.Source.ValueString() - target2 := mappingAttributesItem.MappingAttribute.CopyValueMapper.Target.ValueString() - copyValueMapper = &shared.CopyValueMapper{ - Mode: mode1, - Source: source1, - Target: target2, - } - } - if copyValueMapper != nil { - mappingAttribute = shared.MappingAttribute{ - CopyValueMapper: copyValueMapper, - } - } - var appendValueMapper *shared.AppendValueMapper - if mappingAttributesItem.MappingAttribute.AppendValueMapper != nil { - mode2 := shared.MappingAttributeMode(mappingAttributesItem.MappingAttribute.AppendValueMapper.Mode.ValueString()) - source2 := new(string) - if !mappingAttributesItem.MappingAttribute.AppendValueMapper.Source.IsUnknown() && !mappingAttributesItem.MappingAttribute.AppendValueMapper.Source.IsNull() { - *source2 = mappingAttributesItem.MappingAttribute.AppendValueMapper.Source.ValueString() - } else { - source2 = nil - } - target3 := mappingAttributesItem.MappingAttribute.AppendValueMapper.Target.ValueString() - var targetUnique []string = nil - for _, targetUniqueItem := range mappingAttributesItem.MappingAttribute.AppendValueMapper.TargetUnique { - targetUnique = append(targetUnique, targetUniqueItem.ValueString()) - } - valueJSON := mappingAttributesItem.MappingAttribute.AppendValueMapper.ValueJSON.ValueString() - appendValueMapper = &shared.AppendValueMapper{ - Mode: mode2, - Source: source2, - Target: target3, - TargetUnique: targetUnique, - ValueJSON: valueJSON, - } - } - if appendValueMapper != nil { - mappingAttribute = shared.MappingAttribute{ - AppendValueMapper: appendValueMapper, - } - } - mappingAttributes = append(mappingAttributes, shared.MappingAttributes{ - MappingAttribute: &mappingAttribute, - }) - } - } - name := new(string) - if !targetsItem.Name.IsUnknown() && !targetsItem.Name.IsNull() { - *name = targetsItem.Name.ValueString() - } else { - name = nil - } - var relationAttributes []shared.RelationAttribute = nil - for _, relationAttributesItem := range targetsItem.RelationAttributes { - mode3 := shared.Mode(relationAttributesItem.Mode.ValueString()) - origin1 := new(shared.AttributeOrigin) - if !relationAttributesItem.Origin.IsUnknown() && !relationAttributesItem.Origin.IsNull() { - *origin1 = shared.AttributeOrigin(relationAttributesItem.Origin.ValueString()) - } else { - origin1 = nil - } - relatedTo := make(map[string]interface{}) - for relatedToKey, relatedToValue := range relationAttributesItem.RelatedTo { - var relatedToInst interface{} - _ = json.Unmarshal([]byte(relatedToValue.ValueString()), &relatedToInst) - relatedTo[relatedToKey] = relatedToInst - } - var sourceFilter *shared.SourceFilter - if relationAttributesItem.SourceFilter != nil { - attribute := new(string) - if !relationAttributesItem.SourceFilter.Attribute.IsUnknown() && !relationAttributesItem.SourceFilter.Attribute.IsNull() { - *attribute = relationAttributesItem.SourceFilter.Attribute.ValueString() - } else { - attribute = nil - } - limit := new(int64) - if !relationAttributesItem.SourceFilter.Limit.IsUnknown() && !relationAttributesItem.SourceFilter.Limit.IsNull() { - *limit = relationAttributesItem.SourceFilter.Limit.ValueInt64() - } else { - limit = nil - } - relationTag := new(string) - if !relationAttributesItem.SourceFilter.RelationTag.IsUnknown() && !relationAttributesItem.SourceFilter.RelationTag.IsNull() { - *relationTag = relationAttributesItem.SourceFilter.RelationTag.ValueString() - } else { - relationTag = nil - } - schema := new(string) - if !relationAttributesItem.SourceFilter.Schema.IsUnknown() && !relationAttributesItem.SourceFilter.Schema.IsNull() { - *schema = relationAttributesItem.SourceFilter.Schema.ValueString() - } else { - schema = nil - } - self := new(bool) - if !relationAttributesItem.SourceFilter.Self.IsUnknown() && !relationAttributesItem.SourceFilter.Self.IsNull() { - *self = relationAttributesItem.SourceFilter.Self.ValueBool() - } else { - self = nil - } - tag := new(string) - if !relationAttributesItem.SourceFilter.Tag.IsUnknown() && !relationAttributesItem.SourceFilter.Tag.IsNull() { - *tag = relationAttributesItem.SourceFilter.Tag.ValueString() - } else { - tag = nil - } - sourceFilter = &shared.SourceFilter{ - Attribute: attribute, - Limit: limit, - RelationTag: relationTag, - Schema: schema, - Self: self, - Tag: tag, - } - } - target4 := relationAttributesItem.Target.ValueString() - var targetTags []string = nil - for _, targetTagsItem := range relationAttributesItem.TargetTags { - targetTags = append(targetTags, targetTagsItem.ValueString()) - } - targetTagsIncludeSource := new(bool) - if !relationAttributesItem.TargetTagsIncludeSource.IsUnknown() && !relationAttributesItem.TargetTagsIncludeSource.IsNull() { - *targetTagsIncludeSource = relationAttributesItem.TargetTagsIncludeSource.ValueBool() - } else { - targetTagsIncludeSource = nil - } - relationAttributes = append(relationAttributes, shared.RelationAttribute{ - Mode: mode3, - Origin: origin1, - RelatedTo: relatedTo, - SourceFilter: sourceFilter, - Target: target4, - TargetTags: targetTags, - TargetTagsIncludeSource: targetTagsIncludeSource, - }) - } - targetSchema := targetsItem.TargetSchema.ValueString() - var targetUnique1 []string = nil - for _, targetUniqueItem1 := range targetsItem.TargetUnique { - targetUnique1 = append(targetUnique1, targetUniqueItem1.ValueString()) - } - targets = append(targets, shared.TargetConfig{ - AllowFailure: allowFailure, - ConditionMode: conditionMode, - Conditions: conditions, - ID: id1, - LinkbackRelationAttribute: linkbackRelationAttribute, - LinkbackRelationTags: linkbackRelationTags, - MappingAttributes: mappingAttributes, - Name: name, - RelationAttributes: relationAttributes, - TargetSchema: targetSchema, - TargetUnique: targetUnique1, - }) - } - version, _ := r.Version.ValueBigFloat().Float64() - out := shared.MappingConfig{ - ID: id, - OrgID: orgID, - Source: source, - Targets: targets, - Version: version, - } - return &out -} - -func (r *EntityMappingResourceModel) RefreshFromSharedMappingConfig(resp *shared.MappingConfig) { - r.ID = types.StringValue(resp.ID) - r.OrgID = types.StringValue(resp.OrgID) - if resp.Source.Config == nil { - r.Source.Config = nil - } else { - r.Source.Config = &Config{} - if resp.Source.Config.EntityRef != nil { - r.Source.Config.EntityRef = &EntityRef{} - r.Source.Config.EntityRef.EntityID = types.StringValue(resp.Source.Config.EntityRef.EntityID) - r.Source.Config.EntityRef.EntitySchema = types.StringPointerValue(resp.Source.Config.EntityRef.EntitySchema) - } - if resp.Source.Config.JourneyRef != nil { - r.Source.Config.JourneyRef = &JourneyRef{} - r.Source.Config.JourneyRef.JourneyID = types.StringPointerValue(resp.Source.Config.JourneyRef.JourneyID) - } - } - if resp.Source.Type != nil { - r.Source.Type = types.StringValue(string(*resp.Source.Type)) - } else { - r.Source.Type = types.StringNull() - } - if len(r.Targets) > len(resp.Targets) { - r.Targets = r.Targets[:len(resp.Targets)] - } - for targetsCount, targetsItem := range resp.Targets { - var targets1 TargetConfig - targets1.AllowFailure = types.BoolPointerValue(targetsItem.AllowFailure) - if targetsItem.ConditionMode == nil { - targets1.ConditionMode = types.StringNull() - } else { - conditionModeResult, _ := json.Marshal(targetsItem.ConditionMode) - targets1.ConditionMode = types.StringValue(string(conditionModeResult)) - } - if targetsItem.Conditions == nil { - targets1.Conditions = types.StringNull() - } else { - conditionsResult, _ := json.Marshal(targetsItem.Conditions) - targets1.Conditions = types.StringValue(string(conditionsResult)) - } - targets1.ID = types.StringPointerValue(targetsItem.ID) - targets1.LinkbackRelationAttribute = types.StringPointerValue(targetsItem.LinkbackRelationAttribute) - targets1.LinkbackRelationTags = nil - for _, v := range targetsItem.LinkbackRelationTags { - targets1.LinkbackRelationTags = append(targets1.LinkbackRelationTags, types.StringValue(v)) - } - for mappingAttributesCount, mappingAttributesItem := range targetsItem.MappingAttributes { - var mappingAttributes1 MappingAttributes - if mappingAttributesItem.MappingAttribute != nil { - mappingAttributes1.MappingAttribute = &MappingAttribute{} - if mappingAttributesItem.MappingAttribute.AppendValueMapper != nil { - mappingAttributes1.MappingAttribute.AppendValueMapper = &AppendValueMapper{} - mappingAttributes1.MappingAttribute.AppendValueMapper.Mode = types.StringValue(string(mappingAttributesItem.MappingAttribute.AppendValueMapper.Mode)) - mappingAttributes1.MappingAttribute.AppendValueMapper.Source = types.StringPointerValue(mappingAttributesItem.MappingAttribute.AppendValueMapper.Source) - mappingAttributes1.MappingAttribute.AppendValueMapper.Target = types.StringValue(mappingAttributesItem.MappingAttribute.AppendValueMapper.Target) - mappingAttributes1.MappingAttribute.AppendValueMapper.TargetUnique = nil - for _, v := range mappingAttributesItem.MappingAttribute.AppendValueMapper.TargetUnique { - mappingAttributes1.MappingAttribute.AppendValueMapper.TargetUnique = append(mappingAttributes1.MappingAttribute.AppendValueMapper.TargetUnique, types.StringValue(v)) - } - mappingAttributes1.MappingAttribute.AppendValueMapper.ValueJSON = types.StringValue(mappingAttributesItem.MappingAttribute.AppendValueMapper.ValueJSON) - } - if mappingAttributesItem.MappingAttribute.CopyValueMapper != nil { - mappingAttributes1.MappingAttribute.CopyValueMapper = &CopyValueMapper{} - mappingAttributes1.MappingAttribute.CopyValueMapper.Mode = types.StringValue(string(mappingAttributesItem.MappingAttribute.CopyValueMapper.Mode)) - mappingAttributes1.MappingAttribute.CopyValueMapper.Source = types.StringValue(mappingAttributesItem.MappingAttribute.CopyValueMapper.Source) - mappingAttributes1.MappingAttribute.CopyValueMapper.Target = types.StringValue(mappingAttributesItem.MappingAttribute.CopyValueMapper.Target) - } - if mappingAttributesItem.MappingAttribute.SetValueMapper != nil { - mappingAttributes1.MappingAttribute.SetValueMapper = &SetValueMapper{} - mappingAttributes1.MappingAttribute.SetValueMapper.Mode = types.StringValue(string(mappingAttributesItem.MappingAttribute.SetValueMapper.Mode)) - mappingAttributes1.MappingAttribute.SetValueMapper.Target = types.StringValue(mappingAttributesItem.MappingAttribute.SetValueMapper.Target) - valueResult, _ := json.Marshal(mappingAttributesItem.MappingAttribute.SetValueMapper.Value) - mappingAttributes1.MappingAttribute.SetValueMapper.Value = types.StringValue(string(valueResult)) - } - } - if mappingAttributesItem.MappingAttributeV2 != nil { - mappingAttributes1.MappingAttributeV2 = &MappingAttributeV2{} - if mappingAttributesItem.MappingAttributeV2.Operation.Any != nil { - anyResult, _ := json.Marshal(mappingAttributesItem.MappingAttributeV2.Operation.Any) - mappingAttributes1.MappingAttributeV2.Operation.Any = types.StringValue(string(anyResult)) - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode = &OperationObjectNode{} - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Append = nil - for _, appendItem := range mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Append { - var append2 types.String - append2Result, _ := json.Marshal(appendItem) - append2 = types.StringValue(string(append2Result)) - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Append = append(mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Append, append2) - } - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Copy = types.StringPointerValue(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Copy) - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random == nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random = nil - } else { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random = &RandomOperation{} - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.One != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.One = &One{} - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.One.Type = types.StringValue(string(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.One.Type)) - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two = &Two{} - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max = types.NumberValue(big.NewFloat(float64(*mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max))) - } else { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Max = types.NumberNull() - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min = types.NumberValue(big.NewFloat(float64(*mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min))) - } else { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Min = types.NumberNull() - } - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Type = types.StringValue(string(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Random.Two.Type)) - } - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Set == nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Set = types.StringNull() - } else { - setResult, _ := json.Marshal(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Set) - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Set = types.StringValue(string(setResult)) - } - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Template = types.StringPointerValue(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Template) - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq == nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq = nil - } else { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq = &Uniq{} - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.Boolean != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq.Boolean = types.BoolPointerValue(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.Boolean) - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr != nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr = nil - for _, v := range mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr = append(mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.Uniq.ArrayOfStr, types.StringValue(v)) - } - } - } - if mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties == nil { - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties = types.StringNull() - } else { - additionalPropertiesResult, _ := json.Marshal(mappingAttributesItem.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties) - mappingAttributes1.MappingAttributeV2.Operation.OperationObjectNode.AdditionalProperties = types.StringValue(string(additionalPropertiesResult)) - } - } - if mappingAttributesItem.MappingAttributeV2.Origin != nil { - mappingAttributes1.MappingAttributeV2.Origin = types.StringValue(string(*mappingAttributesItem.MappingAttributeV2.Origin)) - } else { - mappingAttributes1.MappingAttributeV2.Origin = types.StringNull() - } - mappingAttributes1.MappingAttributeV2.Target = types.StringValue(mappingAttributesItem.MappingAttributeV2.Target) - } - if mappingAttributesCount+1 > len(targets1.MappingAttributes) { - targets1.MappingAttributes = append(targets1.MappingAttributes, mappingAttributes1) - } else { - } - } - targets1.Name = types.StringPointerValue(targetsItem.Name) - for relationAttributesCount, relationAttributesItem := range targetsItem.RelationAttributes { - var relationAttributes1 RelationAttribute - relationAttributes1.Mode = types.StringValue(string(relationAttributesItem.Mode)) - if relationAttributesItem.Origin != nil { - relationAttributes1.Origin = types.StringValue(string(*relationAttributesItem.Origin)) - } else { - relationAttributes1.Origin = types.StringNull() - } - if len(relationAttributesItem.RelatedTo) > 0 { - relationAttributes1.RelatedTo = make(map[string]types.String) - for key, value1 := range relationAttributesItem.RelatedTo { - result, _ := json.Marshal(value1) - relationAttributes1.RelatedTo[key] = types.StringValue(string(result)) - } - } - if relationAttributesItem.SourceFilter == nil { - relationAttributes1.SourceFilter = nil - } else { - relationAttributes1.SourceFilter = &SourceFilter{} - relationAttributes1.SourceFilter.Attribute = types.StringPointerValue(relationAttributesItem.SourceFilter.Attribute) - relationAttributes1.SourceFilter.Limit = types.Int64PointerValue(relationAttributesItem.SourceFilter.Limit) - relationAttributes1.SourceFilter.RelationTag = types.StringPointerValue(relationAttributesItem.SourceFilter.RelationTag) - relationAttributes1.SourceFilter.Schema = types.StringPointerValue(relationAttributesItem.SourceFilter.Schema) - relationAttributes1.SourceFilter.Self = types.BoolPointerValue(relationAttributesItem.SourceFilter.Self) - relationAttributes1.SourceFilter.Tag = types.StringPointerValue(relationAttributesItem.SourceFilter.Tag) - } - relationAttributes1.Target = types.StringValue(relationAttributesItem.Target) - relationAttributes1.TargetTags = nil - for _, v := range relationAttributesItem.TargetTags { - relationAttributes1.TargetTags = append(relationAttributes1.TargetTags, types.StringValue(v)) - } - relationAttributes1.TargetTagsIncludeSource = types.BoolPointerValue(relationAttributesItem.TargetTagsIncludeSource) - if relationAttributesCount+1 > len(targets1.RelationAttributes) { - targets1.RelationAttributes = append(targets1.RelationAttributes, relationAttributes1) - } else { - targets1.RelationAttributes[relationAttributesCount].Mode = relationAttributes1.Mode - targets1.RelationAttributes[relationAttributesCount].Origin = relationAttributes1.Origin - targets1.RelationAttributes[relationAttributesCount].RelatedTo = relationAttributes1.RelatedTo - targets1.RelationAttributes[relationAttributesCount].SourceFilter = relationAttributes1.SourceFilter - targets1.RelationAttributes[relationAttributesCount].Target = relationAttributes1.Target - targets1.RelationAttributes[relationAttributesCount].TargetTags = relationAttributes1.TargetTags - targets1.RelationAttributes[relationAttributesCount].TargetTagsIncludeSource = relationAttributes1.TargetTagsIncludeSource - } - } - targets1.TargetSchema = types.StringValue(targetsItem.TargetSchema) - targets1.TargetUnique = nil - for _, v := range targetsItem.TargetUnique { - targets1.TargetUnique = append(targets1.TargetUnique, types.StringValue(v)) - } - if targetsCount+1 > len(r.Targets) { - r.Targets = append(r.Targets, targets1) - } else { - r.Targets[targetsCount].AllowFailure = targets1.AllowFailure - r.Targets[targetsCount].ConditionMode = targets1.ConditionMode - r.Targets[targetsCount].Conditions = targets1.Conditions - r.Targets[targetsCount].ID = targets1.ID - r.Targets[targetsCount].LinkbackRelationAttribute = targets1.LinkbackRelationAttribute - r.Targets[targetsCount].LinkbackRelationTags = targets1.LinkbackRelationTags - r.Targets[targetsCount].MappingAttributes = targets1.MappingAttributes - r.Targets[targetsCount].Name = targets1.Name - r.Targets[targetsCount].RelationAttributes = targets1.RelationAttributes - r.Targets[targetsCount].TargetSchema = targets1.TargetSchema - r.Targets[targetsCount].TargetUnique = targets1.TargetUnique - } - } - r.Version = types.NumberValue(big.NewFloat(float64(resp.Version))) -} diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 3865a29..83a8fed 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -81,15 +81,11 @@ func (p *EpilotEntitymappingProvider) Configure(ctx context.Context, req provide } func (p *EpilotEntitymappingProvider) Resources(ctx context.Context) []func() resource.Resource { - return []func() resource.Resource{ - NewEntityMappingResource, - } + return []func() resource.Resource{} } func (p *EpilotEntitymappingProvider) DataSources(ctx context.Context) []func() datasource.DataSource { - return []func() datasource.DataSource{ - NewEntityMappingDataSource, - } + return []func() datasource.DataSource{} } func New(version string) func() provider.Provider { diff --git a/internal/provider/type_append_value_mapper.go b/internal/provider/type_append_value_mapper.go deleted file mode 100644 index 62b44c0..0000000 --- a/internal/provider/type_append_value_mapper.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type AppendValueMapper struct { - Mode types.String `tfsdk:"mode"` - Source types.String `tfsdk:"source"` - Target types.String `tfsdk:"target"` - TargetUnique []types.String `tfsdk:"target_unique"` - ValueJSON types.String `tfsdk:"value_json"` -} diff --git a/internal/provider/type_config.go b/internal/provider/type_config.go deleted file mode 100644 index 9f1e18e..0000000 --- a/internal/provider/type_config.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -type Config struct { - EntityRef *EntityRef `tfsdk:"entity_ref"` - JourneyRef *JourneyRef `tfsdk:"journey_ref"` -} diff --git a/internal/provider/type_copy_value_mapper.go b/internal/provider/type_copy_value_mapper.go deleted file mode 100644 index 70e2ca3..0000000 --- a/internal/provider/type_copy_value_mapper.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type CopyValueMapper struct { - Mode types.String `tfsdk:"mode"` - Source types.String `tfsdk:"source"` - Target types.String `tfsdk:"target"` -} diff --git a/internal/provider/type_entity_ref.go b/internal/provider/type_entity_ref.go deleted file mode 100644 index fccc4fd..0000000 --- a/internal/provider/type_entity_ref.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type EntityRef struct { - EntityID types.String `tfsdk:"entity_id"` - EntitySchema types.String `tfsdk:"entity_schema"` -} diff --git a/internal/provider/type_journey_ref.go b/internal/provider/type_journey_ref.go deleted file mode 100644 index 1566a70..0000000 --- a/internal/provider/type_journey_ref.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type JourneyRef struct { - JourneyID types.String `tfsdk:"journey_id"` -} diff --git a/internal/provider/type_mapping_attribute.go b/internal/provider/type_mapping_attribute.go deleted file mode 100644 index a222b13..0000000 --- a/internal/provider/type_mapping_attribute.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -type MappingAttribute struct { - AppendValueMapper *AppendValueMapper `tfsdk:"append_value_mapper"` - CopyValueMapper *CopyValueMapper `tfsdk:"copy_value_mapper"` - SetValueMapper *SetValueMapper `tfsdk:"set_value_mapper"` -} diff --git a/internal/provider/type_mapping_attribute_v2.go b/internal/provider/type_mapping_attribute_v2.go deleted file mode 100644 index 5380d8d..0000000 --- a/internal/provider/type_mapping_attribute_v2.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type MappingAttributeV2 struct { - Operation OperationNode `tfsdk:"operation"` - Origin types.String `tfsdk:"origin"` - Target types.String `tfsdk:"target"` -} diff --git a/internal/provider/type_mapping_attributes.go b/internal/provider/type_mapping_attributes.go deleted file mode 100644 index 22dbe37..0000000 --- a/internal/provider/type_mapping_attributes.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -type MappingAttributes struct { - MappingAttribute *MappingAttribute `tfsdk:"mapping_attribute"` - MappingAttributeV2 *MappingAttributeV2 `tfsdk:"mapping_attribute_v2"` -} diff --git a/internal/provider/type_one.go b/internal/provider/type_one.go deleted file mode 100644 index acc4aa2..0000000 --- a/internal/provider/type_one.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type One struct { - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/type_operation_node.go b/internal/provider/type_operation_node.go deleted file mode 100644 index 2481e53..0000000 --- a/internal/provider/type_operation_node.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type OperationNode struct { - Any types.String `tfsdk:"any"` - OperationObjectNode *OperationObjectNode `tfsdk:"operation_object_node"` -} diff --git a/internal/provider/type_operation_object_node.go b/internal/provider/type_operation_object_node.go deleted file mode 100644 index b9b73a7..0000000 --- a/internal/provider/type_operation_object_node.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type OperationObjectNode struct { - Append []types.String `tfsdk:"append"` - Copy types.String `tfsdk:"copy"` - Random *RandomOperation `tfsdk:"random"` - Set types.String `tfsdk:"set"` - Template types.String `tfsdk:"template"` - Uniq *Uniq `tfsdk:"uniq"` - AdditionalProperties types.String `tfsdk:"additional_properties"` -} diff --git a/internal/provider/type_random_operation.go b/internal/provider/type_random_operation.go deleted file mode 100644 index a46b2ca..0000000 --- a/internal/provider/type_random_operation.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -type RandomOperation struct { - One *One `tfsdk:"one"` - Two *Two `tfsdk:"two"` -} diff --git a/internal/provider/type_relation_attribute.go b/internal/provider/type_relation_attribute.go deleted file mode 100644 index 0e14646..0000000 --- a/internal/provider/type_relation_attribute.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type RelationAttribute struct { - Mode types.String `tfsdk:"mode"` - Origin types.String `tfsdk:"origin"` - RelatedTo map[string]types.String `tfsdk:"related_to"` - SourceFilter *SourceFilter `tfsdk:"source_filter"` - Target types.String `tfsdk:"target"` - TargetTags []types.String `tfsdk:"target_tags"` - TargetTagsIncludeSource types.Bool `tfsdk:"target_tags_include_source"` -} diff --git a/internal/provider/type_set_value_mapper.go b/internal/provider/type_set_value_mapper.go deleted file mode 100644 index cb6c8fd..0000000 --- a/internal/provider/type_set_value_mapper.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type SetValueMapper struct { - Mode types.String `tfsdk:"mode"` - Target types.String `tfsdk:"target"` - Value types.String `tfsdk:"value"` -} diff --git a/internal/provider/type_source_config.go b/internal/provider/type_source_config.go deleted file mode 100644 index f81aa6e..0000000 --- a/internal/provider/type_source_config.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type SourceConfig struct { - Config *Config `tfsdk:"config"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/type_source_filter.go b/internal/provider/type_source_filter.go deleted file mode 100644 index 698207c..0000000 --- a/internal/provider/type_source_filter.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type SourceFilter struct { - Attribute types.String `tfsdk:"attribute"` - Limit types.Int64 `tfsdk:"limit"` - RelationTag types.String `tfsdk:"relation_tag"` - Schema types.String `tfsdk:"schema"` - Self types.Bool `tfsdk:"self"` - Tag types.String `tfsdk:"tag"` -} diff --git a/internal/provider/type_target_config.go b/internal/provider/type_target_config.go deleted file mode 100644 index ba3958e..0000000 --- a/internal/provider/type_target_config.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type TargetConfig struct { - AllowFailure types.Bool `tfsdk:"allow_failure"` - ConditionMode types.String `tfsdk:"condition_mode"` - Conditions types.String `tfsdk:"conditions"` - ID types.String `tfsdk:"id"` - LinkbackRelationAttribute types.String `tfsdk:"linkback_relation_attribute"` - LinkbackRelationTags []types.String `tfsdk:"linkback_relation_tags"` - MappingAttributes []MappingAttributes `tfsdk:"mapping_attributes"` - Name types.String `tfsdk:"name"` - RelationAttributes []RelationAttribute `tfsdk:"relation_attributes"` - TargetSchema types.String `tfsdk:"target_schema"` - TargetUnique []types.String `tfsdk:"target_unique"` -} diff --git a/internal/provider/type_two.go b/internal/provider/type_two.go deleted file mode 100644 index 14812fa..0000000 --- a/internal/provider/type_two.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Two struct { - Max types.Number `tfsdk:"max"` - Min types.Number `tfsdk:"min"` - Type types.String `tfsdk:"type"` -} diff --git a/internal/provider/type_uniq.go b/internal/provider/type_uniq.go deleted file mode 100644 index 353b58b..0000000 --- a/internal/provider/type_uniq.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type Uniq struct { - Boolean types.Bool `tfsdk:"boolean"` - ArrayOfStr []types.String `tfsdk:"array_of_str"` -} diff --git a/internal/sdk/mappings.go b/internal/sdk/mappings.go index c6ccc0e..90fd53d 100644 --- a/internal/sdk/mappings.go +++ b/internal/sdk/mappings.go @@ -79,13 +79,6 @@ func (s *Mappings) DeleteConfig(ctx context.Context, request operations.DeleteCo "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { @@ -190,13 +183,6 @@ func (s *Mappings) ExecuteMapping(ctx context.Context, request operations.Execut "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { @@ -298,13 +284,6 @@ func (s *Mappings) ExecuteRelations(ctx context.Context, request *shared.Execute "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { @@ -400,13 +379,6 @@ func (s *Mappings) GetAllVersions(ctx context.Context, request operations.GetAll "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { @@ -501,13 +473,6 @@ func (s *Mappings) GetConfig(ctx context.Context, request operations.GetConfigRe "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { @@ -602,13 +567,6 @@ func (s *Mappings) GetConfigVersion(ctx context.Context, request operations.GetC "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { @@ -704,13 +662,6 @@ func (s *Mappings) QueryMappingHistory(ctx context.Context, request operations.Q "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { @@ -811,13 +762,6 @@ func (s *Mappings) SearchConfigs(ctx context.Context, request *shared.SearchMapp "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { @@ -923,13 +867,6 @@ func (s *Mappings) StoreConfig(ctx context.Context, request operations.StoreConf "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { @@ -1034,13 +971,6 @@ func (s *Mappings) StoreNewVersion(ctx context.Context, request operations.Store "5XX", }, }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } return client.Do(req) }) if err != nil { diff --git a/internal/sdk/pkg/models/shared/mappingconfig.go b/internal/sdk/pkg/models/shared/mappingconfig.go index a849ac0..d44fdbd 100644 --- a/internal/sdk/pkg/models/shared/mappingconfig.go +++ b/internal/sdk/pkg/models/shared/mappingconfig.go @@ -2,12 +2,46 @@ package shared +import ( + "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/sdk/pkg/utils" + "time" +) + type MappingConfig struct { - ID string `json:"id"` - OrgID string `json:"org_id"` - Source SourceConfig `json:"source"` - Targets []TargetConfig `json:"targets"` - Version float64 `json:"version"` + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatedBy *Owner `json:"created_by,omitempty"` + ID string `json:"id"` + LastUpdatedBy *Owner `json:"last_updated_by,omitempty"` + OrgID string `json:"org_id"` + Source SourceConfig `json:"source"` + Targets []TargetConfig `json:"targets"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Version float64 `json:"version"` +} + +func (m MappingConfig) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(m, "", false) +} + +func (m *MappingConfig) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &m, "", false, false); err != nil { + return err + } + return nil +} + +func (o *MappingConfig) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *MappingConfig) GetCreatedBy() *Owner { + if o == nil { + return nil + } + return o.CreatedBy } func (o *MappingConfig) GetID() string { @@ -17,6 +51,13 @@ func (o *MappingConfig) GetID() string { return o.ID } +func (o *MappingConfig) GetLastUpdatedBy() *Owner { + if o == nil { + return nil + } + return o.LastUpdatedBy +} + func (o *MappingConfig) GetOrgID() string { if o == nil { return "" @@ -38,6 +79,13 @@ func (o *MappingConfig) GetTargets() []TargetConfig { return o.Targets } +func (o *MappingConfig) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} + func (o *MappingConfig) GetVersion() float64 { if o == nil { return 0.0 diff --git a/internal/sdk/pkg/models/shared/operationobjectnode.go b/internal/sdk/pkg/models/shared/operationobjectnode.go index 9cce1f6..a4a91aa 100644 --- a/internal/sdk/pkg/models/shared/operationobjectnode.go +++ b/internal/sdk/pkg/models/shared/operationobjectnode.go @@ -11,13 +11,13 @@ type UniqType string const ( UniqTypeBoolean UniqType = "boolean" - UniqTypeArrayOfStr UniqType = "array_Of_str" + UniqTypeArrayOfstr UniqType = "arrayOfstr" ) // Uniq - Unique array type Uniq struct { Boolean *bool - ArrayOfStr []string + ArrayOfstr []string Type UniqType } @@ -31,11 +31,11 @@ func CreateUniqBoolean(boolean bool) Uniq { } } -func CreateUniqArrayOfStr(arrayOfStr []string) Uniq { - typ := UniqTypeArrayOfStr +func CreateUniqArrayOfstr(arrayOfstr []string) Uniq { + typ := UniqTypeArrayOfstr return Uniq{ - ArrayOfStr: arrayOfStr, + ArrayOfstr: arrayOfstr, Type: typ, } } @@ -49,10 +49,10 @@ func (u *Uniq) UnmarshalJSON(data []byte) error { return nil } - arrayOfStr := []string{} - if err := utils.UnmarshalJSON(data, &arrayOfStr, "", true, true); err == nil { - u.ArrayOfStr = arrayOfStr - u.Type = UniqTypeArrayOfStr + arrayOfstr := []string{} + if err := utils.UnmarshalJSON(data, &arrayOfstr, "", true, true); err == nil { + u.ArrayOfstr = arrayOfstr + u.Type = UniqTypeArrayOfstr return nil } @@ -64,8 +64,8 @@ func (u Uniq) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Boolean, "", true) } - if u.ArrayOfStr != nil { - return utils.MarshalJSON(u.ArrayOfStr, "", true) + if u.ArrayOfstr != nil { + return utils.MarshalJSON(u.ArrayOfstr, "", true) } return nil, errors.New("could not marshal union type: all fields are null") diff --git a/internal/sdk/pkg/models/shared/owner.go b/internal/sdk/pkg/models/shared/owner.go new file mode 100644 index 0000000..15d3955 --- /dev/null +++ b/internal/sdk/pkg/models/shared/owner.go @@ -0,0 +1,62 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +type Type string + +const ( + TypeUser Type = "user" + TypeInternalService Type = "internal_service" +) + +func (e Type) ToPointer() *Type { + return &e +} + +func (e *Type) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "user": + fallthrough + case "internal_service": + *e = Type(v) + return nil + default: + return fmt.Errorf("invalid value for Type: %v", v) + } +} + +type Owner struct { + OrgID *string `json:"org_id,omitempty"` + Type Type `json:"type"` + UserID *string `json:"user_id,omitempty"` +} + +func (o *Owner) GetOrgID() *string { + if o == nil { + return nil + } + return o.OrgID +} + +func (o *Owner) GetType() Type { + if o == nil { + return Type("") + } + return o.Type +} + +func (o *Owner) GetUserID() *string { + if o == nil { + return nil + } + return o.UserID +} diff --git a/internal/sdk/pkg/models/shared/randomoperation.go b/internal/sdk/pkg/models/shared/randomoperation.go index dcf8dd4..08ea4ad 100644 --- a/internal/sdk/pkg/models/shared/randomoperation.go +++ b/internal/sdk/pkg/models/shared/randomoperation.go @@ -9,34 +9,34 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-entitymapping/internal/sdk/pkg/utils" ) -type RandomOperationType string +type RandomOperationSchemasType string const ( - RandomOperationTypeNumber RandomOperationType = "number" + RandomOperationSchemasTypeNumber RandomOperationSchemasType = "number" ) -func (e RandomOperationType) ToPointer() *RandomOperationType { +func (e RandomOperationSchemasType) ToPointer() *RandomOperationSchemasType { return &e } -func (e *RandomOperationType) UnmarshalJSON(data []byte) error { +func (e *RandomOperationSchemasType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case "number": - *e = RandomOperationType(v) + *e = RandomOperationSchemasType(v) return nil default: - return fmt.Errorf("invalid value for RandomOperationType: %v", v) + return fmt.Errorf("invalid value for RandomOperationSchemasType: %v", v) } } type Two struct { - Max *float64 `default:"1" json:"max"` - Min *float64 `default:"0" json:"min"` - Type RandomOperationType `json:"type"` + Max *float64 `default:"1" json:"max"` + Min *float64 `default:"0" json:"min"` + Type RandomOperationSchemasType `json:"type"` } func (t Two) MarshalJSON() ([]byte, error) { @@ -64,25 +64,25 @@ func (o *Two) GetMin() *float64 { return o.Min } -func (o *Two) GetType() RandomOperationType { +func (o *Two) GetType() RandomOperationSchemasType { if o == nil { - return RandomOperationType("") + return RandomOperationSchemasType("") } return o.Type } -type RandomOperationSchemasType string +type RandomOperationType string const ( - RandomOperationSchemasTypeUUID RandomOperationSchemasType = "uuid" - RandomOperationSchemasTypeNanoid RandomOperationSchemasType = "nanoid" + RandomOperationTypeUUID RandomOperationType = "uuid" + RandomOperationTypeNanoid RandomOperationType = "nanoid" ) -func (e RandomOperationSchemasType) ToPointer() *RandomOperationSchemasType { +func (e RandomOperationType) ToPointer() *RandomOperationType { return &e } -func (e *RandomOperationSchemasType) UnmarshalJSON(data []byte) error { +func (e *RandomOperationType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -91,20 +91,20 @@ func (e *RandomOperationSchemasType) UnmarshalJSON(data []byte) error { case "uuid": fallthrough case "nanoid": - *e = RandomOperationSchemasType(v) + *e = RandomOperationType(v) return nil default: - return fmt.Errorf("invalid value for RandomOperationSchemasType: %v", v) + return fmt.Errorf("invalid value for RandomOperationType: %v", v) } } type One struct { - Type RandomOperationSchemasType `json:"type"` + Type RandomOperationType `json:"type"` } -func (o *One) GetType() RandomOperationSchemasType { +func (o *One) GetType() RandomOperationType { if o == nil { - return RandomOperationSchemasType("") + return RandomOperationType("") } return o.Type } diff --git a/internal/sdk/pkg/models/shared/sourceconfig.go b/internal/sdk/pkg/models/shared/sourceconfig.go index 64b248a..2fc8ea2 100644 --- a/internal/sdk/pkg/models/shared/sourceconfig.go +++ b/internal/sdk/pkg/models/shared/sourceconfig.go @@ -72,18 +72,18 @@ func (u Config) MarshalJSON() ([]byte, error) { return nil, errors.New("could not marshal union type: all fields are null") } -type Type string +type SourceConfigType string const ( - TypeJourney Type = "journey" - TypeEntity Type = "entity" + SourceConfigTypeJourney SourceConfigType = "journey" + SourceConfigTypeEntity SourceConfigType = "entity" ) -func (e Type) ToPointer() *Type { +func (e SourceConfigType) ToPointer() *SourceConfigType { return &e } -func (e *Type) UnmarshalJSON(data []byte) error { +func (e *SourceConfigType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -92,16 +92,16 @@ func (e *Type) UnmarshalJSON(data []byte) error { case "journey": fallthrough case "entity": - *e = Type(v) + *e = SourceConfigType(v) return nil default: - return fmt.Errorf("invalid value for Type: %v", v) + return fmt.Errorf("invalid value for SourceConfigType: %v", v) } } type SourceConfig struct { - Config *Config `json:"config,omitempty"` - Type *Type `json:"type,omitempty"` + Config *Config `json:"config,omitempty"` + Type *SourceConfigType `json:"type,omitempty"` } func (o *SourceConfig) GetConfig() *Config { @@ -111,7 +111,7 @@ func (o *SourceConfig) GetConfig() *Config { return o.Config } -func (o *SourceConfig) GetType() *Type { +func (o *SourceConfig) GetType() *SourceConfigType { if o == nil { return nil } diff --git a/internal/sdk/pkg/utils/json.go b/internal/sdk/pkg/utils/json.go index ca8699d..8d0804f 100644 --- a/internal/sdk/pkg/utils/json.go +++ b/internal/sdk/pkg/utils/json.go @@ -358,7 +358,7 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc return []byte(fmt.Sprintf(`"%s"`, tagValue)) default: if typ.Kind() == reflect.String { - return []byte(fmt.Sprintf("%q", tagValue)) + return []byte(fmt.Sprintf(`"%s"`, tagValue)) } } diff --git a/internal/sdk/pkg/utils/security.go b/internal/sdk/pkg/utils/security.go index ea1d4b2..fa5eff7 100644 --- a/internal/sdk/pkg/utils/security.go +++ b/internal/sdk/pkg/utils/security.go @@ -204,9 +204,9 @@ func parseSecuritySchemeValue(client *securityConfig, schemeTag *securityTag, se panic("not supported") } case "openIdConnect": - client.headers[secTag.Name] = prefixBearer(valToString(val)) + client.headers[secTag.Name] = valToString(val) case "oauth2": - client.headers[secTag.Name] = prefixBearer(valToString(val)) + client.headers[secTag.Name] = valToString(val) case "http": switch schemeTag.SubType { case "bearer": diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go index 75dbab5..c2d68e2 100644 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -141,9 +141,9 @@ func New(opts ...SDKOption) *SDK { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.4.0", - GenVersion: "2.277.0", - UserAgent: "speakeasy-sdk/go 0.4.0 2.277.0 1.0.0 epilot-entitymapping", + SDKVersion: "0.4.1", + GenVersion: "2.230.1", + UserAgent: "speakeasy-sdk/go 0.4.1 2.230.1 1.0.0 epilot-entitymapping", }, } for _, opt := range opts { diff --git a/main.go b/main.go index 3868581..7407f22 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( // Run the docs generation tool, check its repository for more information on how it works and how docs // can be customized. -//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-name terraform-provider-epilot-entitymapping --rendered-provider-name terraform-provider-epilot-entitymapping +//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --rendered-provider-name terraform-provider-epilot-entitymapping var ( // these will be set by the goreleaser configuration diff --git a/overlay.yaml b/overlay.yaml index 9025ce1..3dfc340 100644 --- a/overlay.yaml +++ b/overlay.yaml @@ -21,10 +21,10 @@ actions: - target: $["paths"]["/v2/mappings/{id}"]["get"]["parameters"][0] update: x-speakeasy-match: id - - target: $["paths"]["/v2/mappings/{id}/versions"]["post"] + - target: $["paths"]["/v2/mappings/{id}"]["put"] update: - x-speakeasy-entity-operation: EntityMapping#create - - target: $["paths"]["/v2/mappings/{id}/versions"]["post"]["parameters"][0] + x-speakeasy-entity-operation: EntityMapping#update + - target: $["paths"]["/v2/mappings/{id}"]["put"]["parameters"][0] update: x-speakeasy-match: id - target: $["components"]["schemas"]["MappingConfigV2"]