vmware / go-vcloud-director

Golang SDK for VMware Cloud Director
Other
80 stars 76 forks source link

Add VM Group and Logical VM Group support to facilitate VM Placement Policy creation; Update Compute Policies to v2.0.0 #504

Closed adambarreiro closed 2 years ago

adambarreiro commented 2 years ago

This PR builds on top of #502.

Description

Same as #502, this PR aims to serve as the foundation for https://github.com/vmware/terraform-provider-vcd/pull/904. This PR contains the required changes to be able to create the vcd_vm_placement_policy resource to be able to test it.

As vcd_vm_placement_policy requires to handle VM Groups and Logical VM Groups in VCD, there are additions of some functions for that purpose.

It also updates Compute Policies OpenAPI support from v1.0.0 to v2.0.0, marking v1.0.0 as deprecated and leaving it untouched, while creating a new set of functions for the new version to avoid breaking compatibility. This change was done to support more filtering options of the v2.0.0 endpoint and prepare for the future.

Other changes

Testing

Tests require a new field in govcd_test_config.yaml:

vcd:
    ...
    nsxt_provider_vdc:
      ...
      placementPolicyVmGroup: testVmGroup
adambarreiro commented 2 years ago

Converting back to Draft as I'll need to adapt the changes to a few additions in https://github.com/vmware/terraform-provider-vcd/pull/904

adambarreiro commented 2 years ago

Converting back to Draft as I'll need to upgrade to v2.0.0 for ComputePolicies endpoint as there's a quirk with the Description field. In v1.0.0, if it's empty, the API puts a default description message, which makes VM Sizing Policy and VM Placement Policy resources to always update even nothing was changed in HCL.