Damans227 commented on code in PR #13895:
URL: https://github.com/apache/cloudstack/pull/13895#discussion_r3974923862


##########
api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java:
##########
@@ -111,9 +113,11 @@ public class ListTemplatesCmd extends 
BaseListTaggedResourcesCmd implements User
             since = "4.21.0")
     private Boolean forCks;
 
-    @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
-            description = "the CPU arch of the template. Valid options are: 
x86_64, aarch64, s390x",
-            since = "4.20")
+    @Parameter(name = ApiConstants.ARCH,
+           type = CommandType.STRING,
+           description = "the CPU arch of the template. Valid options are: 
x86_64, aarch64, s390x",
+           since = "4.20",
+           allowedValueType = CPU.CPUArch.class)

Review Comment:
   tested on a lab, 3 of the 4 values here get rejected. `CPUArch` has no 
`toString()` so we publish the constant names, but the api parses with 
`fromType()` which matches the `type` field.
   
   ```
   $ cmk list templates templatefilter=all listall=true arch=amd64
   Error: (HTTP 431, error code 9999) Unsupported arch type: amd64
   
   $ cmk list templates templatefilter=all listall=true arch=arm64
   Error: (HTTP 431, error code 9999) Unsupported arch type: arm64
   
   $ cmk list templates templatefilter=all listall=true arch=x86
   Error: (HTTP 431, error code 9999) Unsupported arch type: x86
   
   $ cmk list templates templatefilter=all listall=true arch=x86_64
     "count": 2
   ```
   
   ```
   listApis says   x86, amd64, arm64, s390x
   api accepts     i686, x86_64, aarch64, s390x
   ```
   
   the `description` on this same annotation already says `x86_64, aarch64, 
s390x`.
   
   same on `ListIsosCmd:95`, and it flows through to `listVnfTemplates`.
   
   can we add a `toString()` on `CPUArch` returning `type`? `ProvisioningType` 
only works because it overrides `toString()`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to