1 from types import StringTypes
2 from sfa.util.faults import *
3 from sfa.util.xrn import urn_to_hrn
4 from sfa.util.method import Method
5 from sfa.util.parameter import Parameter, Mixed
6 from sfa.trust.auth import Auth
7 from sfa.server.aggregate import Aggregates
9 class get_aggregates(Method):
11 Get a list of connection information for all known aggregates.
13 @param cred credential string specifying the rights of the caller
14 @param a Human readable name (hrn or urn), or list of hrns or None
15 @return list of dictionaries with aggregate information.
18 interfaces = ['registry', 'aggregate', 'slicemgr']
21 Parameter(str, "Credential string"),
22 Mixed(Parameter(str, "Human readable name (hrn or urn)"),
23 Parameter(None, "hrn not specified"))
26 returns = [Parameter(dict, "Aggregate interface information")]
28 def call(self, cred, xrn = None):
29 hrn, type = urn_to_hrn(xrn)
30 self.api.auth.check(cred, 'list')
31 aggregates = Aggregates(self.api).interfaces.values()
33 aggregates = [agg for agg in aggregates if agg['hrn'] == hrn]