Update projects data source schema to use an extended attributes definition

This commit is contained in:
Julien Dessaux 2023-06-24 14:39:13 +02:00
parent 21b3a6e587
commit 575c4ed228
Signed by: adyxax
GPG key ID: F92E51B86E07177E
3 changed files with 24 additions and 14 deletions

View file

@ -1,3 +1,8 @@
## 0.0.3 - 2023-06-24
### Notes
* Update projects data source schema to use an extended attributes definition
## 0.0.2 - 2023-06-19 ## 0.0.2 - 2023-06-19
### Notes ### Notes

View file

@ -3,12 +3,12 @@
page_title: "eventline_projects Data Source - terraform-provider-eventline" page_title: "eventline_projects Data Source - terraform-provider-eventline"
subcategory: "" subcategory: ""
description: |- description: |-
Eventline projects data source Use this data source to retrieve information about existing eventline projects.
--- ---
# eventline_projects (Data Source) # eventline_projects (Data Source)
Eventline projects data source Use this data source to retrieve information about existing eventline projects.
## Example Usage ## Example Usage
@ -22,12 +22,12 @@ data "projects" "example" {
### Read-Only ### Read-Only
- `elements` (List of Object) Projects list (see [below for nested schema](#nestedatt--elements)) - `elements` (Attributes List) The list of projects. (see [below for nested schema](#nestedatt--elements))
<a id="nestedatt--elements"></a> <a id="nestedatt--elements"></a>
### Nested Schema for `elements` ### Nested Schema for `elements`
Read-Only: Read-Only:
- `id` (String) - `id` (String) The identifier of the project.
- `name` (String) - `name` (String) The name of the project.

View file

@ -5,7 +5,6 @@ import (
"fmt" "fmt"
"git.adyxax.org/adyxax/terraform-provider-eventline/external/evcli" "git.adyxax.org/adyxax/terraform-provider-eventline/external/evcli"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
@ -35,18 +34,24 @@ func (d *ProjectsDataSource) Metadata(ctx context.Context, req datasource.Metada
func (d *ProjectsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { func (d *ProjectsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = schema.Schema{ resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{ Attributes: map[string]schema.Attribute{
"elements": schema.ListAttribute{ "elements": schema.ListNestedAttribute{
Computed: true, Computed: true,
ElementType: types.ObjectType{ MarkdownDescription: "The list of projects.",
AttrTypes: map[string]attr.Type{ NestedObject: schema.NestedAttributeObject{
"id": types.StringType, Attributes: map[string]schema.Attribute{
"name": types.StringType, "id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The identifier of the project.",
},
"name": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The name of the project.",
},
}, },
}, },
MarkdownDescription: "Projects list",
}, },
}, },
MarkdownDescription: "Eventline projects data source", MarkdownDescription: "Use this data source to retrieve information about existing eventline projects.",
} }
} }