swh.vault.api.server module

swh.vault.api.server.get_vault(config: Optional[Dict[str, Any]] = None) swh.vault.interface.VaultInterface[source]
class swh.vault.api.server.VaultServerApp(app_name: Optional[str] = None, backend_class: Optional[Callable] = None, backend_factory: Optional[Union[Callable, str]] = None, middlewares=(), **kwargs)[source]

Bases: MutableMapping[str, Any]

client_exception_classes: Tuple[Type[Exception], ...] = (<class 'swh.vault.exc.NotFoundExc'>,)

Exceptions that should be handled as a client error (eg. object not found, invalid argument)

extra_type_decoders: Dict[str, Callable] = {'core_swhid': <bound method _BaseSWHID.from_string of <class 'swh.model.swhids.CoreSWHID'>>}

Value of extra_decoders passed to json_loads or msgpack_loads to be able to deserialize more object types.

extra_type_encoders: List[Tuple[type, str, Callable]] = [(<class 'swh.model.swhids.CoreSWHID'>, 'core_swhid', <class 'str'>)]

Value of extra_encoders passed to json_dumps or msgpack_dumps to be able to serialize more object types.

swh.vault.api.server.index(request)[source]
swh.vault.api.server.check_config(cfg: Dict[str, Any]) Dict[str, Any][source]

Ensure the configuration is ok to run a local vault server, and propagate defaults.

Raises
  • EnvironmentError if the configuration is not for local instance

  • ValueError if one of the following keys is missing – vault, cache, storage,

  • scheduler

Returns

New configuration dict to instantiate a local vault server instance.

swh.vault.api.server.make_app(config: Dict[str, Any]) swh.vault.api.server.VaultServerApp[source]

Ensure the configuration is ok, then instantiate the server application

swh.vault.api.server.make_app_from_configfile(config_path: Optional[str] = None, **kwargs) swh.vault.api.server.VaultServerApp[source]

Load and check configuration if ok, then instantiate (once) a vault server application.