summaryrefslogtreecommitdiff
path: root/saharaclient/api/base.py
diff options
context:
space:
mode:
authorJeremy Freudberg <jeremyfreudberg@gmail.com>2018-01-12 04:22:06 +0000
committerJeremy Freudberg <jeremyfreudberg@gmail.com>2018-01-25 05:47:33 +0000
commit45088c61f0798d2cf85e06a73df1cff089e0fec0 (patch)
treeb6b6bf12a23891d02639a1d30357c5e97cfa93de /saharaclient/api/base.py
parent44ecbf55c7aca7c783aa2e6a180379c089c47dc3 (diff)
downloadpython-saharaclient-45088c61f0798d2cf85e06a73df1cff089e0fec0.tar.gz
APIv2 support in client
* Support of all APIv2 features carried from APIv1 ("feature parity") * Minimum amount of docs to pass the gate * Endpoint manipulation and version discovery handled by keystoneauth * APIv2 feature: decommision of specific instances (doc change only) * APIv2 feature: force delete (new method) Unit tests will arrive in a future patch. bp v2-api-experimental-impl Co-Authored-By: Monty Taylor <mordred@inaugust.com> Change-Id: I32178439fe85cc6d5faf4ac2e33ae80c08619de5
Diffstat (limited to 'saharaclient/api/base.py')
-rw-r--r--saharaclient/api/base.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/saharaclient/api/base.py b/saharaclient/api/base.py
index 2d04716..9dccf13 100644
--- a/saharaclient/api/base.py
+++ b/saharaclient/api/base.py
@@ -120,7 +120,7 @@ class ResourceManager(object):
resp = self.api.put(url, **kwargs)
- if resp.status_code != 202:
+ if resp.status_code not in [200, 202]:
self._raise_api_exception(resp)
if response_key is not None:
data = get_json(resp)[response_key]
@@ -206,8 +206,12 @@ class ResourceManager(object):
else:
self._raise_api_exception(resp)
- def _delete(self, url):
- resp = self.api.delete(url)
+ def _delete(self, url, data=None):
+ if data is not None:
+ kwargs = {'json': data}
+ resp = self.api.delete(url, **kwargs)
+ else:
+ resp = self.api.delete(url)
if resp.status_code != 204:
self._raise_api_exception(resp)