mud_server.api.models_policy ============================ .. py:module:: mud_server.api.models_policy .. autoapi-nested-parse:: Pydantic API models for policy hash and canonical policy-object endpoints. This module now carries two model groups: - hash snapshot models used by Step 1 drift checks - policy-object CRUD/validate/activate/publish models used by the 3-layer API Classes ------- .. autoapisummary:: mud_server.api.models_policy.PolicyHashDirectoryResponse mud_server.api.models_policy.PolicyHashSnapshotResponse mud_server.api.models_policy.PolicyObjectResponse mud_server.api.models_policy.PolicyListResponse mud_server.api.models_policy.PolicyCapabilitiesResponse mud_server.api.models_policy.PolicyValidateRequest mud_server.api.models_policy.PolicyValidateResponse mud_server.api.models_policy.PolicyUpsertRequest mud_server.api.models_policy.PolicyActivationRequest mud_server.api.models_policy.PolicyActivationEntryResponse mud_server.api.models_policy.PolicyActivationListResponse mud_server.api.models_policy.PolicyPublishRequest mud_server.api.models_policy.PolicyImportRequest mud_server.api.models_policy.PolicyPublishManifestItemResponse mud_server.api.models_policy.PolicyPublishManifestResponse mud_server.api.models_policy.PolicyPublishArtifactResponse mud_server.api.models_policy.PolicyPublishResponse mud_server.api.models_policy.PolicyPublishRunResponse mud_server.api.models_policy.PolicyImportEntryResponse mud_server.api.models_policy.PolicyImportResponse Module Contents --------------- .. py:class:: PolicyHashDirectoryResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` One deterministic directory hash summary under the canonical policy root. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: path :type: str .. py:attribute:: file_count :type: int .. py:attribute:: hash :type: str .. py:class:: PolicyHashSnapshotResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Top-level canonical policy hash snapshot payload. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: hash_version :type: str .. py:attribute:: canonical_root :type: str .. py:attribute:: generated_at :type: str .. py:attribute:: file_count :type: int .. py:attribute:: root_hash :type: str .. py:attribute:: directories :type: list[PolicyHashDirectoryResponse] .. py:class:: PolicyObjectResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Canonical policy-object payload returned by policy CRUD endpoints. This shape mirrors the contract in ``3_layer_policy_architecture.md`` section 24.1. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: policy_id :type: str .. py:attribute:: policy_type :type: str .. py:attribute:: namespace :type: str .. py:attribute:: policy_key :type: str .. py:attribute:: variant :type: str .. py:attribute:: schema_version :type: str .. py:attribute:: policy_version :type: int .. py:attribute:: status :type: str .. py:attribute:: content :type: dict[str, Any] .. py:attribute:: content_hash :type: str .. py:attribute:: updated_at :type: str .. py:attribute:: updated_by :type: str .. py:attribute:: slot_kinds :type: list[str] .. py:class:: PolicyListResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` List payload for filtered policy-object queries. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: items :type: list[PolicyObjectResponse] .. py:class:: PolicyCapabilitiesResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Capability metadata for authorized policy API sessions. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: authorized :type: bool .. py:attribute:: role :type: str .. py:attribute:: allowed_policy_types :type: list[str] .. py:attribute:: allowed_statuses :type: list[str] .. py:class:: PolicyValidateRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request body for policy variant validation. ``validated_by`` is optional; route handlers default it from authenticated username when omitted. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: schema_version :type: str :value: None .. py:attribute:: policy_version :type: int :value: None .. py:attribute:: status :type: str :value: None .. py:attribute:: content :type: dict[str, Any] .. py:attribute:: validated_by :type: str | None :value: None .. py:class:: PolicyValidateResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Validation response payload for one policy variant. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: policy_id :type: str .. py:attribute:: variant :type: str .. py:attribute:: is_valid :type: bool .. py:attribute:: errors :type: list[str] .. py:attribute:: content_hash :type: str .. py:attribute:: validated_at :type: str .. py:attribute:: validated_by :type: str .. py:attribute:: validation_run_id :type: int .. py:class:: PolicyUpsertRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request body for policy variant upsert. ``updated_by`` is optional; route handlers default it from authenticated username when omitted. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: schema_version :type: str :value: None .. py:attribute:: policy_version :type: int :value: None .. py:attribute:: status :type: str :value: None .. py:attribute:: content :type: dict[str, Any] .. py:attribute:: updated_by :type: str | None :value: None .. py:class:: PolicyActivationRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request body for activation pointer updates. ``rollback_of_activation_id`` points to a prior activation audit event and requests pointer reassignment to that event's variant. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str :value: None .. py:attribute:: client_profile :type: str | None :value: None .. py:attribute:: policy_id :type: str :value: None .. py:attribute:: variant :type: str :value: None .. py:attribute:: activated_by :type: str | None :value: None .. py:attribute:: rollback_of_activation_id :type: int | None :value: None .. py:class:: PolicyActivationEntryResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` One activation pointer row in API responses. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str .. py:attribute:: client_profile :type: str | None .. py:attribute:: policy_id :type: str .. py:attribute:: variant :type: str .. py:attribute:: activated_at :type: str .. py:attribute:: activated_by :type: str .. py:attribute:: rollback_of_activation_id :type: int | None .. py:attribute:: audit_event_id :type: int | None :value: None .. py:class:: PolicyActivationListResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Scope activation listing payload. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str .. py:attribute:: client_profile :type: str | None .. py:attribute:: items :type: list[PolicyActivationEntryResponse] .. py:class:: PolicyPublishRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request payload for deterministic policy publish generation. ``actor`` is optional; route handlers default it from authenticated username when omitted. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str :value: None .. py:attribute:: client_profile :type: str | None :value: None .. py:attribute:: actor :type: str | None :value: None .. py:class:: PolicyImportRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request payload for importing one publish artifact into canonical DB. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: artifact :type: dict[str, Any] .. py:attribute:: actor :type: str | None :value: None .. py:attribute:: activate :type: bool :value: True .. py:class:: PolicyPublishManifestItemResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` One policy variant row in publish manifest payload. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: policy_id :type: str .. py:attribute:: policy_type :type: str .. py:attribute:: namespace :type: str .. py:attribute:: policy_key :type: str .. py:attribute:: variant :type: str .. py:attribute:: schema_version :type: str .. py:attribute:: policy_version :type: int .. py:attribute:: status :type: str .. py:attribute:: content_hash :type: str .. py:attribute:: updated_at :type: str .. py:class:: PolicyPublishManifestResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Deterministic publish manifest for one activation scope. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str .. py:attribute:: client_profile :type: str | None .. py:attribute:: generated_at :type: str .. py:attribute:: item_count :type: int .. py:attribute:: items_hash :type: str .. py:attribute:: manifest_hash :type: str .. py:attribute:: items :type: list[PolicyPublishManifestItemResponse] .. py:class:: PolicyPublishArtifactResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Deterministic export artifact metadata for downstream mirrors. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: artifact_hash :type: str .. py:attribute:: artifact_path :type: str .. py:attribute:: latest_path :type: str .. py:class:: PolicyPublishResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` API response for publish-run creation. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: publish_run_id :type: int .. py:attribute:: manifest :type: PolicyPublishManifestResponse .. py:attribute:: artifact :type: PolicyPublishArtifactResponse .. py:class:: PolicyPublishRunResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` API response for one persisted publish run. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: publish_run_id :type: int .. py:attribute:: world_id :type: str .. py:attribute:: client_profile :type: str | None .. py:attribute:: actor :type: str .. py:attribute:: created_at :type: str .. py:attribute:: manifest :type: PolicyPublishManifestResponse .. py:attribute:: artifact :type: PolicyPublishArtifactResponse .. py:class:: PolicyImportEntryResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` One import outcome row for artifact ingestion. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: policy_id :type: str | None .. py:attribute:: variant :type: str | None .. py:attribute:: action :type: str .. py:attribute:: detail :type: str .. py:class:: PolicyImportResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` API response for artifact import into canonical policy state. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str .. py:attribute:: client_profile :type: str | None .. py:attribute:: activate :type: bool .. py:attribute:: item_count :type: int .. py:attribute:: imported_count :type: int .. py:attribute:: updated_count :type: int .. py:attribute:: skipped_count :type: int .. py:attribute:: error_count :type: int .. py:attribute:: activated_count :type: int .. py:attribute:: activation_skipped_count :type: int .. py:attribute:: manifest_hash :type: str .. py:attribute:: items_hash :type: str .. py:attribute:: artifact_hash :type: str .. py:attribute:: variants_hash :type: str .. py:attribute:: entries :type: list[PolicyImportEntryResponse]