{
  "description": "SLO is the Schema for the slos API.\nSee also https://coralogix.com/platform/apm/slo-management/",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "SLOSpec defines the desired state of SLO. For more information, see: https://coralogix.com/platform/apm/slo-management/",
      "properties": {
        "description": {
          "description": "Optional SLO description",
          "type": "string"
        },
        "labels": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Labels are additional labels to be added to the SLO.",
          "type": "object"
        },
        "name": {
          "description": "SLO name",
          "type": "string"
        },
        "sliType": {
          "description": "SliType defines the type of SLI used for the SLO. Exactly one of metric or windowBasedMetric must be set.",
          "properties": {
            "requestBasedMetric": {
              "properties": {
                "goodEvents": {
                  "description": "GoodEvents defines the good events metric.",
                  "properties": {
                    "query": {
                      "description": "Query is the metric query string.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "query"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "groupByLabels": {
                  "description": "GroupByLabels defines the labels to group the SLI by.",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "totalEvents": {
                  "description": "TotalEvents defines the total events metric.",
                  "properties": {
                    "query": {
                      "description": "Query is the metric query string.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "query"
                  ],
                  "type": "object",
                  "additionalProperties": false
                }
              },
              "required": [
                "goodEvents",
                "totalEvents"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "windowBasedMetric": {
              "properties": {
                "comparisonOperator": {
                  "description": "ComparisonOperator defines the comparison operator for the SLO. Valid values are \"unspecified\", \"greaterThan\", \"lessThan\", \"greaterThanOrEquals\", and \"lessThanOrEquals\".",
                  "enum": [
                    "unspecified",
                    "greaterThan",
                    "lessThan",
                    "greaterThanOrEquals",
                    "lessThanOrEquals"
                  ],
                  "type": "string"
                },
                "query": {
                  "description": "Optional query for the metric.",
                  "properties": {
                    "query": {
                      "description": "Query is the metric query string.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "query"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "threshold": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "Threshold defines the threshold for the SLO.",
                  "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                  "x-kubernetes-int-or-string": true
                },
                "window": {
                  "description": "Window defines the time window for the SLO. Valid values are \"unspecified\", \"1m\", and \"5m\".",
                  "enum": [
                    "unspecified",
                    "1m",
                    "5m"
                  ],
                  "type": "string"
                }
              },
              "type": "object",
              "additionalProperties": false
            }
          },
          "type": "object",
          "x-kubernetes-validations": [
            {
              "message": "Exactly one of requestBasedMetricSli or windowBasedMetric must be set",
              "rule": "has(self.requestBasedMetric) != has(self.windowBasedMetric)"
            }
          ],
          "additionalProperties": false
        },
        "targetThresholdPercentage": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "description": "TargetThresholdPercentage is the target threshold percentage for the SLO.",
          "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
          "x-kubernetes-int-or-string": true
        },
        "window": {
          "description": "Window defines the time window for the SLO.",
          "properties": {
            "timeFrame": {
              "description": "TimeFrame defines the time frame for the SLO window. Valid values are \"unspecified\", \"7d\", \"14d\", \"21d\", and \"28d\".\nDeprecated: \"90d\" is no longer supported by the Coralogix API and will be rejected by the operator.",
              "enum": [
                "unspecified",
                "7d",
                "14d",
                "21d",
                "28d",
                "90d"
              ],
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        }
      },
      "required": [
        "name",
        "sliType",
        "targetThresholdPercentage",
        "window"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "SLOStatus defines the observed state of SLO.",
      "properties": {
        "conditions": {
          "items": {
            "description": "Condition contains details for one aspect of the current state of this API Resource.",
            "properties": {
              "lastTransitionTime": {
                "description": "lastTransitionTime is the last time the condition transitioned from one status to another.\nThis should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "message is a human readable message indicating details about the transition.\nThis may be an empty string.",
                "maxLength": 32768,
                "type": "string"
              },
              "observedGeneration": {
                "description": "observedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith respect to the current state of the instance.",
                "format": "int64",
                "minimum": 0,
                "type": "integer"
              },
              "reason": {
                "description": "reason contains a programmatic identifier indicating the reason for the condition's last transition.\nProducers of specific condition types may define expected values and meanings for this field,\nand whether the values are considered a guaranteed API.\nThe value should be a CamelCase string.\nThis field may not be empty.",
                "maxLength": 1024,
                "minLength": 1,
                "pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$",
                "type": "string"
              },
              "status": {
                "description": "status of the condition, one of True, False, Unknown.",
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ],
                "type": "string"
              },
              "type": {
                "description": "type of condition in CamelCase or in foo.example.com/CamelCase.",
                "maxLength": 316,
                "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$",
                "type": "string"
              }
            },
            "required": [
              "lastTransitionTime",
              "message",
              "reason",
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "id": {
          "type": "string"
        },
        "printableStatus": {
          "type": "string"
        },
        "revision": {
          "format": "int32",
          "type": "integer"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
