{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/lotus-yaml/latest.json",
  "x-lintel": {
    "source": "https://grnhse-vpc-assets.s3.amazonaws.com/jsonschemas/lotus.yaml.json",
    "sourceSha256": "1a32ff8490f8d032916370302649f50d254229d6b09ceda8baade5919ec5a030",
    "fileMatch": [
      "lotus.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "$ref": "#/$defs/LotusManifest",
  "$defs": {
    "Autoscaling": {
      "properties": {
        "metrics": {
          "items": {
            "$ref": "#/$defs/AutoscalingMetrics"
          },
          "type": "array"
        }
      },
      "required": [
        "metrics"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "AutoscalingMetrics": {
      "properties": {
        "name": {
          "type": "string"
        },
        "query": {
          "type": "string"
        },
        "average_value": {
          "type": "integer",
          "description": "nolint:tagliatelle"
        }
      },
      "required": [
        "name",
        "query",
        "average_value"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "ClientOf": {
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "application": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "type"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "Component": {
      "properties": {
        "livenessProbe": {
          "$ref": "#/$defs/Probe",
          "description": "Periodic probe of container liveness.\nContainer will be restarted if the probe fails.\nMore info: <https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/>"
        },
        "readinessProbe": {
          "$ref": "#/$defs/Probe",
          "description": "Periodic probe of container service readiness.\nContainer will be removed from service endpoints if the probe fails.\nMore info: <https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/>"
        },
        "startupProbe": {
          "$ref": "#/$defs/Probe",
          "description": "StartupProbe indicates whether the container has started.\nAll other probes are disabled until startup succeeds.\nMore info: <https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/>"
        },
        "name": {
          "type": "string",
          "maxLength": 45,
          "pattern": "^[a-z][a-z0-9-\\.]*[a-z0-9]$",
          "description": "Unique name for the component. It must be DNS-friendly"
        },
        "progressDeadlineSeconds": {
          "type": "integer",
          "description": "Used for deployments that need longer than the default 5 minutes to start up"
        },
        "type": {
          "type": "string",
          "enum": [
            "http",
            "worker",
            "predeploy",
            "postdeploy",
            "grpc-sso-proxy",
            "cron"
          ],
          "description": "The type of component."
        },
        "service_name": {
          "type": "string",
          "description": "The service name is only useful for grpc-sso-proxy components. If present,\na health service will be spun up for the service name, and it can be\npossible to perform auto updates of binaries."
        },
        "command": {
          "type": "string",
          "description": "Command describes how to run the workload"
        },
        "rollingUpdate": {
          "$ref": "#/$defs/RollingUpdateDeployment"
        },
        "sso_proxy": {
          "$ref": "#/$defs/SSOProxy",
          "description": "SSO Proxy settings for http components (grpc-sso-proxy has it enabled by default)"
        },
        "autoscaling": {
          "$ref": "#/$defs/Autoscaling",
          "description": "Autoscaling settings for components of type http, grpc-sso-proxy or worker"
        },
        "expose_metrics": {
          "$ref": "#/$defs/ExposeMetrics",
          "description": "ExposeMetrics for components of type http"
        }
      },
      "required": [
        "name",
        "type",
        "command"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "Datastore": {
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 24,
          "pattern": "^[a-z][a-z0-9-\\.]*[a-z0-9]$"
        },
        "type": {
          "type": "string"
        },
        "className": {
          "type": "string"
        },
        "disableFirewallRules": {
          "type": "boolean"
        },
        "postgresOptions": {
          "type": "object"
        },
        "elasticsearchOptions": {
          "type": "object"
        },
        "kafkaOptions": {
          "type": "object"
        },
        "kafkaClientOptions": {
          "type": "object"
        },
        "kafkaConnectorOptions": {
          "type": "object"
        },
        "opensearchOptions": {
          "type": "object"
        },
        "allowedClientApplications": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "apps that will connect to the datastores for this app"
        },
        "clientOf": {
          "$ref": "#/$defs/ClientOf",
          "description": "datastores that connect to other ones need to pass in the reference claim here"
        }
      },
      "required": [
        "name",
        "type"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "ExecAction": {
      "properties": {
        "command": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "ExposeMetrics": {
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "port": {
          "type": "integer",
          "description": "optional port to expose metrics on, defaults to 8080"
        }
      },
      "required": [
        "enabled"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "GRPCAction": {
      "properties": {
        "port": {
          "type": "integer"
        },
        "service": {
          "type": "string"
        }
      },
      "required": [
        "port",
        "service"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "HTTPGetAction": {
      "properties": {
        "path": {
          "type": "string"
        },
        "port": {
          "$ref": "#/$defs/IntOrString"
        },
        "host": {
          "type": "string"
        },
        "scheme": {
          "type": "string"
        },
        "httpHeaders": {
          "items": {
            "$ref": "#/$defs/HTTPHeader"
          },
          "type": "array"
        }
      },
      "required": [
        "port"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "HTTPHeader": {
      "properties": {
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "value"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "IntOrString": {
      "properties": {
        "Type": {
          "type": "integer"
        },
        "IntVal": {
          "type": "integer"
        },
        "StrVal": {
          "type": "string"
        }
      },
      "required": [
        "Type",
        "IntVal",
        "StrVal"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "LotusManifest": {
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 45,
          "pattern": "^[a-z][a-z0-9-\\.]*[a-z0-9]$",
          "title": "application name",
          "description": "The application name should match the repository's"
        },
        "components": {
          "items": {
            "$ref": "#/$defs/Component"
          },
          "type": "array",
          "description": "Workloads to run"
        },
        "auth_tokens": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Tokens minted to securely interact with other applications"
        },
        "firewall_rules": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Named egress rules"
        },
        "datastores": {
          "items": {
            "$ref": "#/$defs/Datastore"
          },
          "type": "array",
          "description": "List of datastores to provision"
        }
      },
      "required": [
        "name",
        "components"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "Probe": {
      "properties": {
        "exec": {
          "$ref": "#/$defs/ExecAction"
        },
        "httpGet": {
          "$ref": "#/$defs/HTTPGetAction"
        },
        "tcpSocket": {
          "$ref": "#/$defs/TCPSocketAction"
        },
        "grpc": {
          "$ref": "#/$defs/GRPCAction"
        },
        "initialDelaySeconds": {
          "type": "integer"
        },
        "timeoutSeconds": {
          "type": "integer"
        },
        "periodSeconds": {
          "type": "integer"
        },
        "successThreshold": {
          "type": "integer"
        },
        "failureThreshold": {
          "type": "integer"
        },
        "terminationGracePeriodSeconds": {
          "type": "integer"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "RollingUpdateDeployment": {
      "properties": {
        "maxUnavailable": {
          "$ref": "#/$defs/IntOrString"
        },
        "maxSurge": {
          "$ref": "#/$defs/IntOrString"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "SSOProxy": {
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "pass_auth_header": {
          "type": "boolean",
          "description": "pass OIDC IDToken to upstream via Authorization Bearer header"
        },
        "allow_bearer_auth": {
          "type": "boolean",
          "description": "skip requests that have verified JWT bearer tokens"
        },
        "skip_auth": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "bypass authentication for requests that match the method & path. Format: method=path_regex OR path_regex alone for all methods"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "TCPSocketAction": {
      "properties": {
        "port": {
          "$ref": "#/$defs/IntOrString"
        },
        "host": {
          "type": "string"
        }
      },
      "required": [
        "port"
      ],
      "type": "object",
      "additionalProperties": false
    }
  }
}
