Complete types for hvac.v1.Client (#11886)

This commit is contained in:
kasium
2024-05-13 14:31:48 +02:00
committed by GitHub
parent 0382803c4c
commit 708656f5ad
2 changed files with 36 additions and 24 deletions

View File

@@ -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

View File

@@ -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: ...