added 2 new methods, 'get_aggregates' and 'get_registries'
authorTony Mack <tmack@cs.princeton.edu>
Fri, 14 Aug 2009 00:52:06 +0000 (00:52 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Fri, 14 Aug 2009 00:52:06 +0000 (00:52 +0000)
sfa/methods/get_aggregates.py [new file with mode: 0644]
sfa/methods/get_registries.py [new file with mode: 0644]

diff --git a/sfa/methods/get_aggregates.py b/sfa/methods/get_aggregates.py
new file mode 100644 (file)
index 0000000..4e45969
--- /dev/null
@@ -0,0 +1,37 @@
+### $Id: get_slices.py 14387 2009-07-08 18:19:11Z faiyaza $
+### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/get_aggregates.py $
+
+from sfa.util.faults import *
+from sfa.util.misc import *
+from sfa.util.method import Method
+from sfa.util.parameter import Parameter, Mixed
+from sfa.trust.auth import Auth
+from sfa.server.aggregate import Aggregates
+
+class get_aggregates(Method):
+    """
+    Get a list of connection information for all known aggregates.      
+
+    @param cred credential string specifying the rights of the caller
+    @param a Human readable name (hrn), or list of hrns or None
+    @return list of dictionaries with aggregate information.  
+    """
+
+    interfaces = ['registry', 'aggregate', 'slicemgr']
+    
+    accepts = [
+        Parameter(str, "Credential string"),
+        Mixed([Parameter(str, "Human readable name (hrn)")],
+              Parameter(str, "Human readable name (hrn)"),
+              Parameter(None, "hrn not specified"))  
+        ]
+
+    returns = [Parameter(dict, "Aggregate interface information")]
+    
+    def call(self, cred, hrn = None):
+       
+        self.api.auth.check(cred, 'list')
+        aggregates = Aggregates(self.api)
+        print "SHIT"
+        print aggregates.interfaces
+        return aggregates.interfaces
diff --git a/sfa/methods/get_registries.py b/sfa/methods/get_registries.py
new file mode 100644 (file)
index 0000000..ed46b5a
--- /dev/null
@@ -0,0 +1,35 @@
+### $Id: get_slices.py 14387 2009-07-08 18:19:11Z faiyaza $
+### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/get_registries.py $
+
+from sfa.util.faults import *
+from sfa.util.misc import *
+from sfa.util.method import Method
+from sfa.util.parameter import Parameter, Mixed
+from sfa.trust.auth import Auth
+from sfa.server.registry import Registries
+
+class get_registries(Method):
+    """
+    Get a list of connection information for all known registries.      
+
+    @param cred credential string specifying the rights of the caller
+    @param a Human readable name (hrn), or list of hrns or None
+    @return list of dictionaries with aggregate information.  
+    """
+
+    interfaces = ['registry', 'aggregate', 'slicemgr']
+    
+    accepts = [
+        Parameter(str, "Credential string"),
+        Mixed([Parameter(str, "Human readable name (hrn)")],
+              Parameter(str, "Human readable name (hrn)"),
+              Parameter(None, "hrn not specified"))  
+        ]
+
+    returns = [Parameter(dict, "Registry interface information")]
+    
+    def call(self, cred, hrn = None):
+       
+        self.api.auth.check(cred, 'list')
+        registries = Registries(self.api)
+        return registries.interfaces