Skip to content

Commit 7e343ea

Browse files
committed
adding description to schema fields
1 parent 4a18d91 commit 7e343ea

File tree

3 files changed

+76
-39
lines changed

3 files changed

+76
-39
lines changed

cloudstack/service_offering_constrained_resource.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,36 @@ func (r *serviceOfferingConstrainedResource) Schema(_ context.Context, _ resourc
3030
resp.Schema = schema.Schema{
3131
Attributes: serviceOfferingMergeCommonSchema(map[string]schema.Attribute{
3232
"cpu_speed": schema.Int32Attribute{
33-
Required: true,
33+
Description: "Speed of CPU in Mhz. This does not apply to kvm.",
34+
Required: true,
3435
PlanModifiers: []planmodifier.Int32{
3536
int32planmodifier.RequiresReplace(),
3637
},
3738
},
3839
"max_cpu_number": schema.Int32Attribute{
39-
Required: true,
40+
Description: "The maximum number of CPUs to be set with Custom Computer Offering",
41+
Required: true,
4042
PlanModifiers: []planmodifier.Int32{
4143
int32planmodifier.RequiresReplace(),
4244
},
4345
},
4446
"max_memory": schema.Int32Attribute{
45-
Required: true,
47+
Description: "The maximum memory size of the custom service offering in MB",
48+
Required: true,
4649
PlanModifiers: []planmodifier.Int32{
4750
int32planmodifier.RequiresReplace(),
4851
},
4952
},
5053
"min_cpu_number": schema.Int32Attribute{
51-
Required: true,
54+
Description: "The minimum number of CPUs to be set with Custom Computer Offering",
55+
Required: true,
5256
PlanModifiers: []planmodifier.Int32{
5357
int32planmodifier.RequiresReplace(),
5458
},
5559
},
5660
"min_memory": schema.Int32Attribute{
57-
Required: true,
61+
Description: "The minimum memory size of the custom service offering in MB",
62+
Required: true,
5863
PlanModifiers: []planmodifier.Int32{
5964
int32planmodifier.RequiresReplace(),
6065
},

cloudstack/service_offering_fixed_resource.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,22 @@ func (r *serviceOfferingFixedResource) Schema(_ context.Context, _ resource.Sche
3030
resp.Schema = schema.Schema{
3131
Attributes: serviceOfferingMergeCommonSchema(map[string]schema.Attribute{
3232
"cpu_number": schema.Int32Attribute{
33-
Required: true,
33+
Description: "Number of CPU cores",
34+
Required: true,
3435
PlanModifiers: []planmodifier.Int32{
3536
int32planmodifier.RequiresReplace(),
3637
},
3738
},
3839
"cpu_speed": schema.Int32Attribute{
39-
Required: true,
40+
Description: "the CPU speed of the service offering in MHz. This does not apply to KVM.",
41+
Required: true,
4042
PlanModifiers: []planmodifier.Int32{
4143
int32planmodifier.RequiresReplace(),
4244
},
4345
},
4446
"memory": schema.Int32Attribute{
45-
Required: true,
47+
Description: "the total memory of the service offering in MB",
48+
Required: true,
4649
PlanModifiers: []planmodifier.Int32{
4750
int32planmodifier.RequiresReplace(),
4851
},

cloudstack/service_offering_schema.go

Lines changed: 60 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,107 +14,127 @@ import (
1414
func serviceOfferingMergeCommonSchema(s1 map[string]schema.Attribute) map[string]schema.Attribute {
1515
common := map[string]schema.Attribute{
1616
"deployment_planner": schema.StringAttribute{
17-
Optional: true,
17+
Description: "The deployment planner for the service offering",
18+
Optional: true,
1819
},
1920
"disk_offering_id": schema.StringAttribute{
20-
Optional: true,
21+
Description: "The ID of the disk offering",
22+
Optional: true,
2123
},
2224
"display_text": schema.StringAttribute{
23-
Required: true,
25+
Description: "The display text of the service offering",
26+
Required: true,
2427
},
2528
"domain_ids": schema.SetAttribute{
29+
Description: "the ID of the containing domain(s), null for public offerings",
2630
Optional: true,
2731
ElementType: types.StringType,
2832
},
2933
"dynamic_scaling_enabled": schema.BoolAttribute{
30-
Optional: true,
31-
Computed: true,
34+
Description: "Enable dynamic scaling of the service offering",
35+
Optional: true,
36+
Computed: true,
3237
PlanModifiers: []planmodifier.Bool{
3338
boolplanmodifier.RequiresReplace(),
3439
},
3540
Default: booldefault.StaticBool(false),
3641
},
3742
"host_tags": schema.StringAttribute{
38-
Optional: true,
43+
Description: "The host tag for this service offering",
44+
Optional: true,
3945
},
4046
"id": schema.StringAttribute{
41-
Computed: true,
47+
Description: "uuid of service offering",
48+
Computed: true,
4249
PlanModifiers: []planmodifier.String{
4350
stringplanmodifier.UseStateForUnknown(),
4451
},
4552
},
4653
"is_volatile": schema.BoolAttribute{
47-
Optional: true,
48-
Computed: true,
54+
Description: "Service offering is volatile",
55+
Optional: true,
56+
Computed: true,
4957
PlanModifiers: []planmodifier.Bool{
5058
boolplanmodifier.RequiresReplace(),
5159
},
5260
Default: booldefault.StaticBool(false),
5361
},
5462
"limit_cpu_use": schema.BoolAttribute{
55-
Optional: true,
56-
Computed: true,
63+
Description: "Restrict the CPU usage to committed service offering",
64+
Optional: true,
65+
Computed: true,
5766
PlanModifiers: []planmodifier.Bool{
5867
boolplanmodifier.RequiresReplace(),
5968
},
6069
Default: booldefault.StaticBool(false),
6170
},
6271
"name": schema.StringAttribute{
63-
Required: true,
72+
Description: "The name of the service offering",
73+
Required: true,
6474
},
6575
"network_rate": schema.Int32Attribute{
66-
Optional: true,
76+
Description: "Data transfer rate in megabits per second",
77+
Optional: true,
6778
},
6879
"offer_ha": schema.BoolAttribute{
69-
Optional: true,
70-
Computed: true,
80+
Description: "The HA for the service offering",
81+
Optional: true,
82+
Computed: true,
7183
PlanModifiers: []planmodifier.Bool{
7284
boolplanmodifier.RequiresReplace(),
7385
},
7486
Default: booldefault.StaticBool(false),
7587
},
7688
"storage_tags": schema.StringAttribute{
77-
Optional: true,
89+
Description: "the tags for the service offering",
90+
Optional: true,
7891
},
7992
"zone_ids": schema.SetAttribute{
93+
Description: "The ID of the zone(s)",
8094
Optional: true,
8195
ElementType: types.StringType,
8296
},
8397
"disk_hypervisor": schema.SingleNestedAttribute{
8498
Optional: true,
8599
Attributes: map[string]schema.Attribute{
86100
"bytes_read_rate": schema.Int64Attribute{
87-
Required: true,
101+
Description: "io requests read rate of the disk offering",
102+
Required: true,
88103
PlanModifiers: []planmodifier.Int64{
89104
int64planmodifier.RequiresReplace(),
90105
},
91106
},
92107
"bytes_read_rate_max": schema.Int64Attribute{
93-
Required: true,
108+
Description: "burst requests read rate of the disk offering",
109+
Required: true,
94110
PlanModifiers: []planmodifier.Int64{
95111
int64planmodifier.RequiresReplace(),
96112
},
97113
},
98114
"bytes_read_rate_max_length": schema.Int64Attribute{
99-
Required: true,
115+
Description: "length (in seconds) of the burst",
116+
Required: true,
100117
PlanModifiers: []planmodifier.Int64{
101118
int64planmodifier.RequiresReplace(),
102119
},
103120
},
104121
"bytes_write_rate": schema.Int64Attribute{
105-
Required: true,
122+
Description: "io requests write rate of the disk offering",
123+
Required: true,
106124
PlanModifiers: []planmodifier.Int64{
107125
int64planmodifier.RequiresReplace(),
108126
},
109127
},
110128
"bytes_write_rate_max": schema.Int64Attribute{
111-
Required: true,
129+
Description: "burst io requests write rate of the disk offering",
130+
Required: true,
112131
PlanModifiers: []planmodifier.Int64{
113132
int64planmodifier.RequiresReplace(),
114133
},
115134
},
116135
"bytes_write_rate_max_length": schema.Int64Attribute{
117-
Required: true,
136+
Description: "length (in seconds) of the burst",
137+
Required: true,
118138
PlanModifiers: []planmodifier.Int64{
119139
int64planmodifier.RequiresReplace(),
120140
},
@@ -125,31 +145,36 @@ func serviceOfferingMergeCommonSchema(s1 map[string]schema.Attribute) map[string
125145
Optional: true,
126146
Attributes: map[string]schema.Attribute{
127147
"cache_mode": schema.StringAttribute{
128-
Required: true,
148+
Description: "the cache mode to use for this disk offering. none, writeback or writethrough",
149+
Required: true,
129150
PlanModifiers: []planmodifier.String{
130151
stringplanmodifier.RequiresReplace(),
131152
},
132153
},
133154
"disk_offering_strictness": schema.BoolAttribute{
134-
Required: true,
155+
Description: "True/False to indicate the strictness of the disk offering association with the compute offering. When set to true, override of disk offering is not allowed when VM is deployed and change disk offering is not allowed for the ROOT disk after the VM is deployed",
156+
Required: true,
135157
PlanModifiers: []planmodifier.Bool{
136158
boolplanmodifier.RequiresReplace(),
137159
},
138160
},
139161
"provisioning_type": schema.StringAttribute{
140-
Required: true,
162+
Description: "provisioning type used to create volumes. Valid values are thin, sparse, fat.",
163+
Required: true,
141164
PlanModifiers: []planmodifier.String{
142165
stringplanmodifier.RequiresReplace(),
143166
},
144167
},
145168
"root_disk_size": schema.Int64Attribute{
146-
Required: true,
169+
Description: "the Root disk size in GB.",
170+
Required: true,
147171
PlanModifiers: []planmodifier.Int64{
148172
int64planmodifier.RequiresReplace(),
149173
},
150174
},
151175
"storage_type": schema.StringAttribute{
152-
Required: true,
176+
Description: "the storage type of the service offering. Values are local and shared.",
177+
Required: true,
153178
PlanModifiers: []planmodifier.String{
154179
stringplanmodifier.RequiresReplace(),
155180
},
@@ -160,25 +185,29 @@ func serviceOfferingMergeCommonSchema(s1 map[string]schema.Attribute) map[string
160185
Optional: true,
161186
Attributes: map[string]schema.Attribute{
162187
"customized_iops": schema.BoolAttribute{
163-
Optional: true,
188+
Description: "true if disk offering uses custom iops, false otherwise",
189+
Optional: true,
164190
PlanModifiers: []planmodifier.Bool{
165191
boolplanmodifier.RequiresReplace(),
166192
},
167193
},
168194
"hypervisor_snapshot_reserve": schema.Int32Attribute{
169-
Optional: true,
195+
Description: "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)",
196+
Optional: true,
170197
PlanModifiers: []planmodifier.Int32{
171198
int32planmodifier.RequiresReplace(),
172199
},
173200
},
174201
"max_iops": schema.Int64Attribute{
175-
Optional: true,
202+
Description: "max iops of the compute offering",
203+
Optional: true,
176204
PlanModifiers: []planmodifier.Int64{
177205
int64planmodifier.RequiresReplace(),
178206
},
179207
},
180208
"min_iops": schema.Int64Attribute{
181-
Optional: true,
209+
Description: "min iops of the compute offering",
210+
Optional: true,
182211
PlanModifiers: []planmodifier.Int64{
183212
int64planmodifier.RequiresReplace(),
184213
},

0 commit comments

Comments
 (0)