{
  "description": "AlloyDBInstance is the Schema for the AlloyDBInstance API",
  "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": "AlloyDBInstanceSpec defines the desired state of AlloyDBInstance",
      "properties": {
        "annotations": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Annotations to allow client tools to store small amount of arbitrary data. This is distinct from labels.",
          "type": "object"
        },
        "availabilityType": {
          "description": "Availability type of an Instance. If empty, defaults to REGIONAL for primary instances.\n\nFor read pools, availabilityType is always UNSPECIFIED. Instances in the\nread pools are evenly distributed across available zones within the region\n(i.e. read pools with more than one node will have a node in at least two zones).\nPossible values: [\"AVAILABILITY_TYPE_UNSPECIFIED\", \"ZONAL\", \"REGIONAL\"].",
          "type": "string"
        },
        "clusterRef": {
          "description": "The AlloyDBInstance cluster that this resource belongs to.",
          "oneOf": [
            {
              "not": {
                "required": [
                  "external"
                ]
              },
              "required": [
                "name"
              ]
            },
            {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "name"
                    ]
                  },
                  {
                    "required": [
                      "namespace"
                    ]
                  }
                ]
              },
              "required": [
                "external"
              ]
            }
          ],
          "properties": {
            "external": {
              "description": "If provided must be in the format `projects/[projectId]/locations/[location]/clusters/[clusterId]`.",
              "type": "string"
            },
            "name": {
              "description": "The `metadata.name` field of a `AlloyDBCluster` resource.",
              "type": "string"
            },
            "namespace": {
              "description": "The `metadata.namespace` field of a `AlloyDBCluster` resource.",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "connectionPoolConfig": {
          "description": "Configuration for Managed Connection Pool (MCP).",
          "properties": {
            "enabled": {
              "description": "Optional. Whether to enable Managed Connection Pool (MCP).",
              "type": "boolean"
            },
            "flags": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Optional. Connection Pool flags, as a list of \"key\": \"value\" pairs.",
              "type": "object"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "databaseFlags": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Database flags. Set at instance level. * They are copied from primary instance on read instance creation. * Read instances can set new or override existing flags that are relevant for reads, e.g. for enabling columnar cache on a read instance. Flags set on read instance may or may not be present on primary.",
          "type": "object"
        },
        "displayName": {
          "description": "User-settable and human-readable display name for the Instance.",
          "type": "string"
        },
        "gceZone": {
          "description": "The Compute Engine zone that the instance should serve from, per https://cloud.google.com/compute/docs/regions-zones This can ONLY be specified for ZONAL instances. If present for a REGIONAL instance, an error will be thrown. If this is absent for a ZONAL instance, instance is created in a random zone with available capacity.",
          "type": "string"
        },
        "instanceType": {
          "description": "Not recommended. We recommend that you use `instanceTypeRef` instead. The type of the instance. Possible values: [PRIMARY, READ_POOL, SECONDARY]",
          "type": "string"
        },
        "instanceTypeRef": {
          "description": "The type of instance.\nPossible values: [\"PRIMARY\", \"READ_POOL\", \"SECONDARY\"]\n\nFor PRIMARY and SECONDARY instances, set the value to refer to the name of the associated cluster.\nThis is recommended because the instance type of primary and secondary instances is tied to the cluster type of the associated cluster.\nIf the secondary cluster is promoted to primary cluster, then the associated secondary instance also becomes primary instance.\nExample:\ninstanceTypeRef:\n  name: clusterName\nFor instances of type READ_POOL, set the value using external keyword.\nExample:\ninstanceTypeRef:\n  external: READ_POOL\nIf the instance type is SECONDARY, the delete instance operation does not delete the secondary instance but abandons it instead.\nUse deletionPolicy = \"FORCE\" in the associated secondary cluster and delete the cluster forcefully to delete the secondary cluster as well its associated secondary instance.",
          "oneOf": [
            {
              "not": {
                "required": [
                  "external"
                ]
              },
              "required": [
                "name"
              ]
            },
            {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "name"
                    ]
                  },
                  {
                    "required": [
                      "namespace"
                    ]
                  }
                ]
              },
              "required": [
                "external"
              ]
            }
          ],
          "properties": {
            "external": {
              "description": "The type of instance. Possible values: [\"PRIMARY\", \"READ_POOL\", \"SECONDARY\"]",
              "type": "string"
            },
            "name": {
              "description": "The `metadata.name` field of a `AlloyDBCluster` resource.",
              "type": "string"
            },
            "namespace": {
              "description": "The `metadata.namespace` field of a `AlloyDBCluster` resource.",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "machineConfig": {
          "description": "Configurations for the machines that host the underlying database engine.",
          "properties": {
            "cpuCount": {
              "description": "The number of CPU's in the VM instance.",
              "format": "int32",
              "type": "integer"
            },
            "machineType": {
              "description": "Machine type of the VM instance. E.g. \"n2-highmem-4\", \"n2-highmem-8\", \"c4a-highmem-4-lssd\". cpu_count must match the number of vCPUs in the machine type.",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "networkConfig": {
          "description": "Instance level network configuration.",
          "properties": {
            "authorizedExternalNetworks": {
              "description": "Optional. A list of external network authorized to access this instance. This field is only allowed to be set when 'enablePublicIp' is set to true.",
              "items": {
                "properties": {
                  "cidrRange": {
                    "description": "CIDR range for one authorzied network of the instance.",
                    "type": "string"
                  }
                },
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "enableOutboundPublicIp": {
              "description": "Optional. Enabling an outbound public IP address to support a database server sending requests out into the internet.",
              "type": "boolean"
            },
            "enablePublicIp": {
              "description": "Optional. Enabling public ip for the instance. If a user wishes to disable this, please also clear the list of the authorized external networks set on the same instance.",
              "type": "boolean"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "observabilityConfig": {
          "properties": {
            "assistiveExperiencesEnabled": {
              "description": "Whether assistive experiences are enabled for this AlloyDB instance.",
              "type": "boolean"
            },
            "enabled": {
              "description": "Observability feature status for an instance. This flag is turned \"off\" by default.",
              "type": "boolean"
            },
            "maxQueryStringLength": {
              "description": "Query string length. The default value is 10k.",
              "format": "int32",
              "type": "integer"
            },
            "preserveComments": {
              "description": "Preserve comments in query string for an instance. This flag is turned \"off\" by default.",
              "type": "boolean"
            },
            "queryPlansPerMinute": {
              "description": "Number of query execution plans captured by Insights per minute for all queries combined. The default value is 200. Any integer between 0 to 200 is considered valid.",
              "format": "int32",
              "type": "integer"
            },
            "recordApplicationTags": {
              "description": "Record application tags for an instance. This flag is turned \"off\" by default.",
              "type": "boolean"
            },
            "trackActiveQueries": {
              "description": "Track actively running queries on the instance. If not set, this flag is \"off\" by default.",
              "type": "boolean"
            },
            "trackClientAddress": {
              "description": "Track client address for an instance. If not set, default value is \"off\".",
              "type": "boolean"
            },
            "trackWaitEvents": {
              "description": "Track wait events during query execution for an instance. This flag is turned \"on\" by default but tracking is enabled only after observability enabled flag is also turned on.",
              "type": "boolean"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "queryInsightsConfig": {
          "properties": {
            "queryPlansPerMinute": {
              "description": "Number of query execution plans captured by Insights per minute for all queries combined. The default value is 5. Any integer between 0 and 20 is considered valid.",
              "format": "int32",
              "type": "integer"
            },
            "queryStringLength": {
              "description": "Query string length. The default value is 1024. Any integer between 256 and 4500 is considered valid.",
              "format": "int32",
              "type": "integer"
            },
            "recordApplicationTags": {
              "description": "Record application tags for an instance. This flag is turned \"on\" by default.",
              "type": "boolean"
            },
            "recordClientAddress": {
              "description": "Record client address for an instance. Client address is PII information. This flag is turned \"on\" by default.",
              "type": "boolean"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "readPoolConfig": {
          "description": "Read pool specific config. If the instance type is READ_POOL, this configuration must be provided.",
          "properties": {
            "nodeCount": {
              "description": "Read capacity, i.e. number of nodes in a read pool instance.",
              "format": "int32",
              "type": "integer"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "resourceID": {
          "description": "Optional. The instanceId of the resource. If not given, the metadata.name will be used.",
          "type": "string"
        }
      },
      "required": [
        "clusterRef"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "AlloyDBInstanceStatus defines the config connector machine state of AlloyDBInstance",
      "properties": {
        "conditions": {
          "description": "Conditions represent the latest available observations of the object's current state.",
          "items": {
            "properties": {
              "lastTransitionTime": {
                "description": "Last time the condition transitioned from one status to another.",
                "type": "string"
              },
              "message": {
                "description": "Human-readable message indicating details about last transition.",
                "type": "string"
              },
              "reason": {
                "description": "Unique, one-word, CamelCase reason for the condition's last transition.",
                "type": "string"
              },
              "status": {
                "description": "Status is the status of the condition. Can be True, False, Unknown.",
                "type": "string"
              },
              "type": {
                "description": "Type is the type of the condition.",
                "type": "string"
              }
            },
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "createTime": {
          "description": "Time the Instance was created in UTC.",
          "type": "string"
        },
        "externalRef": {
          "description": "A unique specifier for the AlloyDBInstance resource in GCP.",
          "type": "string"
        },
        "ipAddress": {
          "description": "The IP address for the Instance. This is the connection endpoint for an end-user application.",
          "type": "string"
        },
        "name": {
          "description": "The name of the instance resource.",
          "type": "string"
        },
        "observedGeneration": {
          "description": "ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource.",
          "format": "int64",
          "type": "integer"
        },
        "observedState": {
          "description": "ObservedState is the state of the resource as most recently observed in GCP.",
          "properties": {
            "connectionPoolConfig": {
              "description": "Output for Managed Connection Pool (MCP).",
              "properties": {
                "poolerCount": {
                  "description": "Output only. The number of running poolers per instance.",
                  "format": "int32",
                  "type": "integer"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "observabilityConfig": {
              "description": "Observability feature status for an instance.",
              "properties": {
                "trackWaitEventTypes": {
                  "description": "Output only. Track wait event types during query execution for an instance. This flag is turned \"on\" by default but tracking is enabled only after observability enabled flag is also turned on. This is read-only flag and only modifiable by internal API.",
                  "type": "boolean"
                }
              },
              "type": "object",
              "additionalProperties": false
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "outboundPublicIpAddresses": {
          "description": "The outbound public IP addresses for the instance. This is available ONLY when networkConfig.enableOutboundPublicIp is set to true. These IP addresses are used for outbound connections.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "publicIpAddress": {
          "description": "The public IP addresses for the Instance. This is available ONLY when networkConfig.enablePublicIp is set to true. This is the connection endpoint for an end-user application.",
          "type": "string"
        },
        "reconciling": {
          "description": "Set to true if the current state of Instance does not match the user's intended state, and the service is actively updating the resource to reconcile them. This can happen due to user-triggered updates or system actions like failover or maintenance.",
          "type": "boolean"
        },
        "state": {
          "description": "The current state of the alloydb instance.",
          "type": "string"
        },
        "uid": {
          "description": "The system-generated UID of the resource.",
          "type": "string"
        },
        "updateTime": {
          "description": "Time the Instance was updated in UTC.",
          "type": "string"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "required": [
    "spec"
  ],
  "type": "object"
}
