{
  "$defs": {
    "apply_item": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "enum": [
            "delete_accepted",
            "skipped",
            "failed",
            "preserved"
          ]
        },
        "error_code": {
          "pattern": "^DPONE_AIRFLOW_RUNTIME_POD_RETENTION_[A-Z0-9_]+$",
          "type": "string"
        },
        "http_status": {
          "maximum": 599,
          "minimum": 100,
          "type": "integer"
        },
        "phase": {
          "minLength": 1,
          "type": "string"
        },
        "pod_name": {
          "minLength": 1,
          "type": "string"
        },
        "pod_ref": {
          "pattern": "^sha256:[0-9a-f]{64}$",
          "type": "string"
        },
        "precondition_ref": {
          "pattern": "^sha256:[0-9a-f]{64}$",
          "type": "string"
        },
        "reason": {
          "enum": [
            "stale_terminal",
            "already_absent",
            "changed_since_plan",
            "delete_failed",
            "evidence_unavailable",
            "batch_limit",
            "not_attempted_after_failure",
            "inventory_phase_conflict",
            "invalid_phase",
            "invalid_identity",
            "terminating",
            "invalid_ownership",
            "missing_correlation",
            "timestamp_missing",
            "future_timestamp",
            "minimum_age"
          ]
        },
        "sequence": {
          "maximum": 10000,
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "sequence",
        "pod_ref",
        "precondition_ref",
        "pod_name",
        "phase",
        "action",
        "reason"
      ],
      "type": "object"
    }
  },
  "$id": "https://paulkov.github.io/dpone/schemas/gitops/airflow-runtime-pod-retention-apply.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "properties": {
          "evidence_status": {
            "const": "incomplete"
          }
        },
        "required": [
          "evidence_status"
        ]
      },
      "then": {
        "properties": {
          "status": {
            "const": "failed"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "status": {
            "const": "ok"
          }
        },
        "required": [
          "status"
        ]
      },
      "then": {
        "properties": {
          "evidence_status": {
            "const": "complete"
          },
          "failed_pod_names": {
            "maxItems": 0
          },
          "items": {
            "items": {
              "properties": {
                "action": {
                  "enum": [
                    "delete_accepted",
                    "skipped",
                    "preserved"
                  ]
                },
                "reason": {
                  "enum": [
                    "stale_terminal",
                    "already_absent",
                    "terminating",
                    "minimum_age"
                  ]
                }
              }
            }
          }
        }
      }
    }
  ],
  "properties": {
    "actor": {
      "minLength": 1,
      "type": "string"
    },
    "actor_source": {
      "const": "operator_acknowledgement"
    },
    "age_basis": {
      "const": "creation_timestamp_fallback"
    },
    "authorization_authority": {
      "const": "kubernetes_api_rbac"
    },
    "credential_context": {
      "maxLength": 253,
      "minLength": 1,
      "type": [
        "string",
        "null"
      ]
    },
    "credential_mode": {
      "enum": [
        "in-cluster",
        "kubeconfig"
      ]
    },
    "delete_accepted_pod_names": {
      "items": {
        "minLength": 1,
        "type": "string"
      },
      "maxItems": 10000,
      "type": "array",
      "uniqueItems": true
    },
    "deletion_evidence": {
      "const": "api_request_accepted_not_observed"
    },
    "evidence_durability": {
      "enum": [
        "process_ordered",
        "durable_acknowledged"
      ]
    },
    "evidence_status": {
      "enum": [
        "complete",
        "incomplete"
      ]
    },
    "failed_pod_names": {
      "items": {
        "minLength": 1,
        "type": "string"
      },
      "maxItems": 10000,
      "type": "array",
      "uniqueItems": true
    },
    "items": {
      "items": {
        "$ref": "#/$defs/apply_item"
      },
      "maxItems": 10000,
      "type": "array"
    },
    "max_delete_count": {
      "maximum": 1000,
      "minimum": 1,
      "type": "integer"
    },
    "minimum_age_seconds": {
      "maximum": 2592000,
      "minimum": 300,
      "type": "integer"
    },
    "namespace": {
      "minLength": 1,
      "type": "string"
    },
    "observed_at": {
      "format": "date-time",
      "type": "string"
    },
    "operation_id": {
      "pattern": "^sha256:[0-9a-f]{64}$",
      "type": "string"
    },
    "schema": {
      "const": "dpone.airflow-runtime-pod-retention-apply.v1"
    },
    "skipped_pod_names": {
      "items": {
        "minLength": 1,
        "type": "string"
      },
      "maxItems": 10000,
      "type": "array",
      "uniqueItems": true
    },
    "status": {
      "enum": [
        "ok",
        "partial",
        "failed"
      ]
    },
    "terminal_age_exact": {
      "const": false
    }
  },
  "required": [
    "schema",
    "status",
    "operation_id",
    "evidence_status",
    "evidence_durability",
    "namespace",
    "actor",
    "actor_source",
    "authorization_authority",
    "credential_mode",
    "deletion_evidence",
    "observed_at",
    "minimum_age_seconds",
    "max_delete_count",
    "age_basis",
    "terminal_age_exact",
    "items",
    "delete_accepted_pod_names",
    "skipped_pod_names",
    "failed_pod_names"
  ],
  "title": "dpone GitOps Airflow runtime Pod retention apply report",
  "type": "object",
  "x-dpone-authoritative-field": "items"
}
