-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.go
109 lines (106 loc) · 3.27 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package nfs
import (
"github.com/awlsring/terraform-provider-proxmox/proxmox/storage-class"
ds "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
rs "github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
var dataSourceSchema = ds.Schema{
Attributes: map[string]ds.Attribute{
"filters": filter.Schema(),
"nfs_storage_classes": ds.ListNestedAttribute{
Computed: true,
NestedObject: ds.NestedAttributeObject{
Attributes: map[string]ds.Attribute{
"id": ds.StringAttribute{
Computed: true,
Description: "The identifier of the storage class.",
},
"server": ds.StringAttribute{
Computed: true,
Description: "The NFS server used in the storage class.",
},
"nodes": ds.ListAttribute{
Computed: true,
ElementType: types.StringType,
Description: "Nodes that implement this storage class.",
},
"content_types": ds.ListAttribute{
Computed: true,
ElementType: types.StringType,
Description: "The content types that can be stored on this storage class.",
},
"mount": ds.StringAttribute{
Computed: true,
Description: "The local mount of the NFS share that should be implemented by each node.",
},
"export": ds.StringAttribute{
Computed: true,
Description: "The remote export path of the NFS server.",
},
},
},
},
},
}
var resourceSchema = rs.Schema{
Attributes: map[string]rs.Attribute{
"id": rs.StringAttribute{
Required: true,
Description: "The identifier of the storage class.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
},
"server": rs.StringAttribute{
Required: true,
Description: "The NFS server used in the storage class.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
},
"nodes": rs.ListAttribute{
Optional: true,
Computed: true,
ElementType: types.StringType,
Description: "Nodes that implement this storage class.",
PlanModifiers: []planmodifier.List{
listplanmodifier.UseStateForUnknown(),
},
},
"content_types": rs.ListAttribute{
Optional: true,
Computed: true,
ElementType: types.StringType,
Description: "The content types that can be stored on this storage class.",
PlanModifiers: []planmodifier.List{
listplanmodifier.UseStateForUnknown(),
},
Validators: storage.ContentTypeValidator(
"images",
"rootdir",
"vztmpl",
"backup",
"iso",
"snippets",
),
},
"mount": rs.StringAttribute{
Computed: true,
Description: "The local mount of the NFS share that should be implemented by each node.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"export": rs.StringAttribute{
Required: true,
Description: "The remote export path of the NFS server.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
},
},
}