Skip to content

Commit de7c769

Browse files
authored
Merge pull request #173 from vmware/chore/5.1.1-api
Bump SDK to 0.3.0 and add support for VCF 5.1.1 APIs
2 parents ff434ea + eb19de4 commit de7c769

30 files changed

+88
-91
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
## [v0.9.0](https://github.com/vmware/terraform-provider-vcf/releases/tag/v0.9.0)
4+
5+
> Release Date: May 23 2024
6+
7+
FEATURES:
8+
* Official support for VCF 5.1.1 [\#173](https://github.com/vmware/terraform-provider-vcf/pull/173)
9+
310
## [v0.8.5](https://github.com/vmware/terraform-provider-vcf/releases/tag/v0.8.5)
411

512
> Release Date: Apr 26 2024

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/hashicorp/terraform-plugin-log v0.9.0
1010
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
1111
github.com/stretchr/testify v1.9.0
12-
github.com/vmware/vcf-sdk-go v0.2.4
12+
github.com/vmware/vcf-sdk-go v0.3.0
1313
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df
1414
)
1515

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh
224224
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
225225
github.com/vmware/vcf-sdk-go v0.2.4 h1:OBUhTHcgdYhH1uEEhB0KuhR0ziOmnyska6zjQ9LH3h8=
226226
github.com/vmware/vcf-sdk-go v0.2.4/go.mod h1:EXM19ZwD2qmvMVSvgUzcnT7dSTCq3lzv84ErrFPZm1Q=
227+
github.com/vmware/vcf-sdk-go v0.3.0 h1:uDz57vEsLMuocPsp3OHgy137YdD4z1i9x9FrepoPcRs=
228+
github.com/vmware/vcf-sdk-go v0.3.0/go.mod h1:EXM19ZwD2qmvMVSvgUzcnT7dSTCq3lzv84ErrFPZm1Q=
227229
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
228230
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
229231
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=

internal/certificates/certificate_operations.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ func ValidateResourceCertificates(ctx context.Context, client *vcfclient.VcfClie
6969
// Wait for certificate validation to fisnish
7070
if !validationutils.HasCertificateValidationFinished(validationResponse) {
7171
for {
72-
getResourceCertificatesValidationResultParams := certificates.NewGetResourceCertificatesValidationResultParams().
72+
getResourceCertificatesValidationResultParams := certificates.NewGetResourceCertificatesValidationByIDParams().
7373
WithContext(ctx).
7474
WithTimeout(constants.DefaultVcfApiCallTimeout).
7575
WithID(*validationId)
76-
getValidationResponse, err := client.Certificates.GetResourceCertificatesValidationResult(getResourceCertificatesValidationResultParams)
76+
getValidationResponse, err := client.Certificates.GetResourceCertificatesValidationByID(getResourceCertificatesValidationResultParams)
7777
if err != nil {
7878
return validationutils.ConvertVcfErrorToDiag(err)
7979
}
@@ -104,11 +104,11 @@ func GetCertificateForResourceInDomain(ctx context.Context, client *vcfclient.Vc
104104
return nil, fmt.Errorf("could not determine FQDN for resourceType %s in domain %s", resourceType, domainId)
105105
}
106106

107-
viewCertificatesParams := certificates.NewViewCertificateParamsWithContext(ctx).
107+
viewCertificatesParams := certificates.NewGetCertificatesByDomainParamsWithContext(ctx).
108108
WithTimeout(constants.DefaultVcfApiCallTimeout)
109-
viewCertificatesParams.SetDomainName(domainId)
109+
viewCertificatesParams.ID = domainId
110110

111-
certificatesResponse, err := client.Certificates.ViewCertificate(viewCertificatesParams)
111+
certificatesResponse, _, err := client.Certificates.GetCertificatesByDomain(viewCertificatesParams)
112112
if err != nil {
113113
return nil, err
114114
}
@@ -134,7 +134,7 @@ func GenerateCertificateForResource(ctx context.Context, client *api_client.Sddc
134134
}
135135
generateCertificatesParam := certificates.NewGenerateCertificatesParamsWithContext(ctx).
136136
WithTimeout(constants.DefaultVcfApiCallTimeout).
137-
WithDomainName(*domainId)
137+
WithID(*domainId)
138138
generateCertificatesParam.SetCertificateGenerationSpec(certificateGenerationSpec)
139139

140140
var taskId string

internal/cluster/cluster_operations.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func SetStretchOrUnstretchSpec(updateSpec *models.ClusterUpdateSpec, data *schem
127127

128128
stretchSpec := &models.ClusterStretchSpec{
129129
HostSpecs: hostSpecs,
130-
SecondaryAzOverlayVlanID: &secondaryAzOverlayVlanId,
130+
SecondaryAzOverlayVlanID: secondaryAzOverlayVlanId,
131131
WitnessSpec: &witnessSpec,
132132
IsEdgeClusterConfiguredForMultiAZ: false,
133133
}
@@ -143,12 +143,12 @@ type EmptySpec struct{}
143143

144144
func ValidateClusterUpdateOperation(ctx context.Context, clusterId string,
145145
clusterUpdateSpec *models.ClusterUpdateSpec, apiClient *client.VcfClient) diag.Diagnostics {
146-
validateClusterSpec := clusters.NewValidateClusterOperationsParamsWithContext(ctx).
146+
validateClusterSpec := clusters.NewValidateClusterUpdateSpecParamsWithContext(ctx).
147147
WithTimeout(constants.DefaultVcfApiCallTimeout)
148148
validateClusterSpec.ClusterUpdateSpec = clusterUpdateSpec
149149
validateClusterSpec.ID = clusterId
150150

151-
validateResponse, err := apiClient.Clusters.ValidateClusterOperations(validateClusterSpec)
151+
validateResponse, err := apiClient.Clusters.ValidateClusterUpdateSpec(validateClusterSpec)
152152
if err != nil {
153153
return validationUtils.ConvertVcfErrorToDiag(err)
154154
}
@@ -214,7 +214,8 @@ func TryConvertToClusterSpec(object map[string]interface{}) (*models.ClusterSpec
214214
result.NetworkSpec.NsxClusterSpec.NsxTClusterSpec = &models.NsxTClusterSpec{}
215215

216216
if geneveVlanId, ok := object["geneve_vlan_id"]; ok && !validationUtils.IsEmpty(geneveVlanId) {
217-
result.NetworkSpec.NsxClusterSpec.NsxTClusterSpec.GeneveVlanID = int32(geneveVlanId.(int))
217+
vlanValue := int32(geneveVlanId.(int))
218+
result.NetworkSpec.NsxClusterSpec.NsxTClusterSpec.GeneveVlanID = &vlanValue
218219
}
219220

220221
if ipAddressPoolRaw, ok := object["ip_address_pool"]; ok && !validationUtils.IsEmpty(ipAddressPoolRaw) {

internal/datastores/vsan_datastore_subresource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TryConvertToVsanDatastoreSpec(object map[string]interface{}) (*models.VSAND
6161
}
6262
if failuresToTolerate, ok := object["failures_to_tolerate"]; ok && !validationutils.IsEmpty(failuresToTolerate) {
6363
failuresToTolerateInt := int32(failuresToTolerate.(int))
64-
result.FailuresToTolerate = &failuresToTolerateInt
64+
result.FailuresToTolerate = failuresToTolerateInt
6565
}
6666

6767
return result, nil

internal/network/nsx_subresource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ func FlattenNsxClusterRef(ctx context.Context, nsxtClusterRef *models.NsxTCluste
151151
flattenedNsxCluster["vip"] = nsxtClusterRef.Vip
152152
flattenedNsxCluster["vip_fqdn"] = nsxtClusterRef.VipFqdn
153153

154-
getNsxTClusterParams := nsxt_clusters.NewGetNSXTClusterParamsWithContext(ctx).
154+
getNsxTClusterParams := nsxt_clusters.NewGetNsxClusterParamsWithContext(ctx).
155155
WithTimeout(constants.DefaultVcfApiCallTimeout).WithID(nsxtClusterRef.ID)
156156

157-
nsxtClusterResponse, err := apiClient.NSXTClusters.GetNSXTCluster(getNsxTClusterParams)
157+
nsxtClusterResponse, err := apiClient.NSXTClusters.GetNsxCluster(getNsxTClusterParams)
158158
if err != nil {
159159
return nil, err
160160
}

internal/nsx_edge_cluster/edge_cluster_operations.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ func GetNsxEdgeClusterCreationSpec(data *schema.ResourceData) *models.EdgeCluste
5656
InternalTransitSubnets: internalTransitSubnets,
5757
Mtu: &mtu,
5858
Asn: asn,
59-
Tier0Name: &tier0Name,
60-
Tier0RoutingType: &routingType,
61-
Tier0ServicesHighAvailability: &highAvailability,
62-
Tier1Name: &tier1Name,
59+
Tier0Name: tier0Name,
60+
Tier0RoutingType: routingType,
61+
Tier0ServicesHighAvailability: highAvailability,
62+
Tier1Name: tier1Name,
6363
Tier1Unhosted: tier1Unhosted,
6464
TransitSubnets: transitSubnets,
6565
}
@@ -152,9 +152,9 @@ func getNodeSpec(node map[string]interface{}) *models.NsxTEdgeNodeSpec {
152152
nodeSpec := &models.NsxTEdgeNodeSpec{
153153
ClusterID: &clusterId,
154154
EdgeNodeName: &name,
155-
EdgeTep1IP: &tep1IP,
156-
EdgeTep2IP: &tep2IP,
157-
EdgeTepGateway: &tepGateway,
155+
EdgeTep1IP: tep1IP,
156+
EdgeTep2IP: tep2IP,
157+
EdgeTepGateway: tepGateway,
158158
EdgeTepVlan: &tepVlan,
159159
ManagementGateway: &managementGateway,
160160
ManagementIP: &managementIP,

internal/provider/resource_ceip.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func resourceCeipUpdate(ctx context.Context, d *schema.ResourceData, meta interf
7575
vcfClient := meta.(*api_client.SddcManagerClient)
7676
apiClient := vcfClient.ApiClient
7777

78-
params := ceip.NewUpdateCEIPStatusParamsWithTimeout(2 * time.Minute)
78+
params := ceip.NewSetCEIPStatusParamsWithTimeout(2 * time.Minute)
7979
updateSpec := models.CEIPUpdateSpec{}
8080

8181
if status, ok := d.GetOk("status"); ok {
@@ -91,7 +91,7 @@ func resourceCeipUpdate(ctx context.Context, d *schema.ResourceData, meta interf
9191
}
9292

9393
params.CEIPUpdateSpec = &updateSpec
94-
_, ceipAccepted, err := apiClient.CEIP.UpdateCEIPStatus(params)
94+
_, ceipAccepted, err := apiClient.CEIP.SetCEIPStatus(params)
9595
if err != nil {
9696
tflog.Error(ctx, err.Error())
9797
return diag.FromErr(err)
@@ -111,13 +111,13 @@ func resourceCeipDelete(ctx context.Context, d *schema.ResourceData, meta interf
111111
vcfClient := meta.(*api_client.SddcManagerClient)
112112
apiClient := vcfClient.ApiClient
113113

114-
params := ceip.NewUpdateCEIPStatusParams()
114+
params := ceip.NewSetCEIPStatusParams()
115115
updateSpec := models.CEIPUpdateSpec{}
116116
statusVal := DisableApiParam
117117
updateSpec.Status = &statusVal
118118
params.CEIPUpdateSpec = &updateSpec
119119

120-
_, ceipAccepted, err := apiClient.CEIP.UpdateCEIPStatus(params)
120+
_, ceipAccepted, err := apiClient.CEIP.SetCEIPStatus(params)
121121
if err != nil {
122122
tflog.Error(ctx, err.Error())
123123
return diag.FromErr(err)

internal/provider/resource_certificate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func resourceResourceCertificateCreate(ctx context.Context, data *schema.Resourc
9090
}
9191
replaceCertificatesParams := certificatesSdk.NewReplaceCertificatesParamsWithContext(ctx).
9292
WithTimeout(constants.DefaultVcfApiCallTimeout).
93-
WithDomainName(domainID)
93+
WithID(domainID)
9494
replaceCertificatesParams.SetCertificateOperationSpec(certificateOperationSpec)
9595

9696
var taskId string

0 commit comments

Comments
 (0)