# Path: castellan/common/exception.py
# _FATAL_EXCEPTION_FORMAT_ERRORS = False
# class RedirectException(Exception):
# class CastellanException(Exception):
# class Forbidden(CastellanException):
# class KeyManagerError(CastellanException):
# class ManagedObjectNotFoundError(CastellanException):
# class InvalidManagedObjectDictError(CastellanException):
# class UnknownManagedObjectTypeError(CastellanException):
# class AuthTypeInvalidError(CastellanException):
# class InsufficientCredentialDataError(CastellanException):
#     def __init__(self, url):
#     def __init__(self, message_arg=None, *args, **kwargs):


import abc
import binascii
from castellan.common import exception
        Returns the object's type identifier for serialization purpose.
        """
        pass

    @classmethod
    def from_dict(cls, dict_fields, id=None, metadata_only=False):
        """Returns an instance of this class based on a dict object.

        :param dict_fields: The dictionary containing all necessary params
                            to create one instance.
        :param id: The optional param 'id' to be passed to the constructor.
        :param metadata_only: A switch to create an instance with metadata
                              only, without the secret itself.
        """
        try:
            value = None

            # NOTE(moguimar): the managed object's value is exported as
            # a hex string. For now, this is a compatibility thing with
            # the already existent vault_key_manager backend.
            if not metadata_only and dict_fields["value"] is not None:
                value = binascii.unhexlify(dict_fields["value"])

            return cls(
                value,
                name=dict_fields["name"],
                created=dict_fields["created"],
                id=id,
            )
        except KeyError as e:

# Path: castellan/common/exception.py
# _FATAL_EXCEPTION_FORMAT_ERRORS = False
# class RedirectException(Exception):
# class CastellanException(Exception):
# class Forbidden(CastellanException):
# class KeyManagerError(CastellanException):
# class ManagedObjectNotFoundError(CastellanException):
# class InvalidManagedObjectDictError(CastellanException):
# class UnknownManagedObjectTypeError(CastellanException):
# class AuthTypeInvalidError(CastellanException):
# class InsufficientCredentialDataError(CastellanException):
#     def __init__(self, url):
#     def __init__(self, message_arg=None, *args, **kwargs):


# Path: castellan/common/objects/managed_object.py
import abc
import binascii
from castellan.common import exception

        Returns the object's type identifier for serialization purpose.
        """
        pass

    @classmethod
    def from_dict(cls, dict_fields, id=None, metadata_only=False):
        """Returns an instance of this class based on a dict object.

        :param dict_fields: The dictionary containing all necessary params
                            to create one instance.
        :param id: The optional param 'id' to be passed to the constructor.
        :param metadata_only: A switch to create an instance with metadata
                              only, without the secret itself.
        """
        try:
            value = None

            # NOTE(moguimar): the managed object's value is exported as
            # a hex string. For now, this is a compatibility thing with
            # the already existent vault_key_manager backend.
            if not metadata_only and dict_fields["value"] is not None:
                value = binascii.unhexlify(dict_fields["value"])

            return cls(
                value,
                name=dict_fields["name"],
                created=dict_fields["created"],
                id=id,
            )
        except KeyError as e:

            raise exception.InvalidManagedObjectDictError(field=str(e))