updated renew(), delete(), allocate(), provision()
[sfa.git] / sfa / methods / RenewSliver.py
index c64b884..ee951c0 100644 (file)
@@ -9,13 +9,15 @@ from sfa.trust.credential import Credential
 
 from sfa.storage.parameter import Parameter
 
-class RenewSliver(Method):
+class Renew(Method):
     """
-    Renews the resources in a sliver, extending the lifetime of the slice.    
-    @param slice_urn (string) URN of slice to renew
+    Renews the resources in the specified slice or slivers by 
+    extending the lifetime.
+    
+    @param surn ([string]) List of URNs of to renew
     @param credentials ([string]) of credentials
     @param expiration_time (string) requested time of expiration
-    
+    @param options (dict) options
     """
     interfaces = ['aggregate', 'slicemgr']
     accepts = [
@@ -26,14 +28,12 @@ class RenewSliver(Method):
         ]
     returns = Parameter(bool, "Success or Failure")
 
-    def call(self, slice_xrn, creds, expiration_time, options):
-
-        (hrn, type) = urn_to_hrn(slice_xrn)
+    def call(self, urns, creds, expiration_time, options):
 
-        self.api.logger.info("interface: %s\ttarget-hrn: %s\tcaller-creds: %s\tmethod-name: %s"%(self.api.interface, hrn, creds, self.name))
+        self.api.logger.info("interface: %s\ttarget-hrn: %s\tcaller-creds: %s\tmethod-name: %s"%(self.api.interface, urns, creds, self.name))
 
         # Find the valid credentials
-        valid_creds = self.api.auth.checkCredentials(creds, 'renewsliver', hrn)
+        valid_creds = self.api.auth.checkCredentials(creds, 'renewsliver', urns)
 
         # Validate that the time does not go beyond the credential's expiration time
         requested_time = utcparse(expiration_time)
@@ -42,5 +42,5 @@ class RenewSliver(Method):
             raise InsufficientRights('Renewsliver: Credential expires before requested expiration time')
         if requested_time > datetime.datetime.utcnow() + datetime.timedelta(days=max_renew_days):
             raise Exception('Cannot renew > %s days from now' % max_renew_days)
-        return self.api.manager.RenewSliver(self.api, slice_xrn, valid_creds, expiration_time, options)
+        return self.api.manager.Renew(self.api, urns, expiration_time, options)