hvac.utils¶
Misc utility functions and constants
-
hvac.utils.
deprecated_method
(to_be_removed_in_version, new_method=None)[source]¶ This is a decorator which can be used to mark methods as deprecated. It will result in a warning being emitted when the function is used.
Parameters: - to_be_removed_in_version (str) – Version of this module the decorated method will be removed in.
- new_method (function) – Method intended to replace the decorated method. This method’s docstrings are included in the decorated method’s docstring.
Returns: Wrapped function that includes a deprecation warning and update docstrings from the replacement method.
Return type: types.FunctionType
-
hvac.utils.
raise_for_error
(status_code, message=None, errors=None)[source]¶ Helper method to raise exceptions based on the status code of a response received back from Vault.
Parameters: - status_code (int) – Status code received in a response from Vault.
- message (str) – Optional message to include in a resulting exception.
- errors (list | str) – Optional errors to include in a resulting exception.
Raises: hvac.exceptions.InvalidRequest | hvac.exceptions.Unauthorized | hvac.exceptions.Forbidden | hvac.exceptions.InvalidPath | hvac.exceptions.RateLimitExceeded | hvac.exceptions.InternalServerError | hvac.exceptions.VaultNotInitialized | hvac.exceptions.VaultDown | hvac.exceptions.UnexpectedError