def container_set_properties(self, account=None, reference=None, properties=None, clear=False, cid=None, system=None, **kwargs): params = self._make_params(account, reference, cid=cid) if clear: params["flush"] = 1 data = json.dumps({ 'properties': properties or {}, 'system': system or {} }) del_cached_container_metadata(account=account, reference=reference, cid=cid, **kwargs) _resp, body = self._request('POST', '/set_properties', data=data, params=params, **kwargs) return body
def container_delete(self, account=None, reference=None, cid=None, **kwargs): """ Delete a container. :param account: account from which to delete the container :type account: `str` :param reference: name of the container :type reference: `str` :param cid: container id that can be used instead of account and reference :type cid: `str` :keyword headers: extra headers to send to the proxy :type headers: `dict` """ params = self._make_params(account, reference, cid=cid) del_cached_container_metadata(account=account, reference=reference, cid=cid, **kwargs) try: self._request('POST', '/destroy', params=params, **kwargs) except exceptions.Conflict as exc: raise exceptions.ContainerNotEmpty(exc)
def container_freeze(self, account=None, reference=None, cid=None, **kwargs): """ Freeze the database of a container :param account: account in which the container is :type account: `str` :param reference: name of the container :type reference: name of the container :param cid: container id that can be used instead of account and reference """ uri = self._make_uri('admin/freeze') params = self._make_params(account, reference, cid=cid) params.update({"type": "meta2"}) del_cached_container_metadata(account=account, reference=reference, cid=cid, **kwargs) resp, _ = self._direct_request('POST', uri, params=params, **kwargs) return resp
def container_del_properties(self, account=None, reference=None, properties=[], cid=None, **kwargs): params = self._make_params(account, reference, cid=cid) data = json.dumps(properties) del_cached_container_metadata( account=account, reference=reference, cid=cid, **kwargs) _resp, body = self._request( 'POST', '/del_properties', data=data, params=params, **kwargs) return body