Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.

Scopes

You will need authorization for at least one of the following scopes to make a valid call:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/sqlservice.admin

If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform. You can set the scope for this method like this: sqladmin1 --scope <scope> instances patch ...

Required Scalar Arguments

  • <project> (string)
    • Project ID of the project that contains the instance.
  • <instance> (string)
    • Cloud SQL instance ID. This does not include the project ID.

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

DatabaseInstance:
  available-maintenance-versions: [string]
  backend-type: string
  connection-name: string
  create-time: string
  current-disk-size: string
  database-installed-version: string
  database-version: string
  disk-encryption-configuration:
    kind: string
    kms-key-name: string
  disk-encryption-status:
    kind: string
    kms-key-version-name: string
  dns-name: string
  etag: string
  failover-replica:
    available: boolean
    name: string
  gce-zone: string
  instance-type: string
  ipv6-address: string
  kind: string
  maintenance-version: string
  master-instance-name: string
  max-disk-size: string
  name: string
  on-premises-configuration:
    ca-certificate: string
    client-certificate: string
    client-key: string
    dump-file-path: string
    host-port: string
    kind: string
    password: string
    source-instance:
      name: string
      project: string
      region: string
    username: string
  out-of-disk-report:
    sql-min-recommended-increase-size-gb: integer
    sql-out-of-disk-state: string
  primary-dns-name: string
  project: string
  psc-service-attachment-link: string
  region: string
  replica-configuration:
    cascadable-replica: boolean
    failover-target: boolean
    kind: string
    mysql-replica-configuration:
      ca-certificate: string
      client-certificate: string
      client-key: string
      connect-retry-interval: integer
      dump-file-path: string
      kind: string
      master-heartbeat-period: string
      password: string
      ssl-cipher: string
      username: string
      verify-server-certificate: boolean
  replica-names: [string]
  root-password: string
  satisfies-pzs: boolean
  scheduled-maintenance:
    can-defer: boolean
    can-reschedule: boolean
    schedule-deadline-time: string
    start-time: string
  secondary-gce-zone: string
  self-link: string
  server-ca-cert:
    cert: string
    cert-serial-number: string
    common-name: string
    create-time: string
    expiration-time: string
    instance: string
    kind: string
    self-link: string
    sha1-fingerprint: string
  service-account-email-address: string
  settings:
    activation-policy: string
    active-directory-config:
      domain: string
      kind: string
    advanced-machine-features:
      threads-per-core: integer
    authorized-gae-applications: [string]
    availability-type: string
    backup-configuration:
      backup-retention-settings:
        retained-backups: integer
        retention-unit: string
      binary-log-enabled: boolean
      enabled: boolean
      kind: string
      location: string
      point-in-time-recovery-enabled: boolean
      replication-log-archiving-enabled: boolean
      start-time: string
      transaction-log-retention-days: integer
    collation: string
    connector-enforcement: string
    crash-safe-replication-enabled: boolean
    data-cache-config:
      data-cache-enabled: boolean
    data-disk-size-gb: string
    data-disk-type: string
    database-replication-enabled: boolean
    deletion-protection-enabled: boolean
    edition: string
    insights-config:
      query-insights-enabled: boolean
      query-plans-per-minute: integer
      query-string-length: integer
      record-application-tags: boolean
      record-client-address: boolean
    ip-configuration:
      allocated-ip-range: string
      enable-private-path-for-google-cloud-services: boolean
      ipv4-enabled: boolean
      private-network: string
      psc-config:
        allowed-consumer-projects: [string]
        psc-enabled: boolean
      require-ssl: boolean
      ssl-mode: string
    kind: string
    location-preference:
      follow-gae-application: string
      kind: string
      secondary-zone: string
      zone: string
    maintenance-window:
      day: integer
      hour: integer
      kind: string
      update-track: string
    password-validation-policy:
      complexity: string
      disallow-compromised-credentials: boolean
      disallow-username-substring: boolean
      enable-password-policy: boolean
      min-length: integer
      password-change-interval: string
      reuse-interval: integer
    pricing-plan: string
    replication-type: string
    settings-version: string
    sql-server-audit-config:
      bucket: string
      kind: string
      retention-interval: string
      upload-interval: string
    storage-auto-resize: boolean
    storage-auto-resize-limit: string
    tier: string
    time-zone: string
    user-labels: { string: string }
  sql-network-architecture: string
  state: string
  suspension-reason: [string]
  write-endpoint: string

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r . available-maintenance-versions=sed
    • Output only. List all maintenance versions applicable on the instance
    • Each invocation of this argument appends the given value to the array.
  • backend-type=nonumy
    • The backend type. SECOND_GEN: Cloud SQL database instance. EXTERNAL: A database server that is not managed by Google. This property is read-only; use the tier property in the settings object to determine the database type.
  • connection-name=sea
    • Connection name of the Cloud SQL instance used in connection strings.
  • create-time=ipsum
    • Output only. The time when the instance was created in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
  • current-disk-size=kasd
    • The current disk usage of the instance in bytes. This property has been deprecated. Use the "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud Monitoring API instead. Please see this announcement for details.
  • database-installed-version=justo
    • Output only. Stores the current database version running on the instance including minor version such as MYSQL_8_0_18.
  • database-version=ea
    • The database engine type and version. The databaseVersion field cannot be changed after instance creation.
  • disk-encryption-configuration kind=at
    • This is always sql#diskEncryptionConfiguration.
  • kms-key-name=erat

    • Resource name of KMS key for disk encryption
  • ..disk-encryption-status kind=clita

    • This is always sql#diskEncryptionStatus.
  • kms-key-version-name=vero

    • KMS key version used to encrypt the Cloud SQL instance resource
  • .. dns-name=invidunt

    • Output only. The dns name of the instance.
  • etag=nonumy
    • This field is deprecated and will be removed from a future version of the API. Use the settings.settingsVersion field instead.
  • failover-replica available=false
    • The availability status of the failover replica. A false status indicates that the failover replica is out of sync. The primary instance can only failover to the failover replica when the status is true.
  • name=erat

    • The name of the failover replica. If specified at instance creation, a failover replica is created for the instance. The name doesn't include the project ID.
  • .. gce-zone=dolores

    • The Compute Engine zone that the instance is currently serving from. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary zone. WARNING: Changing this might restart the instance.
  • instance-type=ipsum
    • The instance type.
  • ipv6-address=voluptua.
    • The IPv6 address assigned to the instance. (Deprecated) This property was applicable only to First Generation instances.
  • kind=eos
    • This is always sql#instance.
  • maintenance-version=duo
    • The current software version on the instance.
  • master-instance-name=elitr
    • The name of the instance which will act as primary in the replication setup.
  • max-disk-size=consetetur
    • The maximum disk size of the instance in bytes.
  • name=et
    • Name of the Cloud SQL instance. This does not include the project ID.
  • on-premises-configuration ca-certificate=clita
    • PEM representation of the trusted CA's x509 certificate.
  • client-certificate=sit
    • PEM representation of the replica's x509 certificate.
  • client-key=takimata
    • PEM representation of the replica's private key. The corresponsing public key is encoded in the client's certificate.
  • dump-file-path=erat
    • The dump file to create the Cloud SQL replica.
  • host-port=diam
    • The host and port of the on-premises instance in host:port format
  • kind=nonumy
    • This is always sql#onPremisesConfiguration.
  • password=lorem
    • The password for connecting to on-premises instance.
  • source-instance name=at
    • The name of the Cloud SQL instance being referenced. This does not include the project ID.
  • project=diam
    • The project ID of the Cloud SQL instance being referenced. The default is the same project ID as the instance references it.
  • region=diam

    • The region of the Cloud SQL instance being referenced.
  • .. username=sed

    • The username for connecting to on-premises instance.
  • ..out-of-disk-report sql-min-recommended-increase-size-gb=83

    • The minimum recommended increase size in GigaBytes This field is consumed by the frontend * Writers: * the proactive database wellness job for OOD. * Readers:
  • sql-out-of-disk-state=ea

    • This field represents the state generated by the proactive database wellness job for OutOfDisk issues. * Writers: * the proactive database wellness job for OOD. * Readers: * the proactive database wellness job
  • .. primary-dns-name=dolore

    • Output only. DEPRECATED: please use write_endpoint instead.
  • project=ipsum
    • The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable.
  • psc-service-attachment-link=ea
    • Output only. The link to service attachment of PSC instance.
  • region=at
    • The geographical region of the Cloud SQL instance. It can be one of the regions where Cloud SQL operates: For example, asia-east1, europe-west1, and us-central1. The default value is us-central1.
  • replica-configuration cascadable-replica=true
    • Optional. Specifies if a SQL Server replica is a cascadable replica. A cascadable replica is a SQL Server cross region replica that supports replica(s) under it.
  • failover-target=false
    • Specifies if the replica is the failover target. If the field is set to true, the replica will be designated as a failover replica. In case the primary instance fails, the replica instance will be promoted as the new primary instance. Only one replica can be specified as failover target, and the replica has to be in different zone with the primary instance.
  • kind=lorem
    • This is always sql#replicaConfiguration.
  • mysql-replica-configuration ca-certificate=stet
    • PEM representation of the trusted CA's x509 certificate.
  • client-certificate=duo
    • PEM representation of the replica's x509 certificate.
  • client-key=elitr
    • PEM representation of the replica's private key. The corresponsing public key is encoded in the client's certificate.
  • connect-retry-interval=69
    • Seconds to wait between connect retries. MySQL's default is 60 seconds.
  • dump-file-path=erat
    • Path to a SQL dump file in Google Cloud Storage from which the replica instance is to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip files (.gz) are also supported. Dumps have the binlog co-ordinates from which replication begins. This can be accomplished by setting --master-data to 1 when using mysqldump.
  • kind=ut
    • This is always sql#mysqlReplicaConfiguration.
  • master-heartbeat-period=et
    • Interval in milliseconds between replication heartbeats.
  • password=lorem
    • The password for the replication connection.
  • ssl-cipher=rebum.
    • A list of permissible ciphers to use for SSL encryption.
  • username=et
    • The username for the replication connection.
  • verify-server-certificate=true

    • Whether or not to check the primary instance's Common Name value in the certificate that it sends during the SSL handshake.
  • ... replica-names=aliquyam

    • The replicas of the instance.
    • Each invocation of this argument appends the given value to the array.
  • root-password=kasd
    • Initial root password. Use only on creation. You must set root passwords before you can connect to PostgreSQL instances.
  • satisfies-pzs=false
    • The status indicating if instance satisfiesPzs. Reserved for future use.
  • scheduled-maintenance can-defer=true
    • No description provided.
  • can-reschedule=true
    • If the scheduled maintenance can be rescheduled.
  • schedule-deadline-time=tempor
    • Maintenance cannot be rescheduled to start beyond this deadline.
  • start-time=dolor

    • The start time of any upcoming scheduled maintenance for this instance.
  • .. secondary-gce-zone=amet

    • The Compute Engine zone that the failover instance is currently serving from for a regional instance. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary/failover zone.
  • self-link=sit
    • The URI of this resource.
  • server-ca-cert cert=rebum.
    • PEM representation.
  • cert-serial-number=sea
    • Serial number, as extracted from the certificate.
  • common-name=ipsum
    • User supplied name. Constrained to [a-zA-Z.-_ ]+.
  • create-time=ipsum
    • The time when the certificate was created in RFC 3339 format, for example 2012-11-15T16:19:00.094Z
  • expiration-time=et
    • The time when the certificate expires in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
  • instance=elitr
    • Name of the database instance.
  • kind=eirmod
    • This is always sql#sslCert.
  • self-link=dolor
    • The URI of this resource.
  • sha1-fingerprint=sadipscing

    • Sha1 Fingerprint.
  • .. service-account-email-address=dolor

    • The service account email address assigned to the instance.\This property is read-only.
  • settings activation-policy=dolor
    • The activation policy specifies when the instance is activated; it is applicable only when the instance state is RUNNABLE. Valid values: * ALWAYS: The instance is on, and remains so even in the absence of connection requests. * NEVER: The instance is off; it is not activated, even if a connection request arrives.
  • active-directory-config domain=consetetur
    • The name of the domain (e.g., mydomain.com).
  • kind=et

    • This is always sql#activeDirectoryConfig.
  • ..advanced-machine-features threads-per-core=53

    • The number of threads per physical core.
  • .. authorized-gae-applications=lorem

    • The App Engine app IDs that can access this instance. (Deprecated) Applied to First Generation instances only.
    • Each invocation of this argument appends the given value to the array.
  • availability-type=nonumy
    • Availability type. Potential values: * ZONAL: The instance serves data from only one zone. Outages in that zone affect data accessibility. * REGIONAL: The instance can serve data from more than one zone in a region (it is highly available)./ For more information, see Overview of the High Availability Configuration.
  • backup-configuration.backup-retention-settings retained-backups=22
    • Depending on the value of retention_unit, this is used to determine if a backup needs to be deleted. If retention_unit is 'COUNT', we will retain this many backups.
  • retention-unit=ipsum

    • The unit that 'retained_backups' represents.
  • .. binary-log-enabled=true

    • (MySQL only) Whether binary log is enabled. If backup configuration is disabled, binarylog must be disabled as well.
  • enabled=false
    • Whether this configuration is enabled.
  • kind=at
    • This is always sql#backupConfiguration.
  • location=diam
    • Location of the backup
  • point-in-time-recovery-enabled=true
    • Whether point in time recovery is enabled.
  • replication-log-archiving-enabled=false
    • Reserved for future use.
  • start-time=eirmod
    • Start time for the daily backup configuration in UTC timezone in the 24 hour format - HH:MM.
  • transaction-log-retention-days=70

    • The number of days of transaction logs we retain for point in time restore, from 1-7.
  • .. collation=duo

    • The name of server Instance collation.
  • connector-enforcement=et
    • Specifies if connections must use Cloud SQL connectors. Option values include the following: NOT_REQUIRED (Cloud SQL instances can be connected without Cloud SQL Connectors) and REQUIRED (Only allow connections that use Cloud SQL Connectors). Note that using REQUIRED disables all existing authorized networks. If this field is not specified when creating a new instance, NOT_REQUIRED is used. If this field is not specified when patching or updating an existing instance, it is left unchanged in the instance.
  • crash-safe-replication-enabled=false
    • Configuration specific to read replica instances. Indicates whether database flags for crash-safe replication are enabled. This property was only applicable to First Generation instances.
  • data-cache-config data-cache-enabled=true

    • Whether data cache is enabled for the instance.
  • .. data-disk-size-gb=accusam

    • The size of data disk, in GB. The data disk size minimum is 10GB.
  • data-disk-type=et
    • The type of data disk: PD_SSD (default) or PD_HDD. Not used for First Generation instances.
  • database-replication-enabled=false
    • Configuration specific to read replica instances. Indicates whether replication is enabled or not. WARNING: Changing this restarts the instance.
  • deletion-protection-enabled=false
    • Configuration to protect against accidental instance deletion.
  • edition=ut
    • Optional. The edition of the instance.
  • insights-config query-insights-enabled=false
    • Whether Query Insights feature is enabled.
  • query-plans-per-minute=55
    • Number of query execution plans captured by Insights per minute for all queries combined. Default is 5.
  • query-string-length=2
    • Maximum query length stored in bytes. Default value: 1024 bytes. Range: 256-4500 bytes. Query length more than this field value will be truncated to this value. When unset, query length will be the default value. Changing query length will restart the database.
  • record-application-tags=true
    • Whether Query Insights will record application tags from query when enabled.
  • record-client-address=true

    • Whether Query Insights will record client address when enabled.
  • ..ip-configuration allocated-ip-range=invidunt

    • The name of the allocated ip range for the private ip Cloud SQL instance. For example: "google-managed-services-default". If set, the instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?.
  • enable-private-path-for-google-cloud-services=true
    • Controls connectivity to private IP instances from Google services, such as BigQuery.
  • ipv4-enabled=true
    • Whether the instance is assigned a public IP address or not.
  • private-network=sadipscing
    • The resource link for the VPC network from which the Cloud SQL instance is accessible for private IP. For example, /projects/myProject/global/networks/default. This setting can be updated, but it cannot be removed after it is set.
  • psc-config allowed-consumer-projects=no
    • Optional. The list of consumer projects that are allow-listed for PSC connections to this instance. This instance can be connected to with PSC from any network in these projects. Each consumer project in this list may be represented by a project number (numeric) or by a project id (alphanumeric).
    • Each invocation of this argument appends the given value to the array.
  • psc-enabled=true

    • Whether PSC connectivity is enabled for this instance.
  • .. require-ssl=true

    • Use ssl_mode instead for MySQL and PostgreSQL. SQL Server uses this flag. Whether SSL/TLS connections over IP are enforced. If set to false, then allow both non-SSL/non-TLS and SSL/TLS connections. For SSL/TLS connections, the client certificate won't be verified. If set to true, then only allow connections encrypted with SSL/TLS and with valid client certificates. If you want to enforce SSL/TLS without enforcing the requirement for valid client certificates, then use the ssl_mode flag instead of the require_ssl flag.
  • ssl-mode=sea

    • Specify how SSL/TLS is enforced in database connections. MySQL and PostgreSQL use the ssl_mode flag. If you must use the require_ssl flag for backward compatibility, then only the following value pairs are valid: * ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED and require_ssl=false * ssl_mode=ENCRYPTED_ONLY and require_ssl=false * ssl_mode=TRUSTED_CLIENT_CERTIFICATE_REQUIRED and require_ssl=true The value of ssl_mode gets priority over the value of require_ssl. For example, for the pair ssl_mode=ENCRYPTED_ONLY and require_ssl=false, the ssl_mode=ENCRYPTED_ONLY means only accept SSL connections, while the require_ssl=false means accept both non-SSL and SSL connections. MySQL and PostgreSQL databases respect ssl_mode in this case and accept only SSL connections. SQL Server uses the require_ssl flag. You can set the value for this flag to true or false.
  • .. kind=sit

    • This is always sql#settings.
  • location-preference follow-gae-application=amet.
    • The App Engine application to follow, it must be in the same region as the Cloud SQL instance. WARNING: Changing this might restart the instance.
  • kind=ipsum
    • This is always sql#locationPreference.
  • secondary-zone=at
    • The preferred Compute Engine zone for the secondary/failover (for example: us-central1-a, us-central1-b, etc.). To disable this field, set it to 'no_secondary_zone'.
  • zone=vero

    • The preferred Compute Engine zone (for example: us-central1-a, us-central1-b, etc.). WARNING: Changing this might restart the instance.
  • ..maintenance-window day=42

    • day of week (1-7), starting on Monday.
  • hour=89
    • hour of day - 0 to 23.
  • kind=et
    • This is always sql#maintenanceWindow.
  • update-track=invidunt

    • Maintenance timing setting: canary (Earlier) or stable (Later). Learn more.
  • ..password-validation-policy complexity=magna

    • The complexity of the password.
  • disallow-compromised-credentials=false
    • This field is deprecated and will be removed in a future version of the API.
  • disallow-username-substring=false
    • Disallow username as a part of the password.
  • enable-password-policy=true
    • Whether the password policy is enabled or not.
  • min-length=88
    • Minimum number of characters allowed.
  • password-change-interval=dolore
    • Minimum interval after which the password can be changed. This flag is only supported for PostgreSQL.
  • reuse-interval=50

    • Number of previous passwords that cannot be reused.
  • .. pricing-plan=amet

    • The pricing plan for this instance. This can be either PER_USE or PACKAGE. Only PER_USE is supported for Second Generation instances.
  • replication-type=ipsum
    • The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS. (Deprecated) This property was only applicable to First Generation instances.
  • settings-version=lorem
    • The version of instance settings. This is a required field for update method to make sure concurrent updates are handled properly. During update, use the most recent settingsVersion value for this instance and do not try to update this value.
  • sql-server-audit-config bucket=dolores
    • The name of the destination bucket (e.g., gs://mybucket).
  • kind=consetetur
    • This is always sql#sqlServerAuditConfig
  • retention-interval=stet
    • How long to keep generated audit files.
  • upload-interval=accusam

    • How often to upload generated audit files.
  • .. storage-auto-resize=true

    • Configuration to increase storage size automatically. The default value is true.
  • storage-auto-resize-limit=takimata
    • The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.
  • tier=sed
    • The tier (or machine type) for this instance, for example db-custom-1-3840. WARNING: Changing this restarts the instance.
  • time-zone=nonumy
    • Server timezone, relevant only for Cloud SQL for SQL Server.
  • user-labels=key=sea

    • User-provided labels, represented as a dictionary where each label is a single key value pair.
    • the value will be associated with the given key
  • .. sql-network-architecture=eos

    • No description provided.
  • state=dolore
    • The current serving state of the Cloud SQL instance.
  • suspension-reason=accusam
    • If the instance state is SUSPENDED, the reason for the suspension.
    • Each invocation of this argument appends the given value to the array.
  • write-endpoint=elitr
    • Output only. The dns name of the primary instance in a replication group.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").