eBayClassifiedsGroup/nsnitro

Create a filter function for retrieving available resources

Opened this issue · 10 comments

It would be nice to have a generic filter f unction that can take resourcetype and filter field and return resources matching that filter.

There is a filter function in base resource in java, I haven't ported it yet. I'll try to do it in the coming days.

Hmm, actually...

there is base_resource.getfiltered(), but it's an addition to each objecttype of a sort:

   /**
    * Use this API to fetch filtered set of lbvserver resources.
    * set the filter parameter values in filtervalue object.
    */
    public static lbvserver[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{
            lbvserver obj = new lbvserver();
            options option = new options();
            option.set_filter(filter);
            lbvserver[] response = (lbvserver[]) obj.getfiltered(service, option);
            return response;
    }

Where filter value (of options string in another overload) should be a filter string in JSON format.. Not really elegant.

Ok.. will try that and see if i can improve it... once i find some free time.

Hi also, do you have any plans to refactor some code..esp.. the classes deriving nsbaseresource ..
To begin with i think the get and set functions should be replaced and options should become attributes... (again, i'll have to look up the syntactic sugar to be more precise.)

Sure, my python is quite rusty and originates from the stone age, so if there're some improvements that can be made I'm all for it.

Unfortunately my python ain't shiny and new either.... it's not rusty but dull and coarse..:-) will keep sharpening it though..

Anyways, i noticed that NSBaseResource.delete_resource calls delete_get_args and appends the options. The NS 9.3 documentation doesn't mention args at all... is it there for 9.2 compatibility?? it fails on NS 9.3 with error Invalid argument..

Hmm, it works on 9.2. Basically I was porting 9.2's API. If there's something to fix with 9.3, then we definitely should. I don't have a 9.3 handy. The best would be to have a look at API that's a part of 9.3 and see how it done there.

Preferably fix it in a way that 9.2 doesn't break either :P

Oh.. ok just created a new issue with the sample code... Update there if you have any insights after looking at the code... I will get on with trying out binding creation part...

Euh, commented wrong issue it seems. I just added nsservicegroup.py containing NSServiceGroup class, can you try?