summaryrefslogtreecommitdiff
path: root/barbicanclient/client.py
diff options
context:
space:
mode:
authorAdam Harwell <flux.adam@gmail.com>2014-09-29 16:14:18 -0500
committerAdam Harwell <flux.adam@gmail.com>2014-10-08 16:45:37 -0500
commit0966770a0eef4c84b0e9a4c5c32cf757afd90db7 (patch)
treebc26fe78b44eadc0ca84315c15d7a88855f04920 /barbicanclient/client.py
parent075e213391f7588604e1188758117a95595c26f9 (diff)
downloadpython-barbicanclient-0966770a0eef4c84b0e9a4c5c32cf757afd90db7.tar.gz
Fix consistency between Order/Secret/Container
Order/Secret capitalized factory methods disappear and are replaced by more appropriate get/create methods in their respective managers, to match the revised Container code. The higher level REST functions for get/get_raw/post/delete become private so that the namespace for developers using the client is much cleaner. For example, nothing is visible in the top level client object besides the manager classes for container/secret/order and nothing is visible inside the manager classes besides the appropriate get/create/delete methods (or other applicable functions). Internally, the barbican_cli code uses at least one private property from ContainerManager, but it is assumed to be OK since it is within the same "package", and the code will be maintained simultaneously. Change-Id: I89525506f3be26b77421a5b8efa49bb645169aaf
Diffstat (limited to 'barbicanclient/client.py')
-rw-r--r--barbicanclient/client.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/barbicanclient/client.py b/barbicanclient/client.py
index 71d0d43..fb89637 100644
--- a/barbicanclient/client.py
+++ b/barbicanclient/client.py
@@ -97,7 +97,7 @@ class Client(object):
self._barbican_url = self._get_normalized_endpoint(endpoint)
self._tenant_id = tenant_id
- self.base_url = '{0}'.format(self._barbican_url)
+ self._base_url = '{0}'.format(self._barbican_url)
self.secrets = secrets.SecretManager(self)
self.orders = orders.OrderManager(self)
self.containers = containers.ContainerManager(self)
@@ -161,27 +161,27 @@ class Client(object):
if isinstance(headers, dict) and not self._session.auth:
headers['X-Project-Id'] = self._tenant_id
- def get(self, href, params=None):
+ def _get(self, href, params=None):
headers = {'Accept': 'application/json'}
self._prepare_auth(headers)
resp = self._session.get(href, params=params, headers=headers)
self._check_status_code(resp)
return resp.json()
- def get_raw(self, href, headers):
+ def _get_raw(self, href, headers):
self._prepare_auth(headers)
resp = self._session.get(href, headers=headers)
self._check_status_code(resp)
return resp.content
- def delete(self, href, json=None):
+ def _delete(self, href, json=None):
headers = {}
self._prepare_auth(headers)
resp = self._session.delete(href, headers=headers, json=json)
self._check_status_code(resp)
- def post(self, path, data):
- url = '{0}/{1}/'.format(self.base_url, path)
+ def _post(self, path, data):
+ url = '{0}/{1}/'.format(self._base_url, path)
headers = {'content-type': 'application/json'}
self._prepare_auth(headers)
resp = self._session.post(url, data=json.dumps(data), headers=headers)