dheeraj12347 commented on code in PR #13543:
URL: https://github.com/apache/cloudstack/pull/13543#discussion_r3556849029


##########
api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java:
##########
@@ -92,10 +92,15 @@ public class CreateVPCOfferingCmd extends 
BaseAsyncCreateCmd {
     @Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = 
CommandType.MAP, description = "Desired service capabilities as part of VPC 
offering", since = "4.4")
     private Map<String, List<String>> serviceCapabilityList;
 
-    @Parameter(name = ApiConstants.INTERNET_PROTOCOL,
-            type = CommandType.STRING,
-            description = "The internet protocol of the offering. Options are 
IPv4 and dualstack. Default is IPv4. dualstack will create an offering that 
supports both IPv4 and IPv6",
-            since = "4.17.0")
+    @Parameter(
+        name = ApiConstants.INTERNET_PROTOCOL,
+        type = CommandType.STRING,
+        description = "The internet protocol of the offering. Options are IPv4 
and dualstack. Default is IPv4. dualstack will create an offering that supports 
both IPv4 and IPv6",
+        since = "4.17.0",
+        allowedValues = {
+                "IPv4",
+                "dualstack"
+        })

Review Comment:
   > I wonder if it's possible to point to existing enums - so that, in future 
if the list changes i.e, the enum, this will always stay in sync. With the 
hard-coded approach there's a risk of these values going state. It's a good 
first approach, but worth checking the feasibility of pointing to existing enums
   
   Hi @Pearl1594 ,
   I investigated this further. The parameter is validated using the existing 
NetUtils.InternetProtocol enum, and I confirmed it's already used throughout 
the codebase via NetUtils.InternetProtocol.fromValue(...). Since annotation 
attributes must be compile-time constants, they can't directly reference 
Enum.values(). I updated the documented allowed value to use the enum's 
canonical name (DualStack) for consistency. If there's another preferred 
approach for keeping these values synchronized, I'd be happy to follow it.



-- 
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