apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: reportqueries.metering.openshift.io
spec:
  group: metering.openshift.io
  scope: Namespaced
  names:
    plural: reportqueries
    singular: reportquery
    kind: ReportQuery
    shortNames:
    - rq
  versions:
  - name: v1
    served: true
    storage: true
    additionalPrinterColumns:
    - name: Age
      type: date
      jsonPath: .metadata.creationTimestamp
    schema:
      openAPIV3Schema:
        type: object
        required:
        - spec
        properties:
          spec:
            type: object
            required:
            - columns
            - query
            properties:
              columns:
                type: array
                minItems: 1
                items:
                  type: object
                  required:
                  - name
                  - type
                  properties:
                    name:
                      type: string
                      minLength: 1
                    type:
                      type: string
                      enum:
                      - BOOLEAN
                      - TINYINT
                      - SMALLINT
                      - INTEGER
                      - BIGINT
                      - REAL
                      - DOUBLE
                      - DECIMAL
                      - VARCHAR
                      - CHAR
                      - VARBINARY
                      - JSON
                      - DATE
                      - TIME
                      - TIMESTAMP
                      - ARRAY
                      - MAP
                      - MAP<VARCHAR, VARCHAR>
                      - MAP<VARCHAR, INT>
                      - MAP<INT, INT>
                      - MAP<INT, VARCHAR>
                      - ROW
                      - IPADDRESS
                      - UUID
                      - HYPERLOGLOG
                      - P4HYPERLOGLOG
                      - QDIGEST
                      - boolean
                      - tinyint
                      - smallint
                      - integer
                      - bigint
                      - real
                      - double
                      - decimal
                      - varchar
                      - char
                      - varbinary
                      - json
                      - date
                      - time
                      - timestamp
                      - array
                      - map
                      - map<varchar, varchar>
                      - map<varchar, int>
                      - map<int, int>
                      - map<int, varchar>
                      - row
                      - ipaddress
                      - uuid
                      - hyperloglog
                      - p4hyperloglog
                      - qdigest
                    unit:
                      type: string
                      enum:
                      - date
                      - kubernetes_pod
                      - kubernetes_persistentvolumeclaim
                      - kubernetes_persistentvolume
                      - kubernetes_storageclass
                      - kubernetes_namespace
                      - kubernetes_node
                      - bytes
                      - byte_seconds
                      - time
                      - cpu_core_seconds
                      - cpu_cores
                      - memory_bytes
                      - memory_byte_seconds
                      - seconds
                    tableHidden:
                      type: boolean
              inputs:
                type: array
                minItems: 1
                items:
                  type: object
                  required:
                  - name
                  properties:
                    name:
                      type: string
                      minLength: 1
                    type:
                      type: string
                      enum:
                      - string
                      - integer
                      - time
                      - ReportDataSource
                      - ReportQuery
                      - Report
                    required:
                      type: boolean
                    default:
                      type: string
              query:
                type: string
                pattern: '[Ss][Ee][Ll][Ee][Cc][Tt]\s'
                minLength: 1

