diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1aa263a..8daef7c 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,55 +3,28 @@ id: 998a101f-1cb6-4c08-9fd1-b3ee7a1cdeb4 management: docChecksum: ba0b634f013b3a51aada11726ca60e99 docVersion: 0.0.1 - speakeasyVersion: 1.346.0 - generationVersion: 2.379.3 - releaseVersion: 0.8.2 - configChecksum: 276a88dd22038564ff771b452c438b1e + speakeasyVersion: 1.460.2 + generationVersion: 2.484.0 + releaseVersion: 0.9.0 + configChecksum: 0cb27a37e875921ab51413bed9f5cbad + repoURL: https://github.com/epilot-dev/terraform-provider-epilot-designbuilder.git features: terraform: additionalDependencies: 0.1.0 - core: 3.24.3 - globalSecurity: 2.81.6 + core: 3.27.6 + envVarSecurityUsage: 0.1.0 + globalSecurity: 2.81.9 globalServerURLs: 2.82.1 typeOverrides: 2.81.1 generatedFiles: - - internal/sdk/sdk.go - - internal/sdk/models/errors/sdkerror.go - - internal/sdk/retry/config.go - - internal/sdk/types/bigint.go - - internal/sdk/types/date.go - - internal/sdk/types/datetime.go - - internal/sdk/types/decimal.go - - internal/sdk/types/pointers.go - - internal/sdk/internal/utils/contenttype.go - - internal/sdk/internal/utils/form.go - - internal/sdk/internal/utils/headers.go - - internal/sdk/internal/utils/json.go - - internal/sdk/internal/utils/pathparams.go - - internal/sdk/internal/utils/queryparams.go - - internal/sdk/internal/utils/requestbody.go - - internal/sdk/internal/utils/retries.go - - internal/sdk/internal/utils/security.go - - internal/sdk/internal/utils/utils.go - - internal/sdk/models/operations/adddesign.go - - internal/sdk/models/operations/deletedesign.go - - internal/sdk/models/operations/getalldesigns.go - - internal/sdk/models/operations/getdesign.go - - internal/sdk/models/operations/updatedesign.go - - internal/sdk/models/shared/errorresp.go - - internal/sdk/models/shared/adddesignres.go - - internal/sdk/models/shared/adddesignreq.go - - internal/sdk/models/shared/getalldesignsres.go - - internal/sdk/models/shared/getdesignres.go - - internal/sdk/models/shared/updatedesignreq.go - - internal/sdk/models/shared/security.go - - internal/sdk/.gitignore - - internal/sdk/models/operations/options.go - - internal/sdk/.gitattributes - - internal/sdk/internal/hooks/registration.go - - internal/sdk/internal/hooks/hooks.go - - internal/sdk/CONTRIBUTING.md + - .gitattributes + - CONTRIBUTING.md + - USAGE.md - examples/README.md + - examples/data-sources/epilot-designbuilder_design/data-source.tf + - examples/provider/provider.tf + - examples/resources/epilot-designbuilder_design/import.sh + - examples/resources/epilot-designbuilder_design/resource.tf - go.mod - go.sum - internal/planmodifiers/boolplanmodifier/suppress_diff.go @@ -64,6 +37,11 @@ generatedFiles: - internal/planmodifiers/setplanmodifier/suppress_diff.go - internal/planmodifiers/stringplanmodifier/suppress_diff.go - internal/planmodifiers/utils/state_check.go + - internal/provider/design_data_source.go + - internal/provider/design_data_source_sdk.go + - internal/provider/design_resource.go + - internal/provider/design_resource_sdk.go + - internal/provider/provider.go - internal/provider/reflect/diags.go - internal/provider/reflect/doc.go - internal/provider/reflect/generic_attr_value.go @@ -78,7 +56,44 @@ generatedFiles: - internal/provider/reflect/primitive.go - internal/provider/reflect/slice.go - internal/provider/reflect/struct.go + - internal/provider/types/user.go - internal/provider/utils.go + - internal/sdk/.gitattributes + - internal/sdk/.gitignore + - internal/sdk/CONTRIBUTING.md + - internal/sdk/internal/hooks/hooks.go + - internal/sdk/internal/utils/contenttype.go + - internal/sdk/internal/utils/env.go + - internal/sdk/internal/utils/form.go + - internal/sdk/internal/utils/headers.go + - internal/sdk/internal/utils/json.go + - internal/sdk/internal/utils/pathparams.go + - internal/sdk/internal/utils/queryparams.go + - internal/sdk/internal/utils/requestbody.go + - internal/sdk/internal/utils/retries.go + - internal/sdk/internal/utils/security.go + - internal/sdk/internal/utils/utils.go + - internal/sdk/models/errors/sdkerror.go + - internal/sdk/models/operations/adddesign.go + - internal/sdk/models/operations/deletedesign.go + - internal/sdk/models/operations/getalldesigns.go + - internal/sdk/models/operations/getdesign.go + - internal/sdk/models/operations/options.go + - internal/sdk/models/operations/updatedesign.go + - internal/sdk/models/shared/adddesignreq.go + - internal/sdk/models/shared/adddesignres.go + - internal/sdk/models/shared/errorresp.go + - internal/sdk/models/shared/getalldesignsres.go + - internal/sdk/models/shared/getdesignres.go + - internal/sdk/models/shared/security.go + - internal/sdk/models/shared/updatedesignreq.go + - internal/sdk/retry/config.go + - internal/sdk/sdk.go + - internal/sdk/types/bigint.go + - internal/sdk/types/date.go + - internal/sdk/types/datetime.go + - internal/sdk/types/decimal.go + - internal/sdk/types/pointers.go - internal/validators/DateValidator.go - internal/validators/ExactlyOneChild.go - internal/validators/JSONParseValidator.go @@ -95,16 +110,42 @@ generatedFiles: - main.go - terraform-registry-manifest.json - tools/tools.go - - internal/provider/types/user.go - - USAGE.md - - internal/provider/provider.go - - examples/provider/provider.tf - - examples/resources/epilot-designbuilder_design/import.sh - - internal/provider/design_resource.go - - internal/provider/design_resource_sdk.go - - examples/resources/epilot-designbuilder_design/resource.tf - - internal/provider/design_data_source.go - - internal/provider/design_data_source_sdk.go - - examples/data-sources/epilot-designbuilder_design/data-source.tf - - .gitattributes - - CONTRIBUTING.md +examples: + addDesign: + speakeasy-default-add-design: + requestBody: + application/json: {"design": {"created_at": "2021-01-30T08:30:00Z", "edited": true, "style": "", "style_name": ""}} + responses: + "201": + application/json: {"design": {"created_at": "2021-01-30T08:30:00Z", "edited": false, "style": "", "style_name": ""}} + "400": + application/json: {} + deleteDesign: + "": + parameters: + path: + designId: "4a062990-a6a3-11eb-9828-4f3da7d4935a" + getAllDesigns: + speakeasy-default-get-all-designs: + responses: + "200": + application/json: [{}] + "500": + application/json: {} + getDesign: + "": + parameters: + path: + designId: "4a062990-a6a3-11eb-9828-4f3da7d4935a" + responses: + "200": + application/json: {"design": {"created_at": "2021-01-30T08:30:00Z", "edited": false, "style": "", "style_name": ""}} + "400": {} + updateDesign: + "": + parameters: + path: + designId: "4a062990-a6a3-11eb-9828-4f3da7d4935a" + requestBody: + application/json: {"design": {"created_at": "2021-01-30T08:30:00Z", "edited": true, "style": "", "style_name": ""}} +generatedTests: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock new file mode 100644 index 0000000..842d922 --- /dev/null +++ b/.speakeasy/workflow.lock @@ -0,0 +1,29 @@ +speakeasyVersion: 1.460.2 +sources: + my-source: + sourceNamespace: my-source + sourceRevisionDigest: sha256:83eb298c906f0390a71895740e9520d19a8257e13f9a6d45d455bdd652098924 + sourceBlobDigest: sha256:0e905b51af77f61d4c39e8c2c2e973b22593ea9e31bdf64daaa9ba8584ac9ec4 + tags: + - latest + - speakeasy-sdk-regen-1730852025 + - 0.0.1 +targets: + terraform: + source: my-source + sourceNamespace: my-source + sourceRevisionDigest: sha256:83eb298c906f0390a71895740e9520d19a8257e13f9a6d45d455bdd652098924 + sourceBlobDigest: sha256:0e905b51af77f61d4c39e8c2c2e973b22593ea9e31bdf64daaa9ba8584ac9ec4 +workflow: + workflowVersion: 1.0.0 + speakeasyVersion: latest + sources: + my-source: + inputs: + - location: designbuilder.yaml + registry: + location: registry.speakeasyapi.dev/epilot/epilot/my-source + targets: + terraform: + target: terraform + source: my-source diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 7a7f14b..e492b69 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -1,8 +1,11 @@ workflowVersion: 1.0.0 +speakeasyVersion: latest sources: my-source: inputs: - location: designbuilder.yaml + registry: + location: registry.speakeasyapi.dev/epilot/epilot/my-source targets: terraform: target: terraform diff --git a/README.md b/README.md index c69dea7..66dc905 100755 --- a/README.md +++ b/README.md @@ -1,63 +1 @@ -
- - - - -

Epilot is the digital foundation for sales, service, network and implementation processes in the context of the energy transition..

- - -
- - -## SDK Installation - -To install this provider, copy and paste this code into your Terraform configuration. Then, run `terraform init`. - -```hcl -terraform { - required_providers { - epilot-designbuilder = { - source = "epilot-dev/epilot-designbuilder" - version = "0.8.2" - } - } -} - -provider "epilot-designbuilder" { - # Configuration options -} -``` - - - -## SDK Example Usage - -### Testing the provider locally - -Should you want to validate a change locally, the `--debug` flag allows you to execute the provider against a terraform instance locally. - -This also allows for debuggers (e.g. delve) to be attached to the provider. - -### Example - -```sh -go run main.go --debug -# Copy the TF_REATTACH_PROVIDERS env var -# In a new terminal -cd examples/your-example -TF_REATTACH_PROVIDERS=... terraform init -TF_REATTACH_PROVIDERS=... terraform apply -``` - - - -## Available Resources and Operations - - - - - - - - -### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks) +undefined \ No newline at end of file diff --git a/RELEASES.md b/RELEASES.md index 22a7ee6..5c646a6 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -30,4 +30,14 @@ Based on: - OpenAPI Doc 1.0.0 - Speakeasy CLI 1.147.0 (2.237.2) https://github.com/speakeasy-api/speakeasy ### Generated -- [terraform v0.2.3] . \ No newline at end of file +- [terraform v0.2.3] . + +## 2024-12-24 00:14:29 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.460.2 (2.484.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [terraform v0.9.0] . +### Releases +- [Terraform v0.9.0] https://registry.terraform.io/providers/epilot-dev/epilot-designbuilder/0.9.0 - . \ No newline at end of file diff --git a/docs/data-sources/design.md b/docs/data-sources/design.md new file mode 100644 index 0000000..a126eef --- /dev/null +++ b/docs/data-sources/design.md @@ -0,0 +1,46 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "epilot-designbuilder_design Data Source - terraform-provider-epilot-designbuilder" +subcategory: "" +description: |- + Design DataSource +--- + +# epilot-designbuilder_design (Data Source) + +Design DataSource + +## Example Usage + +```terraform +data "epilot-designbuilder_design" "my_design" { +} +``` + + +## Schema + +### Read-Only + +- `brand_id` (String) Parsed as JSON. +- `brand_name` (String) +- `created_at` (String) Creation date and time using ISO 8601 full-time format +- `created_by` (String) +- `custom_theme` (String) Parsed as JSON. +- `edited` (Boolean) +- `id` (String) The ID of this resource. +- `last_modified_at` (String) +- `style` (String) Parsed as JSON. +- `style_name` (String) +- `use_custom_theme` (Boolean) +- `user` (Attributes) (see [below for nested schema](#nestedatt--user)) + + +### Nested Schema for `user` + +Read-Only: + +- `emailaddress` (String) +- `fullname` (String) +- `name` (String) +- `userid` (String) diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..c445039 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,36 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "epilot-designbuilder Provider" +subcategory: "" +description: |- + +--- + +# epilot-designbuilder Provider + + + +## Example Usage + +```terraform +terraform { + required_providers { + epilot-designbuilder = { + source = "epilot-dev/epilot-designbuilder" + version = "0.9.0" + } + } +} + +provider "epilot-designbuilder" { + # Configuration options +} +``` + + +## Schema + +### Optional + +- `custom_authorizer` (String, Sensitive) +- `server_url` (String) Server URL (defaults to https://design-builder-api.sls.epilot.io) diff --git a/docs/resources/design.md b/docs/resources/design.md new file mode 100644 index 0000000..061684d --- /dev/null +++ b/docs/resources/design.md @@ -0,0 +1,77 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "epilot-designbuilder_design Resource - terraform-provider-epilot-designbuilder" +subcategory: "" +description: |- + Design Resource +--- + +# epilot-designbuilder_design (Resource) + +Design Resource + +## Example Usage + +```terraform +resource "epilot-designbuilder_design" "my_design" { + brand_id = "{ \"see\": \"documentation\" }" + brand_name = "...my_brand_name..." + created_at = "2021-01-30T08:30:00Z" + created_by = "...my_created_by..." + custom_theme = "{ \"see\": \"documentation\" }" + edited = false + id = "...my_id..." + last_modified_at = "...my_last_modified_at..." + style = "{ \"see\": \"documentation\" }" + style_name = "...my_style_name..." + use_custom_theme = false + user = { + emailaddress = "...my_emailaddress..." + fullname = "...my_fullname..." + name = "...my_name..." + userid = "...my_userid..." + } +} +``` + + +## Schema + +### Required + +- `edited` (Boolean) +- `style` (String) Parsed as JSON. +- `style_name` (String) + +### Optional + +- `brand_id` (String) Parsed as JSON. +- `brand_name` (String) +- `created_at` (String) Creation date and time using ISO 8601 full-time format +- `created_by` (String) +- `custom_theme` (String) Parsed as JSON. +- `last_modified_at` (String) +- `use_custom_theme` (Boolean) +- `user` (Attributes) (see [below for nested schema](#nestedatt--user)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `user` + +Optional: + +- `emailaddress` (String) +- `fullname` (String) +- `name` (String) +- `userid` (String) + +## Import + +Import is supported using the following syntax: + +```shell +terraform import epilot-designbuilder_design.my_epilot-designbuilder_design "" +``` diff --git a/examples/data-sources/epilot-designbuilder_design/data-source.tf b/examples/data-sources/epilot-designbuilder_design/data-source.tf index 3ca8f19..0974cfc 100644 --- a/examples/data-sources/epilot-designbuilder_design/data-source.tf +++ b/examples/data-sources/epilot-designbuilder_design/data-source.tf @@ -1,3 +1,2 @@ data "epilot-designbuilder_design" "my_design" { - design_id = "4a062990-a6a3-11eb-9828-4f3da7d4935a" } \ No newline at end of file diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 043ff7b..4fc7b03 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { epilot-designbuilder = { source = "epilot-dev/epilot-designbuilder" - version = "0.8.2" + version = "0.9.0" } } } diff --git a/examples/resources/epilot-designbuilder_design/resource.tf b/examples/resources/epilot-designbuilder_design/resource.tf index e4b4ca9..d763ec0 100644 --- a/examples/resources/epilot-designbuilder_design/resource.tf +++ b/examples/resources/epilot-designbuilder_design/resource.tf @@ -4,11 +4,16 @@ resource "epilot-designbuilder_design" "my_design" { created_at = "2021-01-30T08:30:00Z" created_by = "...my_created_by..." custom_theme = "{ \"see\": \"documentation\" }" - design_id = "4a062990-a6a3-11eb-9828-4f3da7d4935a" - edited = true - id = "4d59415d-9b16-41f7-8b78-bf5bc35ca152" + edited = false + id = "...my_id..." last_modified_at = "...my_last_modified_at..." style = "{ \"see\": \"documentation\" }" style_name = "...my_style_name..." - use_custom_theme = true + use_custom_theme = false + user = { + emailaddress = "...my_emailaddress..." + fullname = "...my_fullname..." + name = "...my_name..." + userid = "...my_userid..." + } } \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index 4b0a3dc..4db6d7c 100755 --- a/gen.yaml +++ b/gen.yaml @@ -9,14 +9,17 @@ generation: requestResponseComponentNamesFeb2024: false auth: oAuth2ClientCredentialsEnabled: false + oAuth2PasswordEnabled: false telemetryEnabled: false terraform: - version: 0.8.2 + version: 0.9.0 additionalDataSources: [] additionalDependencies: {} additionalResources: [] allowUnknownFieldsInWeakUnions: false author: epilot-dev + defaultErrorName: SDKError + enableTypeDeduplication: true environmentVariables: [] imports: option: openapi diff --git a/go.mod b/go.mod index f7b3db0..1e7c3f5 100644 --- a/go.mod +++ b/go.mod @@ -1,64 +1,73 @@ module github.com/epilot-dev/terraform-provider-epilot-designbuilder -go 1.21 - -toolchain go1.21.6 +go 1.22.0 require ( - github.com/cenkalti/backoff/v4 v4.2.0 github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 - github.com/hashicorp/terraform-plugin-docs v0.13.0 - github.com/hashicorp/terraform-plugin-framework v1.7.0 - github.com/hashicorp/terraform-plugin-framework-validators v0.10.0 - github.com/hashicorp/terraform-plugin-go v0.22.1 + github.com/hashicorp/go-uuid v1.0.3 + github.com/hashicorp/terraform-plugin-docs v0.19.4 + github.com/hashicorp/terraform-plugin-framework v1.12.0 + github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 + github.com/hashicorp/terraform-plugin-go v0.24.0 + github.com/hashicorp/terraform-plugin-log v0.9.0 ) require ( + github.com/BurntSushi/toml v1.2.1 // indirect + github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.1.1 // indirect - github.com/Masterminds/sprig/v3 v3.2.2 // indirect - github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/Masterminds/semver/v3 v3.2.0 // indirect + github.com/Masterminds/sprig/v3 v3.2.3 // indirect + github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect - github.com/fatih/color v1.13.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect + github.com/cloudflare/circl v1.3.7 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/cli v1.1.6 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.6.0 // indirect - github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/hc-install v0.4.0 // indirect - github.com/hashicorp/terraform-exec v0.17.2 // indirect - github.com/hashicorp/terraform-json v0.14.0 // indirect - github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect + github.com/hashicorp/go-plugin v1.6.1 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect + github.com/hashicorp/hc-install v0.7.0 // indirect + github.com/hashicorp/terraform-exec v0.21.0 // indirect + github.com/hashicorp/terraform-json v0.22.1 // indirect github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect - github.com/huandu/xstrings v1.3.2 // indirect - github.com/imdario/mergo v0.3.13 // indirect - github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect - github.com/mitchellh/cli v1.1.4 // indirect + github.com/huandu/xstrings v1.3.3 // indirect + github.com/imdario/mergo v0.3.15 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.0.0 // indirect github.com/posener/complete v1.2.3 // indirect - github.com/russross/blackfriday v1.6.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - github.com/zclconf/go-cty v1.13.1 // indirect - golang.org/x/crypto v0.18.0 // indirect - golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.16.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect - google.golang.org/grpc v1.62.1 // indirect - google.golang.org/protobuf v1.33.0 // indirect + github.com/yuin/goldmark v1.7.1 // indirect + github.com/yuin/goldmark-meta v1.1.0 // indirect + github.com/zclconf/go-cty v1.14.4 // indirect + go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect + golang.org/x/crypto v0.24.0 // indirect + golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/grpc v1.66.2 // indirect + google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/yaml.v2 v2.3.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 417aa41..762ad5a 100644 --- a/go.sum +++ b/go.sum @@ -1,71 +1,62 @@ -github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/Kunde21/markdownfmt/v3 v3.1.0 h1:KiZu9LKs+wFFBQKhrZJrFZwtLnCCWJahL+S+E/3VnM0= +github.com/Kunde21/markdownfmt/v3 v3.1.0/go.mod h1:tPXN1RTyOzJwhfHoon9wUr4HGYmWgVxSQN6VBJDkrVc= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= -github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/sprig/v3 v3.2.0/go.mod h1:tWhwTbUTndesPNeF0C900vKoq283u6zp4APT9vaF3SI= -github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= -github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= -github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= -github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= -github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= +github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= +github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg= +github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= +github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 h1:S92OBrGuLLZsyM5ybUzgc/mPjIYk2AZqufieooe98uw= github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= -github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= -github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= -github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= -github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= +github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= +github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8= +github.com/hashicorp/cli v1.1.6/go.mod h1:MPon5QYlgjjo0BSoAiN0ESeT5fRzDjVRp+uioJ0piz4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -79,28 +70,27 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= -github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= +github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= +github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= -github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk= -github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI= -github.com/hashicorp/terraform-exec v0.17.2 h1:EU7i3Fh7vDUI9nNRdMATCEfnm9axzTnad8zszYZ73Go= -github.com/hashicorp/terraform-exec v0.17.2/go.mod h1:tuIbsL2l4MlwwIZx9HPM+LOV9vVyEfBYu2GsO1uH3/8= -github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= -github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= -github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY= -github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ= -github.com/hashicorp/terraform-plugin-framework v1.7.0 h1:wOULbVmfONnJo9iq7/q+iBOBJul5vRovaYJIu2cY/Pw= -github.com/hashicorp/terraform-plugin-framework v1.7.0/go.mod h1:jY9Id+3KbZ17OMpulgnWLSfwxNVYSoYBQFTgsx044CI= -github.com/hashicorp/terraform-plugin-framework-validators v0.10.0 h1:4L0tmy/8esP6OcvocVymw52lY0HyQ5OxB7VNl7k4bS0= -github.com/hashicorp/terraform-plugin-framework-validators v0.10.0/go.mod h1:qdQJCdimB9JeX2YwOpItEu+IrfoJjWQ5PhLpAOMDQAE= -github.com/hashicorp/terraform-plugin-go v0.22.1 h1:iTS7WHNVrn7uhe3cojtvWWn83cm2Z6ryIUDTRO0EV7w= -github.com/hashicorp/terraform-plugin-go v0.22.1/go.mod h1:qrjnqRghvQ6KnDbB12XeZ4FluclYwptntoWCr9QaXTI= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC1659aBk= +github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA= +github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ= +github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= +github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec= +github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= +github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSeyEljqjH3G39w28JK4c= +github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA= +github.com/hashicorp/terraform-plugin-framework v1.12.0 h1:7HKaueHPaikX5/7cbC1r9d1m12iYHY+FlNZEGxQ42CQ= +github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE= +github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E= +github.com/hashicorp/terraform-plugin-framework-validators v0.13.0/go.mod h1:wGeI02gEhj9nPANU62F2jCaHjXulejm/X+af4PdZaNo= +github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U= +github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= @@ -109,166 +99,144 @@ github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= -github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= +github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mitchellh/cli v1.1.4 h1:qj8czE26AU4PbiaPXK5uVmMSM+V5BYsFBiM9HhGRLUA= -github.com/mitchellh/cli v1.1.4/go.mod h1:vTLESy5mRhKOs9KDp0/RATawxP1UqBmdrpVRMnpcvKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= +github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= -github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= -github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= -github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= +github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= 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/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= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= -github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= -github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= -github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty v1.13.1 h1:0a6bRwuiSHtAmqCqNOE+c2oHgepv0ctoxU4FUe43kwc= -github.com/zclconf/go-cty v1.13.1/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= -github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U= +github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= +github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= +github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= +github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= +go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= -google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/planmodifiers/boolplanmodifier/suppress_diff.go b/internal/planmodifiers/boolplanmodifier/suppress_diff.go index b9ed3c5..0789a46 100644 --- a/internal/planmodifiers/boolplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/boolplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package boolplanmodifier diff --git a/internal/planmodifiers/float64planmodifier/suppress_diff.go b/internal/planmodifiers/float64planmodifier/suppress_diff.go index 94f6532..9e49bcb 100644 --- a/internal/planmodifiers/float64planmodifier/suppress_diff.go +++ b/internal/planmodifiers/float64planmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package float64planmodifier diff --git a/internal/planmodifiers/int64planmodifier/suppress_diff.go b/internal/planmodifiers/int64planmodifier/suppress_diff.go index 31c0331..a503603 100644 --- a/internal/planmodifiers/int64planmodifier/suppress_diff.go +++ b/internal/planmodifiers/int64planmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package int64planmodifier diff --git a/internal/planmodifiers/listplanmodifier/suppress_diff.go b/internal/planmodifiers/listplanmodifier/suppress_diff.go index ecce288..29283f1 100644 --- a/internal/planmodifiers/listplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/listplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package listplanmodifier diff --git a/internal/planmodifiers/mapplanmodifier/suppress_diff.go b/internal/planmodifiers/mapplanmodifier/suppress_diff.go index 4f1cd6b..226a729 100644 --- a/internal/planmodifiers/mapplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/mapplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package mapplanmodifier diff --git a/internal/planmodifiers/numberplanmodifier/suppress_diff.go b/internal/planmodifiers/numberplanmodifier/suppress_diff.go index 4e8ca2b..e225903 100644 --- a/internal/planmodifiers/numberplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/numberplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package numberplanmodifier diff --git a/internal/planmodifiers/objectplanmodifier/suppress_diff.go b/internal/planmodifiers/objectplanmodifier/suppress_diff.go index eead5a0..148402f 100644 --- a/internal/planmodifiers/objectplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/objectplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package objectplanmodifier diff --git a/internal/planmodifiers/setplanmodifier/suppress_diff.go b/internal/planmodifiers/setplanmodifier/suppress_diff.go index 1090325..e40d800 100644 --- a/internal/planmodifiers/setplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/setplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package setplanmodifier diff --git a/internal/planmodifiers/stringplanmodifier/suppress_diff.go b/internal/planmodifiers/stringplanmodifier/suppress_diff.go index 07bfce1..5db4b89 100644 --- a/internal/planmodifiers/stringplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/stringplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package stringplanmodifier diff --git a/internal/planmodifiers/utils/state_check.go b/internal/planmodifiers/utils/state_check.go index 6b126bf..51d5362 100644 --- a/internal/planmodifiers/utils/state_check.go +++ b/internal/planmodifiers/utils/state_check.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/internal/provider/design_data_source.go b/internal/provider/design_data_source.go index 28001b1..c7f483c 100644 --- a/internal/provider/design_data_source.go +++ b/internal/provider/design_data_source.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package provider @@ -150,7 +150,9 @@ func (r *DesignDataSource) Read(ctx context.Context, req datasource.ReadRequest, return } - designID := data.ID.ValueString() + var designID string + designID = data.ID.ValueString() + request := operations.GetDesignRequest{ DesignID: designID, } diff --git a/internal/provider/design_data_source_sdk.go b/internal/provider/design_data_source_sdk.go index 6c03334..3de9f76 100644 --- a/internal/provider/design_data_source_sdk.go +++ b/internal/provider/design_data_source_sdk.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package provider diff --git a/internal/provider/design_resource.go b/internal/provider/design_resource.go index 6aec3d8..2a4ff18 100644 --- a/internal/provider/design_resource.go +++ b/internal/provider/design_resource.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package provider @@ -222,7 +222,9 @@ func (r *DesignResource) Read(ctx context.Context, req resource.ReadRequest, res return } - designID := data.ID.ValueString() + var designID string + designID = data.ID.ValueString() + request := operations.GetDesignRequest{ DesignID: designID, } @@ -274,7 +276,9 @@ func (r *DesignResource) Update(ctx context.Context, req resource.UpdateRequest, updateDesignReq := shared.UpdateDesignReq{ Design: design, } - designID := data.ID.ValueString() + var designID string + designID = data.ID.ValueString() + request := operations.UpdateDesignRequest{ UpdateDesignReq: updateDesignReq, DesignID: designID, @@ -319,7 +323,9 @@ func (r *DesignResource) Delete(ctx context.Context, req resource.DeleteRequest, return } - designID := data.ID.ValueString() + var designID string + designID = data.ID.ValueString() + request := operations.DeleteDesignRequest{ DesignID: designID, } diff --git a/internal/provider/design_resource_sdk.go b/internal/provider/design_resource_sdk.go index c1f0745..97d2b68 100644 --- a/internal/provider/design_resource_sdk.go +++ b/internal/provider/design_resource_sdk.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package provider @@ -36,7 +36,9 @@ func (r *DesignResourceModel) ToSharedDesign() *shared.Design { if !r.CustomTheme.IsUnknown() && !r.CustomTheme.IsNull() { _ = json.Unmarshal([]byte(r.CustomTheme.ValueString()), &customTheme) } - edited := r.Edited.ValueBool() + var edited bool + edited = r.Edited.ValueBool() + id := new(string) if !r.ID.IsUnknown() && !r.ID.IsNull() { *id = r.ID.ValueString() @@ -51,7 +53,9 @@ func (r *DesignResourceModel) ToSharedDesign() *shared.Design { } var style interface{} _ = json.Unmarshal([]byte(r.Style.ValueString()), &style) - styleName := r.StyleName.ValueString() + var styleName string + styleName = r.StyleName.ValueString() + useCustomTheme := new(bool) if !r.UseCustomTheme.IsUnknown() && !r.UseCustomTheme.IsNull() { *useCustomTheme = r.UseCustomTheme.ValueBool() @@ -207,7 +211,9 @@ func (r *DesignResourceModel) ToSharedUpdateDesignReqDesign() *shared.UpdateDesi if !r.CustomTheme.IsUnknown() && !r.CustomTheme.IsNull() { _ = json.Unmarshal([]byte(r.CustomTheme.ValueString()), &customTheme) } - edited := r.Edited.ValueBool() + var edited bool + edited = r.Edited.ValueBool() + id := new(string) if !r.ID.IsUnknown() && !r.ID.IsNull() { *id = r.ID.ValueString() @@ -222,7 +228,9 @@ func (r *DesignResourceModel) ToSharedUpdateDesignReqDesign() *shared.UpdateDesi } var style interface{} _ = json.Unmarshal([]byte(r.Style.ValueString()), &style) - styleName := r.StyleName.ValueString() + var styleName string + styleName = r.StyleName.ValueString() + useCustomTheme := new(bool) if !r.UseCustomTheme.IsUnknown() && !r.UseCustomTheme.IsNull() { *useCustomTheme = r.UseCustomTheme.ValueBool() diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 85541f1..68e0936 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package provider @@ -43,8 +43,8 @@ func (p *EpilotDesignbuilderProvider) Schema(ctx context.Context, req provider.S Required: false, }, "custom_authorizer": schema.StringAttribute{ - Optional: true, Sensitive: true, + Optional: true, }, }, } @@ -65,15 +65,23 @@ func (p *EpilotDesignbuilderProvider) Configure(ctx context.Context, req provide ServerURL = "https://design-builder-api.sls.epilot.io" } - customAuthorizer := data.CustomAuthorizer.ValueString() + customAuthorizer := new(string) + if !data.CustomAuthorizer.IsUnknown() && !data.CustomAuthorizer.IsNull() { + *customAuthorizer = data.CustomAuthorizer.ValueString() + } else { + customAuthorizer = nil + } security := shared.Security{ CustomAuthorizer: customAuthorizer, } + httpClient := http.DefaultClient + httpClient.Transport = NewLoggingHTTPTransport(http.DefaultTransport) + opts := []sdk.SDKOption{ sdk.WithServerURL(ServerURL), sdk.WithSecurity(security), - sdk.WithClient(http.DefaultClient), + sdk.WithClient(httpClient), } client := sdk.New(opts...) diff --git a/internal/provider/reflect/diags.go b/internal/provider/reflect/diags.go index ce8aa51..50c50c8 100644 --- a/internal/provider/reflect/diags.go +++ b/internal/provider/reflect/diags.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/doc.go b/internal/provider/reflect/doc.go index 2978edc..e384126 100644 --- a/internal/provider/reflect/doc.go +++ b/internal/provider/reflect/doc.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. // Package reflect is a forked version of https://github.com/hashicorp/terraform-plugin-framework/tree/main/internal/reflect // that has been modified to support speakeasy's terraform generator. diff --git a/internal/provider/reflect/generic_attr_value.go b/internal/provider/reflect/generic_attr_value.go index 39454f5..48824d5 100644 --- a/internal/provider/reflect/generic_attr_value.go +++ b/internal/provider/reflect/generic_attr_value.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/helpers.go b/internal/provider/reflect/helpers.go index 398049d..8085789 100644 --- a/internal/provider/reflect/helpers.go +++ b/internal/provider/reflect/helpers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -46,7 +46,7 @@ func commaSeparatedString(in []string) string { // getStructTags returns a map of Terraform field names to their position in // the tags of the struct `in`. `in` must be a struct. -func getStructTags(_ context.Context, in reflect.Value, path path.Path, opts Options) (map[string]int, error) { +func getStructTags(_ context.Context, in reflect.Value, path path.Path, _ Options) (map[string]int, error) { tags := map[string]int{} typ := trueReflectValue(in).Type() if typ.Kind() != reflect.Struct { diff --git a/internal/provider/reflect/interfaces.go b/internal/provider/reflect/interfaces.go index f5bd513..ff4416e 100644 --- a/internal/provider/reflect/interfaces.go +++ b/internal/provider/reflect/interfaces.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -73,18 +73,38 @@ func FromUnknownable(ctx context.Context, typ attr.Type, val Unknownable, path p if val.GetUnknown(ctx) { tfVal := tftypes.NewValue(typ.TerraformType(ctx), tftypes.UnknownValue) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + res, err := typ.ValueFromTerraform(ctx, tfVal) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := res.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } + return res, nil } err := tftypes.ValidateValue(typ.TerraformType(ctx), val.GetValue(ctx)) @@ -94,18 +114,38 @@ func FromUnknownable(ctx context.Context, typ attr.Type, val Unknownable, path p tfVal := tftypes.NewValue(typ.TerraformType(ctx), val.GetValue(ctx)) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + res, err := typ.ValueFromTerraform(ctx, tfVal) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := res.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } + return res, nil } @@ -167,18 +207,38 @@ func FromNullable(ctx context.Context, typ attr.Type, val Nullable, path path.Pa if val.GetNull(ctx) { tfVal := tftypes.NewValue(typ.TerraformType(ctx), nil) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + res, err := typ.ValueFromTerraform(ctx, tfVal) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := res.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } + return res, nil } err := tftypes.ValidateValue(typ.TerraformType(ctx), val.GetValue(ctx)) @@ -188,18 +248,38 @@ func FromNullable(ctx context.Context, typ attr.Type, val Nullable, path path.Pa tfVal := tftypes.NewValue(typ.TerraformType(ctx), val.GetValue(ctx)) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + res, err := typ.ValueFromTerraform(ctx, tfVal) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := res.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } + return res, diags } @@ -259,18 +339,38 @@ func FromValueCreator(ctx context.Context, typ attr.Type, val tftypes.ValueCreat } tfVal := tftypes.NewValue(typ.TerraformType(ctx), raw) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + res, err := typ.ValueFromTerraform(ctx, tfVal) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := res.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - res, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } + return res, diags } @@ -282,18 +382,38 @@ func FromValueCreator(ctx context.Context, typ attr.Type, val tftypes.ValueCreat func NewAttributeValue(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { var diags diag.Diagnostics - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, val, path)...) + res, err := typ.ValueFromTerraform(ctx, val) + if err != nil { + return target, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := res.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return target, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, val, path)...) - res, err := typ.ValueFromTerraform(ctx, val) - if err != nil { - return target, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return target, diags + } + } } + if reflect.TypeOf(res) != target.Type() { diags.Append(diag.WithPath(path, DiagNewAttributeValueIntoWrongType{ ValType: reflect.TypeOf(res), @@ -336,17 +456,36 @@ func FromAttributeValue(ctx context.Context, typ attr.Type, val attr.Value, path return nil, diags } - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - tfVal, err := val.ToTerraformValue(ctx) - if err != nil { - return val, append(diags, toTerraformValueErrorDiag(err, path)) - } + switch t := val.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return val, diags } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + tfVal, err := val.ToTerraformValue(ctx) + if err != nil { + return val, append(diags, toTerraformValueErrorDiag(err, path)) + } + + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + + if diags.HasError() { + return val, diags + } + } } return val, diags diff --git a/internal/provider/reflect/into.go b/internal/provider/reflect/into.go index 45b15ef..29a437f 100644 --- a/internal/provider/reflect/into.go +++ b/internal/provider/reflect/into.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -166,6 +166,20 @@ func BuildValue(ctx context.Context, typ attr.Type, val tftypes.Value, target re return target, diags } + + // Dynamic reflection is currently only supported using an `attr.Value`, which should have happened in logic above. + if typ.TerraformType(ctx).Is(tftypes.DynamicPseudoType) { + diags.AddAttributeError( + path, + "Value Conversion Error", + "An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ + "Reflection for dynamic types is currently not supported. Use the corresponding `types` package type or a custom type that handles dynamic values.\n\n"+ + fmt.Sprintf("Path: %s\nTarget Type: %s\nSuggested `types` Type: %s", path.String(), target.Type(), reflect.TypeOf(typ.ValueType(ctx))), + ) + + return target, diags + } + // *big.Float and *big.Int are technically pointers, but we want them // handled as numbers if target.Type() == reflect.TypeOf(big.NewFloat(0)) || target.Type() == reflect.TypeOf(big.NewInt(0)) { diff --git a/internal/provider/reflect/map.go b/internal/provider/reflect/map.go index affbabe..91e27a6 100644 --- a/internal/provider/reflect/map.go +++ b/internal/provider/reflect/map.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -102,14 +102,6 @@ func FromMap(ctx context.Context, typ attr.TypeWithElementType, val reflect.Valu if val.IsNil() { tfVal := tftypes.NewValue(tfType, nil) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) if err != nil { @@ -121,6 +113,33 @@ func FromMap(ctx context.Context, typ attr.TypeWithElementType, val reflect.Valu return nil, diags } + switch t := attrVal.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) + + if diags.HasError() { + return nil, diags + } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + + if diags.HasError() { + return nil, diags + } + } + } + return attrVal, diags } @@ -136,23 +155,50 @@ func FromMap(ctx context.Context, typ attr.TypeWithElementType, val reflect.Valu ) return nil, diags } - val, valDiags := FromValue(ctx, elemType, val.MapIndex(key).Interface(), path.AtMapKey(key.String())) + + mapKeyPath := path.AtMapKey(key.String()) + + // If the element implements xattr.ValidateableAttribute, or xattr.TypeWithValidate, + // and the element does not validate then diagnostics will be added here and returned + // before reaching the switch statement below. + val, valDiags := FromValue(ctx, elemType, val.MapIndex(key).Interface(), mapKeyPath) + diags.Append(valDiags...) if diags.HasError() { return nil, diags } + tfVal, err := val.ToTerraformValue(ctx) if err != nil { return nil, append(diags, toTerraformValueErrorDiag(err, path)) } - if typeWithValidate, ok := elemType.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path.AtMapKey(key.String()))...) + switch t := val.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: mapKeyPath, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := elemType.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, mapKeyPath)...) + + if diags.HasError() { + return nil, diags + } + } } tfElems[key.String()] = tfVal @@ -165,14 +211,6 @@ func FromMap(ctx context.Context, typ attr.TypeWithElementType, val reflect.Valu tfVal := tftypes.NewValue(tfType, tfElems) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) if err != nil { @@ -184,5 +222,32 @@ func FromMap(ctx context.Context, typ attr.TypeWithElementType, val reflect.Valu return nil, diags } + switch t := attrVal.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) + + if diags.HasError() { + return nil, diags + } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + + if diags.HasError() { + return nil, diags + } + } + } + return attrVal, diags } diff --git a/internal/provider/reflect/number.go b/internal/provider/reflect/number.go index e0021c3..53673b8 100644 --- a/internal/provider/reflect/number.go +++ b/internal/provider/reflect/number.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -23,9 +23,7 @@ import ( // *big.Int). // // Number will loudly fail when a number cannot be losslessly represented using -// the requested type, unless opts.AllowRoundingNumbers is set to true. This -// setting is mildly dangerous, because Terraform does not like when you round -// things, as a general rule of thumb. +// the requested type. // // It is meant to be called through Into, not directly. func Number(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path path.Path) (reflect.Value, diag.Diagnostics) { @@ -52,7 +50,7 @@ func Number(ctx context.Context, typ attr.Type, val tftypes.Value, target reflec return reflect.ValueOf(result), diags case reflect.TypeOf(big.NewInt(0)): intResult, acc := result.Int(nil) - if acc != big.Exact && !opts.AllowRoundingNumbers { + if acc != big.Exact { return reflect.ValueOf(result), append(diags, roundingErrorDiag) } return reflect.ValueOf(intResult), diags @@ -61,64 +59,40 @@ func Number(ctx context.Context, typ attr.Type, val tftypes.Value, target reflec case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: intResult, acc := result.Int64() - if acc != big.Exact && !opts.AllowRoundingNumbers { + if acc != big.Exact { return target, append(diags, roundingErrorDiag) } switch target.Kind() { case reflect.Int: if strconv.IntSize == 32 && intResult > math.MaxInt32 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - intResult = math.MaxInt32 + return target, append(diags, roundingErrorDiag) } if strconv.IntSize == 32 && intResult < math.MinInt32 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - intResult = math.MinInt32 + return target, append(diags, roundingErrorDiag) } return reflect.ValueOf(int(intResult)), diags case reflect.Int8: if intResult > math.MaxInt8 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - intResult = math.MaxInt8 + return target, append(diags, roundingErrorDiag) } if intResult < math.MinInt8 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - intResult = math.MinInt8 + return target, append(diags, roundingErrorDiag) } return reflect.ValueOf(int8(intResult)), diags case reflect.Int16: if intResult > math.MaxInt16 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - intResult = math.MaxInt16 + return target, append(diags, roundingErrorDiag) } if intResult < math.MinInt16 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - intResult = math.MinInt16 + return target, append(diags, roundingErrorDiag) } return reflect.ValueOf(int16(intResult)), diags case reflect.Int32: if intResult > math.MaxInt32 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - intResult = math.MaxInt32 + return target, append(diags, roundingErrorDiag) } if intResult < math.MinInt32 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - intResult = math.MinInt32 + return target, append(diags, roundingErrorDiag) } return reflect.ValueOf(int32(intResult)), diags case reflect.Int64: @@ -127,105 +101,74 @@ func Number(ctx context.Context, typ attr.Type, val tftypes.Value, target reflec case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: uintResult, acc := result.Uint64() - if acc != big.Exact && !opts.AllowRoundingNumbers { + if acc != big.Exact { return target, append(diags, roundingErrorDiag) } switch target.Kind() { case reflect.Uint: if strconv.IntSize == 32 && uintResult > math.MaxUint32 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - uintResult = math.MaxUint32 + return target, append(diags, roundingErrorDiag) } return reflect.ValueOf(uint(uintResult)), diags case reflect.Uint8: if uintResult > math.MaxUint8 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - uintResult = math.MaxUint8 + return target, append(diags, roundingErrorDiag) } return reflect.ValueOf(uint8(uintResult)), diags case reflect.Uint16: if uintResult > math.MaxUint16 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - uintResult = math.MaxUint16 + return target, append(diags, roundingErrorDiag) } return reflect.ValueOf(uint16(uintResult)), diags case reflect.Uint32: if uintResult > math.MaxUint32 { - if !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } - uintResult = math.MaxUint32 + return target, append(diags, roundingErrorDiag) } return reflect.ValueOf(uint32(uintResult)), diags case reflect.Uint64: return reflect.ValueOf(uintResult), diags } case reflect.Float32: - floatResult, acc := result.Float32() - if acc != big.Exact && !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) - } else if acc == big.Above { - floatResult = math.MaxFloat32 - } else if acc == big.Below { - floatResult = math.SmallestNonzeroFloat32 - } else if acc != big.Exact { - err := fmt.Errorf("unsure how to round %s and %f", acc, floatResult) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert to number. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) + float64Result, _ := result.Float64() + + bf := big.NewFloat(float64Result) + + if result.Text('f', -1) != bf.Text('f', -1) { + diags.Append(roundingErrorDiag) + return target, diags } - return reflect.ValueOf(floatResult), diags - case reflect.Float64: - floatResult, acc := result.Float64() - if acc != big.Exact && !opts.AllowRoundingNumbers { - return target, append(diags, roundingErrorDiag) + + float32Result, accuracy := result.Float32() + + // Underflow + // Reference: https://pkg.go.dev/math/big#Float.Float32 + if float32Result == 0 && accuracy != big.Exact { + diags.Append(roundingErrorDiag) + + return target, diags } - if acc == big.Above { - if floatResult == math.Inf(1) || floatResult == math.MaxFloat64 { - floatResult = math.MaxFloat64 - } else if floatResult == 0.0 || floatResult == math.SmallestNonzeroFloat64 { - floatResult = -math.SmallestNonzeroFloat64 - } else { - err := fmt.Errorf("not sure how to round %s and %f", acc, floatResult) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert to number. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags - } - } else if acc == big.Below { - if floatResult == math.Inf(-1) || floatResult == -math.MaxFloat64 { - floatResult = -math.MaxFloat64 - } else if floatResult == 0.0 || floatResult == -math.SmallestNonzeroFloat64 { - floatResult = math.SmallestNonzeroFloat64 - } else { - err := fmt.Errorf("not sure how to round %s and %f", acc, floatResult) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert to number. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags - } - } else if acc != big.Exact { - err := fmt.Errorf("not sure how to round %s and %f", acc, floatResult) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert to number. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) + + // Overflow + // Reference: https://pkg.go.dev/math/big#Float.Float32 + if math.IsInf(float64(float32Result), 0) { + diags.Append(roundingErrorDiag) + + return target, diags + } + + return reflect.ValueOf(float32Result), diags + case reflect.Float64: + floatResult, _ := result.Float64() + + bf := big.NewFloat(floatResult) + + if result.Text('f', -1) != bf.Text('f', -1) { + diags.Append(roundingErrorDiag) + return target, diags } + return reflect.ValueOf(floatResult), diags } err = fmt.Errorf("cannot convert number to %s", target.Type()) @@ -248,17 +191,36 @@ func FromInt(ctx context.Context, typ attr.Type, val int64, path path.Path) (att } tfNum := tftypes.NewValue(tftypes.Number, val) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) + num, err := typ.ValueFromTerraform(ctx, tfNum) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := num.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } return num, diags @@ -275,17 +237,36 @@ func FromUint(ctx context.Context, typ attr.Type, val uint64, path path.Path) (a } tfNum := tftypes.NewValue(tftypes.Number, val) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) + num, err := typ.ValueFromTerraform(ctx, tfNum) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := num.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } return num, diags @@ -302,17 +283,36 @@ func FromFloat(ctx context.Context, typ attr.Type, val float64, path path.Path) } tfNum := tftypes.NewValue(tftypes.Number, val) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) + num, err := typ.ValueFromTerraform(ctx, tfNum) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := num.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } return num, diags @@ -329,17 +329,36 @@ func FromBigFloat(ctx context.Context, typ attr.Type, val *big.Float, path path. } tfNum := tftypes.NewValue(tftypes.Number, val) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) + num, err := typ.ValueFromTerraform(ctx, tfNum) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := num.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } return num, diags @@ -357,17 +376,36 @@ func FromBigInt(ctx context.Context, typ attr.Type, val *big.Int, path path.Path } tfNum := tftypes.NewValue(tftypes.Number, fl) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) + num, err := typ.ValueFromTerraform(ctx, tfNum) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := num.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfNum, path)...) - num, err := typ.ValueFromTerraform(ctx, tfNum) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } return num, diags diff --git a/internal/provider/reflect/options.go b/internal/provider/reflect/options.go index c6d7b44..063353f 100644 --- a/internal/provider/reflect/options.go +++ b/internal/provider/reflect/options.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -20,10 +20,6 @@ type Options struct { // they must be explicitly handled. UnhandledUnknownAsEmpty bool - // AllowRoundingNumbers silently rounds numbers that don't fit - // perfectly in the types they're being stored in, rather than - // returning errors. Numbers will always be rounded towards 0. - AllowRoundingNumbers bool // SourceType informs the reflection system what the source is // such that it can make decisions based on the tfPlanOnly annotation // The default is SourceTypeState diff --git a/internal/provider/reflect/outof.go b/internal/provider/reflect/outof.go index 4fc5d24..215406a 100644 --- a/internal/provider/reflect/outof.go +++ b/internal/provider/reflect/outof.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/pointer.go b/internal/provider/reflect/pointer.go index 0ac5ebb..215653e 100644 --- a/internal/provider/reflect/pointer.go +++ b/internal/provider/reflect/pointer.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -97,14 +97,6 @@ func FromPointer(ctx context.Context, typ attr.Type, value reflect.Value, path p if value.IsNil() { tfVal := tftypes.NewValue(typ.TerraformType(ctx), nil) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) if err != nil { @@ -116,6 +108,33 @@ func FromPointer(ctx context.Context, typ attr.Type, value reflect.Value, path p return nil, diags } + switch t := attrVal.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) + + if diags.HasError() { + return nil, diags + } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + + if diags.HasError() { + return nil, diags + } + } + } + return attrVal, diags } diff --git a/internal/provider/reflect/primitive.go b/internal/provider/reflect/primitive.go index fc6b0e6..adf648e 100644 --- a/internal/provider/reflect/primitive.go +++ b/internal/provider/reflect/primitive.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -67,17 +67,36 @@ func FromString(ctx context.Context, typ attr.Type, val string, path path.Path) } tfStr := tftypes.NewValue(tftypes.String, val) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfStr, path)...) + str, err := typ.ValueFromTerraform(ctx, tfStr) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := str.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfStr, path)...) - str, err := typ.ValueFromTerraform(ctx, tfStr) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } return str, diags @@ -94,17 +113,36 @@ func FromBool(ctx context.Context, typ attr.Type, val bool, path path.Path) (att } tfBool := tftypes.NewValue(tftypes.Bool, val) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfBool, path)...) + b, err := typ.ValueFromTerraform(ctx, tfBool) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := b.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfBool, path)...) - b, err := typ.ValueFromTerraform(ctx, tfBool) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } return b, diags diff --git a/internal/provider/reflect/slice.go b/internal/provider/reflect/slice.go index 7eea860..79ad6b8 100644 --- a/internal/provider/reflect/slice.go +++ b/internal/provider/reflect/slice.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -28,16 +28,6 @@ func reflectSlice(ctx context.Context, typ attr.Type, val tftypes.Value, target })) return target, diags } - // TODO: check that the val is a list or set or tuple - elemTyper, ok := typ.(attr.TypeWithElementType) - if !ok { - diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ - Val: val, - TargetType: target.Type(), - Err: fmt.Errorf("cannot reflect %s using type information provided by %T, %T must be an attr.TypeWithElementType", val.Type(), typ, typ), - })) - return target, diags - } // we need our value to become a list of values so we can iterate over // them and handle them individually @@ -52,50 +42,130 @@ func reflectSlice(ctx context.Context, typ attr.Type, val tftypes.Value, target return target, diags } - // we need to know the type the slice is wrapping - elemType := target.Type().Elem() - elemAttrType := elemTyper.ElementType() + switch t := typ.(type) { + // List or Set + case attr.TypeWithElementType: + // we need to know the type the slice is wrapping + elemType := target.Type().Elem() + elemAttrType := t.ElementType() + + // we want an empty version of the slice + slice := reflect.MakeSlice(target.Type(), 0, len(values)) + + // go over each of the values passed in, create a Go value of the right + // type for them, and add it to our new slice + for pos, value := range values { + // create a new Go value of the type that can go in the slice + targetValue := reflect.Zero(elemType) + + // update our path so we can have nice errors + valPath := path.AtListIndex(pos) + + if typ.TerraformType(ctx).Is(tftypes.Set{}) { + attrVal, err := elemAttrType.ValueFromTerraform(ctx, value) + + if err != nil { + diags.AddAttributeError( + path, + "Value Conversion Error", + "An unexpected error was encountered trying to convert to slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), + ) + return target, diags + } + + valPath = path.AtSetValue(attrVal) + } - // we want an empty version of the slice - slice := reflect.MakeSlice(target.Type(), 0, len(values)) + // reflect the value into our new target + val, valDiags := BuildValue(ctx, elemAttrType, value, targetValue, opts, valPath) + diags.Append(valDiags...) - // go over each of the values passed in, create a Go value of the right - // type for them, and add it to our new slice - for pos, value := range values { - // create a new Go value of the type that can go in the slice - targetValue := reflect.Zero(elemType) + if diags.HasError() { + return target, diags + } - // update our path so we can have nice errors - valPath := path.AtListIndex(pos) + // add the new target to our slice + slice = reflect.Append(slice, val) + } - if typ.TerraformType(ctx).Is(tftypes.Set{}) { - attrVal, err := elemAttrType.ValueFromTerraform(ctx, value) + return slice, diags - if err != nil { - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert to slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return target, diags + // Tuple reflection into slices is currently limited to use-cases where all tuple element types are the same. + // + // Overall, Tuple support is limited in the framework, but the main path that executes tuple reflection is the provider-defined function variadic + // parameter. All tuple elements in this variadic parameter will have the same element type. For use-cases where the variadic parameter is a dynamic type, + // all elements will have the same type of `DynamicType` and value of `DynamicValue`, with an underlying value that may be different. + case attr.TypeWithElementTypes: + // we need to know the type the slice is wrapping + elemType := target.Type().Elem() + + // we want an empty version of the slice + slice := reflect.MakeSlice(target.Type(), 0, len(values)) + + if len(t.ElementTypes()) <= 0 { + // If the tuple values are empty as well, we can just pass back an empty slice of the type we received. + if len(values) == 0 { + return slice, diags } - valPath = path.AtSetValue(attrVal) + diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ + Val: val, + TargetType: target.Type(), + Err: fmt.Errorf("cannot reflect %s using type information provided by %T, tuple type contained no element types but received values", val.Type(), t), + })) + return target, diags } - // reflect the value into our new target - val, valDiags := BuildValue(ctx, elemAttrType, value, targetValue, opts, valPath) - diags.Append(valDiags...) + // Ensure that all tuple element types are the same by comparing each element type to the first + multipleTypes := false + allElemTypes := t.ElementTypes() + elemAttrType := allElemTypes[0] + for _, elemType := range allElemTypes[1:] { + if !elemAttrType.Equal(elemType) { + multipleTypes = true + break + } + } - if diags.HasError() { + if multipleTypes { + diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ + Val: val, + TargetType: target.Type(), + Err: fmt.Errorf("cannot reflect %s using type information provided by %T, reflection support for tuples is limited to multiple elements of the same element type. Expected all element types to be %T", val.Type(), t, elemAttrType), + })) return target, diags } - // add the new target to our slice - slice = reflect.Append(slice, val) - } + // go over each of the values passed in, create a Go value of the right + // type for them, and add it to our new slice + for pos, value := range values { + // create a new Go value of the type that can go in the slice + targetValue := reflect.Zero(elemType) + + // update our path so we can have nice errors + valPath := path.AtTupleIndex(pos) - return slice, diags + // reflect the value into our new target + val, valDiags := BuildValue(ctx, elemAttrType, value, targetValue, opts, valPath) + diags.Append(valDiags...) + + if diags.HasError() { + return target, diags + } + + // add the new target to our slice + slice = reflect.Append(slice, val) + } + + return slice, diags + default: + diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ + Val: val, + TargetType: target.Type(), + Err: fmt.Errorf("cannot reflect %s using type information provided by %T, %T must be an attr.TypeWithElementType or attr.TypeWithElementTypes", val.Type(), typ, typ), + })) + return target, diags + } } // FromSlice returns an attr.Value as produced by `typ` using the data in @@ -115,14 +185,6 @@ func FromSlice(ctx context.Context, typ attr.Type, val reflect.Value, path path. if val.IsNil() { tfVal := tftypes.NewValue(tfType, nil) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) if err != nil { @@ -134,54 +196,195 @@ func FromSlice(ctx context.Context, typ attr.Type, val reflect.Value, path path. return nil, diags } - return attrVal, diags - } + switch t := attrVal.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} - t, ok := typ.(attr.TypeWithElementType) - if !ok { - err := fmt.Errorf("cannot use type %T as schema type %T; %T must be an attr.TypeWithElementType to hold %T", val, typ, typ, val) - diags.AddAttributeError( - path, - "Value Conversion Error", - "An unexpected error was encountered trying to convert from slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), - ) - return nil, diags + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) + + if diags.HasError() { + return nil, diags + } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + + if diags.HasError() { + return nil, diags + } + } + } + + return attrVal, diags } - elemType := t.ElementType() tfElems := make([]tftypes.Value, 0, val.Len()) - for i := 0; i < val.Len(); i++ { - // The underlying reflect.Slice is fetched by Index(). For set types, - // the path is value-based instead of index-based. Since there is only - // the index until the value is retrieved, this will pass the - // technically incorrect index-based path at first for framework - // debugging purposes, then correct the path afterwards. - valPath := path.AtListIndex(i) + switch t := typ.(type) { + // List or Set + case attr.TypeWithElementType: + elemType := t.ElementType() + for i := 0; i < val.Len(); i++ { + // The underlying reflect.Slice is fetched by Index(). For set types, + // the path is value-based instead of index-based. Since there is only + // the index until the value is retrieved, this will pass the + // technically incorrect index-based path at first for framework + // debugging purposes, then correct the path afterwards. + valPath := path.AtListIndex(i) + + // If the element implements xattr.ValidateableAttribute, or xattr.TypeWithValidate, + // and the element does not validate then diagnostics will be added here and returned + // before reaching the switch statement below. + val, valDiags := FromValue(ctx, elemType, val.Index(i).Interface(), valPath) + diags.Append(valDiags...) + + if diags.HasError() { + return nil, diags + } - val, valDiags := FromValue(ctx, elemType, val.Index(i).Interface(), valPath) - diags.Append(valDiags...) + tfVal, err := val.ToTerraformValue(ctx) + if err != nil { + return nil, append(diags, toTerraformValueErrorDiag(err, path)) + } - if diags.HasError() { + if tfType.Is(tftypes.Set{}) { + valPath = path.AtSetValue(val) + } + + switch t := val.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: valPath, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) + + if diags.HasError() { + return nil, diags + } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := elemType.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, valPath)...) + + if diags.HasError() { + return nil, diags + } + } + } + + tfElems = append(tfElems, tfVal) + } + + // Tuple reflection from slices is currently limited to use-cases where all tuple element types are the same. + // + // Overall, Tuple support is limited in the framework, but the main path that executes tuple reflection is the provider-defined function variadic + // parameter. All tuple elements in this variadic parameter will have the same element type. For use-cases where the variadic parameter is a dynamic type, + // all elements will have the same type of `DynamicType` and value of `DynamicValue`, with an underlying value that may be different. + case attr.TypeWithElementTypes: + if len(t.ElementTypes()) <= 0 { + // If the tuple values are empty as well, we can just pass back an empty slice of the type we received. + if val.Len() == 0 { + break + } + + err := fmt.Errorf("cannot use type %s as schema type %T; tuple type contained no element types but received values", val.Type(), t) + diags.AddAttributeError( + path, + "Value Conversion Error", + "An unexpected error was encountered trying to convert from slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), + ) return nil, diags } - tfVal, err := val.ToTerraformValue(ctx) - if err != nil { - return nil, append(diags, toTerraformValueErrorDiag(err, path)) + // Ensure that all tuple element types are the same by comparing each element type to the first + multipleTypes := false + allElemTypes := t.ElementTypes() + elemAttrType := allElemTypes[0] + for _, elemType := range allElemTypes[1:] { + if !elemAttrType.Equal(elemType) { + multipleTypes = true + break + } } - if tfType.Is(tftypes.Set{}) { - valPath = path.AtSetValue(val) + if multipleTypes { + err := fmt.Errorf("cannot use type %s as schema type %T; reflection support for tuples is limited to multiple elements of the same element type. Expected all element types to be %T", val.Type(), t, elemAttrType) + diags.AddAttributeError( + path, + "Value Conversion Error", + "An unexpected error was encountered trying to convert from slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), + ) + return nil, diags } - if typeWithValidate, ok := elemType.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, valPath)...) + for i := 0; i < val.Len(); i++ { + valPath := path.AtTupleIndex(i) + + // If the element implements xattr.ValidateableAttribute, or xattr.TypeWithValidate, + // and the element does not validate then diagnostics will be added here and returned + // before reaching the switch statement below. + val, valDiags := FromValue(ctx, elemAttrType, val.Index(i).Interface(), valPath) + diags.Append(valDiags...) + if diags.HasError() { return nil, diags } - } - tfElems = append(tfElems, tfVal) + tfVal, err := val.ToTerraformValue(ctx) + if err != nil { + return nil, append(diags, toTerraformValueErrorDiag(err, path)) + } + + switch t := val.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: valPath, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) + + if diags.HasError() { + return nil, diags + } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := elemAttrType.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, valPath)...) + + if diags.HasError() { + return nil, diags + } + } + } + + tfElems = append(tfElems, tfVal) + } + default: + err := fmt.Errorf("cannot use type %s as schema type %T; %T must be an attr.TypeWithElementType or attr.TypeWithElementTypes", val.Type(), t, t) + diags.AddAttributeError( + path, + "Value Conversion Error", + "An unexpected error was encountered trying to convert from slice value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error(), + ) + return nil, diags } err := tftypes.ValidateValue(tfType, tfElems) @@ -191,14 +394,6 @@ func FromSlice(ctx context.Context, typ attr.Type, val reflect.Value, path path. tfVal := tftypes.NewValue(tfType, tfElems) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - - if diags.HasError() { - return nil, diags - } - } - attrVal, err := typ.ValueFromTerraform(ctx, tfVal) if err != nil { @@ -210,5 +405,32 @@ func FromSlice(ctx context.Context, typ attr.Type, val reflect.Value, path path. return nil, diags } + switch t := attrVal.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) + + if diags.HasError() { + return nil, diags + } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + + if diags.HasError() { + return nil, diags + } + } + } + return attrVal, diags } diff --git a/internal/provider/reflect/struct.go b/internal/provider/reflect/struct.go index 01ceb7b..68ea994 100644 --- a/internal/provider/reflect/struct.go +++ b/internal/provider/reflect/struct.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package reflect @@ -229,6 +229,9 @@ func FromStruct(ctx context.Context, typ attr.TypeWithAttributeTypes, val reflec path := path.AtName(name) fieldValue := val.Field(fieldNo) + // If the attr implements xattr.ValidateableAttribute, or xattr.TypeWithValidate, + // and the attr does not validate then diagnostics will be added here and returned + // before reaching the switch statement below. attrVal, attrValDiags := FromValue(ctx, attrTypes[name], fieldValue.Interface(), path) diags.Append(attrValDiags...) @@ -241,33 +244,80 @@ func FromStruct(ctx context.Context, typ attr.TypeWithAttributeTypes, val reflec return nil, append(diags, toTerraformValueErrorDiag(err, path)) } - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfObjVal, path)...) + switch t := attrVal.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := attrTypes[name].(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfObjVal, path)...) + + if diags.HasError() { + return nil, diags + } + } + } + + tfObjTyp := tfObjVal.Type() + + // If the original attribute type is tftypes.DynamicPseudoType, the value could end up being + // a concrete type (like tftypes.String, tftypes.List, etc.). In this scenario, the type used + // to build the final tftypes.Object must stay as tftypes.DynamicPseudoType + if attrTypes[name].TerraformType(ctx).Is(tftypes.DynamicPseudoType) { + tfObjTyp = tftypes.DynamicPseudoType } objValues[name] = tfObjVal - objTypes[name] = tfObjVal.Type() + objTypes[name] = tfObjTyp } tfVal := tftypes.NewValue(tftypes.Object{ AttributeTypes: objTypes, }, objValues) - if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { - diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) + ret, err := typ.ValueFromTerraform(ctx, tfVal) + if err != nil { + return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + } + + switch t := ret.(type) { + case xattr.ValidateableAttribute: + resp := xattr.ValidateAttributeResponse{} + + t.ValidateAttribute(ctx, + xattr.ValidateAttributeRequest{ + Path: path, + }, + &resp, + ) + + diags.Append(resp.Diagnostics...) if diags.HasError() { return nil, diags } - } + default: + //lint:ignore SA1019 xattr.TypeWithValidate is deprecated, but we still need to support it. + if typeWithValidate, ok := typ.(xattr.TypeWithValidate); ok { + diags.Append(typeWithValidate.Validate(ctx, tfVal, path)...) - ret, err := typ.ValueFromTerraform(ctx, tfVal) - if err != nil { - return nil, append(diags, valueFromTerraformErrorDiag(err, path)) + if diags.HasError() { + return nil, diags + } + } } return ret, diags diff --git a/internal/provider/types/user.go b/internal/provider/types/user.go index b0712dc..cd573ec 100644 --- a/internal/provider/types/user.go +++ b/internal/provider/types/user.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/internal/provider/utils.go b/internal/provider/utils.go index 9a99820..6bbd190 100644 --- a/internal/provider/utils.go +++ b/internal/provider/utils.go @@ -1,19 +1,27 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package provider import ( + "bufio" + "bytes" "context" "encoding/json" + "errors" "fmt" tfReflect "github.com/epilot-dev/terraform-provider-epilot-designbuilder/internal/provider/reflect" + "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" + "io" "net/http" "net/http/httputil" + "net/textproto" "reflect" + "strings" ) func debugResponse(response *http.Response) string { @@ -91,3 +99,177 @@ func refreshPlan(ctx context.Context, plan types.Object, target interface{}, dia SourceType: tfReflect.SourceTypePlan, }, path.Empty())...) } + +// Note: this is taken as a more minimal/specific version of https://github.com/hashicorp/terraform-plugin-sdk/blob/main/helper/logging/logging_http_transport.go +func NewLoggingHTTPTransport(t http.RoundTripper) *loggingHttpTransport { + return &loggingHttpTransport{t} +} + +const ( + FieldHttpOperationType = "tf_http_op_type" + OperationHttpRequest = "request" + OperationHttpResponse = "response" + FieldHttpRequestMethod = "tf_http_req_method" + FieldHttpRequestUri = "tf_http_req_uri" + FieldHttpRequestProtoVersion = "tf_http_req_version" + FieldHttpRequestBody = "tf_http_req_body" + FieldHttpResponseProtoVersion = "tf_http_res_version" + FieldHttpResponseStatusCode = "tf_http_res_status_code" + FieldHttpResponseStatusReason = "tf_http_res_status_reason" + FieldHttpResponseBody = "tf_http_res_body" + FieldHttpTransactionId = "tf_http_trans_id" +) + +type loggingHttpTransport struct { + transport http.RoundTripper +} + +func (t *loggingHttpTransport) RoundTrip(req *http.Request) (*http.Response, error) { + ctx := req.Context() + ctx = t.addTransactionIdField(ctx) + + // Decompose the request bytes in a message (HTTP body) and fields (HTTP headers), then log it + fields, err := decomposeRequestForLogging(req) + if err != nil { + tflog.Error(ctx, "Failed to parse request bytes for logging", []map[string]interface{}{map[string]interface{}{ + "error": err, + }}...) + } else { + tflog.Debug(ctx, "Sending HTTP Request", []map[string]interface{}{fields}...) + } + + // Invoke the wrapped RoundTrip now + res, err := t.transport.RoundTrip(req) + if err != nil { + return res, err + } + + // Decompose the response bytes in a message (HTTP body) and fields (HTTP headers), then log it + fields, err = decomposeResponseForLogging(res) + if err != nil { + tflog.Error(ctx, "Failed to parse response bytes for logging", []map[string]interface{}{map[string]interface{}{ + "error": err, + }}...) + } else { + tflog.Debug(ctx, "Received HTTP Response", []map[string]interface{}{fields}...) + } + + return res, nil +} + +func (t *loggingHttpTransport) addTransactionIdField(ctx context.Context) context.Context { + tId, err := uuid.GenerateUUID() + + if err != nil { + tId = "Unable to assign Transaction ID: " + err.Error() + } + + return tflog.SetField(ctx, FieldHttpTransactionId, tId) +} + +func decomposeRequestForLogging(req *http.Request) (map[string]interface{}, error) { + fields := make(map[string]interface{}, len(req.Header)+4) + fields[FieldHttpOperationType] = OperationHttpRequest + + fields[FieldHttpRequestMethod] = req.Method + fields[FieldHttpRequestUri] = req.URL.RequestURI() + fields[FieldHttpRequestProtoVersion] = req.Proto + + // Get the full body of the request, including headers appended by http.Transport: + // this is necessary because the http.Request at this stage doesn't contain + // all the headers that will be eventually sent. + // We rely on `httputil.DumpRequestOut` to obtain the actual bytes that will be sent out. + reqBytes, err := httputil.DumpRequestOut(req, true) + if err != nil { + return nil, err + } + + // Create a reader around the request full body + reqReader := textproto.NewReader(bufio.NewReader(bytes.NewReader(reqBytes))) + + err = fieldHeadersFromRequestReader(reqReader, fields) + if err != nil { + return nil, err + } + + // Read the rest of the body content + fields[FieldHttpRequestBody] = bodyFromRestOfRequestReader(reqReader) + return fields, nil +} + +func fieldHeadersFromRequestReader(reader *textproto.Reader, fields map[string]interface{}) error { + // Ignore the first line: it contains non-header content + // that we have already captured. + // Skipping this step, would cause the following call to `ReadMIMEHeader()` + // to fail as it cannot parse the first line. + _, err := reader.ReadLine() + if err != nil { + return err + } + + // Read the MIME-style headers + mimeHeader, err := reader.ReadMIMEHeader() + if err != nil { + return err + } + + // Set the headers as fields to log + for k, v := range mimeHeader { + if len(v) == 1 { + fields[k] = v[0] + } else { + fields[k] = v + } + } + if _, ok := fields["Authorization"]; ok { + fields["Authorization"] = "(sensitive)" + } + + return nil +} + +func bodyFromRestOfRequestReader(reader *textproto.Reader) string { + var builder strings.Builder + for { + line, err := reader.ReadContinuedLine() + if errors.Is(err, io.EOF) { + break + } + builder.WriteString(line) + } + + return builder.String() +} + +func decomposeResponseForLogging(res *http.Response) (map[string]interface{}, error) { + fields := make(map[string]interface{}, len(res.Header)+4) + fields[FieldHttpOperationType] = OperationHttpResponse + + fields[FieldHttpResponseProtoVersion] = res.Proto + fields[FieldHttpResponseStatusCode] = res.StatusCode + fields[FieldHttpResponseStatusReason] = res.Status + + // Set the headers as fields to log + for k, v := range res.Header { + if len(v) == 1 { + fields[k] = v[0] + } else { + fields[k] = v + } + } + + // Read the whole response body + resBody, err := io.ReadAll(res.Body) + if err != nil { + return nil, err + } + + // Wrap the bytes from the response body, back into an io.ReadCloser, + // to respect the interface of http.Response, as expected by users of the + // http.Client + res.Body = io.NopCloser(bytes.NewBuffer(resBody)) + + fields[FieldHttpResponseBody] = string(resBody) + + return fields, nil +} diff --git a/internal/sdk/internal/hooks/hooks.go b/internal/sdk/internal/hooks/hooks.go index b978f6b..8ea491a 100644 --- a/internal/sdk/internal/hooks/hooks.go +++ b/internal/sdk/internal/hooks/hooks.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package hooks diff --git a/internal/sdk/internal/hooks/registration.go b/internal/sdk/internal/hooks/registration.go index 99a3606..fa131be 100644 --- a/internal/sdk/internal/hooks/registration.go +++ b/internal/sdk/internal/hooks/registration.go @@ -1,15 +1,18 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. - package hooks /* * This file is only ever generated once on the first generation and then is free to be modified. - * Any hooks you wish to add should be registered in the InitHooks function. Feel free to define them - * in this file or in separate files in the hooks package. + * Any hooks you wish to add should be registered in the initHooks function. Feel free to define + * your hooks in this file or in separate files in the hooks package. + * + * Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance. */ func initHooks(h *Hooks) { - // Add hooks by calling h.register{SDKInit/BeforeRequest/AfterSuccess/AfterError}Hook - // with an instance of a hook that implements that specific Hook interface - // Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance + // exampleHook := &ExampleHook{} + + // h.registerSDKInitHook(exampleHook) + // h.registerBeforeRequestHook(exampleHook) + // h.registerAfterErrorHook(exampleHook) + // h.registerAfterSuccessHook(exampleHook) } diff --git a/internal/sdk/internal/utils/contenttype.go b/internal/sdk/internal/utils/contenttype.go index 81e669d..f6487e0 100644 --- a/internal/sdk/internal/utils/contenttype.go +++ b/internal/sdk/internal/utils/contenttype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/internal/sdk/internal/utils/env.go b/internal/sdk/internal/utils/env.go new file mode 100644 index 0000000..110d464 --- /dev/null +++ b/internal/sdk/internal/utils/env.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package utils + +import ( + "os" +) + +// GetEnv returns the value of the environment variable named by the key or the defaultValue if the environment variable is not set. +func GetEnv(name, defaultValue string) string { + value := os.Getenv(name) + if value == "" { + return defaultValue + } + return value +} diff --git a/internal/sdk/internal/utils/form.go b/internal/sdk/internal/utils/form.go index b52cee4..b4a06a9 100644 --- a/internal/sdk/internal/utils/form.go +++ b/internal/sdk/internal/utils/form.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/internal/sdk/internal/utils/headers.go b/internal/sdk/internal/utils/headers.go index 7af15f9..a07608b 100644 --- a/internal/sdk/internal/utils/headers.go +++ b/internal/sdk/internal/utils/headers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/internal/sdk/internal/utils/json.go b/internal/sdk/internal/utils/json.go index 4f2ca8d..eaadc41 100644 --- a/internal/sdk/internal/utils/json.go +++ b/internal/sdk/internal/utils/json.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -165,11 +165,17 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool if field.Tag.Get("const") != "" { if r, ok := unmarhsaled[fieldName]; ok { val := string(r) + if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { - val = val[1 : len(val)-1] + var err error + val, err = strconv.Unquote(val) + if err != nil { + return fmt.Errorf("failed to unquote const field `%s` value `%s`: %w", fieldName, val, err) + } } - if val != field.Tag.Get("const") { - return fmt.Errorf("const field %s does not match expected value %s", fieldName, field.Tag.Get("const")) + constValue := field.Tag.Get("const") + if val != constValue { + return fmt.Errorf("const field `%s` does not match expected value `%s` got `%s`", fieldName, constValue, val) } delete(unmarhsaled, fieldName) @@ -481,30 +487,29 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa v.Set(m) return nil case reflect.Slice, reflect.Array: - if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { - if v.CanAddr() { - return json.Unmarshal(value, v.Addr().Interface()) - } else { - return json.Unmarshal(value, v.Interface()) - } - } - - var unmarhsaled []json.RawMessage + var unmarshaled []json.RawMessage - if err := json.Unmarshal(value, &unmarhsaled); err != nil { + if err := json.Unmarshal(value, &unmarshaled); err != nil { return err } - arrVal := v + arrVal := reflect.MakeSlice(typ, len(unmarshaled), len(unmarshaled)) - for _, value := range unmarhsaled { + for index, value := range unmarshaled { itemVal := reflect.New(typ.Elem()) if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { return err } - arrVal = reflect.Append(arrVal, itemVal.Elem()) + arrVal.Index(index).Set(itemVal.Elem()) + } + + if v.Kind() == reflect.Pointer { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() } v.Set(arrVal) diff --git a/internal/sdk/internal/utils/pathparams.go b/internal/sdk/internal/utils/pathparams.go index 135f2b4..7dca519 100644 --- a/internal/sdk/internal/utils/pathparams.go +++ b/internal/sdk/internal/utils/pathparams.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/internal/sdk/internal/utils/queryparams.go b/internal/sdk/internal/utils/queryparams.go index 1fc905e..78d41a7 100644 --- a/internal/sdk/internal/utils/queryparams.go +++ b/internal/sdk/internal/utils/queryparams.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -214,7 +214,11 @@ func populateDeepObjectParamsStruct(qsValues url.Values, priorScope string, stru continue } - scope := priorScope + "[" + qpTag.ParamName + "]" + scope := priorScope + + if !qpTag.Inline { + scope = priorScope + "[" + qpTag.ParamName + "]" + } switch fieldValue.Kind() { case reflect.Array, reflect.Slice: @@ -252,6 +256,13 @@ type paramTag struct { Explode bool ParamName string Serialization string + + // Inline is a special case for union/oneOf. When a wrapper struct type is + // used, each union/oneOf value field should be inlined (e.g. not appended + // in deepObject style with the name) as if the value was directly on the + // parent struct field. Without this annotation, the value would not be + // encoded by downstream logic that requires the struct field tag. + Inline bool } func parseQueryParamTag(field reflect.StructField) *paramTag { diff --git a/internal/sdk/internal/utils/requestbody.go b/internal/sdk/internal/utils/requestbody.go index b4e2b8b..78479c6 100644 --- a/internal/sdk/internal/utils/requestbody.go +++ b/internal/sdk/internal/utils/requestbody.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -66,15 +66,16 @@ func serializeRequestBody(request interface{}, nullable, optional bool, requestF if tag != nil { // request object (non-flattened) requestVal := requestValType.FieldByName(requestFieldName) + val := reflect.ValueOf(requestVal.Interface()) if isNil(requestField.Type, requestVal) { if !nullable && optional { return nil, "", nil } - return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) + return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) } - return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) + return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) } } @@ -82,7 +83,7 @@ func serializeRequestBody(request interface{}, nullable, optional bool, requestF return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], reflect.ValueOf(request), tag) } -func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (*bytes.Buffer, string, error) { +func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (io.Reader, string, error) { buf := &bytes.Buffer{} if isNil(val.Type(), val) { @@ -116,6 +117,8 @@ func serializeContentType(fieldName string, mediaType string, val reflect.Value, if err := encodeFormData(fieldName, buf, val.Interface()); err != nil { return nil, "", err } + case val.Type().Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()): + return val.Interface().(io.Reader), mediaType, nil default: val = reflect.Indirect(val) @@ -124,8 +127,8 @@ func serializeContentType(fieldName string, mediaType string, val reflect.Value, if _, err := buf.WriteString(valToString(val.Interface())); err != nil { return nil, "", err } - case val.Type() == reflect.TypeOf([]byte(nil)): - if _, err := buf.Write(val.Bytes()); err != nil { + case reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)): + if _, err := buf.Write(val.Interface().([]byte)); err != nil { return nil, "", err } default: @@ -163,7 +166,7 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { tag := parseMultipartFormTag(field) if tag.File { - if err := encodeMultipartFormDataFile(writer, fieldType, valType); err != nil { + if err := encodeMultipartFormDataFile(writer, tag.Name, fieldType, valType); err != nil { writer.Close() return "", err } @@ -208,14 +211,13 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { return writer.FormDataContentType(), nil } -func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, valType reflect.Value) error { +func encodeMultipartFormDataFile(w *multipart.Writer, fieldName string, fieldType reflect.Type, valType reflect.Value) error { if fieldType.Kind() != reflect.Struct { return fmt.Errorf("invalid type %s for multipart/form-data file", valType.Type()) } - var fieldName string var fileName string - var content []byte + var reader io.Reader for i := 0; i < fieldType.NumField(); i++ { field := fieldType.Field(i) @@ -226,15 +228,18 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va continue } - if tag.Content { - content = val.Bytes() + if tag.Content && val.CanInterface() { + if reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)) { + reader = bytes.NewReader(val.Interface().([]byte)) + } else if reflect.TypeOf(val.Interface()).Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()) { + reader = val.Interface().(io.Reader) + } } else { - fieldName = tag.Name fileName = val.String() } } - if fieldName == "" || fileName == "" || content == nil { + if fileName == "" || reader == nil { return fmt.Errorf("invalid multipart/form-data file") } @@ -242,7 +247,7 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va if err != nil { return err } - if _, err := fw.Write(content); err != nil { + if _, err := io.Copy(fw, reader); err != nil { return err } diff --git a/internal/sdk/internal/utils/retries.go b/internal/sdk/internal/utils/retries.go index 31e1675..3f35f90 100644 --- a/internal/sdk/internal/utils/retries.go +++ b/internal/sdk/internal/utils/retries.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -6,8 +6,9 @@ import ( "context" "errors" "fmt" - "github.com/cenkalti/backoff/v4" "github.com/epilot-dev/terraform-provider-epilot-designbuilder/internal/sdk/retry" + "math" + "math/rand" "net/http" "net/url" "strconv" @@ -15,8 +16,6 @@ import ( "time" ) -var errRequestFailed = errors.New("request failed") - // Deprecated: Use retry.BackoffStrategy instead. type BackoffStrategy = retry.BackoffStrategy @@ -28,34 +27,27 @@ type Retries struct { StatusCodes []string } -func Retry(ctx context.Context, r Retries, action func() (*http.Response, error)) (*http.Response, error) { +func Retry(ctx context.Context, r Retries, operation func() (*http.Response, error)) (*http.Response, error) { switch r.Config.Strategy { case "backoff": if r.Config.Backoff == nil { - return action() + return operation() } - config := backoff.NewExponentialBackOff() - config.InitialInterval = time.Duration(r.Config.Backoff.InitialInterval) * time.Millisecond - config.MaxInterval = time.Duration(r.Config.Backoff.MaxInterval) * time.Millisecond - config.Multiplier = r.Config.Backoff.Exponent - config.MaxElapsedTime = time.Duration(r.Config.Backoff.MaxElapsedTime) * time.Millisecond - config.Reset() - var resp *http.Response - err := backoff.Retry(func() error { + err := retryWithBackoff(ctx, r.Config.Backoff, func() error { if resp != nil { resp.Body.Close() } select { case <-ctx.Done(): - return backoff.Permanent(ctx.Err()) + return retry.Permanent(ctx.Err()) default: } - res, err := action() + res, err := operation() if err != nil { urlError := new(url.Error) if errors.As(err, &urlError) { @@ -64,7 +56,7 @@ func Retry(ctx context.Context, r Retries, action func() (*http.Response, error) } } - return backoff.Permanent(err) + return retry.Permanent(err) } resp = res if res == nil { @@ -81,7 +73,7 @@ func Retry(ctx context.Context, r Retries, action func() (*http.Response, error) s := res.StatusCode / 100 if s >= codeRange && s < codeRange+1 { - return errRequestFailed + return retry.TemporaryFromResponse("request failed", res) } } else { parsedCode, err := strconv.Atoi(code) @@ -90,7 +82,7 @@ func Retry(ctx context.Context, r Retries, action func() (*http.Response, error) } if res.StatusCode == parsedCode { - return errRequestFailed + return retry.TemporaryFromResponse("request failed", res) } } } @@ -98,13 +90,131 @@ func Retry(ctx context.Context, r Retries, action func() (*http.Response, error) resp = res return nil - }, config) - if err != nil && !errors.Is(err, errRequestFailed) { + }) + + var tempErr *retry.TemporaryError + if err != nil && !errors.As(err, &tempErr) { return nil, err } return resp, nil default: - return action() + return operation() + } +} + +func retryWithBackoff(ctx context.Context, s *retry.BackoffStrategy, operation func() error) error { + var ( + err error + next time.Duration + attempt int + start = time.Now() + maxElapsedTime = time.Duration(s.MaxElapsedTime) * time.Millisecond + ) + + timer := &defaultTimer{} + defer func() { + timer.Stop() + }() + + for { + err = operation() + if err == nil { + return nil + } + + var permanent *retry.PermanentError + if errors.As(err, &permanent) { + return permanent.Unwrap() + } + + if time.Since(start) >= maxElapsedTime { + return err + } + + var temporary *retry.TemporaryError + if errors.As(err, &temporary) { + next = temporary.RetryAfter() + } + + if next <= 0 { + next = nextInterval(s, attempt) + } + + timer.Start(next) + + select { + case <-ctx.Done(): + return ctx.Err() + case <-timer.C(): + } + + attempt += 1 } } + +type Timer interface { + Start(duration time.Duration) + Stop() + C() <-chan time.Time +} + +// defaultTimer implements Timer interface using time.Timer +type defaultTimer struct { + timer *time.Timer +} + +// C returns the timers channel which receives the current time when the timer fires. +func (t *defaultTimer) C() <-chan time.Time { + return t.timer.C +} + +// Start starts the timer to fire after the given duration +func (t *defaultTimer) Start(duration time.Duration) { + if t.timer == nil { + t.timer = time.NewTimer(duration) + return + } + + if !t.timer.Stop() { + select { + case <-t.timer.C: + default: + } + } + + t.timer.Reset(duration) +} + +// Stop is called when the timer is not used anymore and resources may be freed. +func (t *defaultTimer) Stop() { + if t.timer != nil { + t.timer.Stop() + } +} + +func nextInterval(s *retry.BackoffStrategy, attempt int) time.Duration { + initialInterval := float64(time.Duration(s.InitialInterval) * time.Millisecond) + maxInterval := float64(time.Duration(s.MaxInterval) * time.Millisecond) + exponent := s.Exponent + jitterFactor := float64(0.25) + + interval := initialInterval * math.Pow(float64(attempt+1), exponent) + + jitter := rand.Float64() * jitterFactor * interval + if rand.Float64() < 0.5 { + jitter = -1 * jitter + } + + interval = interval + jitter + + if interval <= 0 { + interval = initialInterval + } + + if interval > maxInterval { + interval = maxInterval + } + + return time.Duration(interval) +} diff --git a/internal/sdk/internal/utils/security.go b/internal/sdk/internal/utils/security.go index ace81f7..19dfa6f 100644 --- a/internal/sdk/internal/utils/security.go +++ b/internal/sdk/internal/utils/security.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -21,6 +21,7 @@ type securityTag struct { Name string Type string SubType string + Env string } func PopulateSecurity(ctx context.Context, req *http.Request, securitySource func(context.Context) (interface{}, error)) error { @@ -118,9 +119,14 @@ func parseSecurityScheme(headers, queryParams map[string]string, schemeTag *secu } if schemeType.Kind() == reflect.Struct { - if schemeTag.Type == "http" && schemeTag.SubType == "basic" { - handleBasicAuthScheme(headers, schemeVal.Interface()) - return + if schemeTag.Type == "http" { + switch schemeTag.SubType { + case "basic": + handleBasicAuthScheme(headers, schemeVal.Interface()) + return + case "custom": + return + } } for i := 0; i < schemeType.NumField(); i++ { @@ -170,6 +176,7 @@ func parseSecuritySchemeValue(headers, queryParams map[string]string, schemeTag switch schemeTag.SubType { case "bearer": headers[secTag.Name] = prefixBearer(valToString(val)) + case "custom": default: panic("not supported") } @@ -227,6 +234,7 @@ func parseSecurityTag(field reflect.StructField) *securityTag { name := "" securityType := "" securitySubType := "" + env := "" options := strings.Split(tag, ",") for _, optionConf := range options { @@ -246,6 +254,8 @@ func parseSecurityTag(field reflect.StructField) *securityTag { option = true case "scheme": scheme = true + case "env": + env = parts[1] } } @@ -257,6 +267,7 @@ func parseSecurityTag(field reflect.StructField) *securityTag { Name: name, Type: securityType, SubType: securitySubType, + Env: env, } } diff --git a/internal/sdk/internal/utils/utils.go b/internal/sdk/internal/utils/utils.go index 50482f2..031a71a 100644 --- a/internal/sdk/internal/utils/utils.go +++ b/internal/sdk/internal/utils/utils.go @@ -1,12 +1,14 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils import ( + "bytes" "context" "fmt" "io" "math/big" + "net/http" "reflect" "regexp" "strconv" @@ -125,6 +127,7 @@ func parseStructTag(tagKey string, field reflect.StructField) map[string]string func parseParamTag(tagKey string, field reflect.StructField, defaultStyle string, defaultExplode bool) *paramTag { // example `{tagKey}:"style=simple,explode=false,name=apiID"` + // example `{tagKey}:"inline"` values := parseStructTag(tagKey, field) if values == nil { return nil @@ -138,6 +141,8 @@ func parseParamTag(tagKey string, field reflect.StructField, defaultStyle string for k, v := range values { switch k { + case "inline": + tag.Inline = v == "true" case "style": tag.Style = v case "explode": @@ -228,3 +233,15 @@ func contains(arr []string, str string) bool { } return false } + +func ConsumeRawBody(res *http.Response) ([]byte, error) { + rawBody, err := io.ReadAll(res.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + + res.Body.Close() + res.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + + return rawBody, nil +} diff --git a/internal/sdk/models/errors/sdkerror.go b/internal/sdk/models/errors/sdkerror.go index ff3fad6..c633d56 100644 --- a/internal/sdk/models/errors/sdkerror.go +++ b/internal/sdk/models/errors/sdkerror.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package errors diff --git a/internal/sdk/models/operations/adddesign.go b/internal/sdk/models/operations/adddesign.go index d68147a..d9f8b32 100644 --- a/internal/sdk/models/operations/adddesign.go +++ b/internal/sdk/models/operations/adddesign.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/internal/sdk/models/operations/deletedesign.go b/internal/sdk/models/operations/deletedesign.go index 05a7d1a..61cf58f 100644 --- a/internal/sdk/models/operations/deletedesign.go +++ b/internal/sdk/models/operations/deletedesign.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/internal/sdk/models/operations/getalldesigns.go b/internal/sdk/models/operations/getalldesigns.go index 7b2075d..5aba95e 100644 --- a/internal/sdk/models/operations/getalldesigns.go +++ b/internal/sdk/models/operations/getalldesigns.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/internal/sdk/models/operations/getdesign.go b/internal/sdk/models/operations/getdesign.go index a0ccb4c..e6341d9 100644 --- a/internal/sdk/models/operations/getdesign.go +++ b/internal/sdk/models/operations/getdesign.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/internal/sdk/models/operations/options.go b/internal/sdk/models/operations/options.go index 4d2b4e8..de837a8 100644 --- a/internal/sdk/models/operations/options.go +++ b/internal/sdk/models/operations/options.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -12,7 +12,6 @@ import ( var ErrUnsupportedOption = errors.New("unsupported option") const ( - SupportedOptionServerURL = "serverURL" SupportedOptionRetries = "retries" SupportedOptionTimeout = "timeout" SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" @@ -24,6 +23,7 @@ type Options struct { Retries *retry.Config Timeout *time.Duration URLOverride *string + SetHeaders map[string]string } type Option func(*Options, ...string) error @@ -31,10 +31,6 @@ type Option func(*Options, ...string) error // WithServerURL allows providing an alternative server URL. func WithServerURL(serverURL string) Option { return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionServerURL) { - return ErrUnsupportedOption - } - opts.ServerURL = &serverURL return nil } @@ -43,10 +39,6 @@ func WithServerURL(serverURL string) Option { // WithTemplatedServerURL allows providing an alternative server URL with templated parameters. func WithTemplatedServerURL(serverURL string, params map[string]string) Option { return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionServerURL) { - return ErrUnsupportedOption - } - if params != nil { serverURL = utils.ReplaceParameters(serverURL, params) } @@ -91,3 +83,12 @@ func WithURLOverride(urlOverride string) Option { return nil } } + +// WithSetHeaders takes a map of headers that will applied to a request. If the +// request contains headers that are in the map then they will be overwritten. +func WithSetHeaders(hdrs map[string]string) Option { + return func(opts *Options, supportedOptions ...string) error { + opts.SetHeaders = hdrs + return nil + } +} diff --git a/internal/sdk/models/operations/updatedesign.go b/internal/sdk/models/operations/updatedesign.go index 0c0ce5b..a0e0180 100644 --- a/internal/sdk/models/operations/updatedesign.go +++ b/internal/sdk/models/operations/updatedesign.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/internal/sdk/models/shared/adddesignreq.go b/internal/sdk/models/shared/adddesignreq.go index 4e43a0b..b6cc3a7 100644 --- a/internal/sdk/models/shared/adddesignreq.go +++ b/internal/sdk/models/shared/adddesignreq.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/internal/sdk/models/shared/adddesignres.go b/internal/sdk/models/shared/adddesignres.go index fb9486f..f265eb9 100644 --- a/internal/sdk/models/shared/adddesignres.go +++ b/internal/sdk/models/shared/adddesignres.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/internal/sdk/models/shared/errorresp.go b/internal/sdk/models/shared/errorresp.go index 499c86a..4f53535 100644 --- a/internal/sdk/models/shared/errorresp.go +++ b/internal/sdk/models/shared/errorresp.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/internal/sdk/models/shared/getalldesignsres.go b/internal/sdk/models/shared/getalldesignsres.go index 6f10971..3dd6e83 100644 --- a/internal/sdk/models/shared/getalldesignsres.go +++ b/internal/sdk/models/shared/getalldesignsres.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/internal/sdk/models/shared/getdesignres.go b/internal/sdk/models/shared/getdesignres.go index 6b11eeb..a1485c1 100644 --- a/internal/sdk/models/shared/getdesignres.go +++ b/internal/sdk/models/shared/getdesignres.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/internal/sdk/models/shared/security.go b/internal/sdk/models/shared/security.go index 416eaeb..b256b4f 100644 --- a/internal/sdk/models/shared/security.go +++ b/internal/sdk/models/shared/security.go @@ -1,14 +1,14 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared type Security struct { - CustomAuthorizer string `security:"scheme,type=http,subtype=bearer,name=Authorization"` + CustomAuthorizer *string `security:"scheme,type=http,subtype=bearer,name=Authorization"` } -func (o *Security) GetCustomAuthorizer() string { +func (o *Security) GetCustomAuthorizer() *string { if o == nil { - return "" + return nil } return o.CustomAuthorizer } diff --git a/internal/sdk/models/shared/updatedesignreq.go b/internal/sdk/models/shared/updatedesignreq.go index 13850d6..e6d96ff 100644 --- a/internal/sdk/models/shared/updatedesignreq.go +++ b/internal/sdk/models/shared/updatedesignreq.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/internal/sdk/retry/config.go b/internal/sdk/retry/config.go index a9b559b..aa4b334 100644 --- a/internal/sdk/retry/config.go +++ b/internal/sdk/retry/config.go @@ -1,7 +1,16 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package retry +import ( + "errors" + "net/http" + "strconv" + "time" +) + +// BackoffStrategy defines the parameters for exponential backoff. This can be +// used to drive a retry loop for example. type BackoffStrategy struct { InitialInterval int MaxInterval int @@ -9,8 +18,128 @@ type BackoffStrategy struct { MaxElapsedTime int } +// Config configures a retry policy. type Config struct { Strategy string Backoff *BackoffStrategy RetryConnectionErrors bool } + +// PermanentError is an error that signals that some operation has terminally +// failed and should not be retried. +type PermanentError struct { + cause error +} + +// Permanent creates a PermanentError that signals to a retry loop that it +// should stop retrying an operation and return the underlying error. +func Permanent(cause error) error { + if IsPermanentError(cause) { + return cause + } + + return &PermanentError{ + cause: cause, + } +} + +func (e *PermanentError) Error() string { + return e.cause.Error() +} + +func (e *PermanentError) Unwrap() error { + return e.cause +} + +// TemporaryError represents a retryable error and signals to a retry loop that +// an operation may be retried with an optional wait interval. +type TemporaryError struct { + wait time.Duration + message string +} + +// Temporary creates a TemporaryError that signals to a retry loop that an +// operation can be retried. The error may also carry details about how long to +// wait before retrying. This wait interval may be used to override the retry +// policy in use. +func Temporary(message string) error { + return &TemporaryError{ + message: message, + } +} + +// TemporaryFromResponse creates a TemporaryError similar to Temporary but +// additionally parses the Retry-After header from a response to determine the +// wait interval before the next retry attempt. +func TemporaryFromResponse(message string, res *http.Response) error { + return &TemporaryError{ + wait: retryIntervalFromResponse(res), + message: message, + } +} + +func (e *TemporaryError) Error() string { + return e.message +} + +// RetryAfter returns the time to wait before retrying the request. The zero +// value should be interpreted by retry loops to mean they should fallback on +// their default policy whether expenonential, constant backoff or something +// else. It does not mean that an operation should be retried immediately. +func (e *TemporaryError) RetryAfter() time.Duration { + return e.wait +} + +func retryIntervalFromResponse(res *http.Response) time.Duration { + if res == nil { + return 0 + } + + retryVal := res.Header.Get("retry-after") + if retryVal == "" { + return 0 + } + + parsedNumber, err := strconv.ParseInt(retryVal, 10, 64) + if err == nil { + if parsedNumber < 0 { + return 0 + } else { + return time.Duration(parsedNumber) * time.Second + } + } + + parsedDate, err := time.Parse(time.RFC1123, retryVal) + if err == nil { + delta := parsedDate.Sub(time.Now()) + if delta < 0 { + return 0 + } else { + return delta + } + } + + return 0 +} + +// IsPermanentError returns true if an error value is or contains a +// PermanentError in its chain of errors. +func IsPermanentError(err error) bool { + if err == nil { + return false + } + + var pe *PermanentError + return errors.As(err, &pe) +} + +// IsTemporaryError returns true if an error value is or contains a +// TemporaryError in its chain of errors. +func IsTemporaryError(err error) bool { + if err == nil { + return false + } + + var pe *TemporaryError + return errors.As(err, &pe) +} diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go index 2e6ad5f..53b5d50 100644 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdk @@ -12,7 +12,6 @@ import ( "github.com/epilot-dev/terraform-provider-epilot-designbuilder/internal/sdk/models/operations" "github.com/epilot-dev/terraform-provider-epilot-designbuilder/internal/sdk/models/shared" "github.com/epilot-dev/terraform-provider-epilot-designbuilder/internal/sdk/retry" - "io" "net/http" "net/url" "time" @@ -46,6 +45,9 @@ func Float32(f float32) *float32 { return &f } // Float64 provides a helper function to return a pointer to a float64 func Float64(f float64) *float64 { return &f } +// Pointer provides a helper function to return a pointer to a type +func Pointer[T any](v T) *T { return &v } + type sdkConfiguration struct { Client HTTPClient Security func(context.Context) (interface{}, error) @@ -146,9 +148,9 @@ func New(opts ...SDKOption) *SDK { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "0.0.1", - SDKVersion: "0.0.1", - GenVersion: "2.379.3", - UserAgent: "speakeasy-sdk/go 0.0.1 2.379.3 0.0.1 github.com/epilot-dev/terraform-provider-epilot-designbuilder/internal/sdk", + SDKVersion: "0.9.0", + GenVersion: "2.484.0", + UserAgent: "speakeasy-sdk/terraform 0.9.0 2.484.0 0.0.1 github.com/epilot-dev/terraform-provider-epilot-designbuilder/internal/sdk", Hooks: hooks.New(), }, } @@ -192,7 +194,12 @@ func (s *SDK) AddDesign(ctx context.Context, request shared.AddDesignReq, opts . } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/designs") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -226,6 +233,10 @@ func (s *SDK) AddDesign(ctx context.Context, request shared.AddDesignReq, opts . return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err @@ -261,17 +272,15 @@ func (s *SDK) AddDesign(ctx context.Context, request shared.AddDesignReq, opts . RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - switch { case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + var out shared.AddDesignRes if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -279,6 +288,10 @@ func (s *SDK) AddDesign(ctx context.Context, request shared.AddDesignReq, opts . res.AddDesignRes = &out default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -288,6 +301,11 @@ func (s *SDK) AddDesign(ctx context.Context, request shared.AddDesignReq, opts . case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + var out shared.ErrorResp if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -295,9 +313,17 @@ func (s *SDK) AddDesign(ctx context.Context, request shared.AddDesignReq, opts . res.ErrorResp = &out default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -326,7 +352,12 @@ func (s *SDK) DeleteDesign(ctx context.Context, request operations.DeleteDesignR } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/designs/{designId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -354,6 +385,10 @@ func (s *SDK) DeleteDesign(ctx context.Context, request operations.DeleteDesignR return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err @@ -389,13 +424,6 @@ func (s *SDK) DeleteDesign(ctx context.Context, request operations.DeleteDesignR RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - switch { case httpRes.StatusCode == 204: fallthrough @@ -407,6 +435,11 @@ func (s *SDK) DeleteDesign(ctx context.Context, request operations.DeleteDesignR case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + var out shared.ErrorResp if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -414,9 +447,17 @@ func (s *SDK) DeleteDesign(ctx context.Context, request operations.DeleteDesignR res.ErrorResp = &out default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -445,7 +486,12 @@ func (s *SDK) GetAllDesigns(ctx context.Context, opts ...operations.Option) (*op } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/designs") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -473,6 +519,10 @@ func (s *SDK) GetAllDesigns(ctx context.Context, opts ...operations.Option) (*op return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err @@ -508,17 +558,15 @@ func (s *SDK) GetAllDesigns(ctx context.Context, opts ...operations.Option) (*op RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + var out []shared.GetAllDesignsRes if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -526,11 +574,20 @@ func (s *SDK) GetAllDesigns(ctx context.Context, opts ...operations.Option) (*op res.Classes = out default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + var out shared.ErrorResp if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -538,9 +595,17 @@ func (s *SDK) GetAllDesigns(ctx context.Context, opts ...operations.Option) (*op res.ErrorResp = &out default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -569,7 +634,12 @@ func (s *SDK) GetDesign(ctx context.Context, request operations.GetDesignRequest } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/designs/{designId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -597,6 +667,10 @@ func (s *SDK) GetDesign(ctx context.Context, request operations.GetDesignRequest return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err @@ -632,17 +706,15 @@ func (s *SDK) GetDesign(ctx context.Context, request operations.GetDesignRequest RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + var out shared.GetDesignRes if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -650,6 +722,10 @@ func (s *SDK) GetDesign(ctx context.Context, request operations.GetDesignRequest res.GetDesignRes = &out default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -659,6 +735,11 @@ func (s *SDK) GetDesign(ctx context.Context, request operations.GetDesignRequest case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + var out shared.ErrorResp if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -666,10 +747,18 @@ func (s *SDK) GetDesign(ctx context.Context, request operations.GetDesignRequest res.ErrorResp = &out default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -698,7 +787,12 @@ func (s *SDK) UpdateDesign(ctx context.Context, request operations.UpdateDesignR } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/designs/{designId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -732,6 +826,10 @@ func (s *SDK) UpdateDesign(ctx context.Context, request operations.UpdateDesignR return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err @@ -767,13 +865,6 @@ func (s *SDK) UpdateDesign(ctx context.Context, request operations.UpdateDesignR RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - switch { case httpRes.StatusCode == 204: fallthrough @@ -785,6 +876,11 @@ func (s *SDK) UpdateDesign(ctx context.Context, request operations.UpdateDesignR case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + var out shared.ErrorResp if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -792,9 +888,17 @@ func (s *SDK) UpdateDesign(ctx context.Context, request operations.UpdateDesignR res.ErrorResp = &out default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/internal/sdk/types/bigint.go b/internal/sdk/types/bigint.go index 4765ef2..9c6a086 100644 --- a/internal/sdk/types/bigint.go +++ b/internal/sdk/types/bigint.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/internal/sdk/types/date.go b/internal/sdk/types/date.go index 131f364..5b2782f 100644 --- a/internal/sdk/types/date.go +++ b/internal/sdk/types/date.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/internal/sdk/types/datetime.go b/internal/sdk/types/datetime.go index c07ddcd..3eff332 100644 --- a/internal/sdk/types/datetime.go +++ b/internal/sdk/types/datetime.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/internal/sdk/types/decimal.go b/internal/sdk/types/decimal.go index f7def72..d8429bc 100644 --- a/internal/sdk/types/decimal.go +++ b/internal/sdk/types/decimal.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/internal/sdk/types/pointers.go b/internal/sdk/types/pointers.go index 1ed80cf..35c439d 100644 --- a/internal/sdk/types/pointers.go +++ b/internal/sdk/types/pointers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types @@ -8,3 +8,4 @@ func Int(i int) *int { return &i } func Int64(i int64) *int64 { return &i } func Float32(f float32) *float32 { return &f } func Float64(f float64) *float64 { return &f } +func Pointer[T any](v T) *T { return &v } diff --git a/internal/validators/DateValidator.go b/internal/validators/DateValidator.go index 7adb144..1fecdde 100644 --- a/internal/validators/DateValidator.go +++ b/internal/validators/DateValidator.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package validators diff --git a/internal/validators/ExactlyOneChild.go b/internal/validators/ExactlyOneChild.go index dc9cd6a..1765a3a 100644 --- a/internal/validators/ExactlyOneChild.go +++ b/internal/validators/ExactlyOneChild.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package validators diff --git a/internal/validators/JSONParseValidator.go b/internal/validators/JSONParseValidator.go index cb680b9..b8bb96b 100644 --- a/internal/validators/JSONParseValidator.go +++ b/internal/validators/JSONParseValidator.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package validators diff --git a/internal/validators/RFC3339Validator.go b/internal/validators/RFC3339Validator.go index 888f85c..f5e6146 100644 --- a/internal/validators/RFC3339Validator.go +++ b/internal/validators/RFC3339Validator.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package validators diff --git a/internal/validators/boolvalidators/not_null.go b/internal/validators/boolvalidators/not_null.go index de7f756..6eca17e 100644 --- a/internal/validators/boolvalidators/not_null.go +++ b/internal/validators/boolvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package boolvalidators diff --git a/internal/validators/float64validators/not_null.go b/internal/validators/float64validators/not_null.go index fed2c05..8f786d2 100644 --- a/internal/validators/float64validators/not_null.go +++ b/internal/validators/float64validators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package float64validators diff --git a/internal/validators/int64validators/not_null.go b/internal/validators/int64validators/not_null.go index c07e1de..707ff95 100644 --- a/internal/validators/int64validators/not_null.go +++ b/internal/validators/int64validators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package int64validators diff --git a/internal/validators/listvalidators/not_null.go b/internal/validators/listvalidators/not_null.go index f39d6fa..9b88e52 100644 --- a/internal/validators/listvalidators/not_null.go +++ b/internal/validators/listvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package listvalidators diff --git a/internal/validators/mapvalidators/not_null.go b/internal/validators/mapvalidators/not_null.go index 9cdf99e..dc6959e 100644 --- a/internal/validators/mapvalidators/not_null.go +++ b/internal/validators/mapvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package mapvalidators diff --git a/internal/validators/numbervalidators/not_null.go b/internal/validators/numbervalidators/not_null.go index e2baffe..57d4da0 100644 --- a/internal/validators/numbervalidators/not_null.go +++ b/internal/validators/numbervalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package numbervalidators diff --git a/internal/validators/objectvalidators/not_null.go b/internal/validators/objectvalidators/not_null.go index 480ec23..bf01894 100644 --- a/internal/validators/objectvalidators/not_null.go +++ b/internal/validators/objectvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package objectvalidators diff --git a/internal/validators/setvalidators/not_null.go b/internal/validators/setvalidators/not_null.go index 45369e3..f859d64 100644 --- a/internal/validators/setvalidators/not_null.go +++ b/internal/validators/setvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package setvalidators diff --git a/internal/validators/stringvalidators/not_null.go b/internal/validators/stringvalidators/not_null.go index ce5f808..1e40ac1 100644 --- a/internal/validators/stringvalidators/not_null.go +++ b/internal/validators/stringvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package stringvalidators diff --git a/main.go b/main.go index c871c01..1123d76 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package main diff --git a/tools/tools.go b/tools/tools.go index 08da0fd..36b2580 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. //go:build tools