vmware / go-vcloud-director

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

Remove conditional API calls with outdated API version #636

Closed Didainius closed 8 months ago

Didainius commented 8 months ago

This PR removes conditional API version elevation for unsupported API versions (< 37.0). This SDK support only 37.0 going forward.

Old API calls were identified using grep -Rin "GetSpecificApiVersionOnCondition(" *. Only the ones that have versions < 37.0 are patched to simply use default API versions client.APIVersion which is 37.0 now.

# grep -Rin "GetSpecificApiVersionOnCondition(" *                               
api_vcd_versions.go:237:func (client *Client) GetSpecificApiVersionOnCondition(vcdApiVersionCondition, wantedApiVersion string) string {
disk.go:88:             vdc.client.GetSpecificApiVersionOnCondition(">= 36.0", "36.0"))
disk.go:170:            disk.client.GetSpecificApiVersionOnCondition(">= 36.0", "36.0"))
disk.go:231:            disk.client.GetSpecificApiVersionOnCondition(">= 36.0", "36.0"))
disk.go:327:            vdc.client.GetSpecificApiVersionOnCondition(">= 36.0", "36.0"))
disk.go:362:            vdc.client.GetSpecificApiVersionOnCondition(">= 36.0", "36.0"))
disk.go:384:            vdc.client.GetSpecificApiVersionOnCondition(">= 36.0", "36.0"))
system.go:742:          "", "error retrieving storage profile: %s", nil, vdcStorageProfile, client.GetSpecificApiVersionOnCondition(">= 35.0", "35.0"))
vapp.go:164:            vAppComposition, vapp.client.GetSpecificApiVersionOnCondition(">=37.1", "37.1"))
vdc.go:1044:            vdc.client.GetSpecificApiVersionOnCondition(">=37.1", "37.1"))
vm.go:74:       _, err := vm.client.ExecuteRequestWithApiVersion(refreshUrl, http.MethodGet, "", "error refreshing VM: %s", nil, vm.VM, vm.client.GetSpecificApiVersionOnCondition(">=37.1", "37.1"))
vm.go:1507:             vm.client.GetSpecificApiVersionOnCondition(">=37.1", "37.1"))
vm.go:1794:             vapp.client.GetSpecificApiVersionOnCondition(">=37.1", "37.1"))
vm.go:1842:             "", "error retrieving vm: %s", nil, newVm.VM, client.GetSpecificApiVersionOnCondition(">=37.1", "37.1"))
vm.go:1966:             }, vm.client.GetSpecificApiVersionOnCondition(">=37.1", "37.1"))
Didainius commented 8 months ago

False alarm, 10.5.1 still supports API v35.0