Skip to content

Add support for 4.22.1.0 release - #143

Draft
Pearl1594 wants to merge 5 commits into
mainfrom
support-4.22.1.0
Draft

Add support for 4.22.1.0 release#143
Pearl1594 wants to merge 5 commits into
mainfrom
support-4.22.1.0

Conversation

@Pearl1594

Copy link
Copy Markdown
Contributor

The main change in this PR is:

…144)
* Add support for managing guest OS category - create, delete, update
---------
Co-authored-by: Pearl Dsilva <pearl1954@gmail.com>
CopilotAI lite review requested due to automatic review settings August 5, 2026 06:11

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.jobid handling via requiredParams.go and adjust codegen/client async polling logic.
  • Regenerate multiple service bindings from updated generate/listApis.json (new request params like resourceid/resourcetype, new response fields like alloweddetails, 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
FileDescription
test/GuestOSService_test.goAdds tests for new GuestOS OS-category APIs.
generate/requiredParams.goAdds required-param override for queryAsyncJobResult.jobid.
generate/layout.goRegisters OS-category commands under GuestOS service for generation/layout.
generate/generate.goUpdates generated GetAsyncJobResult template logic for QueryAsyncJobResult params creation.
cloudstack/cloudstack.goUpdates client helper GetAsyncJobResult implementation.
cloudstack/AsyncjobService.goAdds resourceid/resourcetype support to async-job query/list params.
cloudstack/GuestOSService.goAdds OS-category request/response types + ids filter for ListOsTypes.
cloudstack/GuestOSService_mock.goUpdates gomock interface to include OS-category methods/constructors.
cloudstack/ZoneService.goExtends VMware DC VM response structs with hypervisor details.
cloudstack/VPNService.goDoc comment capitalization/wording updates.
cloudstack/VPCService.goDoc comment capitalization/wording updates.
cloudstack/VolumeService.goAdds storageid param support to CreateVolume + doc comment updates.
cloudstack/VMGroupService.goDoc comment wording updates (“Instance” terminology).
cloudstack/VirtualNetworkFunctionsService.goAdds alloweddetails response field(s).
cloudstack/VirtualMachineService.goAdds params (osid, usevddk) and response field(s) (alloweddetails), plus doc comment wording updates.
cloudstack/UserService.goDoc comment wording update (“Instance” terminology).
cloudstack/UCSService.goDoc comment capitalization update.
cloudstack/TemplateService.goDoc comment capitalization/wording updates.
cloudstack/SystemVMService.goDoc comment wording updates (“System VM” terminology).
cloudstack/SSHService.goAdds alloweddetails response field + doc comment wording update.
cloudstack/SnapshotService.goAdds snapshot chain fields (parent, parentname) + doc comment wording updates.
cloudstack/ResourcemetadataService.goDoc comment wording update (“Instance” terminology).
cloudstack/ResourceIconService.goDoc comment capitalization update.
cloudstack/QuotaService.goDoc comment capitalization/wording updates.
cloudstack/ProjectService.goDoc comment capitalization updates.
cloudstack/PortableIPService.goDoc comment capitalization updates.
cloudstack/NicService.goAdds alloweddetails response field + doc comment wording update.
cloudstack/NetworkService.goDoc comment capitalization/wording updates.
cloudstack/NetworkACLService.goDoc comment capitalization + typo fix (“bettwen” → “between”).
cloudstack/NetscalerService.goDoc comment capitalization updates.
cloudstack/ManagementService.goAdds version filter param to management server list/metrics.
cloudstack/LoadBalancerService.goDoc comment wording/capitalization updates.
cloudstack/LDAPService.goDoc comment capitalization update.
cloudstack/KubernetesService.goAdds isourl field to supported version responses.
cloudstack/ISOService.goAdds alloweddetails response field + doc comment wording updates.
cloudstack/InternalLBService.goDoc comment wording updates (“Instance” terminology).
cloudstack/InfrastructureUsageService.goDoc comment capitalization update.
cloudstack/ImageStoreService.goDoc comment capitalization update.
cloudstack/HostService.goAdds details to AddSecondaryStorage params; adds version filter param to host list/metrics; doc comment wording updates.
cloudstack/FirewallService.goDoc comment wording/capitalization updates.
cloudstack/ExtensionService.goAdds reservedresourcedetails param/field to extension create/update and responses.
cloudstack/DiagnosticsService.goDoc comment wording update (“System VMs” capitalization).
cloudstack/ConsoleEndpointService.goDoc comment wording update (“Instance” terminology).
cloudstack/ConfigurationService.goAdds capability field snapshotshowchainsize.
cloudstack/CertificateService.goDoc comment wording update (“Templates” capitalization).
cloudstack/BrocadeVCSService.goDoc comment capitalization update.
cloudstack/BaremetalService.goDoc comment capitalization/wording updates.
cloudstack/BackupService.goAdds mountopts fields; adjusts backup schedule response struct; adds alloweddetails field; doc comment wording updates.
cloudstack/AutoScaleService.goDoc comment wording updates (“Instance” terminology).
cloudstack/APIDiscoveryService.goDoc comment capitalization update.
cloudstack/AnnotationService.goDoc comment capitalization updates.
cloudstack/AffinityGroupService.goAdds alloweddetails response field + doc comment wording update.
cloudstack/AddressService.goDoc comment wording/capitalization updates (“IP”, “Account”).
cloudstack/AccountService.goDoc 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.

Comment threadgenerate/generate.go
Comment on lines +542 to +544
pn(" p := &QueryAsyncJobResultParams{}")
pn(" p.p = make(map[string]interface{})")
pn(" p.SetJobID(jobid)")
Comment on lines +492 to +494
p := &QueryAsyncJobResultParams{}
p.p = make(map[string]interface{})
p.SetJobID(jobid)
Comment on lines +2441 to +2447
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.
Comment on lines +73 to +75
"queryAsyncJobResult": {
"jobid",
},
* Adds support to upload k8s ISO from local
* update nested response
---------
Co-authored-by: Pearl Dsilva <pearl1954@gmail.com>
CopilotAI review requested due to automatic review settings August 5, 2026 08:14

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 QueryAsyncJobResultParams directly and mutates its internal map, bypassing the service constructor. Prefer emitting cs.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
  • GetAsyncJobResult is now manually creating QueryAsyncJobResultParams and writing to its internal p map. Prefer using the public constructor cs.Asyncjob.NewQueryAsyncJobResultParams(jobid) to keep this code resilient to future changes in param initialization and reduce reliance on internal fields.
    test/KubernetesService_test.go:1
  • t.Errorf is printf-style; passing err.Error() directly can trigger go vet warnings (non-constant format string) and can mis-format messages containing %. Prefer t.Errorf(\"GetUploadParamsForKubernetesSupportedVersion: %v\", err) (or t.Fatalf if the test cannot continue).
    test/GuestOSService_test.go:1
  • t.Errorf is printf-style; passing err.Error() directly can trigger go vet warnings and can mis-format messages containing %. Prefer t.Errorf(\"AddOsCategory: %v\", err) (or t.Fatalf if the test cannot continue).
    cloudstack/KubernetesService.go:3742
  • The checksum parameter 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

  • DeleteOsCategoryResponse does not define an ostypeid field, but UnmarshalJSON tries to coerce it. This looks like accidental leftover code and adds confusing, unnecessary work—remove the ostypeid conversion 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.

Comment on lines +672 to +681
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"`
CopilotAI review requested due to automatic review settings August 5, 2026 09:27
Co-authored-by: Pearl Dsilva <pearl1954@gmail.com>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 58 out of 61 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 (5)

generate/generate.go:1

  • The generator emits code that directly instantiates QueryAsyncJobResultParams and mutates its internal map (p.p). This bypasses the public constructor (NewQueryAsyncJobResultParams(jobid)) and couples generated output to internal struct layout. Prefer generating a call to the constructor when jobid is required; it keeps encapsulation and avoids breakage if the params struct changes.
    cloudstack/cloudstack.go:1
  • GetAsyncJobResult now constructs QueryAsyncJobResultParams by manually allocating the struct and setting the internal p map. Since AsyncjobService already provides NewQueryAsyncJobResultParams(jobid), using the constructor would avoid relying on unexported/internal fields and keep the code resilient to future param-struct changes.
    cloudstack/KubernetesService.go:3742
  • In GetUploadParamsForKubernetesSupportedVersionParams.toURLValues, checksum is handled twice (the same p.p[\"checksum\"] block appears twice). This is redundant and likely indicates a generator issue or a missing second field (e.g., a different checksum-related param). Remove the duplicate block (or replace it with the intended param) to avoid confusion and ensure the generated parameters match the API spec.
	if v, found := p.p["checksum"]; found {
u.Set("checksum", v.(string))
}

cloudstack/GuestOSService.go:2447

  • DeleteOsCategoryResponse.UnmarshalJSON contains logic to coerce ostypeid, but DeleteOsCategoryResponse doesn't define an ostypeid field. This adds unnecessary complexity and extra marshal/unmarshal work. Recommend removing the ostypeid conversion block and keeping only the conversions that the response type actually needs (e.g., success).
	if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
}
}

cloudstack/ConsoleEndpointService.go:102

  • The article is incorrect in the doc comment; it should be 'an Instance' (not 'a Instance').
// Create a console endpoint to connect to a Instance console

Comment on lines +672 to +681
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"`
CopilotAI review requested due to automatic review settings August 5, 2026 09:45

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 58 out of 61 changed files in this pull request and generated no new comments.

Files not reviewed (2)
  • cloudstack/GuestOSService_mock.go: Generated file
  • cloudstack/KubernetesService_mock.go: Generated file
Suppressed comments (6)

cloudstack/cloudstack.go:1

  • This manually constructs QueryAsyncJobResultParams and writes to the unexported p map directly. This is brittle and bypasses the existing constructor (cs.Asyncjob.NewQueryAsyncJobResultParams(jobid)), which already enforces required params and encapsulates initialization. Prefer using the constructor (and/or ensure setters can initialize internal state) to avoid coupling callers to internal struct fields.
    cloudstack/PoolService.go:1
  • Success is typed as bool, but several CloudStack APIs historically return success as a string ("true"/"false"). If configureStorageAccess returns the string form, json.Unmarshal will error and the call will fail. Consider adding an UnmarshalJSON for StorageAccessResponse similar to other response types in this repo that normalize success into a boolean.
    test/PoolService_test.go:1
  • t.Errorf(err.Error()) treats the error text as a format string, which can misbehave if it contains % and is generally discouraged by go vet. Prefer t.Error(err) or t.Errorf(\"...: %v\", err).
    cloudstack/KubernetesService.go:3742
  • In GetUploadParamsForKubernetesSupportedVersionParams.toURLValues(), the checksum parameter is set twice (duplicate block). Remove the duplicate block to avoid redundant work and reduce the chance of future inconsistencies.
	if v, found := p.p["checksum"]; found {
u.Set("checksum", v.(string))
}

cloudstack/GuestOSService.go:2447

  • DeleteOsCategoryResponse.UnmarshalJSON contains an ostypeid normalization block, but DeleteOsCategoryResponse does not define an ostypeid field. This looks like copy/paste or generator leakage and makes the custom unmarshal harder to reason about. Removing the unused conversion block would reduce confusion and maintenance cost.
	if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
}
}

cloudstack/ConsoleEndpointService.go:102

  • Fix article usage: 'a Instance' should be 'an Instance'.
// Create a console endpoint to connect to a Instance console

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Pearl1594@abh1sar