X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=trunk%2FPLC%2FMethods%2FGetAddresses.py;fp=trunk%2FPLC%2FMethods%2FGetAddresses.py;h=b299295ee7e4d657841a691fb8dd37441c6550cb;hb=5a4c1b1278ffa01e630fde47f7c54888ed20a576;hp=0000000000000000000000000000000000000000;hpb=cee5ab52df1c9f38b6eaff2dd354cb22f59028c7;p=plcapi.git diff --git a/trunk/PLC/Methods/GetAddresses.py b/trunk/PLC/Methods/GetAddresses.py new file mode 100644 index 0000000..b299295 --- /dev/null +++ b/trunk/PLC/Methods/GetAddresses.py @@ -0,0 +1,30 @@ +from PLC.Faults import * +from PLC.Method import Method +from PLC.Parameter import Parameter, Mixed +from PLC.Filter import Filter +from PLC.Addresses import Address, Addresses +from PLC.Auth import Auth + +class GetAddresses(Method): + """ + Returns an array of structs containing details about addresses. If + address_filter is specified and is an array of address + identifiers, or a struct of address attributes, only addresses + matching the filter will be returned. If return_fields is + specified, only the specified details will be returned. + """ + + roles = ['admin', 'pi', 'user', 'tech', 'node'] + + accepts = [ + Auth(), + Mixed([Address.fields['address_id']], + Filter(Address.fields)), + Parameter([str], "List of fields to return", nullok = True) + ] + + returns = [Address.fields] + + + def call(self, auth, address_filter = None, return_fields = None): + return Addresses(self.api, address_filter, return_fields)