[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16220532#comment-16220532
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9602:
--------------------------------------------

fmaximus commented on a change in pull request #1554: CLOUDSTACK-9602: API: 
improve resource limits comprehension
URL: https://github.com/apache/cloudstack/pull/1554#discussion_r147157311
 
 

 ##########
 File path: 
api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
 ##########
 @@ -96,4 +117,24 @@ public void execute() {
         response.setResponseName(getCommandName());
         this.setResponseObject(response);
     }
+
+    private Resource.ResourceType getResourceTypeEnum() {
+        // Map resource type
+        Resource.ResourceType resourceTypeResult = null;
+        if (resourceTypeName != null) {
+            try {
+                resourceTypeResult = 
Resource.ResourceType.valueOf(resourceTypeName);
+            } catch (IllegalArgumentException e) {
+                throw new InvalidParameterValueException("Please specify a 
valid resource type name.");
+            }
+        } else if (resourceType != null) {
+            try {
+                resourceTypeResult = 
Resource.ResourceType.values()[resourceType];
 
 Review comment:
   The code here assumes that the ResourceType.getOrdinal() is always in the 
same order as the enum values.
   This might at one moment not be the case..
   I would prefer to search for the ResourceType returning the correct value 
when calling type.getOrdinal()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add resource type name in response
> ----------------------------------
>
>                 Key: CLOUDSTACK-9602
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9602
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: API
>            Reporter: Marc-Aurèle Brothier
>            Assignee: Marc-Aurèle Brothier
>
> Output the resource type name along with its id to be more human readable for 
> all API call returning a resource.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to