# Path: deckhand/barbican/client_wrapper.py
# CONF = config.CONF
# LOG = logging.getLogger(__name__)
# class BarbicanClientWrapper(object):
#     def __init__(self):
#     def _invalidate_cached_client(self):
#     def _get_client(self, retry_on_conflict=True):
#     def _multi_getattr(self, obj, attr):
#     def call(self, method, *args, **kwargs):
# 
# Path: deckhand/common/utils.py
# LOG = logging.getLogger(__name__)
# _PATH_CACHE = dict()
# _ARRAY_RE = re.compile(r'.*\[\d+\].*')
# def to_camel_case(s):
# def to_snake_case(name):
# def _normalize_jsonpath(jsonpath):
# def _jsonpath_parse_cache(jsonpath):
# def jsonpath_parse(data, jsonpath, match_all=False):
# def _populate_data_with_attributes(jsonpath, data):
# def jsonpath_replace(data, value, jsonpath, pattern=None):
#     def _do_replace():
# def multisort(data, sort_by=None, order_by=None):
# def deepfilter(dct, **filters):
#     def _transform_filter_bool(filter_val):
# 
# Path: deckhand/errors.py
# LOG = logging.getLogger(__name__)
# def get_version_from_request(req):
# def format_error_resp(req,
#                       resp,
#                       status_code=falcon.HTTP_500,
#                       message="",
#                       reason=None,
#                       error_type=None,
#                       error_list=None,
#                       info_list=None):
# def default_exception_handler(ex, req, resp, params):
# def default_exception_serializer(req, resp, exception):
#     def __init__(self, message=None, **kwargs):
#     def format_message(self):
# class DeckhandException(Exception):
# class InvalidDocumentFormat(DeckhandException):
# class InvalidDocumentLayer(DeckhandException):
# class InvalidDocumentParent(DeckhandException):
# class IndeterminateDocumentParent(DeckhandException):
# class SubstitutionDependencyCycle(DeckhandException):
# class MissingDocumentKey(DeckhandException):
# class MissingDocumentPattern(DeckhandException):
# class InvalidDocumentReplacement(DeckhandException):
# class UnsupportedActionMethod(DeckhandException):
# class RevisionTagBadFormat(DeckhandException):
# class SubstitutionSourceDataNotFound(DeckhandException):
# class DocumentNotFound(DeckhandException):
# class RevisionNotFound(DeckhandException):
# class RevisionTagNotFound(DeckhandException):
# class ValidationNotFound(DeckhandException):
# class DuplicateDocumentExists(DeckhandException):
# class SingletonDocumentConflict(DeckhandException):
# class LayeringPolicyNotFound(DeckhandException):
# class SubstitutionSourceNotFound(DeckhandException):
# class PolicyNotAuthorized(DeckhandException):
# class BarbicanException(DeckhandException):
# class UnknownSubstitutionError(DeckhandException):


import barbicanclient
from oslo_log import log as logging
from deckhand.barbican import client_wrapper
from deckhand.common import utils
from deckhand import errors
    def create_secret(self, **kwargs):
        """Create a secret."""
        secret = self.barbicanclient.call("secrets.create", **kwargs)

        try:
            secret_ref = secret.store()
        except (barbicanclient.exceptions.HTTPAuthError,
                barbicanclient.exceptions.HTTPClientError,
                barbicanclient.exceptions.HTTPServerError) as e:
            LOG.exception(str(e))
            raise errors.BarbicanException(details=str(e))

        # NOTE(fmontei): The dictionary representation of the Secret object by
        # default has keys that are not snake case -- so make them snake case.
        resp = secret.to_dict()
        for key in resp:
            resp[utils.to_snake_case(key)] = resp.pop(key)
        resp['secret_ref'] = secret_ref
        return resp

    def get_secret(self, secret_ref):
        """Get a secret."""

        try:
            return self.barbicanclient.call("secrets.get", secret_ref)
        except (barbicanclient.exceptions.HTTPAuthError,
                barbicanclient.exceptions.HTTPClientError,
                barbicanclient.exceptions.HTTPServerError,
                ValueError) as e:
            LOG.exception(str(e))

# Path: deckhand/barbican/client_wrapper.py
# CONF = config.CONF
# LOG = logging.getLogger(__name__)
# class BarbicanClientWrapper(object):
#     def __init__(self):
#     def _invalidate_cached_client(self):
#     def _get_client(self, retry_on_conflict=True):
#     def _multi_getattr(self, obj, attr):
#     def call(self, method, *args, **kwargs):
# 
# Path: deckhand/common/utils.py
# LOG = logging.getLogger(__name__)
# _PATH_CACHE = dict()
# _ARRAY_RE = re.compile(r'.*\[\d+\].*')
# def to_camel_case(s):
# def to_snake_case(name):
# def _normalize_jsonpath(jsonpath):
# def _jsonpath_parse_cache(jsonpath):
# def jsonpath_parse(data, jsonpath, match_all=False):
# def _populate_data_with_attributes(jsonpath, data):
# def jsonpath_replace(data, value, jsonpath, pattern=None):
#     def _do_replace():
# def multisort(data, sort_by=None, order_by=None):
# def deepfilter(dct, **filters):
#     def _transform_filter_bool(filter_val):
# 
# Path: deckhand/errors.py
# LOG = logging.getLogger(__name__)
# def get_version_from_request(req):
# def format_error_resp(req,
#                       resp,
#                       status_code=falcon.HTTP_500,
#                       message="",
#                       reason=None,
#                       error_type=None,
#                       error_list=None,
#                       info_list=None):
# def default_exception_handler(ex, req, resp, params):
# def default_exception_serializer(req, resp, exception):
#     def __init__(self, message=None, **kwargs):
#     def format_message(self):
# class DeckhandException(Exception):
# class InvalidDocumentFormat(DeckhandException):
# class InvalidDocumentLayer(DeckhandException):
# class InvalidDocumentParent(DeckhandException):
# class IndeterminateDocumentParent(DeckhandException):
# class SubstitutionDependencyCycle(DeckhandException):
# class MissingDocumentKey(DeckhandException):
# class MissingDocumentPattern(DeckhandException):
# class InvalidDocumentReplacement(DeckhandException):
# class UnsupportedActionMethod(DeckhandException):
# class RevisionTagBadFormat(DeckhandException):
# class SubstitutionSourceDataNotFound(DeckhandException):
# class DocumentNotFound(DeckhandException):
# class RevisionNotFound(DeckhandException):
# class RevisionTagNotFound(DeckhandException):
# class ValidationNotFound(DeckhandException):
# class DuplicateDocumentExists(DeckhandException):
# class SingletonDocumentConflict(DeckhandException):
# class LayeringPolicyNotFound(DeckhandException):
# class SubstitutionSourceNotFound(DeckhandException):
# class PolicyNotAuthorized(DeckhandException):
# class BarbicanException(DeckhandException):
# class UnknownSubstitutionError(DeckhandException):


# Path: deckhand/barbican/driver.py
import barbicanclient
from oslo_log import log as logging
from deckhand.barbican import client_wrapper
from deckhand.common import utils
from deckhand import errors

    def create_secret(self, **kwargs):
        """Create a secret."""
        secret = self.barbicanclient.call("secrets.create", **kwargs)

        try:
            secret_ref = secret.store()
        except (barbicanclient.exceptions.HTTPAuthError,
                barbicanclient.exceptions.HTTPClientError,
                barbicanclient.exceptions.HTTPServerError) as e:
            LOG.exception(str(e))
            raise errors.BarbicanException(details=str(e))

        # NOTE(fmontei): The dictionary representation of the Secret object by
        # default has keys that are not snake case -- so make them snake case.
        resp = secret.to_dict()
        for key in resp:
            resp[utils.to_snake_case(key)] = resp.pop(key)
        resp['secret_ref'] = secret_ref
        return resp

    def get_secret(self, secret_ref):
        """Get a secret."""

        try:
            return self.barbicanclient.call("secrets.get", secret_ref)
        except (barbicanclient.exceptions.HTTPAuthError,
                barbicanclient.exceptions.HTTPClientError,
                barbicanclient.exceptions.HTTPServerError,
                ValueError) as e:
            LOG.exception(str(e))

            raise errors.BarbicanException(details=str(e))