Skip to content

Commit 2d54c11

Browse files
authored
chore: add godoc comments (#68)
Adds Go Doc comments for resources and data source functions. Signed-off-by: Ryan Johnson <[email protected]>
1 parent 8de80b1 commit 2d54c11

13 files changed

+65
-3
lines changed

data_source_compute_profile.go

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/vmware/terraform-provider-hcx/hcx"
1313
)
1414

15+
// dataSourceComputeProfile defines the data source schema to retrieve information about a compute profile.
1516
func dataSourceComputeProfile() *schema.Resource {
1617
return &schema.Resource{
1718
ReadContext: dataSourceComputeProfileRead,
@@ -31,6 +32,7 @@ func dataSourceComputeProfile() *schema.Resource {
3132
}
3233
}
3334

35+
// dataSourceComputeProfileRead retrieves the compute profile configuration.
3436
func dataSourceComputeProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
3537
var diags diag.Diagnostics
3638

data_source_network_backing.go

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/vmware/terraform-provider-hcx/hcx"
1313
)
1414

15+
// dataSourceNetworkBacking defines a data source schema to retrieve information about a network backing.
1516
func dataSourceNetworkBacking() *schema.Resource {
1617
return &schema.Resource{
1718
ReadContext: dataSourceNetworkBackingRead,
@@ -42,6 +43,7 @@ func dataSourceNetworkBacking() *schema.Resource {
4243
}
4344
}
4445

46+
// dataSourceNetworkBackingRead retrieves the network backing configuration.
4547
func dataSourceNetworkBackingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
4648
var diags diag.Diagnostics
4749

resource_activation.go

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/vmware/terraform-provider-hcx/hcx"
1313
)
1414

15+
// resourceActivation defines the resource schema for managing activation configurations.
1516
func resourceActivation() *schema.Resource {
1617
return &schema.Resource{
1718
CreateContext: resourceActivationCreate,
@@ -35,6 +36,7 @@ func resourceActivation() *schema.Resource {
3536
}
3637
}
3738

39+
// resourceActivationCreate creates the activation configuration resource.
3840
func resourceActivationCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
3941

4042
client := m.(*hcx.Client)
@@ -77,6 +79,7 @@ func resourceActivationCreate(ctx context.Context, d *schema.ResourceData, m int
7779
return resourceActivationRead(ctx, d, m)
7880
}
7981

82+
// resourceActivationRead retrieves the activation configuration and sets the resource ID in the schema.
8083
func resourceActivationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
8184
var diags diag.Diagnostics
8285

@@ -92,11 +95,13 @@ func resourceActivationRead(ctx context.Context, d *schema.ResourceData, m inter
9295
return diags
9396
}
9497

98+
// resourceActivationUpdate updates the activation configuration by invoking the read operation to refresh its state.
9599
func resourceActivationUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
96100

97101
return resourceActivationRead(ctx, d, m)
98102
}
99103

104+
// resourceActivationDelete removes the activation configuration and clears the state of the resource in the schema.
100105
func resourceActivationDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
101106
var diags diag.Diagnostics
102107

resource_compute_profile.go

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/vmware/terraform-provider-hcx/hcx"
1717
)
1818

19+
// resourceComputeProfile defines the resource schema for managing compute profile configuration.
1920
func resourceComputeProfile() *schema.Resource {
2021
return &schema.Resource{
2122
CreateContext: resourceComputeProfileCreate,
@@ -90,6 +91,7 @@ func resourceComputeProfile() *schema.Resource {
9091
}
9192
}
9293

94+
// resourceComputeProfileCreate creates the compute profile configuration.
9395
func resourceComputeProfileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
9496

9597
client := m.(*hcx.Client)
@@ -332,17 +334,21 @@ func resourceComputeProfileCreate(ctx context.Context, d *schema.ResourceData, m
332334

333335
}
334336

337+
// resourceComputeProfileRead retrieves the compute profile configuration.
335338
func resourceComputeProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
336339
var diags diag.Diagnostics
337340

338341
return diags
339342
}
340343

344+
// resourceComputeProfileUpdate updates the compute profile configuration.
341345
func resourceComputeProfileUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
342346

343347
return resourceComputeProfileRead(ctx, d, m)
344348
}
345349

350+
// resourceComputeProfileDelete removes the compute profile configuration and clears the state of the resource in the
351+
// schema.
346352
func resourceComputeProfileDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
347353
var diags diag.Diagnostics
348354

resource_l2_extension.go

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/vmware/terraform-provider-hcx/hcx"
1616
)
1717

18+
// resourceL2Extension defines the resource schema for managing an L2 extension, enabling extended network configurations.
1819
func resourceL2Extension() *schema.Resource {
1920
return &schema.Resource{
2021
CreateContext: resourceL2ExtensionCreate,
@@ -83,6 +84,7 @@ func resourceL2Extension() *schema.Resource {
8384
}
8485
}
8586

87+
// resourceComputeProfileCreate creates the L2 extension configuration on the specified service.
8688
func resourceL2ExtensionCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
8789

8890
client := m.(*hcx.Client)
@@ -192,17 +194,20 @@ func resourceL2ExtensionCreate(ctx context.Context, d *schema.ResourceData, m in
192194

193195
}
194196

197+
// resourceL2ExtensionRead retrieves the L2 extension configuration.
195198
func resourceL2ExtensionRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
196199
var diags diag.Diagnostics
197200

198201
return diags
199202
}
200203

204+
// resourceL2ExtensionUpdate updates the L2 extension configuration.
201205
func resourceL2ExtensionUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
202206

203207
return resourceL2ExtensionRead(ctx, d, m)
204208
}
205209

210+
// resourceL2ExtensionDelete removes the L2 extension configuration and clears the state of the resource in the schema.
206211
func resourceL2ExtensionDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
207212
var diags diag.Diagnostics
208213

resource_location.go

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/vmware/terraform-provider-hcx/hcx"
1313
)
1414

15+
// resourceLocation defines the resource schema for managing the location for an HCX site.
1516
func resourceLocation() *schema.Resource {
1617
return &schema.Resource{
1718
CreateContext: resourceLocationCreate,
@@ -59,11 +60,13 @@ func resourceLocation() *schema.Resource {
5960
}
6061
}
6162

63+
// resourceLocationCreate creates the location configuration for an HCX site.
6264
func resourceLocationCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
6365

6466
return resourceLocationUpdate(ctx, d, m)
6567
}
6668

69+
// resourceLocationRead retrieves the location configuration for an HCX site.
6770
func resourceLocationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
6871
var diags diag.Diagnostics
6972

@@ -84,6 +87,7 @@ func resourceLocationRead(ctx context.Context, d *schema.ResourceData, m interfa
8487
return diags
8588
}
8689

90+
// resourceLocationUpdate updates the location configuration for an HCX site.
8791
func resourceLocationUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
8892

8993
client := m.(*hcx.Client)
@@ -114,6 +118,7 @@ func resourceLocationUpdate(ctx context.Context, d *schema.ResourceData, m inter
114118
return resourceLocationRead(ctx, d, m)
115119
}
116120

121+
// resourceLocationDelete removes the location configuration and clears the state of the resource in the schema.
117122
func resourceLocationDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
118123
var diags diag.Diagnostics
119124

resource_network_profile.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/vmware/terraform-provider-hcx/hcx"
1414
)
1515

16+
// NetSchema defines the resource schema a network profile.
1617
func NetSchema() map[string]*schema.Schema {
1718
return map[string]*schema.Schema{
1819
"vmc": {
@@ -97,6 +98,7 @@ func NetSchema() map[string]*schema.Schema {
9798
}
9899
}
99100

101+
// resourceComputeProfile defines the resource for managing network profile configuration.
100102
func resourceNetworkProfile() *schema.Resource {
101103
return &schema.Resource{
102104
CreateContext: resourceNetworkProfileCreate,
@@ -108,6 +110,7 @@ func resourceNetworkProfile() *schema.Resource {
108110
}
109111
}
110112

113+
// resourceNetworkProfileCreate creates the network profile configuration.
111114
func resourceNetworkProfileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
112115

113116
client := m.(*hcx.Client)
@@ -204,6 +207,7 @@ func resourceNetworkProfileCreate(ctx context.Context, d *schema.ResourceData, m
204207
return resourceNetworkProfileRead(ctx, d, m)
205208
}
206209

210+
// resourceNetworkProfileRead retrieves the network profile configuration.
207211
func resourceNetworkProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
208212
var diags diag.Diagnostics
209213

@@ -219,6 +223,7 @@ func resourceNetworkProfileRead(ctx context.Context, d *schema.ResourceData, m i
219223
return diags
220224
}
221225

226+
// resourceNetworkProfileUpdate updates the network profile configuration.
222227
func resourceNetworkProfileUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
223228

224229
client := m.(*hcx.Client)
@@ -256,7 +261,7 @@ func resourceNetworkProfileUpdate(ctx context.Context, d *schema.ResourceData, m
256261
})
257262
}
258263

259-
// Read the exising profile
264+
// Read the existing profile
260265
body, err := hcx.GetNetworkProfile(client, name)
261266
if err != nil {
262267
return diag.FromErr(err)
@@ -317,6 +322,8 @@ func resourceNetworkProfileUpdate(ctx context.Context, d *schema.ResourceData, m
317322
return resourceNetworkProfileRead(ctx, d, m)
318323
}
319324

325+
// resourceNetworkProfileDelete removes the network profile configuration and clears the state of the resource in the
326+
// schema.
320327
func resourceNetworkProfileDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
321328
var diags diag.Diagnostics
322329
var res hcx.NetworkProfileResult
@@ -328,7 +335,7 @@ func resourceNetworkProfileDelete(ctx context.Context, d *schema.ResourceData, m
328335

329336
if vmc {
330337
// If VMware Cloud on AWS, don't really delete the network profile
331-
// Read the exising profile
338+
// Read the existing profile
332339
/*
333340
body, err := hcx.GetNetworkProfile(client, name)
334341
if err != nil {

resource_rolemapping.go

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/vmware/terraform-provider-hcx/hcx"
1313
)
1414

15+
// resourceRoleMapping defines the resource schema for managing role mapping configuration.
1516
func resourceRoleMapping() *schema.Resource {
1617
return &schema.Resource{
1718
CreateContext: resourceRoleMappingCreate,
@@ -59,17 +60,20 @@ func resourceRoleMapping() *schema.Resource {
5960
}
6061
}
6162

63+
// resourceRoleMappingCreate creates the role mapping configuration.
6264
func resourceRoleMappingCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
6365

6466
return resourceRoleMappingUpdate(ctx, d, m)
6567
}
6668

69+
// resourceRoleMappingRead retrieves the role mapping configuration.
6770
func resourceRoleMappingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
6871
var diags diag.Diagnostics
6972

7073
return diags
7174
}
7275

76+
// resourceRoleMappingUpdate updates the role mapping configuration.
7377
func resourceRoleMappingUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
7478

7579
client := m.(*hcx.Client)
@@ -114,6 +118,7 @@ func resourceRoleMappingUpdate(ctx context.Context, d *schema.ResourceData, m in
114118
return resourceRoleMappingRead(ctx, d, m)
115119
}
116120

121+
// resourceRoleMappingDelete removes the role mapping configuration amd clears the state of the resource in the schema.
117122
func resourceRoleMappingDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
118123
var diags diag.Diagnostics
119124

resource_service_mesh.go

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/vmware/terraform-provider-hcx/hcx"
1717
)
1818

19+
// resourceServiceMesh defines the resource schema for managing service mesh configuration.
1920
func resourceServiceMesh() *schema.Resource {
2021
return &schema.Resource{
2122
CreateContext: resourceServiceMeshCreate,
@@ -106,6 +107,7 @@ func resourceServiceMesh() *schema.Resource {
106107
}
107108
}
108109

110+
// resourceServiceMeshCreate creates the service mesh configuration.
109111
func resourceServiceMeshCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
110112

111113
client := m.(*hcx.Client)
@@ -233,17 +235,20 @@ func resourceServiceMeshCreate(ctx context.Context, d *schema.ResourceData, m in
233235

234236
}
235237

238+
// resourceServiceMeshRead retrieves the service mesh configuration.
236239
func resourceServiceMeshRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
237240
var diags diag.Diagnostics
238241

239242
return diags
240243
}
241244

245+
// resourceServiceMeshUpdate updates the service mesh configuration.
242246
func resourceServiceMeshUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
243247

244248
return resourceServiceMeshRead(ctx, d, m)
245249
}
246250

251+
// resourceServiceMeshDelete removes the service mesh configuration and clears the state of the resource in the schema.
247252
func resourceServiceMeshDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
248253
var diags diag.Diagnostics
249254

resource_site_pairing.go

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/vmware/terraform-provider-hcx/hcx"
1515
)
1616

17+
// resourceSitePairing defines the resource schema for managing site pairing configuration.
1718
func resourceSitePairing() *schema.Resource {
1819
return &schema.Resource{
1920
CreateContext: resourceSitePairingCreate,
@@ -82,6 +83,7 @@ func resourceSitePairing() *schema.Resource {
8283
}
8384
}
8485

86+
// resourceSitePairingCreate creates the site paring configuration.
8587
func resourceSitePairingCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
8688

8789
client := m.(*hcx.Client)
@@ -195,6 +197,7 @@ func resourceSitePairingCreate(ctx context.Context, d *schema.ResourceData, m in
195197
return resourceSitePairingRead(ctx, d, m)
196198
}
197199

200+
// resourceSitePairingRead retrieves a site paring configuration.
198201
func resourceSitePairingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
199202
var diags diag.Diagnostics
200203

@@ -253,11 +256,13 @@ func resourceSitePairingRead(ctx context.Context, d *schema.ResourceData, m inte
253256
return diags
254257
}
255258

259+
// resourceSitePairingUpdate updates the site pairing configuration.
256260
func resourceSitePairingUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
257261

258262
return resourceSitePairingRead(ctx, d, m)
259263
}
260264

265+
// resourceSitePairingDelete removes the site pairing configuration and clears the state of the resource in the schema.
261266
func resourceSitePairingDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
262267
var diags diag.Diagnostics
263268

0 commit comments

Comments
 (0)