|
| 1 | +from typing import Any, Final, Generic, TypeVar |
| 2 | + |
| 3 | +from hvac.adapters import Adapter |
1 | 4 | from hvac.api.vault_api_base import VaultApiBase |
| 5 | +from requests import Response |
| 6 | + |
| 7 | +DEFAULT_MOUNT_POINT: Final = "consul" |
2 | 8 |
|
3 | | -DEFAULT_MOUNT_POINT: str |
| 9 | +_R = TypeVar("_R", default=Response | dict[Any, Any]) |
4 | 10 |
|
5 | | -class Consul(VaultApiBase): |
6 | | - def configure_access(self, address, token, scheme=None, mount_point="consul"): ... |
| 11 | +# TODO: Make `hvac.api.vault_api_base.VaultApiBase` generic, and eventually propagate all the way from: |
| 12 | +# - `hvac.api.secrets_engines.SecretsEngines` |
| 13 | +# - `hvac.v1.Client` |
| 14 | +class Consul(VaultApiBase, Generic[_R]): |
| 15 | + def __init__(self, adapter: Adapter[_R]) -> None: ... |
| 16 | + def configure_access(self, address: str, token: str, scheme: str | None = None, mount_point: str = "consul") -> _R: ... |
7 | 17 | def create_or_update_role( |
8 | | - self, name, policy=None, policies=None, token_type=None, local=None, ttl=None, max_ttl=None, mount_point="consul" |
9 | | - ): ... |
10 | | - def read_role(self, name, mount_point="consul"): ... |
11 | | - def list_roles(self, mount_point="consul"): ... |
12 | | - def delete_role(self, name, mount_point="consul"): ... |
13 | | - def generate_credentials(self, name, mount_point="consul"): ... |
| 18 | + self, |
| 19 | + name: str, |
| 20 | + policy: str | None = None, |
| 21 | + policies: list[str] | None = None, |
| 22 | + token_type: str | None = None, |
| 23 | + local: bool | None = None, |
| 24 | + ttl: str | None = None, |
| 25 | + max_ttl: str | None = None, |
| 26 | + mount_point: str = "consul", |
| 27 | + ) -> _R: ... |
| 28 | + def read_role(self, name: str, mount_point: str = "consul") -> _R: ... |
| 29 | + def list_roles(self, mount_point: str = "consul") -> _R: ... |
| 30 | + def delete_role(self, name: str, mount_point: str = "consul") -> _R: ... |
| 31 | + def generate_credentials(self, name: str, mount_point: str = "consul") -> _R: ... |
0 commit comments