Revision d1856abf
b/kamaki/cli.py | ||
---|---|---|
749 | 749 |
self.client.set_object_meta(object, {metakey:metavalue}) |
750 | 750 |
|
751 | 751 |
@command(api='storage') |
752 |
class store_setquota(_store_account_command): |
|
753 |
"""Set new quota (in KB) for account [or container]""" |
|
754 |
|
|
755 |
def main(self, quota, container = None): |
|
756 |
super(store_setquota, self).main() |
|
757 |
if container is None: |
|
758 |
self.client.set_account_quota(quota) |
|
759 |
else: |
|
760 |
self.client.container = container |
|
761 |
self.client.set_container_quota(quota) |
|
762 |
|
|
763 |
@command(api='storage') |
|
764 |
class store_setversioning(_store_account_command): |
|
765 |
"""Set new versioning (auto, none) for account [or container]""" |
|
766 |
|
|
767 |
def main(self, versioning, container = None): |
|
768 |
super(store_setversioning, self).main() |
|
769 |
if container is None: |
|
770 |
self.client.set_account_versioning(versioning) |
|
771 |
else: |
|
772 |
self.client.container = container |
|
773 |
self.client.set_container_versioning(versioning) |
|
774 |
|
|
775 |
@command(api='storage') |
|
752 | 776 |
class store_delmeta(_store_account_command): |
753 | 777 |
"""Delete an existing metadatum of account [, container [or object]]""" |
754 | 778 |
|
... | ... | |
764 | 788 |
self.client.delete_object_meta(metakey, object) |
765 | 789 |
|
766 | 790 |
@command(api='storage') |
767 |
class store_policy(_store_account_command): |
|
768 |
"""Get policy for account [, container [or object]]""" |
|
791 |
class store_quota(_store_account_command): |
|
792 |
"""Get quota for account [or container]""" |
|
793 |
|
|
794 |
def main(self, container = None): |
|
795 |
super(store_quota, self).main() |
|
796 |
if container is None: |
|
797 |
reply = self.client.get_account_quota() |
|
798 |
else: |
|
799 |
reply = self.client.get_container_quota(container) |
|
800 |
print_dict(reply) |
|
801 |
|
|
802 |
@command(api='storage') |
|
803 |
class store_versioning(_store_account_command): |
|
804 |
"""Get versioning for account [or container ]""" |
|
769 | 805 |
|
770 | 806 |
def main(self, container = None): |
771 |
super(store_policy, self).main()
|
|
807 |
super(store_versioning, self).main()
|
|
772 | 808 |
if container is None: |
773 |
reply = self.client.get_account_policy()
|
|
809 |
reply = self.client.get_account_versioning()
|
|
774 | 810 |
else: |
775 |
reply = self.client.get_container_policy(container)
|
|
811 |
reply = self.client.get_container_versioning(container)
|
|
776 | 812 |
print_dict(reply) |
777 | 813 |
|
778 | 814 |
@command(api='storage') |
b/kamaki/clients/pithos.py | ||
---|---|---|
127 | 127 |
self.put(path, json=hashmap, |
128 | 128 |
success=201) |
129 | 129 |
|
130 |
def get_account_policy(self): |
|
131 |
return filter_in(self.get_account_info(), 'X-Account-Policy-') |
|
130 |
def get_account_quota(self): |
|
131 |
return filter_in(self.get_account_info(), 'X-Account-Policy-Quota') |
|
132 |
|
|
133 |
def get_account_versioning(self): |
|
134 |
return filter_in(self.get_account_info(), 'X-Account-Policy-Versioning') |
|
132 | 135 |
|
133 | 136 |
def get_account_meta(self): |
134 | 137 |
return filter_in(self.get_account_info(), 'X-Account-Meta-') |
... | ... | |
141 | 144 |
self.set_header('X-Account-Meta-'+key, val) |
142 | 145 |
self.post(path, success=202) |
143 | 146 |
|
144 |
def get_container_policy(self, container): |
|
145 |
return filter_in(self.get_container_info(container), 'X-Container-Policy-') |
|
147 |
def set_account_quota(self, quota): |
|
148 |
self.assert_account() |
|
149 |
path = path4url(self.account)+params4url({'update':None}) |
|
150 |
self.set_header('X-Account-Policy-Quota', quota) |
|
151 |
self.post(path, success=202) |
|
152 |
|
|
153 |
def set_account_versioning(self, versioning): |
|
154 |
self.assert_account() |
|
155 |
path = path4url(self.account)+params4url({'update':None}) |
|
156 |
self.set_header('X-Account-Policy-Versioning', versioning) |
|
157 |
self.post(path, success=202) |
|
158 |
|
|
159 |
def get_container_versioning(self, container): |
|
160 |
return filter_in(self.get_container_info(container), 'X-Container-Policy-Versioning') |
|
161 |
|
|
162 |
def get_container_quota(self, container): |
|
163 |
return filter_in(self.get_container_info(container), 'X-Container-Policy-Quota') |
|
146 | 164 |
|
147 | 165 |
def get_container_meta(self, container): |
148 | 166 |
return filter_in(self.get_container_info(container), 'X-Container-Meta-') |
... | ... | |
173 | 191 |
self.set_header('X-Container-Meta-'+key, val) |
174 | 192 |
self.post(path, success=202) |
175 | 193 |
|
194 |
def set_container_quota(self, quota): |
|
195 |
self.assert_container() |
|
196 |
path = path4url(self.account, self.container)+params4url({'update':None}) |
|
197 |
self.set_header('X-Container-Policy-Quota', quota) |
|
198 |
self.post(path, success=202) |
|
199 |
|
|
200 |
def set_container_versioning(self, versioning): |
|
201 |
self.assert_container() |
|
202 |
path = path4url(self.account, self.container)+params4url({'update':None}) |
|
203 |
self.set_header('X-Container-Policy-Versioning', versioning) |
|
204 |
self.post(path, success=202) |
|
205 |
|
|
176 | 206 |
def set_object_meta(self, object, metapairs): |
177 | 207 |
assert(type(metapairs) is dict) |
178 | 208 |
self.assert_container() |
... | ... | |
192 | 222 |
path = path4url(self.account, self.container, object)+params4url({'update':None}) |
193 | 223 |
self.set_header('X-Object-Public', False) |
194 | 224 |
self.post(path, success=202) |
195 |
|
|
196 |
|
|
197 |
|
Also available in: Unified diff