{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://runninglake.com/schema/v1alpha1/joblogpolicy.json",
  "title": "JobLogPolicy",
  "description": "A JobLogPolicy as RunningLake's configuration repository declares it, at logs/policy.yaml. Generated from the Go types the control plane decodes this file into, so it checks the shape the gate reads — field names and types, and which fields may exist. The gate also applies rules no schema can express — required fields inside spec among them — so a file this schema accepts can still be refused by `rl diff`. Take #/properties/spec for the spec alone.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "apiVersion",
    "kind",
    "metadata"
  ],
  "properties": {
    "apiVersion": {
      "type": "string",
      "const": "runninglake.io/v1alpha1",
      "description": "The config schema's version, which is independent of the HTTP API's (rule unsupported-api-version)."
    },
    "kind": {
      "type": "string",
      "const": "JobLogPolicy",
      "description": "The kind this file declares. A kind that disagrees with the file's path is refused (rule kind-mismatch)."
    },
    "metadata": {
      "required": [
        "name"
      ],
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9_-]{1,63}$",
          "description": "The resource's name, which is also its path segment. It must be the name this file's path gives it (rule name-mismatch)."
        },
        "labels": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "annotations": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "spec": {
      "description": "JobLogPolicySpec is how long a project keeps its job logs: its runs' and queries' logs. One per project, named default, at logs/policy.yaml. A plane is designed to move those logs from its system bucket into the bucket where it holds the project's data, and to keep them there; both buckets are in your account on a plane in your own account, and in ours on a plane we host. Recorded and checked here; nothing applies the period yet, and no plane keeps job logs yet.",
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "properties": {
        "retentionDays": {
          "description": "RetentionDays is how long job logs are kept: 7, 30, 90 or 365 days. Default 90. An environment may set its own. Making it longer needs an owner or admin to approve, even in an environment that otherwise applies changes straight away; making it shorter in the project's own file does not. An environment's own period is judged without sight of the project's, so setting one for the first time asks for approval unless it is 7 days. A project of an organisation on the trial is refused 365 days when the change is planned. Nothing applies it yet.",
          "type": [
            "integer",
            "null"
          ],
          "minimum": -9223372036854775808,
          "maximum": 9223372036854775807
        }
      }
    }
  }
}
