{{- if and .Values.crds.datadogMonitors (not (.Capabilities.APIVersions.Has "apiextensions.k8s.io/v1/CustomResourceDefinition")) }}
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.4.1
  creationTimestamp: null
  name: datadogmonitors.datadoghq.com
  labels:
    helm.sh/chart: '{{ include "datadog-crds.chart" . }}'
    app.kubernetes.io/managed-by: '{{ .Release.Service }}'
    app.kubernetes.io/name: '{{ include "datadog-crds.name" . }}'
    app.kubernetes.io/instance: '{{ .Release.Name }}'
spec:
  additionalPrinterColumns:
    - JSONPath: .status.id
      name: id
      type: string
    - JSONPath: .status.monitorState
      name: monitor state
      type: string
    - JSONPath: .status.monitorStateLastTransitionTime
      name: last transition
      type: string
    - JSONPath: .status.monitorStateLastUpdateTime
      format: date
      name: last sync
      type: string
    - JSONPath: .status.syncStatus
      name: sync status
      type: string
    - JSONPath: .metadata.creationTimestamp
      name: age
      type: date
  group: datadoghq.com
  names:
    kind: DatadogMonitor
    listKind: DatadogMonitorList
    plural: datadogmonitors
    singular: datadogmonitor
  scope: Namespaced
  subresources:
    status: {}
  validation:
    openAPIV3Schema:
      description: DatadogMonitor allows to define and manage Monitors from your Kubernetes Cluster
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More 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. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
          type: string
        metadata:
          type: object
        spec:
          description: DatadogMonitorSpec defines the desired state of DatadogMonitor
          properties:
            message:
              description: Message is a message to include with notifications for this monitor
              type: string
            name:
              description: Name is the monitor name
              type: string
            options:
              description: Options are the optional parameters associated with your monitor
              properties:
                escalationMessage:
                  description: A message to include with a re-notification.
                  type: string
                evaluationDelay:
                  description: Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.
                  format: int64
                  type: integer
                includeTags:
                  description: A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.
                  type: boolean
                locked:
                  description: Whether or not the monitor is locked (only editable by creator and admins).
                  type: boolean
                newHostDelay:
                  description: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.
                  format: int64
                  type: integer
                noDataTimeframe:
                  description: The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.
                  format: int64
                  type: integer
                notifyAudit:
                  description: A Boolean indicating whether tagged users are notified on changes to this monitor.
                  type: boolean
                notifyNoData:
                  description: A Boolean indicating whether this monitor notifies when data stops reporting.
                  type: boolean
                renotifyInterval:
                  description: The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.
                  format: int64
                  type: integer
                requireFullWindow:
                  description: A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.
                  type: boolean
                thresholdWindows:
                  description: A struct of the alerting time window options.
                  properties:
                    recoveryWindow:
                      description: Describes how long an anomalous metric must be normal before the alert recovers.
                      type: string
                    triggerWindow:
                      description: Describes how long a metric must be anomalous before an alert triggers.
                      type: string
                  type: object
                thresholds:
                  description: A struct of the different monitor threshold values.
                  properties:
                    critical:
                      description: The monitor CRITICAL threshold.
                      type: string
                    criticalRecovery:
                      description: The monitor CRITICAL recovery threshold.
                      type: string
                    ok:
                      description: The monitor OK threshold.
                      type: string
                    unknown:
                      description: The monitor UNKNOWN threshold.
                      type: string
                    warning:
                      description: The monitor WARNING threshold.
                      type: string
                    warningRecovery:
                      description: The monitor WARNING recovery threshold.
                      type: string
                  type: object
                timeoutH:
                  description: The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.
                  format: int64
                  type: integer
              type: object
            priority:
              description: Priority is an integer from 1 (high) to 5 (low) indicating alert severity
              format: int64
              type: integer
            query:
              description: Query is the Datadog monitor query
              type: string
            tags:
              description: Tags is the monitor tags associated with your monitor
              items:
                type: string
              type: array
            type:
              description: Type is the monitor type
              type: string
          type: object
        status:
          description: DatadogMonitorStatus defines the observed state of DatadogMonitor
          properties:
            conditions:
              description: Conditions Represents the latest available observations of a DatadogMonitor's current state.
              items:
                description: DatadogMonitorCondition describes the current state of a DatadogMonitor
                properties:
                  lastTransitionTime:
                    description: Last time the condition transitioned from one status to another.
                    format: date-time
                    type: string
                  lastUpdateTime:
                    description: Last time the condition was updated.
                    format: date-time
                    type: string
                  message:
                    description: A human readable message indicating details about the transition.
                    type: string
                  reason:
                    description: The reason for the condition's last transition.
                    type: string
                  status:
                    description: Status of the condition, one of True, False, Unknown.
                    type: string
                  type:
                    description: Type of DatadogMonitor condition
                    type: string
                required:
                  - status
                  - type
                type: object
              type: array
            created:
              description: Created is the time the monitor was created
              format: date-time
              type: string
            creator:
              description: Creator is the identify of the monitor creator
              type: string
            currentHash:
              description: CurrentHash tracks the hash of the current DatadogMonitorSpec to know if the Spec has changed and needs an update
              type: string
            downtimeStatus:
              description: DowntimeStatus defines whether the monitor is downtimed
              properties:
                downtimeId:
                  type: integer
                isDowntimed:
                  type: boolean
              type: object
            id:
              description: ID is the monitor ID generated in Datadog
              type: integer
            monitorState:
              description: MonitorState is the overall state of monitor
              type: string
            monitorStateLastTransitionTime:
              description: MonitorStateLastTransitionTime is the last time the monitor state changed
              format: date-time
              type: string
            monitorStateLastUpdateTime:
              description: MonitorStateLastUpdateTime is the last time the monitor state updated
              format: date-time
              type: string
            primary:
              description: Primary defines whether the monitor is managed by the Kubernetes custom resource (true) or outside Kubernetes (false)
              type: boolean
            syncStatus:
              description: SyncStatus shows the health of syncing the monitor state to Datadog
              type: string
            triggeredState:
              description: TriggeredState only includes details for monitor groups that are triggering
              items:
                description: DatadogMonitorTriggeredState represents the details of a triggering DatadogMonitor The DatadogMonitor is triggering if one of its groups is in Alert, Warn, or No Data
                properties:
                  lastTransitionTime:
                    format: date-time
                    type: string
                  monitorGroup:
                    description: MonitorGroup is the name of the triggering group
                    type: string
                  state:
                    description: DatadogMonitorState represents the overall DatadogMonitor state
                    type: string
                type: object
              type: array
          type: object
      type: object
  version: v1alpha1
  versions:
    - name: v1alpha1
      served: true
      storage: true
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []
{{- end }}
