---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.17.2
    helm.sh/resource-policy: keep
  name: publications.postgresql.cnpg.io
spec:
  group: postgresql.cnpg.io
  names:
    kind: Publication
    listKind: PublicationList
    plural: publications
    singular: publication
  scope: Namespaced
  versions:
    - additionalPrinterColumns:
        - jsonPath: .metadata.creationTimestamp
          name: Age
          type: date
        - jsonPath: .spec.cluster.name
          name: Cluster
          type: string
        - jsonPath: .spec.name
          name: PG Name
          type: string
        - jsonPath: .status.applied
          name: Applied
          type: boolean
        - jsonPath: .status.message
          name: Message
          type: string
      name: v1
      schema:
        openAPIV3Schema:
          properties:
            apiVersion:
              type: string
            kind:
              type: string
            metadata:
              type: object
            spec:
              properties:
                cluster:
                  properties:
                    name:
                      default: ""
                      type: string
                  type: object
                  x-kubernetes-map-type: atomic
                dbname:
                  type: string
                  x-kubernetes-validations:
                    - message: dbname is immutable
                      rule: self == oldSelf
                name:
                  type: string
                  x-kubernetes-validations:
                    - message: name is immutable
                      rule: self == oldSelf
                parameters:
                  additionalProperties:
                    type: string
                  type: object
                publicationReclaimPolicy:
                  default: retain
                  enum:
                    - delete
                    - retain
                  type: string
                target:
                  properties:
                    allTables:
                      type: boolean
                      x-kubernetes-validations:
                        - message: allTables is immutable
                          rule: self == oldSelf
                    objects:
                      items:
                        properties:
                          table:
                            properties:
                              columns:
                                items:
                                  type: string
                                type: array
                              name:
                                type: string
                              only:
                                type: boolean
                              schema:
                                type: string
                            required:
                              - name
                            type: object
                          tablesInSchema:
                            type: string
                        type: object
                        x-kubernetes-validations:
                          - message: tablesInSchema and table are mutually exclusive
                            rule: (has(self.tablesInSchema) && !has(self.table)) || (!has(self.tablesInSchema) && has(self.table))
                      maxItems: 100000
                      type: array
                      x-kubernetes-validations:
                        - message: specifying a column list when the publication also publishes tablesInSchema is not supported
                          rule: '!(self.exists(o, has(o.table) && has(o.table.columns)) && self.exists(o, has(o.tablesInSchema)))'
                  type: object
                  x-kubernetes-validations:
                    - message: allTables and objects are mutually exclusive
                      rule: (has(self.allTables) && !has(self.objects)) || (!has(self.allTables) && has(self.objects))
              required:
                - cluster
                - dbname
                - name
                - target
              type: object
            status:
              properties:
                applied:
                  type: boolean
                message:
                  type: string
                observedGeneration:
                  format: int64
                  type: integer
              type: object
          required:
            - metadata
            - spec
          type: object
      served: true
      storage: true
      subresources:
        status: {}
