In-Memory Provider
A cloud provider in memory, for tests and local development without a cloud account.
Its DNS zones, records and certificates are kept in memory, and behave like a cloud’s, so that tests exercise the service layer, and its signals, without reaching real infrastructure.
from smarter.apps.infrastructure.providers import configure_provider
from smarter.apps.infrastructure.providers.memory import InMemoryProvider
provider = InMemoryProvider()
configure_provider(lambda: provider)
provider.dns.add_zone("example.com")
provider.certificates.issue_all = True
- class smarter.apps.infrastructure.providers.memory.InMemoryCertificateService(provider, dns, **kwargs)[source]
Bases:
CertificateServiceTLS certificates in memory, issued once their validation records exist, or at once with
issue_all.- issue_all
Issue every certificate, whether or not its validation records exist.
- class smarter.apps.infrastructure.providers.memory.InMemoryDNSService(provider, **kwargs)[source]
Bases:
DNSServiceDNS zones and records in memory.
- class smarter.apps.infrastructure.providers.memory.InMemoryProvider(ready=True, **kwargs)[source]
Bases:
CloudProviderA cloud provider in memory.
- Parameters:
ready (
bool) – Whether the provider is authenticated.
- property account_id: str | None
The cloud account’s id, or None if the provider is not authenticated.
- property certificates: InMemoryCertificateService
The provider’s TLS certificate service.
- property dns: InMemoryDNSService
The provider’s DNS service.
- get_kubernetes_cluster_info()[source]
Describe the platform’s Kubernetes cluster, e.g. for the status API.
- Raises:
InfrastructureNotReadyError – If the provider is not ready.
- Return type:
- property identity: dict[str, Any] | None
The identity that the provider authenticates as, e.g. its account, or None.
- name: str = 'memory'
The provider’s name, see
CloudProviders.