]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
googlestorage_container.py: Implement DELETE object.
authorItamar Turner-Trauring <itamar@futurefoundries.com>
Mon, 4 Mar 2013 20:06:45 +0000 (15:06 -0500)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 9 Apr 2014 00:33:55 +0000 (01:33 +0100)
src/allmydata/storage/backends/cloud/googlestorage/googlestorage_container.py

index 5e91c87f0ec1f7f4210a4b2657565db7e1cf21b8..d272bd3ce40aebc69313121d6808a2ac9ab03012 100644 (file)
@@ -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