module documentation

TTL cache of configured credentials.

The cache isn't bound to an event loop, so that it can be shared across clients created under different loops (e.g. the per-invocation loops of a Lambda worker). Fetches run in daemon threads, state is guarded by thread locks, and callers wait for a fetch on their own loop.

Class CacheEntry One or more secrets that are fetched and replaced together, cached as a single parsed value.
Class SecretCache TTL cache of the configured credentials that falls back to the last fetched value, up to max_staleness old, when a refresh fails.
Class SecretIDs Configured secret IDs. Empty strings are unset.
Exception SecretFetchError A failed fetch of one or more secrets, with its failure_reason label.
Constant FAILED_REFRESH_RETRY_INTERVAL_SECONDS Undocumented
Variable logger Undocumented
Class _SecretRef Undocumented
Function _new_client_cert_entry Entry for the client cert and key, which may be the same secret if bundled. Each secret's relevant PEM blocks are extracted, so a bundled secret can be used as both. A newly fetched pair that doesn't match (e...
Function _new_server_ca_cert_entry Undocumented
Function _parse_api_key Undocumented
Function _pem_certs Undocumented
Constant _CERT_PEM_RE Undocumented
Constant _KEY_PEM_RE Undocumented
Type Variable _T Undocumented
FAILED_REFRESH_RETRY_INTERVAL_SECONDS: float = (source)

Undocumented

Value
30.0

Undocumented

def _new_client_cert_entry(cert_id: str, key_id: str) -> CacheEntry[tuple[bytes, bytes]]: (source)

Entry for the client cert and key, which may be the same secret if bundled. Each secret's relevant PEM blocks are extracted, so a bundled secret can be used as both. A newly fetched pair that doesn't match (e.g. fetched partway through rotating separate cert and key secrets) is treated as a failed fetch, so the previous pair keeps being used.

def _new_server_ca_cert_entry(secret_id: str) -> CacheEntry[bytes]: (source)

Undocumented

def _parse_api_key(secrets: list[SecretValue]) -> str: (source)

Undocumented

def _pem_certs(data: bytes) -> bytes: (source)

Undocumented

_CERT_PEM_RE = (source)

Undocumented

Value
re.compile(rb'-----BEGIN CERTIFICATE-----\r?\n.*?-----END CERTIFICATE-----',
           re.DOTALL)
_KEY_PEM_RE = (source)

Undocumented

Value
re.compile(rb'-----BEGIN ((?:RSA |EC )?PRIVATE KEY)-----\r?\n.*?-----END \1-----'↵
,
           re.DOTALL)

Undocumented

Value
TypeVar('_T')