-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(graphql_api): onboard new resource/data-source (#257)
# 📥 Pull Request close #197 ## ❓ What are you trying to address - Add new resource `fabric_graphql_api` - Add new data-source `fabric_graphql_api` - Add new data-source `fabric_graphql_apis`
- Loading branch information
1 parent
35c5a79
commit 2bad4da
Showing
24 changed files
with
959 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kind: added | ||
body: Onboard new resource/data-source `fabric_graphql_api`. | ||
time: 2025-02-14T16:15:20.6202369+01:00 | ||
custom: | ||
Issue: "197" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "fabric_graphql_api Data Source - terraform-provider-fabric" | ||
subcategory: "" | ||
description: |- | ||
Get a Fabric GraphQL API. | ||
Use this data source to fetch a GraphQL API https://learn.microsoft.com/fabric/data-engineering/api-graphql-overview. | ||
-> This item supports Service Principal authentication. | ||
~> This data-source is in preview. To access it, you must explicitly enable the preview mode in the provider level configuration. | ||
--- | ||
|
||
# fabric_graphql_api (Data Source) | ||
|
||
Get a Fabric GraphQL API. | ||
|
||
Use this data source to fetch a [GraphQL API](https://learn.microsoft.com/fabric/data-engineering/api-graphql-overview). | ||
|
||
-> This item supports Service Principal authentication. | ||
|
||
~> This data-source is in **preview**. To access it, you must explicitly enable the `preview` mode in the provider level configuration. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "fabric_graphql_api" "example_by_id" { | ||
id = "11111111-1111-1111-1111-111111111111" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
data "fabric_graphql_api" "example_by_name" { | ||
display_name = "example" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
# This is an invalid data source | ||
# Do not specify `id` and `display_name` in the same data source block | ||
# data "fabric_graphql_api" "example" { | ||
# display_name = "example" | ||
# id = "11111111-1111-1111-1111-111111111111" | ||
# workspace_id = "00000000-0000-0000-0000-000000000000" | ||
# } | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `workspace_id` (String) The Workspace ID. | ||
|
||
### Optional | ||
|
||
- `display_name` (String) The GraphQL API display name. | ||
- `id` (String) The GraphQL API ID. | ||
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `description` (String) The GraphQL API description. | ||
|
||
<a id="nestedatt--timeouts"></a> | ||
|
||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "fabric_graphql_apis Data Source - terraform-provider-fabric" | ||
subcategory: "" | ||
description: |- | ||
List a Fabric GraphQL APIs. | ||
Use this data source to list GraphQL APIs https://learn.microsoft.com/fabric/data-engineering/api-graphql-overview. | ||
-> This item supports Service Principal authentication. | ||
--- | ||
|
||
# fabric_graphql_apis (Data Source) | ||
|
||
List a Fabric GraphQL APIs. | ||
|
||
Use this data source to list [GraphQL APIs](https://learn.microsoft.com/fabric/data-engineering/api-graphql-overview). | ||
|
||
-> This item supports Service Principal authentication. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "fabric_graphql_apis" "example" { | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `workspace_id` (String) The Workspace ID. | ||
|
||
### Optional | ||
|
||
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `values` (Attributes List) The list of GraphQL APIs. (see [below for nested schema](#nestedatt--values)) | ||
|
||
<a id="nestedatt--timeouts"></a> | ||
|
||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). | ||
|
||
<a id="nestedatt--values"></a> | ||
|
||
### Nested Schema for `values` | ||
|
||
Read-Only: | ||
|
||
- `description` (String) The GraphQL API description. | ||
- `display_name` (String) The GraphQL API display name. | ||
- `id` (String) The GraphQL API ID. | ||
- `workspace_id` (String) The Workspace ID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "fabric_graphql_api Resource - terraform-provider-fabric" | ||
subcategory: "" | ||
description: |- | ||
Manage a Fabric GraphQL API. | ||
Use this resource to manage GraphQL API https://learn.microsoft.com/fabric/data-engineering/api-graphql-overview. | ||
-> This item supports Service Principal authentication. | ||
~> This resource is in preview. To access it, you must explicitly enable the preview mode in the provider level configuration. | ||
--- | ||
|
||
# fabric_graphql_api (Resource) | ||
|
||
Manage a Fabric GraphQL API. | ||
|
||
Use this resource to manage [GraphQL API](https://learn.microsoft.com/fabric/data-engineering/api-graphql-overview). | ||
|
||
-> This item supports Service Principal authentication. | ||
|
||
~> This resource is in **preview**. To access it, you must explicitly enable the `preview` mode in the provider level configuration. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "fabric_graphql_api" "example" { | ||
display_name = "example" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `display_name` (String) The GraphQL API display name. | ||
- `workspace_id` (String) The Workspace ID. | ||
|
||
### Optional | ||
|
||
- `description` (String) The GraphQL API description. | ||
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The GraphQL API ID. | ||
|
||
<a id="nestedatt--timeouts"></a> | ||
|
||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). | ||
- `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs. | ||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled. | ||
- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# terraform import fabric_graphql_api.example "<WorkspaceID>/<GraphQLApiID>" | ||
terraform import fabric_graphql_api.example "00000000-0000-0000-0000-000000000000/11111111-1111-1111-1111-111111111111" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
data "fabric_graphql_api" "example_by_id" { | ||
id = "11111111-1111-1111-1111-111111111111" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
|
||
data "fabric_graphql_api" "example_by_name" { | ||
display_name = "example" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
|
||
# This is an invalid data source | ||
# Do not specify `id` and `display_name` in the same data source block | ||
# data "fabric_graphql_api" "example" { | ||
# display_name = "example" | ||
# id = "11111111-1111-1111-1111-111111111111" | ||
# workspace_id = "00000000-0000-0000-0000-000000000000" | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "example_by_id" { | ||
value = data.fabric_graphql_api.example_by_id | ||
} | ||
|
||
output "example_by_name" { | ||
value = data.fabric_graphql_api.example_by_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
terraform { | ||
required_version = ">= 1.8, < 2.0" | ||
required_providers { | ||
fabric = { | ||
source = "microsoft/fabric" | ||
version = "0.0.0" # Check for the latest version on the Terraform Registry | ||
} | ||
} | ||
} | ||
|
||
provider "fabric" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "fabric_graphql_apis" "example" { | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "example" { | ||
value = data.fabric_graphql_apis.example | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
terraform { | ||
required_version = ">= 1.8, < 2.0" | ||
required_providers { | ||
fabric = { | ||
source = "microsoft/fabric" | ||
version = "0.0.0" # Check for the latest version on the Terraform Registry | ||
} | ||
} | ||
} | ||
|
||
provider "fabric" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# terraform import fabric_graphql_api.example "<WorkspaceID>/<GraphQLApiID>" | ||
terraform import fabric_graphql_api.example "00000000-0000-0000-0000-000000000000/11111111-1111-1111-1111-111111111111" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "example" { | ||
value = resource.fabric_graphql_api.example | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
terraform { | ||
required_version = ">= 1.8, < 2.0" | ||
required_providers { | ||
fabric = { | ||
source = "microsoft/fabric" | ||
version = "0.0.0" # Check for the latest version on the Terraform Registry | ||
} | ||
} | ||
} | ||
|
||
provider "fabric" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resource "fabric_graphql_api" "example" { | ||
display_name = "example" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package graphqlapi | ||
|
||
import ( | ||
fabcore "github.com/microsoft/fabric-sdk-go/fabric/core" | ||
|
||
"github.com/microsoft/terraform-provider-fabric/internal/common" | ||
) | ||
|
||
const ( | ||
ItemName = "GraphQL API" | ||
ItemTFName = "graphql_api" | ||
ItemsName = "GraphQL APIs" | ||
ItemsTFName = "graphql_apis" | ||
ItemType = fabcore.ItemTypeGraphQLAPI | ||
ItemDocsSPNSupport = common.DocsSPNSupported | ||
ItemDocsURL = "https://learn.microsoft.com/fabric/data-engineering/api-graphql-overview" | ||
ItemPreview = true | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package graphqlapi_test | ||
|
||
import ( | ||
"github.com/microsoft/terraform-provider-fabric/internal/services/graphqlapi" | ||
) | ||
|
||
const ( | ||
itemTFName = graphqlapi.ItemTFName | ||
itemsTFName = graphqlapi.ItemsTFName | ||
itemType = graphqlapi.ItemType | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package graphqlapi | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-framework/datasource" | ||
|
||
"github.com/microsoft/terraform-provider-fabric/internal/pkg/fabricitem" | ||
) | ||
|
||
func NewDataSourceGraphQLApi() datasource.DataSource { | ||
config := fabricitem.DataSourceFabricItem{ | ||
Type: ItemType, | ||
Name: ItemName, | ||
TFName: ItemTFName, | ||
MarkdownDescription: "Get a Fabric " + ItemName + ".\n\n" + | ||
"Use this data source to fetch a [" + ItemName + "](" + ItemDocsURL + ").\n\n" + | ||
ItemDocsSPNSupport, | ||
IsDisplayNameUnique: true, | ||
IsPreview: ItemPreview, | ||
} | ||
|
||
return fabricitem.NewDataSourceFabricItem(config) | ||
} |
Oops, something went wrong.