diff --git a/stubs/hvac/hvac/adapters.pyi b/stubs/hvac/hvac/adapters.pyi index 024647bc7..5cc6e1ebf 100644 --- a/stubs/hvac/hvac/adapters.pyi +++ b/stubs/hvac/hvac/adapters.pyi @@ -42,7 +42,7 @@ class Adapter(Generic[_R], metaclass=ABCMeta): def delete(self, url: str, **kwargs: Any) -> _R: ... def list(self, url: str, **kwargs: Any) -> _R: ... def head(self, url: str, **kwargs: Any) -> _R: ... - def login(self, url: str, use_token: bool = True, **kwargs: Any): ... + def login(self, url: str, use_token: bool = True, **kwargs: Any) -> Response: ... @abstractmethod def get_login_token(self, response: _R) -> str: ... @abstractmethod diff --git a/stubs/hvac/hvac/v1/__init__.pyi b/stubs/hvac/hvac/v1/__init__.pyi index 036b640c7..e6d526e45 100644 --- a/stubs/hvac/hvac/v1/__init__.pyi +++ b/stubs/hvac/hvac/v1/__init__.pyi @@ -1,7 +1,10 @@ -from _typeshed import Incomplete -from typing import Any +from typing import Any, Literal, overload from hvac.adapters import Adapter +from hvac.api import AuthMethods, SystemBackend +from hvac.api.secrets_engines import SecretsEngines +from requests import Session +from requests.models import Response has_hcl_parser: bool @@ -15,9 +18,9 @@ class Client: timeout: int = 30, proxies: dict[str, str] | None = None, allow_redirects: bool = True, - session: Incomplete | None = None, + session: Session | None = None, adapter: type[Adapter[Any]] = ..., - namespace: Incomplete | None = None, + namespace: str | None = None, **kwargs: Any, ) -> None: ... def __getattr__(self, name: str) -> Any: ... @@ -34,39 +37,48 @@ class Client: @token.setter def token(self, token: str) -> None: ... @property - def session(self): ... + def session(self) -> Session: ... @session.setter - def session(self, session) -> None: ... + def session(self, session: Session) -> None: ... @property def allow_redirects(self) -> bool: ... @allow_redirects.setter def allow_redirects(self, allow_redirects: bool) -> None: ... @property - def auth(self): ... + def auth(self) -> AuthMethods: ... @property - def secrets(self): ... + def secrets(self) -> SecretsEngines: ... @property - def sys(self): ... + def sys(self) -> SystemBackend: ... @property - def generate_root_status(self): ... + def generate_root_status(self) -> dict[str, Any] | Response: ... @property - def key_status(self): ... + def key_status(self) -> dict[str, Any] | Response: ... @property - def rekey_status(self): ... + def rekey_status(self) -> dict[str, Any] | Response: ... @property - def ha_status(self): ... + def ha_status(self) -> dict[str, Any] | Response: ... @property - def seal_status(self): ... - def read(self, path: str, wrap_ttl: int | str | None = None): ... - def list(self, path: str): ... - def write(self, path: str, wrap_ttl: int | str | None, **kwargs: Any): ... - def write_data(self, path: str, *, data: dict[str, Any] | None = None, wrap_ttl: int | str | None = None): ... + def seal_status(self) -> dict[str, Any] | Response: ... + def read(self, path: str, wrap_ttl: int | str | None = None) -> dict[str, Any] | Response | None: ... + def list(self, path: str) -> dict[str, Any] | Response | None: ... + def write(self, path: str, wrap_ttl: int | str | None, **kwargs: Any) -> dict[str, Any] | Response: ... + def write_data( + self, path: str, *, data: dict[str, Any] | None = None, wrap_ttl: int | str | None = None + ) -> dict[str, Any] | Response: ... def delete(self, path: str) -> None: ... - def get_policy(self, name: str, parse: bool = False): ... - def lookup_token(self, token: str | None = None, accessor: bool = False, wrap_ttl: int | str | None = None): ... + @overload + def get_policy(self, name: str, parse: Literal[False] = False) -> str | None: ... + @overload + def get_policy(self, name: str, parse: Literal[True]) -> dict[str, Any] | None: ... + def lookup_token( + self, token: str | None = None, accessor: bool = False, wrap_ttl: int | str | None = None + ) -> dict[str, Any] | Response: ... def revoke_token(self, token: str, orphan: bool = False, accessor: bool = False) -> None: ... - def renew_token(self, token: str, increment: bool | None = None, wrap_ttl: int | str | None = None): ... + def renew_token( + self, token: str, increment: bool | None = None, wrap_ttl: int | str | None = None + ) -> dict[str, Any] | Response: ... def logout(self, revoke_token: bool = False) -> None: ... def is_authenticated(self) -> bool: ... - def auth_cubbyhole(self, token: str): ... - def login(self, url: str, use_token: bool = True, **kwargs: Any): ... + def auth_cubbyhole(self, token: str) -> Response: ... + def login(self, url: str, use_token: bool = True, **kwargs: Any) -> Response: ...