Gaurav,

"Ideally, when we search by Id, then exception should be thrown and when
We expect by passing account/domainid/projectid/networkid etc, then
Noneshould be returned. Do all List APIs follow a similar guideline?²

Yes, all of CS APIs follow this behavior. If non-existing Id is passed in,
then the error is thrown by the DB Id validator. In case of public ip
address its different, and let me explain why.

When the ip gets disassociated, it doesn¹t get deleted. It¹s just marked
as non-allocated, and left in the DB so next associateIpAddress can pick
it up. Therefore you don¹t see any exception when requesting the ip by id.
Why empty list is returned then? Because by default, listPublicIpAddresses
returns allocated ips only. If you want to see free ips as well, you have
to pass ³allocatedOnly=false² to the call.

Hope it answers your question.

-Alena.



On 8/8/14, 2:05 AM, "Gaurav Aradhye" <gaurav.arad...@clogeny.com> wrote:

>Thanks Daan. I will update the page.
>
>Regards,
>Gaurav
>
>
>On Fri, Aug 8, 2014 at 2:20 PM, Daan Hoogland <daan.hoogl...@gmail.com>
>wrote:
>
>> Gaurav,
>>
>> I think you are now pointing at one of the qualities of our API that
>> need to be addressed in 5.0 [1]. I may be wrong but I don't think a
>> standard behavior in these cases is defined and every list api has a
>> choice of several conventions to folow. Feel free to define what the
>> behavior should be in a future version by editing [1] :)
>>
>> [1] https://cwiki.apache.org/confluence/display/CLOUDSTACK/API+changes
>>
>> On Fri, Aug 8, 2014 at 10:44 AM, Gaurav Aradhye
>> <gaurav.arad...@clogeny.com> wrote:
>> > Hello,
>> >
>> > Can somebody please address this query?
>> >
>> > Regards,
>> > Gaurav
>> >
>> >
>> > On Thu, Aug 7, 2014 at 10:23 PM, Gaurav Aradhye <
>> gaurav.arad...@clogeny.com>
>> > wrote:
>> >
>> >> I want to understand the output of the list APIs when the entity is
>>not
>> >> present / deleted. Suppose I create an account, create a network
>>within
>> it
>> >> and acquire a public IP address in the network.
>> >>
>> >> 1) ListPublicIpAddresses  - public ip id passed, returns public IP
>> >> 2) ListPublicIpAddresses - account, domainid passed, returns public
>>IP
>> >>
>> >> Now I delete the public IP (Disassociate).
>> >>
>> >> After this operation, I expect following results:
>> >> 1) ListPublicIpAddreses - account,domain id passed, result: None
>> (assuming
>> >> there was only one)
>> >> 2) ListPublicIpAddresses - public ip id passed, I expect exception
>>here
>> >> because the id must have been removed from DB. But I get "None" as
>> result
>> >> here.
>> >>
>> >> If I get None, then can I assume that id is still present in DB but
>>it
>> is
>> >> marked as obsolete?
>> >>
>> >> When can I expect an exception in return? And when can I expect None?
>> >> Ideally, when we search by Id, then exception should be thrown and
>>when
>> we
>> >> expect by passing account/domainid/projectid/networkid etc, then None
>> >> should be returned. Do all List APIs follow a similar guideline?
>> >>
>> >> Regards,
>> >> Gaurav
>> >>
>>
>>
>>
>> --
>> Daan

Reply via email to