Source code for dxaws_acm.models
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Literal
[docs]
@dataclass(frozen=True)
class DesiredState:
"""Represents the desired state for this module.
Concrete modules should replace or extend this model with
module-specific desired-state fields.
"""
spec: Any
[docs]
@dataclass(frozen=True)
class Plan:
"""Represents a plan to converge current state to desired state.
Planners should return a Plan instance describing what actions
need to be taken. The structure of `plan` is module-defined.
"""
plan: Any
[docs]
@dataclass(frozen=True)
class ApplyResult:
"""Represents the result of applying a plan.
Executors should return an ApplyResult capturing what actually
occurred (created, updated, no-op, etc.).
"""
result: Any
PlanAction = Literal["noop", "request", "ensure_dns", "wait", "recreate"]
[docs]
@dataclass(frozen=True, slots=True, kw_only=True)
class ValidationRecord:
domain_name: str
name: str
type: str
value: str
[docs]
@dataclass(frozen=True, slots=True, kw_only=True)
class AcmDesired:
"""Desired ACM certificate state.
dxaws-acm issues one certificate per FQDN (no SAN bundles).
Hosted zone resolution and validation record management are delegated
to dxaws-dns during apply.
`zone_name` and `hosted_zone_id` remain available as optional advanced
hints/overrides, but normal callers should not need to provide them.
"""
domain_name: str
region: str | None = None
hosted_zone_id: str | None = None
zone_name: str | None = None
tags: dict[str, str] = field(default_factory=dict)
[docs]
@dataclass(frozen=True, slots=True, kw_only=True)
class AcmCurrent:
exists: bool
certificate_arn: str | None
status: str | None
domain_name: str | None
validation_records: list[ValidationRecord] = field(default_factory=list)
[docs]
@dataclass(frozen=True, slots=True, kw_only=True)
class AcmPlan:
desired: AcmDesired
current: AcmCurrent
action: PlanAction
certificate_arn: str | None = None
dns_changes: list[dict[str, Any]] = field(default_factory=list)
wait: bool = False
reason: str | None = None
validation_records: list[ValidationRecord] = field(default_factory=list)
@property
def is_noop(self) -> bool:
return self.action == "noop"
[docs]
@dataclass(frozen=True, slots=True, kw_only=True)
class AcmOutputs:
certificate_arn: str
status: str
[docs]
@dataclass(frozen=True, slots=True, kw_only=True)
class AcmManagerResult:
desired: AcmDesired
current: AcmCurrent
plan: AcmPlan
outputs: AcmOutputs | None
outcome: str