mirror of
https://github.com/microsoft/terraform-provider-fabric.git
synced 2026-11-04 12:02:31 +00:00
build(deps): bump fabric-sdk-go to v0.21.0 (#1124)
# 📥 Pull Request ## ❓ What are you trying to address `github.com/microsoft/fabric-sdk-go` v0.21.0 introduces breaking changes, so the provider no longer compiles or passes unit tests after the bump from v0.20.0. This PR does the bump and restores compatibility. It changes no Terraform schemas and adds no features. There is no linked issue. The failures were found while updating the SDK: - **Build failure:** `fabeventstream.SourceConnectionResponse` / `DestinationConnectionResponse` no longer exist. The `TopologyClientGetEventstream{Source,Destination}ConnectionResponse` types now embed the polymorphic `EndpointConnectionClassification`. - **Unit-test failure:** `fabric.NewClient` now writes the resolved cloud configuration back into the caller's `ClientOptions`. It also requires any non-empty `Cloud` to contain a `"microsoftFabric"` service entry. The unit-test provider factory reused one options pointer, so every client creation after the first failed with `cloud configuration has no "microsoftFabric" service`. ## ✨ Description of new changes **Dependencies** - Bumped `github.com/microsoft/fabric-sdk-go` v0.20.0 → v0.21.0 via `go get` + `go mod tidy`. - The other bumps are only the minimum versions v0.21.0 requires: `azcore` v1.23.2, `azidentity` v1.14.1, MSAL v1.8.0, `testify` v1.12.1, `go.yaml.in/yaml/v3` v3.0.5. - Tidy also dropped indirect modules that `testify` v1.12.1 no longer needs. **Eventstream source/destination connection (data sources + ephemeral resources)** - Follows the repo's polymorphic pattern, as in `gateway` / `connection`. `set()` in `eventstreamsourceconnection/models.go` and `eventstreamdestinationconnection/models.go` now takes `fabeventstream.EndpointConnectionClassification` and type-switches on it. - The existing Event Hub fields (`event_hub_name`, `fully_qualified_namespace`, `consumer_group_name`, `access_keys`) are mapped from `*CustomEndpointConnection`, so current behaviour is unchanged. - Any other endpoint type (e.g. Kafka), the base `EndpointConnection`, or `nil` now returns an explicit `Unsupported Eventstream source/destination connection type` diagnostic instead of being silently mis-mapped. - **Known limitation:** Kafka endpoints are not supported. Supporting them would be a separate feature. **Unit-test helper (`internal/testhelp/testunit.go`)** - The test provider factory now copies the `fabric.ClientOptions` for each client creation, because the SDK mutates them. - Production client creation (`createDefaultClient`) already builds fresh options on each call and is unaffected. - This SDK behaviour differs from `azcore`, which treats caller options as read-only, and could be reported upstream. **Tests** - The inline fakes now return `*fabeventstream.CustomEndpointConnection` wrapped in the new response types. - Added `TestUnit_EventstreamSourceConnectionDataSource_EndpointTypes` and `TestUnit_EventstreamDestinationConnectionDataSource_EndpointTypes`. They cover: - a custom endpoint without access keys (`access_keys` stays null) - a Kafka endpoint (error) - an unknown base endpoint (error) - a `nil` endpoint (error) **Validation** All runs below are on this branch (based on `main` @ `150412ce`, Go 1.27.1) unless noted otherwise. | Command | Result | | --- | --- | | `go vet ./...` (all packages incl. tests) | ✅ passed | | `task testunit -- Eventstream ./internal/services/eventstream...` | ✅ passed: 20 tests (coverage: `eventstream` 100%, `eventstreamsourceconnection` 87.9%, `eventstreamdestinationconnection` 88.1%) | | `task testunit -- Provider ./internal/provider` | ✅ passed: 9 tests (covers the `testunit.go` change) | | `golangci-lint run ./internal/services/eventstreamsourceconnection/... ./internal/services/eventstreamdestinationconnection/... ./internal/testhelp/...` (v2.15.0) | ✅ 0 issues | | `task testacc -- Eventstream ./internal/services/eventstream...` (run before rebasing onto latest `main`, same fix + SDK v0.21.0; not re-run after rebase) | ⚠️ 6/9 passed, 3 failed (unrelated, see below) | The acceptance tests ran against a live tenant: - The source and destination connection data source and ephemeral resource tests **passed** against the real API. - `TestAcc_EventstreamResource_CRUD`, `TestAcc_EventstreamDefinitionResource_CRUD` and `TestAcc_EventstreamDefinitionResource_CRUD_Parameters` **failed before any Eventstream code ran**. Creating their prerequisite folder or Lakehouse returned `404 EntityNotFound` because the local well-known `WorkspaceRS` workspace had been deleted, which a direct API check confirmed. This is a stale local fixture, not a regression from this change. **Changelog:** no entry is included; this is a dependency bump plus compatibility fixes, and the PR is labelled `skip-changelog`. ## ☑️ PR Checklist - [ ] Link to the issue you are addressing is included above <!-- No issue exists; context is described above. --> - [x] Ensure the PR description clearly describes the feature you're adding and any known limitations ## ☑️ Resources / Data Sources Checklist PRs for new/enhanced resources or data sources are expected to meet the following criteria: - [x] Production quality implementation of the resource or data-source in [./internal/services](./internal/services) - [x] Unit Tests and Acceptance Tests for your contribution in [./internal/services/<service_name>](./internal/services) - [x] Tests should pass and provide >80% coverage of your contribution - [ ] Examples for your contribution in [./examples](./examples) (see [Terraform Documentation on examples](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-documentation-generation#add-configuration-examples)) <!-- N/A: no schema or usage change. --> - [ ] [Schema descriptions](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-documentation-generation#add-schema-descriptions) for your resource or data-source in [./internal/services](./internal/services) <!-- N/A: no schema change. --> - [ ] Docs templates in [./templates](./templates) <!-- N/A: no docs change. --> - [ ] Updated auto-generated documentation in [./docs](./docs). (DO NOT manually edit [./docs](./docs) - your updates will be overwritten) <!-- N/A: no schema change, so generated docs are unchanged. --> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
150412ce95
commit
3324e92aa6
13 files changed
+226
-68
No files matched your search
@@ -3,8 +3,8 @@ module github.com/microsoft/terraform-provider-fabric
|
||||
go 1.27.1
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.2
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1
|
||||
github.com/dcarbone/terraform-plugin-framework-utils/v3 v3.9.0
|
||||
github.com/go-sprout/sprout v1.0.3
|
||||
github.com/google/go-cmp v0.7.0
|
||||
@@ -18,25 +18,24 @@ require (
|
||||
github.com/hashicorp/terraform-plugin-go v0.31.0
|
||||
github.com/hashicorp/terraform-plugin-log v0.11.0
|
||||
github.com/hashicorp/terraform-plugin-testing v1.16.0
|
||||
github.com/microsoft/fabric-sdk-go v0.20.0
|
||||
github.com/microsoft/fabric-sdk-go v0.21.0
|
||||
github.com/ohler55/ojg v1.28.4
|
||||
github.com/orange-cloudavenue/terraform-plugin-framework-superschema v1.12.0
|
||||
github.com/orange-cloudavenue/terraform-plugin-framework-supertypes v1.2.0
|
||||
github.com/orange-cloudavenue/terraform-plugin-framework-validators v1.17.0
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/stretchr/testify v1.12.1
|
||||
software.sslmate.com/src/go-pkcs12 v0.7.3
|
||||
)
|
||||
|
||||
require (
|
||||
dario.cat/mergo v1.0.2 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.4.0 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.4.1 // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/cloudflare/circl v1.6.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/fatih/color v1.19.0 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
@@ -69,13 +68,12 @@ require (
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/oklog/run v1.2.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/spf13/cast v1.10.0 // indirect
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible // 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.18.1 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.5 // indirect
|
||||
golang.org/x/crypto v0.55.0 // indirect
|
||||
golang.org/x/mod v0.38.0 // indirect
|
||||
golang.org/x/net v0.58.0 // indirect
|
||||
@@ -87,5 +85,4 @@ require (
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
|
||||
google.golang.org/grpc v1.83.2 // indirect
|
||||
google.golang.org/protobuf v1.36.11 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
@@ -1,17 +1,17 @@
|
||||
dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
|
||||
dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0 h1:aokoqcHvaGjiM3VpjKDfMMnF/8epJ+Q1HLJ7CudztqE=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0/go.mod h1:/WYEx9pcM9Y+Dd/APJaNlSvVSvzl54rrMdZT5+Oi2LM=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0 h1:CU4+EJeJi3TKYWEcYuSdWsjzw0nVsK/H0MSQOiPcymU=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0/go.mod h1:q0+UTSRvShwUCrR/s5HtyInYphN7Wvxb7snFM3u+SLA=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.2 h1:utpeoEeZjd+A8J41zvoLsOOrqXHhX1Kx/X/tCW9dEYQ=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.2/go.mod h1:iptorS+VYKFL2N6PnebpS91dubG35eAOEERnT4PJbQU=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1 h1:u93s+zU2JD62im61Bm5CZIc1ZrOJaIAWEg0WOrMVkEo=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1/go.mod h1:oXtinPO4OLj9d1DOTrqrL1oRwGhcqadvAmrl6wTeGlk=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0 h1:xFaZZ+IubdftrDHnGGwZ6QvQ3KHTtWl2MCK+GMt2vxs=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0/go.mod h1:mCBhUhlMjLLJKr5aqw2TNS/VqJOie8MzWq3DAMJeKso=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY=
|
||||
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM=
|
||||
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 h1:RHK7bS+HQMslb1sZpAokUt+zTVmue0hKSs2C791hhzU=
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk=
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0 h1:Nljr4q1GRA/5vCrMONS+g4u4LRHNgOXVSh3O43J2CnI=
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0/go.mod h1:Y33QHnf0FfdVewFFISOGe20mkZbxX4H839o955/PoeI=
|
||||
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
|
||||
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
|
||||
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||
@@ -157,8 +157,8 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
|
||||
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
|
||||
github.com/microsoft/fabric-sdk-go v0.20.0 h1:mjsu0c10YCoYlG8eCyPIjLJsHhrwGXMLh5Dsqa30Ufc=
|
||||
github.com/microsoft/fabric-sdk-go v0.20.0/go.mod h1:hM6mZCAkFicenuV87Qy+qj1kmB4FHpQae/71VyvdJns=
|
||||
github.com/microsoft/fabric-sdk-go v0.21.0 h1:Kjqj6FSE622pSWd2KrjyQBP+wADFM7sl54Q9y/YqFqQ=
|
||||
github.com/microsoft/fabric-sdk-go v0.21.0/go.mod h1:yZP3r5T06Iv3lPwDBzGF3uyyo74NFmvpoalffYhqmXA=
|
||||
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-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
|
||||
@@ -184,8 +184,6 @@ github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxu
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
|
||||
@@ -198,8 +196,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
|
||||
github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
|
||||
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
|
||||
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||
@@ -226,8 +224,8 @@ go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRk
|
||||
go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
|
||||
go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
|
||||
go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
|
||||
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
|
||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
|
||||
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
|
||||
@@ -295,7 +293,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
|
||||
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.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
software.sslmate.com/src/go-pkcs12 v0.7.3 h1:JBQD3FDqYjTeyDAeZQklj2ar88ykBLtALloPJHyAauU=
|
||||
software.sslmate.com/src/go-pkcs12 v0.7.3/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI=
|
||||
+1
-1
@@ -172,5 +172,5 @@ func (d *dataSourceEventstreamDestinationConnection) get(ctx context.Context, mo
|
||||
return diags
|
||||
}
|
||||
|
||||
return model.set(ctx, model.WorkspaceID.ValueString(), model.EventstreamID.ValueString(), model.DestinationID.ValueString(), respGet.DestinationConnectionResponse)
|
||||
return model.set(ctx, model.WorkspaceID.ValueString(), model.EventstreamID.ValueString(), model.DestinationID.ValueString(), respGet.EndpointConnectionClassification)
|
||||
}
|
||||
+63
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
at "github.com/dcarbone/terraform-plugin-framework-utils/v3/acctest"
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
|
||||
fabeventstream "github.com/microsoft/fabric-sdk-go/fabric/eventstream"
|
||||
|
||||
"github.com/microsoft/terraform-provider-fabric/internal/common"
|
||||
"github.com/microsoft/terraform-provider-fabric/internal/framework/customtypes"
|
||||
@@ -184,6 +185,68 @@ func TestUnit_EventstreamDestinationDataSource(t *testing.T) {
|
||||
}))
|
||||
}
|
||||
|
||||
func TestUnit_EventstreamDestinationConnectionDataSource_EndpointTypes(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
entity fabeventstream.EndpointConnectionClassification
|
||||
expectError *regexp.Regexp
|
||||
}{
|
||||
"custom endpoint without access keys": {
|
||||
entity: &fabeventstream.CustomEndpointConnection{
|
||||
Type: new(fabeventstream.EndpointConnectionTypeCustomEndpoint),
|
||||
EventHubName: new("event-hub"),
|
||||
FullyQualifiedNamespace: new("namespace"),
|
||||
ConsumerGroupName: new("consumer-group"),
|
||||
},
|
||||
},
|
||||
"kafka endpoint": {
|
||||
entity: &fabeventstream.KafkaEndpointConnection{
|
||||
Type: new(fabeventstream.EndpointConnectionTypeKafkaEndpoint),
|
||||
},
|
||||
expectError: regexp.MustCompile("Unsupported Eventstream destination connection type"),
|
||||
},
|
||||
"unknown endpoint": {
|
||||
entity: &fabeventstream.EndpointConnection{
|
||||
Type: new(fabeventstream.EndpointConnectionType("Unknown")),
|
||||
},
|
||||
expectError: regexp.MustCompile("Unsupported Eventstream destination connection type"),
|
||||
},
|
||||
"nil endpoint": {
|
||||
expectError: regexp.MustCompile("Unsupported Eventstream destination connection type"),
|
||||
},
|
||||
}
|
||||
|
||||
for name, testCase := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
workspaceID := testhelp.RandomUUID()
|
||||
eventstreamID := testhelp.RandomUUID()
|
||||
destinationID := testhelp.RandomUUID()
|
||||
|
||||
fakes.FakeServer.ServerFactory.Eventstream.TopologyServer.GetEventstreamDestinationConnection = fakeGetEventstreamDestinationConnection(
|
||||
workspaceID, eventstreamID, destinationID, testCase.entity,
|
||||
)
|
||||
|
||||
step := resource.TestStep{
|
||||
Config: at.CompileConfig(testDataSourceItemHeader, map[string]any{
|
||||
"workspace_id": workspaceID,
|
||||
"eventstream_id": eventstreamID,
|
||||
"destination_id": destinationID,
|
||||
}),
|
||||
ExpectError: testCase.expectError,
|
||||
}
|
||||
if testCase.expectError == nil {
|
||||
step.Check = resource.ComposeAggregateTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(testDataSourceItemFQN, "event_hub_name", "event-hub"),
|
||||
resource.TestCheckResourceAttr(testDataSourceItemFQN, "fully_qualified_namespace", "namespace"),
|
||||
resource.TestCheckResourceAttr(testDataSourceItemFQN, "consumer_group_name", "consumer-group"),
|
||||
resource.TestCheckNoResourceAttr(testDataSourceItemFQN, "access_keys"),
|
||||
)
|
||||
}
|
||||
|
||||
resource.Test(t, testhelp.NewTestUnitCase(t, nil, fakes.FakeServer.ServerFactory, nil, []resource.TestStep{step}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAcc_EventstreamDestinationConnectionDataSource(t *testing.T) {
|
||||
if testhelp.ShouldSkipTest(t) {
|
||||
t.Skip("Throttling issues which blocks all PR tests in the pipeline")
|
||||
|
||||
+1
-1
@@ -168,5 +168,5 @@ func (e *ephemeralEventstreamDestinationConnection) get(ctx context.Context, mod
|
||||
return diags
|
||||
}
|
||||
|
||||
return model.set(ctx, model.WorkspaceID.ValueString(), model.EventstreamID.ValueString(), model.DestinationID.ValueString(), respGet.DestinationConnectionResponse)
|
||||
return model.set(ctx, model.WorkspaceID.ValueString(), model.EventstreamID.ValueString(), model.DestinationID.ValueString(), respGet.EndpointConnectionClassification)
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
fabcore "github.com/microsoft/fabric-sdk-go/fabric/core"
|
||||
"github.com/microsoft/fabric-sdk-go/fabric/eventstream"
|
||||
fabeventstream "github.com/microsoft/fabric-sdk-go/fabric/eventstream"
|
||||
fabfake "github.com/microsoft/fabric-sdk-go/fabric/fake"
|
||||
|
||||
"github.com/microsoft/terraform-provider-fabric/internal/testhelp"
|
||||
@@ -17,32 +17,35 @@ import (
|
||||
|
||||
func fakeGetEventstreamDestinationConnection(
|
||||
fakeWorkspaceID, fakeEventstreamID, fakeDestinationID string,
|
||||
entity eventstream.TopologyClientGetEventstreamDestinationConnectionResponse,
|
||||
entity fabeventstream.EndpointConnectionClassification,
|
||||
) func(
|
||||
ctx context.Context,
|
||||
workspaceID, eventstreamID, destinationID string,
|
||||
options *eventstream.TopologyClientGetEventstreamDestinationConnectionOptions,
|
||||
) (resp azfake.Responder[eventstream.TopologyClientGetEventstreamDestinationConnectionResponse], errResp azfake.ErrorResponder) {
|
||||
return func(_ context.Context, workspaceID, eventstreamID, destinationID string, _ *eventstream.TopologyClientGetEventstreamDestinationConnectionOptions) (resp azfake.Responder[eventstream.TopologyClientGetEventstreamDestinationConnectionResponse], errResp azfake.ErrorResponder) {
|
||||
resp = azfake.Responder[eventstream.TopologyClientGetEventstreamDestinationConnectionResponse]{}
|
||||
options *fabeventstream.TopologyClientGetEventstreamDestinationConnectionOptions,
|
||||
) (resp azfake.Responder[fabeventstream.TopologyClientGetEventstreamDestinationConnectionResponse], errResp azfake.ErrorResponder) {
|
||||
return func(_ context.Context, workspaceID, eventstreamID, destinationID string, _ *fabeventstream.TopologyClientGetEventstreamDestinationConnectionOptions) (resp azfake.Responder[fabeventstream.TopologyClientGetEventstreamDestinationConnectionResponse], errResp azfake.ErrorResponder) {
|
||||
resp = azfake.Responder[fabeventstream.TopologyClientGetEventstreamDestinationConnectionResponse]{}
|
||||
|
||||
if destinationID != fakeDestinationID || workspaceID != fakeWorkspaceID || eventstreamID != fakeEventstreamID {
|
||||
resp.SetResponse(http.StatusNotFound, eventstream.TopologyClientGetEventstreamDestinationConnectionResponse{}, nil)
|
||||
resp.SetResponse(http.StatusNotFound, fabeventstream.TopologyClientGetEventstreamDestinationConnectionResponse{}, nil)
|
||||
errResp.SetError(fabfake.SetResponseError(http.StatusNotFound, fabcore.ErrItem.ItemNotFound.Error(), "Item not found"))
|
||||
} else {
|
||||
resp.SetResponse(http.StatusOK, entity, nil)
|
||||
resp.SetResponse(http.StatusOK, fabeventstream.TopologyClientGetEventstreamDestinationConnectionResponse{
|
||||
EndpointConnectionClassification: entity,
|
||||
}, nil)
|
||||
}
|
||||
|
||||
return resp, errResp
|
||||
}
|
||||
}
|
||||
|
||||
func NewRandomEventstreamDestinationConnection() eventstream.TopologyClientGetEventstreamDestinationConnectionResponse {
|
||||
return eventstream.TopologyClientGetEventstreamDestinationConnectionResponse{
|
||||
func NewRandomEventstreamDestinationConnection() *fabeventstream.CustomEndpointConnection {
|
||||
return &fabeventstream.CustomEndpointConnection{
|
||||
Type: new(fabeventstream.EndpointConnectionTypeCustomEndpoint),
|
||||
EventHubName: new(testhelp.RandomName()),
|
||||
FullyQualifiedNamespace: new(testhelp.RandomName()),
|
||||
ConsumerGroupName: new(testhelp.RandomName()),
|
||||
AccessKeys: &eventstream.AccessKeys{
|
||||
AccessKeys: &fabeventstream.AccessKeys{
|
||||
PrimaryConnectionString: new(testhelp.RandomName()),
|
||||
SecondaryConnectionString: new(testhelp.RandomName()),
|
||||
PrimaryKey: new(testhelp.RandomName()),
|
||||
|
||||
@@ -5,6 +5,7 @@ package eventstreamdestinationconnection
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
timeoutsD "github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts" //revive:disable-line:import-alias-naming
|
||||
timeoutsE "github.com/hashicorp/terraform-plugin-framework-timeouts/ephemeral/timeouts" //revive:disable-line:import-alias-naming
|
||||
@@ -38,23 +39,36 @@ type baseEventstreamDestinationConnectionModel struct {
|
||||
AccessKeys supertypes.SingleNestedObjectValueOf[accessKeysModel] `tfsdk:"access_keys"`
|
||||
}
|
||||
|
||||
func (to *baseEventstreamDestinationConnectionModel) set(ctx context.Context, workspaceID, eventstreamID, destinationID string, from fabeventstream.DestinationConnectionResponse) diag.Diagnostics {
|
||||
func (to *baseEventstreamDestinationConnectionModel) set(ctx context.Context, workspaceID, eventstreamID, destinationID string, from fabeventstream.EndpointConnectionClassification) diag.Diagnostics {
|
||||
to.DestinationID = customtypes.NewUUIDValue(destinationID)
|
||||
to.EventstreamID = customtypes.NewUUIDValue(eventstreamID)
|
||||
to.WorkspaceID = customtypes.NewUUIDValue(workspaceID)
|
||||
to.EventHubName = types.StringPointerValue(from.EventHubName)
|
||||
to.FullyQualifiedNamespace = types.StringPointerValue(from.FullyQualifiedNamespace)
|
||||
to.ConsumerGroupName = types.StringPointerValue(from.ConsumerGroupName)
|
||||
|
||||
accessKeys := supertypes.NewSingleNestedObjectValueOfNull[accessKeysModel](ctx)
|
||||
|
||||
if from.AccessKeys != nil {
|
||||
accessKeysModel := &accessKeysModel{}
|
||||
accessKeysModel.set(*from.AccessKeys)
|
||||
switch entity := from.(type) {
|
||||
case *fabeventstream.CustomEndpointConnection:
|
||||
to.EventHubName = types.StringPointerValue(entity.EventHubName)
|
||||
to.FullyQualifiedNamespace = types.StringPointerValue(entity.FullyQualifiedNamespace)
|
||||
to.ConsumerGroupName = types.StringPointerValue(entity.ConsumerGroupName)
|
||||
|
||||
if diags := accessKeys.Set(ctx, accessKeysModel); diags.HasError() {
|
||||
return diags
|
||||
if entity.AccessKeys != nil {
|
||||
accessKeysModel := &accessKeysModel{}
|
||||
accessKeysModel.set(*entity.AccessKeys)
|
||||
|
||||
if diags := accessKeys.Set(ctx, accessKeysModel); diags.HasError() {
|
||||
return diags
|
||||
}
|
||||
}
|
||||
default:
|
||||
var diags diag.Diagnostics
|
||||
|
||||
diags.AddError(
|
||||
"Unsupported Eventstream destination connection type",
|
||||
fmt.Sprintf("The Eventstream destination connection type '%T' is not supported.", entity),
|
||||
)
|
||||
|
||||
return diags
|
||||
}
|
||||
|
||||
to.AccessKeys = accessKeys
|
||||
|
||||
@@ -168,5 +168,5 @@ func (d *dataSourceEventstreamSourceConnection) get(ctx context.Context, model *
|
||||
return diags
|
||||
}
|
||||
|
||||
return model.set(ctx, model.WorkspaceID.ValueString(), model.EventstreamID.ValueString(), model.SourceID.ValueString(), respGet.SourceConnectionResponse)
|
||||
return model.set(ctx, model.WorkspaceID.ValueString(), model.EventstreamID.ValueString(), model.SourceID.ValueString(), respGet.EndpointConnectionClassification)
|
||||
}
|
||||
+61
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
at "github.com/dcarbone/terraform-plugin-framework-utils/v3/acctest"
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
|
||||
fabeventstream "github.com/microsoft/fabric-sdk-go/fabric/eventstream"
|
||||
|
||||
"github.com/microsoft/terraform-provider-fabric/internal/common"
|
||||
"github.com/microsoft/terraform-provider-fabric/internal/framework/customtypes"
|
||||
@@ -183,6 +184,66 @@ func TestUnit_EventstreamSourceConnectionDataSource(t *testing.T) {
|
||||
}))
|
||||
}
|
||||
|
||||
func TestUnit_EventstreamSourceConnectionDataSource_EndpointTypes(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
entity fabeventstream.EndpointConnectionClassification
|
||||
expectError *regexp.Regexp
|
||||
}{
|
||||
"custom endpoint without access keys": {
|
||||
entity: &fabeventstream.CustomEndpointConnection{
|
||||
Type: new(fabeventstream.EndpointConnectionTypeCustomEndpoint),
|
||||
EventHubName: new("event-hub"),
|
||||
FullyQualifiedNamespace: new("namespace"),
|
||||
},
|
||||
},
|
||||
"kafka endpoint": {
|
||||
entity: &fabeventstream.KafkaEndpointConnection{
|
||||
Type: new(fabeventstream.EndpointConnectionTypeKafkaEndpoint),
|
||||
},
|
||||
expectError: regexp.MustCompile("Unsupported Eventstream source connection type"),
|
||||
},
|
||||
"unknown endpoint": {
|
||||
entity: &fabeventstream.EndpointConnection{
|
||||
Type: new(fabeventstream.EndpointConnectionType("Unknown")),
|
||||
},
|
||||
expectError: regexp.MustCompile("Unsupported Eventstream source connection type"),
|
||||
},
|
||||
"nil endpoint": {
|
||||
expectError: regexp.MustCompile("Unsupported Eventstream source connection type"),
|
||||
},
|
||||
}
|
||||
|
||||
for name, testCase := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
workspaceID := testhelp.RandomUUID()
|
||||
eventstreamID := testhelp.RandomUUID()
|
||||
sourceID := testhelp.RandomUUID()
|
||||
|
||||
fakes.FakeServer.ServerFactory.Eventstream.TopologyServer.GetEventstreamSourceConnection = fakeGetEventstreamSourceConnection(
|
||||
workspaceID, eventstreamID, sourceID, testCase.entity,
|
||||
)
|
||||
|
||||
step := resource.TestStep{
|
||||
Config: at.CompileConfig(testDataSourceItemHeader, map[string]any{
|
||||
"workspace_id": workspaceID,
|
||||
"eventstream_id": eventstreamID,
|
||||
"source_id": sourceID,
|
||||
}),
|
||||
ExpectError: testCase.expectError,
|
||||
}
|
||||
if testCase.expectError == nil {
|
||||
step.Check = resource.ComposeAggregateTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(testDataSourceItemFQN, "event_hub_name", "event-hub"),
|
||||
resource.TestCheckResourceAttr(testDataSourceItemFQN, "fully_qualified_namespace", "namespace"),
|
||||
resource.TestCheckNoResourceAttr(testDataSourceItemFQN, "access_keys"),
|
||||
)
|
||||
}
|
||||
|
||||
resource.Test(t, testhelp.NewTestUnitCase(t, nil, fakes.FakeServer.ServerFactory, nil, []resource.TestStep{step}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAcc_EventstreamSourceConnectionDataSource(t *testing.T) {
|
||||
if testhelp.ShouldSkipTest(t) {
|
||||
t.Skip("Throttling issues which blocks all PR tests in the pipeline")
|
||||
|
||||
+1
-1
@@ -164,5 +164,5 @@ func (e *ephemeralEventstreamSourceConnection) get(ctx context.Context, model *e
|
||||
return diags
|
||||
}
|
||||
|
||||
return model.set(ctx, model.WorkspaceID.ValueString(), model.EventstreamID.ValueString(), model.SourceID.ValueString(), respGet.SourceConnectionResponse)
|
||||
return model.set(ctx, model.WorkspaceID.ValueString(), model.EventstreamID.ValueString(), model.SourceID.ValueString(), respGet.EndpointConnectionClassification)
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
fabcore "github.com/microsoft/fabric-sdk-go/fabric/core"
|
||||
"github.com/microsoft/fabric-sdk-go/fabric/eventstream"
|
||||
fabeventstream "github.com/microsoft/fabric-sdk-go/fabric/eventstream"
|
||||
fabfake "github.com/microsoft/fabric-sdk-go/fabric/fake"
|
||||
|
||||
"github.com/microsoft/terraform-provider-fabric/internal/testhelp"
|
||||
@@ -17,31 +17,34 @@ import (
|
||||
|
||||
func fakeGetEventstreamSourceConnection(
|
||||
fakeWorkspaceID, fakeEventstreamID, fakeSourceID string,
|
||||
entity eventstream.TopologyClientGetEventstreamSourceConnectionResponse,
|
||||
entity fabeventstream.EndpointConnectionClassification,
|
||||
) func(
|
||||
ctx context.Context,
|
||||
workspaceID, eventstreamID, sourceID string,
|
||||
options *eventstream.TopologyClientGetEventstreamSourceConnectionOptions,
|
||||
) (resp azfake.Responder[eventstream.TopologyClientGetEventstreamSourceConnectionResponse], errResp azfake.ErrorResponder) {
|
||||
return func(_ context.Context, workspaceID, eventstreamID, sourceID string, _ *eventstream.TopologyClientGetEventstreamSourceConnectionOptions) (resp azfake.Responder[eventstream.TopologyClientGetEventstreamSourceConnectionResponse], errResp azfake.ErrorResponder) {
|
||||
resp = azfake.Responder[eventstream.TopologyClientGetEventstreamSourceConnectionResponse]{}
|
||||
options *fabeventstream.TopologyClientGetEventstreamSourceConnectionOptions,
|
||||
) (resp azfake.Responder[fabeventstream.TopologyClientGetEventstreamSourceConnectionResponse], errResp azfake.ErrorResponder) {
|
||||
return func(_ context.Context, workspaceID, eventstreamID, sourceID string, _ *fabeventstream.TopologyClientGetEventstreamSourceConnectionOptions) (resp azfake.Responder[fabeventstream.TopologyClientGetEventstreamSourceConnectionResponse], errResp azfake.ErrorResponder) {
|
||||
resp = azfake.Responder[fabeventstream.TopologyClientGetEventstreamSourceConnectionResponse]{}
|
||||
|
||||
if sourceID != fakeSourceID || workspaceID != fakeWorkspaceID || eventstreamID != fakeEventstreamID {
|
||||
resp.SetResponse(http.StatusNotFound, eventstream.TopologyClientGetEventstreamSourceConnectionResponse{}, nil)
|
||||
resp.SetResponse(http.StatusNotFound, fabeventstream.TopologyClientGetEventstreamSourceConnectionResponse{}, nil)
|
||||
errResp.SetError(fabfake.SetResponseError(http.StatusNotFound, fabcore.ErrItem.ItemNotFound.Error(), "Item not found"))
|
||||
} else {
|
||||
resp.SetResponse(http.StatusOK, entity, nil)
|
||||
resp.SetResponse(http.StatusOK, fabeventstream.TopologyClientGetEventstreamSourceConnectionResponse{
|
||||
EndpointConnectionClassification: entity,
|
||||
}, nil)
|
||||
}
|
||||
|
||||
return resp, errResp
|
||||
}
|
||||
}
|
||||
|
||||
func NewRandomEventstreamSourceConnection() eventstream.TopologyClientGetEventstreamSourceConnectionResponse {
|
||||
return eventstream.TopologyClientGetEventstreamSourceConnectionResponse{
|
||||
func NewRandomEventstreamSourceConnection() *fabeventstream.CustomEndpointConnection {
|
||||
return &fabeventstream.CustomEndpointConnection{
|
||||
Type: new(fabeventstream.EndpointConnectionTypeCustomEndpoint),
|
||||
EventHubName: new(testhelp.RandomName()),
|
||||
FullyQualifiedNamespace: new(testhelp.RandomName()),
|
||||
AccessKeys: &eventstream.AccessKeys{
|
||||
AccessKeys: &fabeventstream.AccessKeys{
|
||||
PrimaryConnectionString: new(testhelp.RandomName()),
|
||||
SecondaryConnectionString: new(testhelp.RandomName()),
|
||||
PrimaryKey: new(testhelp.RandomName()),
|
||||
|
||||
@@ -5,6 +5,7 @@ package eventstreamsourceconnection
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
timeoutsD "github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts" //revive:disable-line:import-alias-naming
|
||||
timeoutsE "github.com/hashicorp/terraform-plugin-framework-timeouts/ephemeral/timeouts" //revive:disable-line:import-alias-naming
|
||||
@@ -37,22 +38,35 @@ type baseEventstreamSourceConnectionModel struct {
|
||||
AccessKeys supertypes.SingleNestedObjectValueOf[accessKeysModel] `tfsdk:"access_keys"`
|
||||
}
|
||||
|
||||
func (to *baseEventstreamSourceConnectionModel) set(ctx context.Context, workspaceID, eventstreamID, sourceID string, from fabeventstream.SourceConnectionResponse) diag.Diagnostics {
|
||||
func (to *baseEventstreamSourceConnectionModel) set(ctx context.Context, workspaceID, eventstreamID, sourceID string, from fabeventstream.EndpointConnectionClassification) diag.Diagnostics {
|
||||
to.SourceID = customtypes.NewUUIDValue(sourceID)
|
||||
to.EventstreamID = customtypes.NewUUIDValue(eventstreamID)
|
||||
to.WorkspaceID = customtypes.NewUUIDValue(workspaceID)
|
||||
to.EventHubName = types.StringPointerValue(from.EventHubName)
|
||||
to.FullyQualifiedNamespace = types.StringPointerValue(from.FullyQualifiedNamespace)
|
||||
|
||||
accessKeys := supertypes.NewSingleNestedObjectValueOfNull[accessKeysModel](ctx)
|
||||
|
||||
if from.AccessKeys != nil {
|
||||
accessKeysModel := &accessKeysModel{}
|
||||
accessKeysModel.set(*from.AccessKeys)
|
||||
switch entity := from.(type) {
|
||||
case *fabeventstream.CustomEndpointConnection:
|
||||
to.EventHubName = types.StringPointerValue(entity.EventHubName)
|
||||
to.FullyQualifiedNamespace = types.StringPointerValue(entity.FullyQualifiedNamespace)
|
||||
|
||||
if diags := accessKeys.Set(ctx, accessKeysModel); diags.HasError() {
|
||||
return diags
|
||||
if entity.AccessKeys != nil {
|
||||
accessKeysModel := &accessKeysModel{}
|
||||
accessKeysModel.set(*entity.AccessKeys)
|
||||
|
||||
if diags := accessKeys.Set(ctx, accessKeysModel); diags.HasError() {
|
||||
return diags
|
||||
}
|
||||
}
|
||||
default:
|
||||
var diags diag.Diagnostics
|
||||
|
||||
diags.AddError(
|
||||
"Unsupported Eventstream source connection type",
|
||||
fmt.Sprintf("The Eventstream source connection type '%T' is not supported.", entity),
|
||||
)
|
||||
|
||||
return diags
|
||||
}
|
||||
|
||||
to.AccessKeys = accessKeys
|
||||
|
||||
@@ -113,7 +113,13 @@ func newTestUnitCase(t *testing.T, testResource *string, fakeServer *fabfake.Ser
|
||||
func GetTestUnitProtoV6ProviderFactories(fabricClientOpts *fabric.ClientOptions, testState *TestState) map[string]func() (tfprotov6.ProviderServer, error) {
|
||||
prov := provider.New("testUnit")
|
||||
prov.ConfigureCreateClient(func(ctx context.Context, cfg *pconfig.ProviderConfig) (*fabric.Client, error) {
|
||||
client, err := fabric.NewClient(&azfake.TokenCredential{}, &cfg.Endpoint, fabricClientOpts)
|
||||
// The SDK mutates client options, so each provider configuration needs its own copy.
|
||||
var clientOptions fabric.ClientOptions
|
||||
if fabricClientOpts != nil {
|
||||
clientOptions = *fabricClientOpts
|
||||
}
|
||||
|
||||
client, err := fabric.NewClient(&azfake.TokenCredential{}, &cfg.Endpoint, &clientOptions)
|
||||
if err != nil {
|
||||
tflog.Error(ctx, "Failed to initialize Microsoft Fabric test client", map[string]any{"error": err})
|
||||
|
||||
|
||||
Reference in new issue
Block a user