Make sure we always requests JSON responses
This patch updates the client to make sure we are always requesting JSON format responses. The osc_lib does not request JSON by default for API calls. If we don't request JSON responses, the Octavia API can return HTML formated responses. Change-Id: I7f64d0c1c74b67ab1097d00282e55b9ba1a4f5a7 Story: 2004283 Task: 27833
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""Octavia API Library"""
|
"""Octavia API Library"""
|
||||||
|
import functools
|
||||||
|
|
||||||
from osc_lib.api import api
|
from osc_lib.api import api
|
||||||
|
|
||||||
@@ -50,6 +51,13 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
self.endpoint = self.endpoint.rstrip('/')
|
self.endpoint = self.endpoint.rstrip('/')
|
||||||
self._build_url()
|
self._build_url()
|
||||||
|
|
||||||
|
# Make sure we are always requesting JSON responses
|
||||||
|
JSON_HEADER = {'Accept': 'application/json'}
|
||||||
|
self._create = functools.partial(self.create, headers=JSON_HEADER)
|
||||||
|
self._delete = functools.partial(self.delete, headers=JSON_HEADER)
|
||||||
|
self._find = functools.partial(self.find, headers=JSON_HEADER)
|
||||||
|
self._list = functools.partial(self.list, headers=JSON_HEADER)
|
||||||
|
|
||||||
def _build_url(self):
|
def _build_url(self):
|
||||||
if not self.endpoint.endswith(self._endpoint_suffix):
|
if not self.endpoint.endswith(self._endpoint_suffix):
|
||||||
self.endpoint += self._endpoint_suffix
|
self.endpoint += self._endpoint_suffix
|
||||||
@@ -63,7 +71,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
List of load balancers
|
List of load balancers
|
||||||
"""
|
"""
|
||||||
url = const.BASE_LOADBALANCER_URL
|
url = const.BASE_LOADBALANCER_URL
|
||||||
response = self.list(url, **params)
|
response = self._list(url, **params)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -75,7 +83,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
:return:
|
:return:
|
||||||
A dict of the specified load balancer's settings
|
A dict of the specified load balancer's settings
|
||||||
"""
|
"""
|
||||||
response = self.find(path=const.BASE_LOADBALANCER_URL, value=lb_id)
|
response = self._find(path=const.BASE_LOADBALANCER_URL, value=lb_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -89,7 +97,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the created load balancer's settings
|
A dict of the created load balancer's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_LOADBALANCER_URL
|
url = const.BASE_LOADBALANCER_URL
|
||||||
response = self.create(url, **params)
|
response = self._create(url, **params)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -105,7 +113,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_LB_URL.format(uuid=lb_id)
|
url = const.BASE_SINGLE_LB_URL.format(uuid=lb_id)
|
||||||
response = self.delete(url, params=params)
|
response = self._delete(url, params=params)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -121,7 +129,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from API
|
Response Code from API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_LB_URL.format(uuid=lb_id)
|
url = const.BASE_SINGLE_LB_URL.format(uuid=lb_id)
|
||||||
response = self.create(url, method='PUT', **params)
|
response = self._create(url, method='PUT', **params)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -134,7 +142,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the specified load balancer's statistics
|
A dict of the specified load balancer's statistics
|
||||||
"""
|
"""
|
||||||
url = const.BASE_LB_STATS_URL.format(uuid=lb_id)
|
url = const.BASE_LB_STATS_URL.format(uuid=lb_id)
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -147,7 +155,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the specified load balancer's status
|
A dict of the specified load balancer's status
|
||||||
"""
|
"""
|
||||||
url = const.BASE_LOADBALANCER_STATUS_URL.format(uuid=lb_id)
|
url = const.BASE_LOADBALANCER_STATUS_URL.format(uuid=lb_id)
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -161,7 +169,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_LOADBALANCER_FAILOVER_URL.format(uuid=lb_id)
|
url = const.BASE_LOADBALANCER_FAILOVER_URL.format(uuid=lb_id)
|
||||||
response = self.create(url, method='PUT')
|
response = self._create(url, method='PUT')
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -174,7 +182,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
List of listeners
|
List of listeners
|
||||||
"""
|
"""
|
||||||
url = const.BASE_LISTENER_URL
|
url = const.BASE_LISTENER_URL
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -186,7 +194,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
:return:
|
:return:
|
||||||
A dict of the specified listener's settings
|
A dict of the specified listener's settings
|
||||||
"""
|
"""
|
||||||
response = self.find(path=const.BASE_LISTENER_URL, value=listener_id)
|
response = self._find(path=const.BASE_LISTENER_URL, value=listener_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -200,7 +208,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the created listener's settings
|
A dict of the created listener's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_LISTENER_URL
|
url = const.BASE_LISTENER_URL
|
||||||
response = self.create(url, **kwargs)
|
response = self._create(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -214,7 +222,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_LISTENER_URL.format(uuid=listener_id)
|
url = const.BASE_SINGLE_LISTENER_URL.format(uuid=listener_id)
|
||||||
response = self.delete(url)
|
response = self._delete(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -230,7 +238,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_LISTENER_URL.format(uuid=listener_id)
|
url = const.BASE_SINGLE_LISTENER_URL.format(uuid=listener_id)
|
||||||
response = self.create(url, method='PUT', **kwargs)
|
response = self._create(url, method='PUT', **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -243,7 +251,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the specified listener's statistics
|
A dict of the specified listener's statistics
|
||||||
"""
|
"""
|
||||||
url = const.BASE_LISTENER_STATS_URL.format(uuid=listener_id)
|
url = const.BASE_LISTENER_STATS_URL.format(uuid=listener_id)
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -256,7 +264,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
List of pools
|
List of pools
|
||||||
"""
|
"""
|
||||||
url = const.BASE_POOL_URL
|
url = const.BASE_POOL_URL
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -270,7 +278,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the created pool's settings
|
A dict of the created pool's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_POOL_URL
|
url = const.BASE_POOL_URL
|
||||||
response = self.create(url, **kwargs)
|
response = self._create(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -284,7 +292,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_POOL_URL.format(pool_id=pool_id)
|
url = const.BASE_SINGLE_POOL_URL.format(pool_id=pool_id)
|
||||||
response = self.delete(url)
|
response = self._delete(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -296,7 +304,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
:return:
|
:return:
|
||||||
Dict of the specified pool's settings
|
Dict of the specified pool's settings
|
||||||
"""
|
"""
|
||||||
response = self.find(path=const.BASE_POOL_URL, value=pool_id)
|
response = self._find(path=const.BASE_POOL_URL, value=pool_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -312,7 +320,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_POOL_URL.format(pool_id=pool_id)
|
url = const.BASE_SINGLE_POOL_URL.format(pool_id=pool_id)
|
||||||
response = self.create(url, method='PUT', **kwargs)
|
response = self._create(url, method='PUT', **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -327,7 +335,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response list members
|
Response list members
|
||||||
"""
|
"""
|
||||||
url = const.BASE_MEMBER_URL.format(pool_id=pool_id)
|
url = const.BASE_MEMBER_URL.format(pool_id=pool_id)
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -344,7 +352,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response of member
|
Response of member
|
||||||
"""
|
"""
|
||||||
url = const.BASE_MEMBER_URL.format(pool_id=pool_id)
|
url = const.BASE_MEMBER_URL.format(pool_id=pool_id)
|
||||||
response = self.find(path=url, value=member_id)
|
response = self._find(path=url, value=member_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -360,7 +368,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A member details on successful creation
|
A member details on successful creation
|
||||||
"""
|
"""
|
||||||
url = const.BASE_MEMBER_URL.format(pool_id=pool_id)
|
url = const.BASE_MEMBER_URL.format(pool_id=pool_id)
|
||||||
response = self.create(url, **kwargs)
|
response = self._create(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -377,7 +385,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_MEMBER_URL.format(pool_id=pool_id,
|
url = const.BASE_SINGLE_MEMBER_URL.format(pool_id=pool_id,
|
||||||
member_id=member_id)
|
member_id=member_id)
|
||||||
response = self.delete(url)
|
response = self._delete(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -396,7 +404,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_MEMBER_URL.format(pool_id=pool_id,
|
url = const.BASE_SINGLE_MEMBER_URL.format(pool_id=pool_id,
|
||||||
member_id=member_id)
|
member_id=member_id)
|
||||||
response = self.create(url, method='PUT', **kwargs)
|
response = self._create(url, method='PUT', **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -409,7 +417,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
List of l7policies
|
List of l7policies
|
||||||
"""
|
"""
|
||||||
url = const.BASE_L7POLICY_URL
|
url = const.BASE_L7POLICY_URL
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -423,7 +431,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the created l7policy's settings
|
A dict of the created l7policy's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_L7POLICY_URL
|
url = const.BASE_L7POLICY_URL
|
||||||
response = self.create(url, **kwargs)
|
response = self._create(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -437,7 +445,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_L7POLICY_URL.format(policy_uuid=l7policy_id)
|
url = const.BASE_SINGLE_L7POLICY_URL.format(policy_uuid=l7policy_id)
|
||||||
response = self.delete(url)
|
response = self._delete(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -449,7 +457,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
:return:
|
:return:
|
||||||
Dict of the specified l7policy's settings
|
Dict of the specified l7policy's settings
|
||||||
"""
|
"""
|
||||||
response = self.find(path=const.BASE_L7POLICY_URL, value=l7policy_id)
|
response = self._find(path=const.BASE_L7POLICY_URL, value=l7policy_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -465,7 +473,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_L7POLICY_URL.format(policy_uuid=l7policy_id)
|
url = const.BASE_SINGLE_L7POLICY_URL.format(policy_uuid=l7policy_id)
|
||||||
response = self.create(url, method='PUT', **kwargs)
|
response = self._create(url, method='PUT', **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -478,7 +486,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
List of l7rules
|
List of l7rules
|
||||||
"""
|
"""
|
||||||
url = const.BASE_L7RULE_URL.format(policy_uuid=l7policy_id)
|
url = const.BASE_L7RULE_URL.format(policy_uuid=l7policy_id)
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -494,7 +502,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the created l7rule's settings
|
A dict of the created l7rule's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_L7RULE_URL.format(policy_uuid=l7policy_id)
|
url = const.BASE_L7RULE_URL.format(policy_uuid=l7policy_id)
|
||||||
response = self.create(url, **kwargs)
|
response = self._create(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -511,7 +519,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_L7RULE_URL.format(rule_uuid=l7rule_id,
|
url = const.BASE_SINGLE_L7RULE_URL.format(rule_uuid=l7rule_id,
|
||||||
policy_uuid=l7policy_id)
|
policy_uuid=l7policy_id)
|
||||||
response = self.delete(url)
|
response = self._delete(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -526,7 +534,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Dict of the specified l7rule's settings
|
Dict of the specified l7rule's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_L7RULE_URL.format(policy_uuid=l7policy_id)
|
url = const.BASE_L7RULE_URL.format(policy_uuid=l7policy_id)
|
||||||
response = self.find(path=url, value=l7rule_id)
|
response = self._find(path=url, value=l7rule_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -545,7 +553,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_L7RULE_URL.format(rule_uuid=l7rule_id,
|
url = const.BASE_SINGLE_L7RULE_URL.format(rule_uuid=l7rule_id,
|
||||||
policy_uuid=l7policy_id)
|
policy_uuid=l7policy_id)
|
||||||
response = self.create(url, method='PUT', **kwargs)
|
response = self._create(url, method='PUT', **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -558,7 +566,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict containing a list of health monitors
|
A dict containing a list of health monitors
|
||||||
"""
|
"""
|
||||||
url = const.BASE_HEALTH_MONITOR_URL
|
url = const.BASE_HEALTH_MONITOR_URL
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -572,7 +580,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the created health monitor's settings
|
A dict of the created health monitor's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_HEALTH_MONITOR_URL
|
url = const.BASE_HEALTH_MONITOR_URL
|
||||||
response = self.create(url, **kwargs)
|
response = self._create(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -587,7 +595,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_HEALTH_MONITOR_URL.format(
|
url = const.BASE_SINGLE_HEALTH_MONITOR_URL.format(
|
||||||
uuid=health_monitor_id)
|
uuid=health_monitor_id)
|
||||||
response = self.delete(url)
|
response = self._delete(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -600,7 +608,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Dict of the specified health monitor's settings
|
Dict of the specified health monitor's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_HEALTH_MONITOR_URL
|
url = const.BASE_HEALTH_MONITOR_URL
|
||||||
response = self.find(path=url, value=health_monitor_id)
|
response = self._find(path=url, value=health_monitor_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -617,7 +625,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_HEALTH_MONITOR_URL.format(
|
url = const.BASE_SINGLE_HEALTH_MONITOR_URL.format(
|
||||||
uuid=health_monitor_id)
|
uuid=health_monitor_id)
|
||||||
response = self.create(url, method='PUT', **kwargs)
|
response = self._create(url, method='PUT', **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -630,7 +638,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A ``dict`` representing a list of quotas for the project
|
A ``dict`` representing a list of quotas for the project
|
||||||
"""
|
"""
|
||||||
url = const.BASE_QUOTA_URL
|
url = const.BASE_QUOTA_URL
|
||||||
response = self.list(url, **params)
|
response = self._list(url, **params)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -642,7 +650,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
:return:
|
:return:
|
||||||
A ``dict`` representing the quota for the project
|
A ``dict`` representing the quota for the project
|
||||||
"""
|
"""
|
||||||
response = self.find(path=const.BASE_QUOTA_URL, value=project_id)
|
response = self._find(path=const.BASE_QUOTA_URL, value=project_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -656,7 +664,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
``None``
|
``None``
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_QUOTA_URL.format(uuid=project_id)
|
url = const.BASE_SINGLE_QUOTA_URL.format(uuid=project_id)
|
||||||
response = self.delete(url)
|
response = self._delete(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -672,7 +680,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A ``dict`` representing the updated quota
|
A ``dict`` representing the updated quota
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_QUOTA_URL.format(uuid=project_id)
|
url = const.BASE_SINGLE_QUOTA_URL.format(uuid=project_id)
|
||||||
response = self.create(url, method='PUT', **params)
|
response = self._create(url, method='PUT', **params)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -683,7 +691,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A ``dict`` representing a list of quota defaults
|
A ``dict`` representing a list of quota defaults
|
||||||
"""
|
"""
|
||||||
url = const.BASE_QUOTA_DEFAULT_URL
|
url = const.BASE_QUOTA_DEFAULT_URL
|
||||||
response = self.list(url)
|
response = self._list(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -696,7 +704,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A ``dict`` of the specified amphora's attributes
|
A ``dict`` of the specified amphora's attributes
|
||||||
"""
|
"""
|
||||||
url = const.BASE_AMPHORA_URL
|
url = const.BASE_AMPHORA_URL
|
||||||
response = self.find(path=url, value=amphora_id)
|
response = self._find(path=url, value=amphora_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -709,7 +717,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A ``dict`` containing a list of amphorae
|
A ``dict`` containing a list of amphorae
|
||||||
"""
|
"""
|
||||||
url = const.BASE_AMPHORA_URL
|
url = const.BASE_AMPHORA_URL
|
||||||
response = self.list(path=url, **kwargs)
|
response = self._list(path=url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -723,7 +731,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_AMPHORA_CONFIGURE_URL.format(uuid=amphora_id)
|
url = const.BASE_AMPHORA_CONFIGURE_URL.format(uuid=amphora_id)
|
||||||
response = self.create(url, method='PUT')
|
response = self._create(url, method='PUT')
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -737,7 +745,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_AMPHORA_FAILOVER_URL.format(uuid=amphora_id)
|
url = const.BASE_AMPHORA_FAILOVER_URL.format(uuid=amphora_id)
|
||||||
response = self.create(url, method='PUT')
|
response = self._create(url, method='PUT')
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -748,7 +756,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A ``dict`` containing a list of provider
|
A ``dict`` containing a list of provider
|
||||||
"""
|
"""
|
||||||
url = const.BASE_PROVIDER_URL
|
url = const.BASE_PROVIDER_URL
|
||||||
response = self.list(path=url)
|
response = self._list(path=url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -762,7 +770,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
"""
|
"""
|
||||||
url = const.BASE_PROVIDER_FLAVOR_CAPABILITY_URL.format(
|
url = const.BASE_PROVIDER_FLAVOR_CAPABILITY_URL.format(
|
||||||
provider=provider)
|
provider=provider)
|
||||||
response = self.list(url)
|
response = self._list(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -775,7 +783,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A ``dict`` containing a list of flavor
|
A ``dict`` containing a list of flavor
|
||||||
"""
|
"""
|
||||||
url = const.BASE_FLAVOR_URL
|
url = const.BASE_FLAVOR_URL
|
||||||
response = self.list(path=url, **kwargs)
|
response = self._list(path=url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -789,7 +797,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_FLAVOR_URL.format(uuid=flavor_id)
|
url = const.BASE_SINGLE_FLAVOR_URL.format(uuid=flavor_id)
|
||||||
response = self.delete(url)
|
response = self._delete(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -803,7 +811,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the created flavor's settings
|
A dict of the created flavor's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_FLAVOR_URL
|
url = const.BASE_FLAVOR_URL
|
||||||
response = self.create(url, **kwargs)
|
response = self._create(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -819,7 +827,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_FLAVOR_URL.format(uuid=flavor_id)
|
url = const.BASE_SINGLE_FLAVOR_URL.format(uuid=flavor_id)
|
||||||
response = self.create(url, method='PUT', **kwargs)
|
response = self._create(url, method='PUT', **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -831,7 +839,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
:return:
|
:return:
|
||||||
A dict of the specified flavor's settings
|
A dict of the specified flavor's settings
|
||||||
"""
|
"""
|
||||||
response = self.find(path=const.BASE_FLAVOR_URL, value=flavor_id)
|
response = self._find(path=const.BASE_FLAVOR_URL, value=flavor_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -845,7 +853,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
A dict of the created flavor profile's settings
|
A dict of the created flavor profile's settings
|
||||||
"""
|
"""
|
||||||
url = const.BASE_FLAVORPROFILE_URL
|
url = const.BASE_FLAVORPROFILE_URL
|
||||||
response = self.create(url, **kwargs)
|
response = self._create(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -858,7 +866,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
List of flavor profile
|
List of flavor profile
|
||||||
"""
|
"""
|
||||||
url = const.BASE_FLAVORPROFILE_URL
|
url = const.BASE_FLAVORPROFILE_URL
|
||||||
response = self.list(url, **kwargs)
|
response = self._list(url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -870,7 +878,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
:return:
|
:return:
|
||||||
A dict of the specified flavor profile's settings
|
A dict of the specified flavor profile's settings
|
||||||
"""
|
"""
|
||||||
response = self.find(path=const.BASE_FLAVORPROFILE_URL,
|
response = self._find(path=const.BASE_FLAVORPROFILE_URL,
|
||||||
value=flavorprofile_id)
|
value=flavorprofile_id)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
@@ -887,7 +895,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_FLAVORPROFILE_URL.format(uuid=flavorprofile_id)
|
url = const.BASE_SINGLE_FLAVORPROFILE_URL.format(uuid=flavorprofile_id)
|
||||||
response = self.create(url, method='PUT', **kwargs)
|
response = self._create(url, method='PUT', **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -901,7 +909,7 @@ class OctaviaAPI(api.BaseAPI):
|
|||||||
Response Code from the API
|
Response Code from the API
|
||||||
"""
|
"""
|
||||||
url = const.BASE_SINGLE_FLAVORPROFILE_URL.format(uuid=flavorprofile_id)
|
url = const.BASE_SINGLE_FLAVORPROFILE_URL.format(uuid=flavorprofile_id)
|
||||||
response = self.delete(url)
|
response = self._delete(url)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
The client will now always ask for a JSON format response from the Octavia
|
||||||
|
API. This resolves a client side bug should certain errors be returned
|
||||||
|
by the API.
|
Reference in New Issue
Block a user