Santhosh Kumar Edukulla created CLOUDSTACK-6403:
---------------------------------------------------

             Summary: ListApi Responses does not have "count" parameter and 
response arrays defined as part of API docs.
                 Key: CLOUDSTACK-6403
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-6403
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
    Affects Versions: 4.4.0
            Reporter: Santhosh Kumar Edukulla


1. Verifying few cases for CS responses, we have observed that the commands.xml 
generated for apidocs does not seems to contain "count" argument as part of 
response structure. EX: for listVirtualMachines, below response from CS has 
count parameter, but apidocs does not have these references. 

{ "count":2 ,"virtualmachine" : [  
{"id":"c82ddb67-261c-4794-9b00-ee081f999466","name":"basicVM2","displayname":"basicVM2","account":"ccp11","domainid":"a282fb70-33cf-487c-9f24-14e5a565ff04","domain":"AA000004","created":"2014-04-11T09:28:41+0530","state":"Running","haenable":false,"groupid":"0f495cdd-143c-42e9-ba03-446fa3eb3288","group":"basicVM2","zoneid":"00f9edb1-5484-47bc-ba6b-d28aa03a5ed5","zonename":"Basic2","templateid":"acf13ade-bd9b-11e3-b856-0e6bf445a756","templatename":"CentOS
 5.6(64-bit) no GUI (XenServer)","templatedisplaytext":"CentOS 5.6(64-bit) no 
GUI 
(XenServer)","passwordenabled":false,"serviceofferingid":"41f933ea-6137-438b-9c9e-3b83c946f9f1","serviceofferingname":"Medium
 
Instance","cpunumber":1,"cpuspeed":128,"memory":128,"cpuused":"0.01%","networkkbsread":57077,"networkkbswrite":365,"diskkbsread":0,"diskkbswrite":0,"diskioread":0,"diskiowrite":0,"guestosid":"ad7cd0a8-bd9b-11e3-b856-0e6bf445a756","rootdeviceid":0,"rootdevicetype":"ROOT","securitygroup":[{"id":"0a22f405-be1a-4e19-a07b-a5123433e6d9","name":"default","description":"Default
 Security 
Group","account":"ccp11","ingressrule":[],"egressrule":[],"tags":[]}],"nic":[{"id":"84f8f52c-68a6-4b36-a5ee-993139caa227","networkid":"b2f7c802-566b-4136-87ca-fcf361065051","networkname":"defaultGuestNetwork","netmask":"255.255.240.0","gateway":"10.105.112.1","ipaddress":"10.105.115.238","broadcasturi":"vlan://untagged","traffictype":"Guest","type":"Shared","isdefault":true,"macaddress":"06:c5:40:00:00:27"}],"hypervisor":"XenServer","tags":[],"details":{"hypervisortoolsversion":"xenserver56"},"affinitygroup":[],"displayvm":true,"isdynamicallyscalable":true},
 
{"id":"35312098-e20a-4a3c-9311-cc10d431f5b1","name":"fvm1","displayname":"fvm2","account":"ccp11","domainid":"a282fb70-33cf-487c-9f24-14e5a565ff04","domain":"AA000004","created":"2014-04-10T16:22:11+0530","state":"Stopped","haenable":false,"groupid":"c5acf387-da00-4f84-a081-80b47be0bdf6","group":"fvm2","zoneid":"ded7f6db-0b71-4de6-b7e2-c8a89c09b0fb","zonename":"Advance-1","templateid":"acf13ade-bd9b-11e3-b856-0e6bf445a756","templatename":"CentOS
 5.6(64-bit) no GUI (XenServer)","templatedisplaytext":"CentOS 5.6(64-bit) no 
GUI 
(XenServer)","passwordenabled":false,"serviceofferingid":"e8b7381d-979e-45fc-869e-34137a2449e8","serviceofferingname":"Tiny
 
Instance","cpunumber":1,"cpuspeed":64,"memory":64,"guestosid":"ad7cd0a8-bd9b-11e3-b856-0e6bf445a756","rootdeviceid":0,"rootdevicetype":"ROOT","securitygroup":[],"nic":[{"id":"abb1426d-a151-4a86-8ab2-ff23ae8c93fb","networkid":"1393fc5d-be74-4e86-9f9f-ce6c207ea6eb","networkname":"ccp11-default
 
Network","netmask":"255.255.255.0","gateway":"10.1.1.1","ipaddress":"10.1.1.10","traffictype":"Guest","type":"Isolated","isdefault":true,"macaddress":"02:00:31:2c:00:01"}],"hypervisor":"XenServer","tags":[],"details":{"hypervisortoolsversion":"xenserver56"},"keypair":"testkey2","affinitygroup":[],"displayvm":true,"isdynamicallyscalable":true}
 ] }

2. Adding annotation as part of ListResponse for count parameter does not have 
effect to apidocs for corresponding command.

3. Also,  getCount seems to return null instead, we can return zero.

public Integer getCount() {
        if (count != null) {
            return count;
        }

        if (responses != null) {
            return responses.size();
        }

        return null;

4. The docs currently does not reflect the response as an array of sub 
elements. Even, if we add "count", there is no way to know that the responses 
are actually list of subelements. EX: ListRegions should have a response 
structure defined as part of docs to say its a list of Region responses. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to