Skip to main content

clusters

Creates, updates, deletes, gets or lists a clusters resource.

Overview

Nameclusters
TypeResource
Idgoogle.alloydb.clusters

Fields

NameDatatypeDescription
namestringOutput only. The name of the cluster resource with the format: projects/{project}/locations/{region}/clusters/{cluster_id} where the cluster ID segment should satisfy the regex expression [a-z0-9-]+. For more details see https://google.aip.dev/122. The prefix of the cluster resource name is the name of the parent resource: projects/{project}/locations/{region}
annotationsobjectAnnotations to allow client tools to store small amount of arbitrary data. This is distinct from labels. https://google.aip.dev/128
automatedBackupPolicyobjectMessage describing the user-specified automated backup policy. All fields in the automated backup policy are optional. Defaults for each field are provided if they are not set.
backupSourceobjectMessage describing a BackupSource.
clusterTypestringOutput only. The type of the cluster. This is an output-only field and it's populated at the Cluster creation time or the Cluster promotion time. The cluster type is determined by which RPC was used to create the cluster (i.e. CreateCluster vs. CreateSecondaryCluster
continuousBackupConfigobjectContinuousBackupConfig describes the continuous backups recovery configurations of a cluster.
continuousBackupInfoobjectContinuousBackupInfo describes the continuous backup properties of a cluster.
createTimestringOutput only. Create time stamp
databaseVersionstringOptional. The database engine major version. This is an optional field and it is populated at the Cluster creation time. If a database version is not supplied at cluster creation time, then a default database version will be used.
deleteTimestringOutput only. Delete time stamp
displayNamestringUser-settable and human-readable display name for the Cluster.
encryptionConfigobjectEncryptionConfig describes the encryption config of a cluster or a backup that is encrypted with a CMEK (customer-managed encryption key).
encryptionInfoobjectEncryptionInfo describes the encryption information of a cluster or a backup.
etagstringFor Resource freshness validation (https://google.aip.dev/154)
initialUserobjectThe username/password for a database user. Used for specifying initial users at cluster creation time.
labelsobjectLabels as key value pairs
maintenanceScheduleobjectMaintenanceSchedule stores the maintenance schedule generated from the MaintenanceUpdatePolicy, once a maintenance rollout is triggered, if MaintenanceWindow is set, and if there is no conflicting DenyPeriod. The schedule is cleared once the update takes place. This field cannot be manually changed; modify the MaintenanceUpdatePolicy instead.
maintenanceUpdatePolicyobjectMaintenanceUpdatePolicy defines the policy for system updates.
migrationSourceobjectSubset of the source instance configuration that is available when reading the cluster resource.
networkstringRequired. The resource link for the VPC network in which cluster resources are created and from which they are accessible via Private IP. The network must belong to the same project as the cluster. It is specified in the form: projects/{project}/global/networks/{network_id}. This is required to create a cluster. Deprecated, use network_config.network instead.
networkConfigobjectMetadata related to network configuration.
primaryConfigobjectConfiguration for the primary cluster. It has the list of clusters that are replicating from this cluster. This should be set if and only if the cluster is of type PRIMARY.
pscConfigobjectPscConfig contains PSC related configuration at a cluster level.
reconcilingbooleanOutput only. Reconciling (https://google.aip.dev/128#reconciliation). Set to true if the current state of Cluster 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.
satisfiesPzsbooleanOutput only. Reserved for future use.
secondaryConfigobjectConfiguration information for the secondary cluster. This should be set if and only if the cluster is of type SECONDARY.
sslConfigobjectSSL configuration.
statestringOutput only. The current serving state of the cluster.
subscriptionTypestringOptional. Subscription type of the cluster.
trialMetadataobjectContains information and all metadata related to TRIAL clusters.
uidstringOutput only. The system-generated UID of the resource. The UID is assigned when the resource is created, and it is retained until it is deleted.
updateTimestringOutput only. Update time stamp

Methods

NameAccessible byRequired ParamsDescription
getSELECTclustersId, locationsId, projectsIdGets details of a single Cluster.
listSELECTlocationsId, projectsIdLists Clusters in a given project and location.
createINSERTlocationsId, projectsIdCreates a new Cluster in a given project and location.
deleteDELETEclustersId, locationsId, projectsIdDeletes a single Cluster.
patchUPDATEclustersId, locationsId, projectsIdUpdates the parameters of a single Cluster.
promoteEXECclustersId, locationsId, projectsIdPromotes a SECONDARY cluster. This turns down replication from the PRIMARY cluster and promotes a secondary cluster into its own standalone cluster. Imperative only.
restoreEXEClocationsId, projectsIdCreates a new Cluster in a given project and location, with a volume restored from the provided source, either a backup ID or a point-in-time and a source cluster.
switchoverEXECclustersId, locationsId, projectsIdSwitches the role of PRIMARY and SECONDARY cluster without any data loss. This promotes the SECONDARY cluster to PRIMARY and sets up original PRIMARY cluster to replicate from this newly promoted cluster.
upgradeEXECclustersId, locationsId, projectsIdUpgrades a single Cluster. Imperative only.

SELECT examples

Lists Clusters in a given project and location.

SELECT
name,
annotations,
automatedBackupPolicy,
backupSource,
clusterType,
continuousBackupConfig,
continuousBackupInfo,
createTime,
databaseVersion,
deleteTime,
displayName,
encryptionConfig,
encryptionInfo,
etag,
initialUser,
labels,
maintenanceSchedule,
maintenanceUpdatePolicy,
migrationSource,
network,
networkConfig,
primaryConfig,
pscConfig,
reconciling,
satisfiesPzs,
secondaryConfig,
sslConfig,
state,
subscriptionType,
trialMetadata,
uid,
updateTime
FROM google.alloydb.clusters
WHERE locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new clusters resource.

/*+ create */
INSERT INTO google.alloydb.clusters (
locationsId,
projectsId,
displayName,
labels,
databaseVersion,
networkConfig,
network,
etag,
annotations,
initialUser,
automatedBackupPolicy,
sslConfig,
encryptionConfig,
continuousBackupConfig,
secondaryConfig,
pscConfig,
maintenanceUpdatePolicy,
subscriptionType
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ displayName }}',
'{{ labels }}',
'{{ databaseVersion }}',
'{{ networkConfig }}',
'{{ network }}',
'{{ etag }}',
'{{ annotations }}',
'{{ initialUser }}',
'{{ automatedBackupPolicy }}',
'{{ sslConfig }}',
'{{ encryptionConfig }}',
'{{ continuousBackupConfig }}',
'{{ secondaryConfig }}',
'{{ pscConfig }}',
'{{ maintenanceUpdatePolicy }}',
'{{ subscriptionType }}'
;

UPDATE example

Updates a clusters resource.

/*+ update */
UPDATE google.alloydb.clusters
SET
displayName = '{{ displayName }}',
labels = '{{ labels }}',
databaseVersion = '{{ databaseVersion }}',
networkConfig = '{{ networkConfig }}',
network = '{{ network }}',
etag = '{{ etag }}',
annotations = '{{ annotations }}',
initialUser = '{{ initialUser }}',
automatedBackupPolicy = '{{ automatedBackupPolicy }}',
sslConfig = '{{ sslConfig }}',
encryptionConfig = '{{ encryptionConfig }}',
continuousBackupConfig = '{{ continuousBackupConfig }}',
secondaryConfig = '{{ secondaryConfig }}',
pscConfig = '{{ pscConfig }}',
maintenanceUpdatePolicy = '{{ maintenanceUpdatePolicy }}',
subscriptionType = '{{ subscriptionType }}'
WHERE
clustersId = '{{ clustersId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified clusters resource.

/*+ delete */
DELETE FROM google.alloydb.clusters
WHERE clustersId = '{{ clustersId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';