Revision 43540670
b/kamaki/cli/commands/pithos.py | ||
---|---|---|
1545 | 1545 |
'set container versioning (auto/none)', '--versioning'), |
1546 | 1546 |
limit=IntArgument('set default container limit', '--limit'), |
1547 | 1547 |
meta=KeyValueArgument( |
1548 |
'set container metadata (can be repeated)', '--meta') |
|
1548 |
'set container metadata (can be repeated)', '--meta'), |
|
1549 |
project=ValueArgument('assign the container to project', '--project'), |
|
1549 | 1550 |
) |
1550 | 1551 |
|
1551 | 1552 |
@errors.generic.all |
... | ... | |
1557 | 1558 |
container=container, |
1558 | 1559 |
sizelimit=self['limit'], |
1559 | 1560 |
versioning=self['versioning'], |
1561 |
project=self['project'], |
|
1560 | 1562 |
metadata=self['meta'], |
1561 | 1563 |
success=(201, )) |
1562 | 1564 |
except ClientError as ce: |
... | ... | |
1624 | 1626 |
self._run(container) |
1625 | 1627 |
|
1626 | 1628 |
|
1629 |
@command(container_cmds) |
|
1630 |
class container_reassign(_pithos_account, _optional_output_cmd): |
|
1631 |
"""Assign a container to a different project |
|
1632 |
""" |
|
1633 |
|
|
1634 |
@errors.generic.all |
|
1635 |
@errors.pithos.connection |
|
1636 |
@errors.pithos.container |
|
1637 |
def _run(self, project): |
|
1638 |
if self.container: |
|
1639 |
self.client.container = self.container |
|
1640 |
self._optional_output(self.client.reassign_container(project)) |
|
1641 |
|
|
1642 |
def main(self, container, project): |
|
1643 |
super(self.__class__, self)._run() |
|
1644 |
self.container = container |
|
1645 |
self._run(project) |
|
1646 |
|
|
1647 |
|
|
1627 | 1648 |
@command(sharer_cmds) |
1628 | 1649 |
class sharer_list(_pithos_account, _optional_json): |
1629 | 1650 |
"""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 |
... | ... | |
1551 | 1551 |
self._assert_container() |
1552 | 1552 |
r = self.object_get(obj, format='json', version='list') |
1553 | 1553 |
return r.json['versions'] |
1554 |
|
|
1555 |
def reassign_container(self, project): |
|
1556 |
r = self.container_post(project=project) |
|
1557 |
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