add custom config api service

add custom config api service for venus module

Change-Id: Ifb162fbb5c7fb9348379adf45f99f5ae36a26a65
This commit is contained in:
wangzhiguang 2023-04-03 16:49:22 +08:00
parent e8103d8645
commit 11824a7992

View File

@ -27,12 +27,22 @@ LOG = logging.getLogger(__name__)
class VenusRestClient(rest_client.RestClient): class VenusRestClient(rest_client.RestClient):
"""Client class for accessing the venus API.""" """Client class for accessing the venus API."""
CC_URL = '/custom_config'
def _response_helper(self, resp, body=None): def _response_helper(self, resp, body=None):
if body: if body:
body = json.loads(body) body = json.loads(body)
return rest_client.ResponseBody(resp, body) return rest_client.ResponseBody(resp, body)
def set_custom_config(self, body):
body = json.dump_as_bytes(body)
resp, body = self.post(self.CC_URL, body=body)
return self._response_helper(resp, body)
def get_custom_config(self):
resp, body = self.get(self.CC_URL)
return self._response_helper(resp, body)
def get_auth_provider(credentials, scope='project'): def get_auth_provider(credentials, scope='project'):
default_params = { default_params = {