diff --git a/stubs/hvac/hvac/api/secrets_engines/consul.pyi b/stubs/hvac/hvac/api/secrets_engines/consul.pyi index 0a27a6da6b70..b4688074571f 100644 --- a/stubs/hvac/hvac/api/secrets_engines/consul.pyi +++ b/stubs/hvac/hvac/api/secrets_engines/consul.pyi @@ -1,13 +1,31 @@ +from typing import Any, Final, Generic, TypeVar + +from hvac.adapters import Adapter from hvac.api.vault_api_base import VaultApiBase +from requests import Response + +DEFAULT_MOUNT_POINT: Final = "consul" -DEFAULT_MOUNT_POINT: str +_R = TypeVar("_R", default=Response | dict[Any, Any]) -class Consul(VaultApiBase): - def configure_access(self, address, token, scheme=None, mount_point="consul"): ... +# TODO: Make `hvac.api.vault_api_base.VaultApiBase` generic, and eventually propagate all the way from: +# - `hvac.api.secrets_engines.SecretsEngines` +# - `hvac.v1.Client` +class Consul(VaultApiBase, Generic[_R]): + def __init__(self, adapter: Adapter[_R]) -> None: ... + def configure_access(self, address: str, token: str, scheme: str | None = None, mount_point: str = "consul") -> _R: ... def create_or_update_role( - self, name, policy=None, policies=None, token_type=None, local=None, ttl=None, max_ttl=None, mount_point="consul" - ): ... - def read_role(self, name, mount_point="consul"): ... - def list_roles(self, mount_point="consul"): ... - def delete_role(self, name, mount_point="consul"): ... - def generate_credentials(self, name, mount_point="consul"): ... + self, + name: str, + policy: str | None = None, + policies: list[str] | None = None, + token_type: str | None = None, + local: bool | None = None, + ttl: str | None = None, + max_ttl: str | None = None, + mount_point: str = "consul", + ) -> _R: ... + def read_role(self, name: str, mount_point: str = "consul") -> _R: ... + def list_roles(self, mount_point: str = "consul") -> _R: ... + def delete_role(self, name: str, mount_point: str = "consul") -> _R: ... + def generate_credentials(self, name: str, mount_point: str = "consul") -> _R: ...