Revision 9c25c741
b/kamaki/cli/commands/pithos.py | ||
---|---|---|
1550 | 1550 |
'set container versioning (auto/none)', '--versioning'), |
1551 | 1551 |
limit=IntArgument('set default container limit', '--limit'), |
1552 | 1552 |
meta=KeyValueArgument( |
1553 |
'set container metadata (can be repeated)', '--meta') |
|
1553 |
'set container metadata (can be repeated)', '--meta'), |
|
1554 |
project=ValueArgument('assign the container to project', '--project'), |
|
1554 | 1555 |
) |
1555 | 1556 |
|
1556 | 1557 |
@errors.generic.all |
... | ... | |
1562 | 1563 |
container=container, |
1563 | 1564 |
sizelimit=self['limit'], |
1564 | 1565 |
versioning=self['versioning'], |
1566 |
project=self['project'], |
|
1565 | 1567 |
metadata=self['meta'], |
1566 | 1568 |
success=(201, )) |
1567 | 1569 |
except ClientError as ce: |
... | ... | |
1629 | 1631 |
self._run(container) |
1630 | 1632 |
|
1631 | 1633 |
|
1634 |
@command(container_cmds) |
|
1635 |
class container_reassign(_pithos_account, _optional_output_cmd): |
|
1636 |
"""Assign a container to a different project |
|
1637 |
""" |
|
1638 |
|
|
1639 |
@errors.generic.all |
|
1640 |
@errors.pithos.connection |
|
1641 |
@errors.pithos.container |
|
1642 |
def _run(self, project): |
|
1643 |
if self.container: |
|
1644 |
self.client.container = self.container |
|
1645 |
self._optional_output(self.client.reassign_container(project)) |
|
1646 |
|
|
1647 |
def main(self, container, project): |
|
1648 |
super(self.__class__, self)._run() |
|
1649 |
self.container = container |
|
1650 |
self._run(project) |
|
1651 |
|
|
1652 |
|
|
1632 | 1653 |
@command(sharer_cmds) |
1633 | 1654 |
class sharer_list(_pithos_account, _optional_json): |
1634 | 1655 |
"""List accounts who share file objects with current user""" |
b/kamaki/clients/pithos/__init__.py | ||
---|---|---|
108 | 108 |
def create_container( |
109 | 109 |
self, |
110 | 110 |
container=None, sizelimit=None, versioning=None, metadata=None, |
111 |
**kwargs): |
|
111 |
project=None, **kwargs):
|
|
112 | 112 |
""" |
113 | 113 |
:param container: (str) if not given, self.container is used instead |
114 | 114 |
|
... | ... | |
126 | 126 |
self.container = container or cnt_back_up |
127 | 127 |
r = self.container_put( |
128 | 128 |
quota=sizelimit, versioning=versioning, metadata=metadata, |
129 |
**kwargs) |
|
129 |
project=project, **kwargs)
|
|
130 | 130 |
return r.headers |
131 | 131 |
finally: |
132 | 132 |
self.container = cnt_back_up |
... | ... | |
1549 | 1549 |
self._assert_container() |
1550 | 1550 |
r = self.object_get(obj, format='json', version='list') |
1551 | 1551 |
return r.json['versions'] |
1552 |
|
|
1553 |
def reassign_container(self, project): |
|
1554 |
r = self.container_post(project=project) |
|
1555 |
return r.headers |
b/kamaki/clients/pithos/rest_api.py | ||
---|---|---|
292 | 292 |
|
293 | 293 |
def container_put( |
294 | 294 |
self, |
295 |
quota=None, versioning=None, metadata=None, |
|
295 |
quota=None, versioning=None, project=None, metadata=None,
|
|
296 | 296 |
*args, **kwargs): |
297 | 297 |
""" Full Pithos+ PUT at container level |
298 | 298 |
|
... | ... | |
311 | 311 |
|
312 | 312 |
self.set_header('X-Container-Policy-Quota', quota) |
313 | 313 |
self.set_header('X-Container-Policy-Versioning', versioning) |
314 |
if project: |
|
315 |
self.set_header('X-Container-Policy-project', project) |
|
316 |
|
|
314 | 317 |
if metadata: |
315 | 318 |
for metaname, metaval in metadata.items(): |
316 | 319 |
self.set_header('X-Container-Meta-' + metaname, metaval) |
... | ... | |
325 | 328 |
format='json', |
326 | 329 |
quota=None, |
327 | 330 |
versioning=None, |
331 |
project=None, |
|
328 | 332 |
metadata=None, |
329 | 333 |
content_type=None, |
330 | 334 |
content_length=None, |
... | ... | |
362 | 366 |
|
363 | 367 |
self.set_header('X-Container-Policy-Quota', quota) |
364 | 368 |
self.set_header('X-Container-Policy-Versioning', versioning) |
369 |
if project: |
|
370 |
self.set_header('X-Container-Policy-project', project) |
|
371 |
|
|
365 | 372 |
if metadata: |
366 | 373 |
for metaname, metaval in metadata.items(): |
367 | 374 |
self.set_header('X-Container-Meta-' + metaname, metaval) |
Also available in: Unified diff