/
framework_schema_datasource.go
38 lines (34 loc) · 1.39 KB
/
framework_schema_datasource.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package nbs
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/linode/terraform-provider-linode/v2/linode/helper/frameworkfilter"
"github.com/linode/terraform-provider-linode/v2/linode/nb"
)
var filterConfig = frameworkfilter.Config{
"label": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString},
"tags": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString},
"ipv4": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString},
"region": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString},
"hostname": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString},
"ipv6": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString},
"client_conn_throttle": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeInt},
}
var frameworkDatasourceSchema = schema.Schema{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "The data source's unique ID.",
Computed: true,
},
"order": filterConfig.OrderSchema(),
"order_by": filterConfig.OrderBySchema(),
},
Blocks: map[string]schema.Block{
"filter": filterConfig.Schema(),
"nodebalancers": schema.ListNestedBlock{
Description: "The returned list of NodeBalancers.",
NestedObject: schema.NestedBlockObject{
Attributes: nb.NodeBalancerAttributes,
},
},
},
}