From 51449a3a6446b8895882f882c91d03a0daef1192 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