{
  "description": "KongVault is the schema for kongvaults API which defines a custom Kong vault.\nA Kong vault is a storage to store sensitive data, where the values can be referenced in configuration of plugins.\nSee: https://docs.konghq.com/gateway/latest/kong-enterprise/secrets-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": "KongVaultSpec defines specification of a custom Kong vault.",
      "properties": {
        "backend": {
          "description": "Backend is the type of the backend storing the secrets in the vault.\nThe supported backends of Kong is listed here:\nhttps://docs.konghq.com/gateway/latest/kong-enterprise/secrets-management/backends/",
          "minLength": 1,
          "type": "string"
        },
        "config": {
          "description": "Config is the configuration of the vault. Varies for different backends.",
          "x-kubernetes-preserve-unknown-fields": true
        },
        "controlPlaneRef": {
          "description": "ControlPlaneRef is a reference to a Konnect ControlPlane this KongVault is associated with.",
          "properties": {
            "konnectID": {
              "description": "KonnectID is the schema for the KonnectID type.\nThis field is required when the Type is konnectID.",
              "pattern": "^[0-9a-f]{8}(?:\\-[0-9a-f]{4}){3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "konnectNamespacedRef": {
              "description": "KonnectNamespacedRef is a reference to a Konnect Control Plane entity inside the cluster.\nIt contains the name of the Konnect Control Plane.\nThis field is required when the Type is konnectNamespacedRef.",
              "properties": {
                "name": {
                  "description": "Name is the name of the Konnect Control Plane.",
                  "type": "string"
                },
                "namespace": {
                  "description": "Namespace is the namespace where the Konnect Control Plane is in.\nCurrently only cluster scoped resources (KongVault) are allowed to set `konnectNamespacedRef.namespace`.",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "type": {
              "default": "kic",
              "description": "Type indicates the type of the control plane being referenced. Allowed values:\n- konnectID\n- konnectNamespacedRef\n- kic\n\nThe default is kic, which implies that the Control Plane is KIC.",
              "enum": [
                "konnectID",
                "konnectNamespacedRef",
                "kic"
              ],
              "type": "string"
            }
          },
          "type": "object",
          "x-kubernetes-validations": [
            {
              "message": "'konnectID' type is not supported",
              "rule": "self.type != 'konnectID'"
            },
            {
              "message": "when type is konnectNamespacedRef, konnectNamespacedRef must be set",
              "rule": "(has(self.type) && self.type == 'konnectNamespacedRef') ? has(self.konnectNamespacedRef) : true"
            },
            {
              "message": "when type is konnectNamespacedRef, konnectID must not be set",
              "rule": "(has(self.type) && self.type == 'konnectNamespacedRef') ? !has(self.konnectID) : true"
            },
            {
              "message": "when type is konnectID, konnectID must be set",
              "rule": "(has(self.type) && self.type == 'konnectID') ? has(self.konnectID) : true"
            },
            {
              "message": "when type is konnectID, konnectNamespacedRef must not be set",
              "rule": "(has(self.type) && self.type == 'konnectID') ? !has(self.konnectNamespacedRef) : true"
            },
            {
              "message": "when type is kic, konnectID must not be set",
              "rule": "(has(self.type) && self.type == 'kic') ? !has(self.konnectID) : true"
            },
            {
              "message": "when type is kic, konnectNamespacedRef must not be set",
              "rule": "(has(self.type) && self.type == 'kic') ? !has(self.konnectNamespacedRef) : true"
            },
            {
              "message": "when type is unset, konnectID must not be set",
              "rule": "!has(self.type) ? !has(self.konnectID) : true"
            },
            {
              "message": "when type is unset, konnectNamespacedRef must not be set",
              "rule": "!has(self.type) ? !has(self.konnectNamespacedRef) : true"
            }
          ],
          "additionalProperties": false
        },
        "description": {
          "description": "Description is the additional information about the vault.",
          "type": "string"
        },
        "prefix": {
          "description": "Prefix is the prefix of vault URI for referencing values in the vault.\nIt is immutable after created.",
          "minLength": 1,
          "type": "string"
        },
        "tags": {
          "description": "Tags are the tags associated to the vault for grouping and filtering.",
          "items": {
            "type": "string"
          },
          "maxItems": 20,
          "type": "array",
          "x-kubernetes-validations": [
            {
              "message": "tags entries must not be longer than 128 characters",
              "rule": "self.all(tag, size(tag) >= 1 && size(tag) <= 128)"
            }
          ]
        }
      },
      "required": [
        "backend",
        "prefix"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "KongVaultStatus represents the current status of the KongVault resource.",
      "properties": {
        "conditions": {
          "default": [
            {
              "lastTransitionTime": "1970-01-01T00:00:00Z",
              "message": "Waiting for controller",
              "reason": "Pending",
              "status": "Unknown",
              "type": "Programmed"
            }
          ],
          "description": "Conditions describe the current conditions of the KongVaultStatus.\n\nKnown condition types are:\n\n* \"Programmed\"",
          "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
          },
          "maxItems": 8,
          "type": "array",
          "x-kubernetes-list-map-keys": [
            "type"
          ],
          "x-kubernetes-list-type": "map"
        },
        "konnect": {
          "description": "Konnect contains the Konnect entity status.",
          "properties": {
            "controlPlaneID": {
              "description": "ControlPlaneID is the Konnect ID of the ControlPlane this Route is associated with.",
              "type": "string"
            },
            "id": {
              "description": "ID is the unique identifier of the Konnect entity as assigned by Konnect API.\nIf it's unset (empty string), it means the Konnect entity hasn't been created yet.",
              "type": "string"
            },
            "organizationID": {
              "description": "OrgID is ID of Konnect Org that this entity has been created in.",
              "type": "string"
            },
            "serverURL": {
              "description": "ServerURL is the URL of the Konnect server in which the entity exists.",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        }
      },
      "required": [
        "conditions"
      ],
      "type": "object",
      "additionalProperties": false
    }
  },
  "required": [
    "spec"
  ],
  "type": "object",
  "x-kubernetes-validations": [
    {
      "message": "The spec.prefix field is immutable",
      "rule": "self.spec.prefix == oldSelf.spec.prefix"
    },
    {
      "message": "controlPlaneRef is required once set",
      "rule": "!has(oldSelf.spec.controlPlaneRef) || has(self.spec.controlPlaneRef)"
    },
    {
      "message": "spec.controlPlaneRef is immutable when an entity is already Programmed",
      "rule": "(!has(self.status) || !self.status.conditions.exists(c, c.type == 'Programmed' && c.status == 'True') || !has(self.spec.controlPlaneRef)) ? true : oldSelf.spec.controlPlaneRef == self.spec.controlPlaneRef"
    }
  ]
}
