# Path: armada/exceptions/api_exceptions.py
# class ApiException(base.ArmadaBaseException):
# class ApiBaseException(ApiException):
# class ApiJsonException(ApiException):
# class ClientUnauthorizedError(ApiException):
# class ClientForbiddenError(ApiException):
# class ClientError(ApiException):
# 
# Path: armada/handlers/armada.py
# LOG = logging.getLogger(__name__)
# CONF = cfg.CONF
# class Armada(object):
#     def __init__(self,
#                  documents,
#                  disable_update_pre=False,
#                  disable_update_post=False,
#                  enable_chart_cleanup=False,
#                  dry_run=False,
#                  set_ovr=None,
#                  force_wait=False,
#                  timeout=0,
#                  tiller_host=None,
#                  tiller_port=None,
#                  tiller_namespace=None,
#                  values=None,
#                  target_manifest=None,
#                  k8s_wait_attempts=1,
#                  k8s_wait_attempt_sleep=1):
#     def find_release_chart(self, known_releases, name):
#     def pre_flight_ops(self):
#     def tag_cloned_repo(self, ch, repos):
#     def get_releases_by_status(self, status):
#     def sync(self):
#     def post_flight_ops(self):
#     def _test_chart(self, release_name, timeout):
#     def show_diff(self, chart, installed_chart, installed_values, target_chart,
#                   target_values, msg):
#         def _sanitize_diff_str(str):


import yaml
from oslo_config import cfg
from oslo_log import log as logging
from armada.exceptions import api_exceptions as err
from armada.handlers.armada import Override

        self._check_response(resp)

        return resp.json()

    def get_test_release(self, release=None, query=None, timeout=None):

        endpoint = self._set_endpoint('1.0', 'test/{}'.format(release))
        resp = self.session.get(endpoint, query=query, timeout=timeout)

        self._check_response(resp)

        return resp.json()

    def post_test_manifest(self, manifest=None, query=None, timeout=None):

        endpoint = self._set_endpoint('1.0', 'tests')
        resp = self.session.post(endpoint, body=manifest, query=query,
                                 timeout=timeout)

        self._check_response(resp)

        return resp.json()

    def _check_response(self, resp):
        if resp.status_code == 401:
            raise err.ClientUnauthorizedError(
                "Unauthorized access to %s, include valid token.".format(
                    resp.url))
        elif resp.status_code == 403:

# Path: armada/exceptions/api_exceptions.py
# class ApiException(base.ArmadaBaseException):
# class ApiBaseException(ApiException):
# class ApiJsonException(ApiException):
# class ClientUnauthorizedError(ApiException):
# class ClientForbiddenError(ApiException):
# class ClientError(ApiException):
# 
# Path: armada/handlers/armada.py
# LOG = logging.getLogger(__name__)
# CONF = cfg.CONF
# class Armada(object):
#     def __init__(self,
#                  documents,
#                  disable_update_pre=False,
#                  disable_update_post=False,
#                  enable_chart_cleanup=False,
#                  dry_run=False,
#                  set_ovr=None,
#                  force_wait=False,
#                  timeout=0,
#                  tiller_host=None,
#                  tiller_port=None,
#                  tiller_namespace=None,
#                  values=None,
#                  target_manifest=None,
#                  k8s_wait_attempts=1,
#                  k8s_wait_attempt_sleep=1):
#     def find_release_chart(self, known_releases, name):
#     def pre_flight_ops(self):
#     def tag_cloned_repo(self, ch, repos):
#     def get_releases_by_status(self, status):
#     def sync(self):
#     def post_flight_ops(self):
#     def _test_chart(self, release_name, timeout):
#     def show_diff(self, chart, installed_chart, installed_values, target_chart,
#                   target_values, msg):
#         def _sanitize_diff_str(str):


# Path: armada/common/client.py
import yaml
from oslo_config import cfg
from oslo_log import log as logging
from armada.exceptions import api_exceptions as err
from armada.handlers.armada import Override


        self._check_response(resp)

        return resp.json()

    def get_test_release(self, release=None, query=None, timeout=None):

        endpoint = self._set_endpoint('1.0', 'test/{}'.format(release))
        resp = self.session.get(endpoint, query=query, timeout=timeout)

        self._check_response(resp)

        return resp.json()

    def post_test_manifest(self, manifest=None, query=None, timeout=None):

        endpoint = self._set_endpoint('1.0', 'tests')
        resp = self.session.post(endpoint, body=manifest, query=query,
                                 timeout=timeout)

        self._check_response(resp)

        return resp.json()

    def _check_response(self, resp):
        if resp.status_code == 401:
            raise err.ClientUnauthorizedError(
                "Unauthorized access to %s, include valid token.".format(
                    resp.url))
        elif resp.status_code == 403:

            raise err.ClientForbiddenError("Forbidden access to %s" % resp.url)