apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: storagelocations.metering.openshift.io
spec:
  group: metering.openshift.io
  scope: Namespaced
  names:
    plural: storagelocations
    singular: storagelocation
    kind: StorageLocation
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        description: |
          StorageLocation is a custom resource that configures where data will
          be stored by the reporting-operator. This included the data collected
          from Prometheus, and the results produced by generating a `Report` custom
          resources.
        required:
        - spec
        properties:
          spec:
            type: object
            description: |
              StorageLocationSpec is the desired specification of a StorageLocation custom resource.
              Required fields: databaseName, unmanagedDatabase, and location.
              More info: https://github.com/kube-reporting/metering-operator/blob/master/Documentation/storagelocations.md
            properties:
              hive:
                type: object
                description: |
                  Configures the StorageLocation to store data in Presto by creating
                  the table using Hive Server.
                  Note: databaseName and unmanagedDatabase are required fields.
                required:
                - databaseName
                - unmanagedDatabase
                properties:
                  databaseName:
                    type: string
                    description: |
                      DatabaseName is the name of the database within hive.
                    minLength: 1
                  unmanagedDatabase:
                    type: boolean
                    description: |
                      UnmanagedDatabase controls whether the StorageLocation will be actively
                      managed, and if true, the databaseName needs to point to an existing table
                      in Hive. If set to false, the reporting-operator creates a database in Hive.
                  location:
                    type: string
                    description: |
                      Location is the filesystem URL for Presto and Hive to use for the
                      database. This can be in the form of `hdfs://` or `sda://` filesystem URL.
                      If this field is unset, or set to an empty string, then the default
                      filesystem URL for Hive is used.
                      Note: this is an optional field.
                    format: uri
                  defaultTableProperties:
                    type: object
                    description: |
                      DefaultTableProperties contains the configuration options for creating table
                      using Hive.
                      Note: this is an optional field.
                    properties:
                      fileFormat:
                        type: string
                        description: |
                          FileFormat specifies the file format used for storing files in the file system.
                          Note: this is an optional field.
                          More info: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-StorageFormatsStorageFormatsRowFormat,StorageFormat,andSerDe
                        minLength: 1
                      rowFormat:
                        type: string
                        description: |
                          RowFormat specifies the Hive row format, which is how Hive serializes and
                          deserializes rows.
                          Note: this is an optional field.
                          More info: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-StorageFormatsStorageFormatsRowFormat,StorageFormat,andSerDe
                        minLength: 1
          status:
            type: object
            properties:
              hive:
                type: object
                properties:
                  databaseName:
                    type: string
                  location:
                    type: string

