Add support for 4.22.1.0 release - #143
Conversation
…144) * Add support for managing guest OS category - create, delete, update --------- Co-authored-by: Pearl Dsilva <pearl1954@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the CloudStack Go SDK/codegen artifacts to align with Apache CloudStack 4.22.1.0, primarily by incorporating updated API metadata (listApis.json) and regenerating affected services (including new params/response fields and new GuestOS OS-category APIs).
Changes:
- Override
queryAsyncJobResult.jobidhandling viarequiredParams.goand adjust codegen/client async polling logic. - Regenerate multiple service bindings from updated
generate/listApis.json(new request params likeresourceid/resourcetype, new response fields likealloweddetails, etc.). - Add GuestOS OS-category API surface (
addOsCategory/deleteOsCategory/updateOsCategory) and corresponding tests/mocks.
Reviewed changes
Copilot reviewed 53 out of 55 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| test/GuestOSService_test.go | Adds tests for new GuestOS OS-category APIs. |
| generate/requiredParams.go | Adds required-param override for queryAsyncJobResult.jobid. |
| generate/layout.go | Registers OS-category commands under GuestOS service for generation/layout. |
| generate/generate.go | Updates generated GetAsyncJobResult template logic for QueryAsyncJobResult params creation. |
| cloudstack/cloudstack.go | Updates client helper GetAsyncJobResult implementation. |
| cloudstack/AsyncjobService.go | Adds resourceid/resourcetype support to async-job query/list params. |
| cloudstack/GuestOSService.go | Adds OS-category request/response types + ids filter for ListOsTypes. |
| cloudstack/GuestOSService_mock.go | Updates gomock interface to include OS-category methods/constructors. |
| cloudstack/ZoneService.go | Extends VMware DC VM response structs with hypervisor details. |
| cloudstack/VPNService.go | Doc comment capitalization/wording updates. |
| cloudstack/VPCService.go | Doc comment capitalization/wording updates. |
| cloudstack/VolumeService.go | Adds storageid param support to CreateVolume + doc comment updates. |
| cloudstack/VMGroupService.go | Doc comment wording updates (“Instance” terminology). |
| cloudstack/VirtualNetworkFunctionsService.go | Adds alloweddetails response field(s). |
| cloudstack/VirtualMachineService.go | Adds params (osid, usevddk) and response field(s) (alloweddetails), plus doc comment wording updates. |
| cloudstack/UserService.go | Doc comment wording update (“Instance” terminology). |
| cloudstack/UCSService.go | Doc comment capitalization update. |
| cloudstack/TemplateService.go | Doc comment capitalization/wording updates. |
| cloudstack/SystemVMService.go | Doc comment wording updates (“System VM” terminology). |
| cloudstack/SSHService.go | Adds alloweddetails response field + doc comment wording update. |
| cloudstack/SnapshotService.go | Adds snapshot chain fields (parent, parentname) + doc comment wording updates. |
| cloudstack/ResourcemetadataService.go | Doc comment wording update (“Instance” terminology). |
| cloudstack/ResourceIconService.go | Doc comment capitalization update. |
| cloudstack/QuotaService.go | Doc comment capitalization/wording updates. |
| cloudstack/ProjectService.go | Doc comment capitalization updates. |
| cloudstack/PortableIPService.go | Doc comment capitalization updates. |
| cloudstack/NicService.go | Adds alloweddetails response field + doc comment wording update. |
| cloudstack/NetworkService.go | Doc comment capitalization/wording updates. |
| cloudstack/NetworkACLService.go | Doc comment capitalization + typo fix (“bettwen” → “between”). |
| cloudstack/NetscalerService.go | Doc comment capitalization updates. |
| cloudstack/ManagementService.go | Adds version filter param to management server list/metrics. |
| cloudstack/LoadBalancerService.go | Doc comment wording/capitalization updates. |
| cloudstack/LDAPService.go | Doc comment capitalization update. |
| cloudstack/KubernetesService.go | Adds isourl field to supported version responses. |
| cloudstack/ISOService.go | Adds alloweddetails response field + doc comment wording updates. |
| cloudstack/InternalLBService.go | Doc comment wording updates (“Instance” terminology). |
| cloudstack/InfrastructureUsageService.go | Doc comment capitalization update. |
| cloudstack/ImageStoreService.go | Doc comment capitalization update. |
| cloudstack/HostService.go | Adds details to AddSecondaryStorage params; adds version filter param to host list/metrics; doc comment wording updates. |
| cloudstack/FirewallService.go | Doc comment wording/capitalization updates. |
| cloudstack/ExtensionService.go | Adds reservedresourcedetails param/field to extension create/update and responses. |
| cloudstack/DiagnosticsService.go | Doc comment wording update (“System VMs” capitalization). |
| cloudstack/ConsoleEndpointService.go | Doc comment wording update (“Instance” terminology). |
| cloudstack/ConfigurationService.go | Adds capability field snapshotshowchainsize. |
| cloudstack/CertificateService.go | Doc comment wording update (“Templates” capitalization). |
| cloudstack/BrocadeVCSService.go | Doc comment capitalization update. |
| cloudstack/BaremetalService.go | Doc comment capitalization/wording updates. |
| cloudstack/BackupService.go | Adds mountopts fields; adjusts backup schedule response struct; adds alloweddetails field; doc comment wording updates. |
| cloudstack/AutoScaleService.go | Doc comment wording updates (“Instance” terminology). |
| cloudstack/APIDiscoveryService.go | Doc comment capitalization update. |
| cloudstack/AnnotationService.go | Doc comment capitalization updates. |
| cloudstack/AffinityGroupService.go | Adds alloweddetails response field + doc comment wording update. |
| cloudstack/AddressService.go | Doc comment wording/capitalization updates (“IP”, “Account”). |
| cloudstack/AccountService.go | Doc comment wording/capitalization updates. |
Files not reviewed (1)
- cloudstack/GuestOSService_mock.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pn(" p := &QueryAsyncJobResultParams{}") | ||
| pn(" p.p = make(map[string]interface{})") | ||
| pn(" p.SetJobID(jobid)") |
| p := &QueryAsyncJobResultParams{} | ||
| p.p = make(map[string]interface{}) | ||
| p.SetJobID(jobid) |
| if ostypeid, ok := m["ostypeid"].(float64); ok { | ||
| m["ostypeid"] = strconv.Itoa(int(ostypeid)) | ||
| b, err = json.Marshal(m) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| } |
| } | ||
|
|
||
| // Create a console endpoint to connect to a VM console | ||
| // Create a console endpoint to connect to a Instance console |
| } | ||
|
|
||
| // Attaches an ISO to a virtual machine. | ||
| // Attaches an ISO to an Instance. |
| } | ||
|
|
||
| // Attaches a disk volume to a virtual machine. | ||
| // Attaches a disk volume to an Instance. |
| "queryAsyncJobResult": { | ||
| "jobid", | ||
| }, |
* Adds support to upload k8s ISO from local * update nested response --------- Co-authored-by: Pearl Dsilva <pearl1954@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 54 out of 57 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- cloudstack/GuestOSService_mock.go: Generated file
- cloudstack/KubernetesService_mock.go: Generated file
Suppressed comments (8)
generate/generate.go:1
- The generator now emits code that instantiates
QueryAsyncJobResultParamsdirectly and mutates its internal map, bypassing the service constructor. Prefer emittingcs.Asyncjob.NewQueryAsyncJobResultParams(jobid)(or an exported constructor/helper) to avoid coupling generated code to internal struct details and to preserve any future constructor invariants.
cloudstack/cloudstack.go:1 GetAsyncJobResultis now manually creatingQueryAsyncJobResultParamsand writing to its internalpmap. Prefer using the public constructorcs.Asyncjob.NewQueryAsyncJobResultParams(jobid)to keep this code resilient to future changes in param initialization and reduce reliance on internal fields.
test/KubernetesService_test.go:1t.Errorfis printf-style; passingerr.Error()directly can triggergo vetwarnings (non-constant format string) and can mis-format messages containing%. Prefert.Errorf(\"GetUploadParamsForKubernetesSupportedVersion: %v\", err)(ort.Fatalfif the test cannot continue).
test/GuestOSService_test.go:1t.Errorfis printf-style; passingerr.Error()directly can triggergo vetwarnings and can mis-format messages containing%. Prefert.Errorf(\"AddOsCategory: %v\", err)(ort.Fatalfif the test cannot continue).
cloudstack/KubernetesService.go:3742- The
checksumparameter is serialized twice. This is redundant and makes it harder to audit generated params; remove the duplicate block so each param is set exactly once.
if v, found := p.p["checksum"]; found {
u.Set("checksum", v.(string))
}
if v, found := p.p["checksum"]; found {
u.Set("checksum", v.(string))
}
cloudstack/KubernetesService.go:3998
- This method fetches upload parameters (it does not perform the upload). Update the doc comment to reflect the actual behavior (e.g., 'Gets upload parameters for a supported Kubernetes version') to avoid misleading API consumers.
// Upload a supported Kubernetes version
func (s *KubernetesService) GetUploadParamsForKubernetesSupportedVersion(p *GetUploadParamsForKubernetesSupportedVersionParams) (*GetUploadParamsForKubernetesSupportedVersionResponse, error) {
resp, err := s.cs.newRequest("getUploadParamsForKubernetesSupportedVersion", p.toURLValues())
cloudstack/GuestOSService.go:2447
DeleteOsCategoryResponsedoes not define anostypeidfield, butUnmarshalJSONtries to coerce it. This looks like accidental leftover code and adds confusing, unnecessary work—remove theostypeidconversion block.
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
}
}
cloudstack/LoadBalancerService.go:5734
- There is an extra space in the comment ('list of Instances'). Consider fixing to improve generated docs readability.
// Removes an Instance or a list of Instances from a load balancer rule.
| Id string `json:"id"` | ||
| Intervaltype string `json:"intervaltype"` | ||
| JobID string `json:"jobid"` | ||
| Jobstatus int `json:"jobstatus"` | ||
| Maxbackups int `json:"maxbackups"` | ||
| Quiescevm bool `json:"quiescevm"` | ||
| Schedule string `json:"schedule"` | ||
| Timezone string `json:"timezone"` | ||
| Virtualmachineid string `json:"virtualmachineid"` | ||
| Virtualmachinename string `json:"virtualmachinename"` |
The main change in this PR is: