allow filters to be specified in most Get() calls
[plcapi.git] / PLC / Methods / GetForeignNodes.py
index e9c2321..9676da4 100644 (file)
@@ -5,25 +5,30 @@
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
+from PLC.Filter import Filter
 from PLC.Auth import Auth
 
 from PLC.ForeignNodes import ForeignNode, ForeignNodes
 
-class GetForeignNodes (Method):
+class GetForeignNodes(Method):
     """
-    returns information on foreign nodes
+    Returns an array of structs containing details about foreign
+    nodes. If foreign_node_filter is specified and is an array of
+    foreign node identifiers or hostnames, or a struct of foreign node
+    attributes, only foreign nodes matching the filter will be
+    returned.
     """
 
     roles = ['admin']
 
-    accepts = [ Auth(),
-               [ Mixed(ForeignNode.fields['node_id'],
-                       ForeignNode.fields['hostname'])]
-               ]
+    accepts = [
+        Auth(),
+        Mixed([Mixed(ForeignNode.fields['node_id'],
+                     ForeignNode.fields['hostname'])],
+              Filter(ForeignNode.fields))
+        ]
     
-    returns = [ ForeignNode.fields]
+    returns = [ForeignNode.fields]
 
-    def call (self, auth, foreign_id_or_hostname_list = None):
-
-       return ForeignNodes (self.api, foreign_id_or_hostname_list).values()
-       
+    def call(self, auth, foreign_node_filter = None):
+       return ForeignNodes(self.api, foreign_node_filter).values()