MCPcopy Create free account
hub / github.com/s3tools/s3cmd / object_restore

Method object_restore

S3/S3.py:898–915  ·  view source on GitHub ↗
(self, uri)

Source from the content-addressed store, hash-verified

896 return response
897
898 def object_restore(self, uri):
899 if uri.type != "s3":
900 raise ValueError("Expected URI type 's3', got '%s'" % uri.type)
901 if self.config.restore_days < 1:
902 raise ParameterError("You must restore a file for 1 or more days")
903 if self.config.restore_priority not in ['Standard', 'Expedited', 'Bulk']:
904 raise ParameterError("Valid restoration priorities: bulk, standard, expedited")
905 body = '<RestoreRequest xmlns="http://s3.amazonaws.com/doc/2006-03-01/">'
906 body += (' <Days>%s</Days>' % self.config.restore_days)
907 body += ' <GlacierJobParameters>'
908 body += (' <Tier>%s</Tier>' % self.config.restore_priority)
909 body += ' </GlacierJobParameters>'
910 body += '</RestoreRequest>'
911 request = self.create_request("OBJECT_POST", uri = uri, body = body,
912 uri_params = {'restore': None})
913 response = self.send_request(request)
914 debug("Received response '%s'" % (response))
915 return response
916
917 def _sanitize_headers(self, headers):
918 to_remove = [

Callers

nothing calls this directly

Calls 3

create_requestMethod · 0.95
send_requestMethod · 0.95
ParameterErrorClass · 0.85

Tested by

no test coverage detected