super(store_purge, self).main()
self.client.purge_container(container)
+@command(api='storage')
+class store_publish(_store_container_command):
+ """Publish an object"""
+
+ def main(self, container, object):
+ super(store_publish, self).main()
+ self.client.container = container
+ self.client.publish_object(object)
+
+@command(api='storage')
+class store_unpublish(_store_container_command):
+ """Unpublish an object"""
+
+ def main(self, container, object):
+ super(store_unpublish, self).main()
+ self.client.container = container
+ self.client.unpublish_object(object)
+
@command(api='astakos')
class astakos_authenticate(object):
"""Authenticate a user"""
data = kwargs.pop('data', None)
headers = kwargs.pop('headers', {})
headers.setdefault('X-Auth-Token', self.token)
+ publish = kwargs.pop('publish', None)
if directory:
headers.setdefault('Content-Type', 'application/directory')
if meta:
for key in meta.keys():
headers[key] = meta[key]
+
+ if publish is not None:
+ headers.setdefault('X-object-public', unicode(publish))
url = self.base_url + path
kwargs.setdefault('verify', False) # Disable certificate verification
path=path4url(self.account, self.container, object)+params4url({'update':None})
meta = prefix_keys(metapairs, 'X-Object-Meta-')
self.post(path, meta=meta, success=202)
+
+ def publish_object(self, object):
+ self.assert_container()
+ path = path4url(self.account, self.container, object)+params4url({'update':None})
+ self.post(path, publish=True, success=202)
+
+ def unpublish_object(self, object):
+ self.assert_container()
+ path = path4url(self.account, self.container, object)+params4url({'update':None})
+ self.post(path, publish=False, success=202)
+
+
+
return reply
def delete_container(self, container):
- #Response codes
- # Success 204
- # NotFound 404
- # Conflict(not empty) 409
self.assert_account()
path = path4url(self.account, container)
r = self.delete(path, success=(204, 404, 409))