/
vdc_group_schema.go
106 lines (100 loc) · 3.48 KB
/
vdc_group_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
package vdc
import (
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
schemaD "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
schemaR "github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
superschema "github.com/FrangipaneTeam/terraform-plugin-framework-superschema"
supertypes "github.com/FrangipaneTeam/terraform-plugin-framework-supertypes"
)
func groupSchema() superschema.Schema {
return superschema.Schema{
Resource: superschema.SchemaDetails{
MarkdownDescription: "The `cloudavenue_vdc_group` resource allows you to manage VDC Group.",
},
DataSource: superschema.SchemaDetails{
MarkdownDescription: "The `cloudavenue_vdc_group` data source allows you to retrieve informations about an existing VDC Group.",
},
Attributes: map[string]superschema.Attribute{
"id": superschema.SuperStringAttribute{
Common: &schemaR.StringAttribute{
Computed: true,
MarkdownDescription: "The ID of the VDC Group.",
},
Resource: &schemaR.StringAttribute{
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
DataSource: &schemaD.StringAttribute{
Optional: true,
Validators: []validator.String{
stringvalidator.ExactlyOneOf(path.MatchRoot("name"), path.MatchRoot("id")),
},
},
},
"name": superschema.SuperStringAttribute{
Common: &schemaR.StringAttribute{
MarkdownDescription: "The name of the VDC Group.",
},
Resource: &schemaR.StringAttribute{
Required: true,
},
DataSource: &schemaD.StringAttribute{
Optional: true,
Validators: []validator.String{
stringvalidator.ExactlyOneOf(path.MatchRoot("name"), path.MatchRoot("id")),
},
},
},
"description": superschema.SuperStringAttribute{
Common: &schemaR.StringAttribute{
MarkdownDescription: "The description of the VDC Group.",
},
Resource: &schemaR.StringAttribute{
Optional: true,
},
DataSource: &schemaD.StringAttribute{
Computed: true,
},
},
"vdc_ids": superschema.SuperSetAttribute{
Common: &schemaR.SetAttribute{
MarkdownDescription: "The list of VDC IDs of the VDC Group.",
ElementType: supertypes.StringType{},
},
Resource: &schemaR.SetAttribute{
Required: true,
Validators: []validator.Set{
setvalidator.SizeAtLeast(1),
},
},
DataSource: &schemaD.SetAttribute{
Computed: true,
},
},
"status": superschema.SuperStringAttribute{
Common: &schemaR.StringAttribute{
MarkdownDescription: "The status of the VDC Group.",
Computed: true,
Validators: []validator.String{
stringvalidator.OneOf("SAVING", "SAVED", "CONFIGURING", "REALIZED", "REALIZATION_FAILED", "DELETING", "DELETE_FAILED", "OBJECT_NOT_FOUND", "UNCONFIGURED"),
},
},
},
"type": superschema.SuperStringAttribute{
Common: &schemaR.StringAttribute{
MarkdownDescription: "The type of the VDC Group.",
Computed: true,
Validators: []validator.String{
stringvalidator.OneOf("LOCAL", "UNIVERSAL"),
},
},
},
},
}
}