a little nicer wrt pep8
[sfa.git] / sfa / methods / Status.py
1 from sfa.util.xrn import urn_to_hrn
2 from sfa.util.method import Method
3 from sfa.util.sfalogging import logger
4
5 from sfa.storage.parameter import Parameter, Mixed
6
7
8 class Status(Method):
9     """
10     Get the status of a sliver
11
12     @param slice_urn (string) URN of slice to allocate to
13
14     """
15     interfaces = ['aggregate']
16     accepts = [
17         Parameter(type([str]), "Slice or sliver URNs"),
18         Parameter(type([dict]), "credentials"),
19         Parameter(dict, "Options")
20     ]
21     returns = Parameter(dict, "Status details")
22
23     def call(self, xrns, creds, options):
24         valid_creds = self.api.auth.checkCredentialsSpeaksFor(
25             creds, 'sliverstatus', xrns,
26             check_sliver_callback=self.api.driver.check_sliver_credentials,
27             options=options)
28
29         logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s" %
30                     (self.api.interface, xrns, self.name))
31         return self.api.manager.Status(self.api, xrns, creds, options)