/
framework_datasource_schema.go
48 lines (45 loc) · 1.57 KB
/
framework_datasource_schema.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
39
40
41
42
43
44
45
46
47
48
package ipv6ranges
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/linode/terraform-provider-linode/v2/linode/helper/frameworkfilter"
)
var filterConfig = frameworkfilter.Config{
"route_target": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString},
"region": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString},
"range": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString},
"prefix": {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,
},
},
Blocks: map[string]schema.Block{
"filter": filterConfig.Schema(),
"ranges": schema.ListNestedBlock{
Description: "The return list of IPv6 ranges.",
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
"range": schema.StringAttribute{
Description: "The IPv6 address of this range.",
Computed: true,
},
"route_target": schema.StringAttribute{
Description: "The IPv6 SLAAC address.",
Computed: true,
},
"prefix": schema.Int64Attribute{
Description: "The prefix length of the address, denoting how many addresses can be assigned from this range.",
Computed: true,
},
"region": schema.StringAttribute{
Description: "The region for this range of IPv6 addresses.",
Computed: true,
},
},
},
},
},
}