From a6fb6bbf24d2d3d12c8e163b90ef9b0c3cb94c3a Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Mon, 4 Mar 2013 15:06:45 -0500 Subject: [PATCH] googlestorage_container.py: Implement DELETE object. --- .../googlestorage/googlestorage_container.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/allmydata/storage/backends/cloud/googlestorage/googlestorage_container.py b/src/allmydata/storage/backends/cloud/googlestorage/googlestorage_container.py index 5e91c87f..d272bd3c 100644 --- a/src/allmydata/storage/backends/cloud/googlestorage/googlestorage_container.py +++ b/src/allmydata/storage/backends/cloud/googlestorage/googlestorage_container.py @@ -109,6 +109,24 @@ class GoogleStorageContainer(CommonContainerMixin): d.addCallback(lambda (response, body): body) return d + def _delete_object(self, object_name): + """ + Delete an object from this container. + """ + d = self._auth_client.get_authorization_header() + def _do_delete(auth_header): + request_headers = { + 'Authorization': [auth_header], + "x-goog-api-version": ["2"], + } + url = self._make_object_url(self.URI, object_name) + return self._http_request("DELETE object", 'DELETE', url, request_headers, + body=None, + need_response_body=False) + d.addCallback(_do_delete) + d.addCallback(lambda (response, body): body) + return d + if __name__ == '__main__': from twisted.internet import reactor -- 2.45.2