xref: /aosp_15_r20/external/googleapis/google/cloud/sql/v1/cloud_sql_instances.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.sql.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/cloud/sql/v1/cloud_sql_resources.proto";
23import "google/protobuf/duration.proto";
24import "google/protobuf/timestamp.proto";
25import "google/protobuf/wrappers.proto";
26
27option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb";
28option java_multiple_files = true;
29option java_outer_classname = "CloudSqlServiceProto";
30option java_package = "com.google.cloud.sql.v1";
31
32// Service to manage Cloud SQL instances.
33service SqlInstancesService {
34  option (google.api.default_host) = "sqladmin.googleapis.com";
35  option (google.api.oauth_scopes) =
36      "https://www.googleapis.com/auth/cloud-platform,"
37      "https://www.googleapis.com/auth/sqlservice.admin";
38
39  // Adds a new trusted Certificate Authority (CA) version for the specified
40  // instance. Required to prepare for a certificate rotation. If a CA version
41  // was previously added but never used in a certificate rotation, this
42  // operation replaces that version. There cannot be more than one CA version
43  // waiting to be rotated in.
44  rpc AddServerCa(SqlInstancesAddServerCaRequest) returns (Operation) {
45    option (google.api.http) = {
46      post: "/v1/projects/{project}/instances/{instance}/addServerCa"
47    };
48  }
49
50  // Creates a Cloud SQL instance as a clone of the source instance. Using this
51  // operation might cause your instance to restart.
52  rpc Clone(SqlInstancesCloneRequest) returns (Operation) {
53    option (google.api.http) = {
54      post: "/v1/projects/{project}/instances/{instance}/clone"
55      body: "body"
56    };
57  }
58
59  // Deletes a Cloud SQL instance.
60  rpc Delete(SqlInstancesDeleteRequest) returns (Operation) {
61    option (google.api.http) = {
62      delete: "/v1/projects/{project}/instances/{instance}"
63    };
64  }
65
66  // Demotes the stand-alone instance to be a Cloud SQL read replica for an
67  // external database server.
68  rpc DemoteMaster(SqlInstancesDemoteMasterRequest) returns (Operation) {
69    option (google.api.http) = {
70      post: "/v1/projects/{project}/instances/{instance}/demoteMaster"
71      body: "body"
72    };
73  }
74
75  // Demotes an existing standalone instance to be a Cloud SQL read replica
76  // for an external database server.
77  rpc Demote(SqlInstancesDemoteRequest) returns (Operation) {
78    option (google.api.http) = {
79      post: "/v1/projects/{project}/instances/{instance}/demote"
80      body: "body"
81    };
82  }
83
84  // Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL
85  // dump or CSV file.
86  rpc Export(SqlInstancesExportRequest) returns (Operation) {
87    option (google.api.http) = {
88      post: "/v1/projects/{project}/instances/{instance}/export"
89      body: "body"
90    };
91  }
92
93  // Initiates a manual failover of a high availability (HA) primary instance
94  // to a standby instance, which becomes the primary instance. Users are
95  // then rerouted to the new primary. For more information, see the
96  // [Overview of high
97  // availability](https://cloud.google.com/sql/docs/mysql/high-availability)
98  // page in the Cloud SQL documentation.
99  // If using Legacy HA (MySQL only), this causes the instance to failover to
100  // its failover replica instance.
101  rpc Failover(SqlInstancesFailoverRequest) returns (Operation) {
102    option (google.api.http) = {
103      post: "/v1/projects/{project}/instances/{instance}/failover"
104      body: "body"
105    };
106  }
107
108  // Reencrypt CMEK instance with latest key version.
109  rpc Reencrypt(SqlInstancesReencryptRequest) returns (Operation) {
110    option (google.api.http) = {
111      post: "/v1/projects/{project}/instances/{instance}/reencrypt"
112      body: "body"
113    };
114  }
115
116  // Retrieves a resource containing information about a Cloud SQL instance.
117  rpc Get(SqlInstancesGetRequest) returns (DatabaseInstance) {
118    option (google.api.http) = {
119      get: "/v1/projects/{project}/instances/{instance}"
120    };
121  }
122
123  // Imports data into a Cloud SQL instance from a SQL dump  or CSV file in
124  // Cloud Storage.
125  rpc Import(SqlInstancesImportRequest) returns (Operation) {
126    option (google.api.http) = {
127      post: "/v1/projects/{project}/instances/{instance}/import"
128      body: "body"
129    };
130  }
131
132  // Creates a new Cloud SQL instance.
133  rpc Insert(SqlInstancesInsertRequest) returns (Operation) {
134    option (google.api.http) = {
135      post: "/v1/projects/{project}/instances"
136      body: "body"
137    };
138  }
139
140  // Lists instances under a given project.
141  rpc List(SqlInstancesListRequest) returns (InstancesListResponse) {
142    option (google.api.http) = {
143      get: "/v1/projects/{project}/instances"
144    };
145  }
146
147  // Lists all of the trusted Certificate Authorities (CAs) for the specified
148  // instance. There can be up to three CAs listed: the CA that was used to sign
149  // the certificate that is currently in use, a CA that has been added but not
150  // yet used to sign a certificate, and a CA used to sign a certificate that
151  // has previously rotated out.
152  rpc ListServerCas(SqlInstancesListServerCasRequest)
153      returns (InstancesListServerCasResponse) {
154    option (google.api.http) = {
155      get: "/v1/projects/{project}/instances/{instance}/listServerCas"
156    };
157  }
158
159  // Partially updates settings of a Cloud SQL instance by merging the request
160  // with the current configuration. This method supports patch semantics.
161  rpc Patch(SqlInstancesPatchRequest) returns (Operation) {
162    option (google.api.http) = {
163      patch: "/v1/projects/{project}/instances/{instance}"
164      body: "body"
165    };
166  }
167
168  // Promotes the read replica instance to be a stand-alone Cloud SQL instance.
169  // Using this operation might cause your instance to restart.
170  rpc PromoteReplica(SqlInstancesPromoteReplicaRequest) returns (Operation) {
171    option (google.api.http) = {
172      post: "/v1/projects/{project}/instances/{instance}/promoteReplica"
173    };
174  }
175
176  // Switches over from the primary instance to the replica instance.
177  rpc Switchover(SqlInstancesSwitchoverRequest) returns (Operation) {
178    option (google.api.http) = {
179      post: "/v1/projects/{project}/instances/{instance}/switchover"
180    };
181  }
182
183  // Deletes all client certificates and generates a new server SSL certificate
184  // for the instance.
185  rpc ResetSslConfig(SqlInstancesResetSslConfigRequest) returns (Operation) {
186    option (google.api.http) = {
187      post: "/v1/projects/{project}/instances/{instance}/resetSslConfig"
188    };
189  }
190
191  // Restarts a Cloud SQL instance.
192  rpc Restart(SqlInstancesRestartRequest) returns (Operation) {
193    option (google.api.http) = {
194      post: "/v1/projects/{project}/instances/{instance}/restart"
195    };
196  }
197
198  // Restores a backup of a Cloud SQL instance. Using this operation might cause
199  // your instance to restart.
200  rpc RestoreBackup(SqlInstancesRestoreBackupRequest) returns (Operation) {
201    option (google.api.http) = {
202      post: "/v1/projects/{project}/instances/{instance}/restoreBackup"
203      body: "body"
204    };
205  }
206
207  // Rotates the server certificate to one signed by the Certificate Authority
208  // (CA) version previously added with the addServerCA method.
209  rpc RotateServerCa(SqlInstancesRotateServerCaRequest) returns (Operation) {
210    option (google.api.http) = {
211      post: "/v1/projects/{project}/instances/{instance}/rotateServerCa"
212      body: "body"
213    };
214  }
215
216  // Starts the replication in the read replica instance.
217  rpc StartReplica(SqlInstancesStartReplicaRequest) returns (Operation) {
218    option (google.api.http) = {
219      post: "/v1/projects/{project}/instances/{instance}/startReplica"
220    };
221  }
222
223  // Stops the replication in the read replica instance.
224  rpc StopReplica(SqlInstancesStopReplicaRequest) returns (Operation) {
225    option (google.api.http) = {
226      post: "/v1/projects/{project}/instances/{instance}/stopReplica"
227    };
228  }
229
230  // Truncate MySQL general and slow query log tables
231  // MySQL only.
232  rpc TruncateLog(SqlInstancesTruncateLogRequest) returns (Operation) {
233    option (google.api.http) = {
234      post: "/v1/projects/{project}/instances/{instance}/truncateLog"
235      body: "body"
236    };
237  }
238
239  // Updates settings of a Cloud SQL instance. Using this operation might cause
240  // your instance to restart.
241  rpc Update(SqlInstancesUpdateRequest) returns (Operation) {
242    option (google.api.http) = {
243      put: "/v1/projects/{project}/instances/{instance}"
244      body: "body"
245    };
246  }
247
248  // Generates a short-lived X509 certificate containing the provided public key
249  // and signed by a private key specific to the target instance. Users may use
250  // the certificate to authenticate as themselves when connecting to the
251  // database.
252  rpc CreateEphemeral(SqlInstancesCreateEphemeralCertRequest)
253      returns (SslCert) {
254    option (google.api.http) = {
255      post: "/v1/projects/{project}/instances/{instance}/createEphemeral"
256      body: "body"
257    };
258  }
259
260  // Reschedules the maintenance on the given instance.
261  rpc RescheduleMaintenance(SqlInstancesRescheduleMaintenanceRequest)
262      returns (Operation) {
263    option (google.api.http) = {
264      post: "/v1/projects/{project}/instances/{instance}/rescheduleMaintenance"
265      body: "body"
266    };
267  }
268
269  // Verify External primary instance external sync settings.
270  rpc VerifyExternalSyncSettings(SqlInstancesVerifyExternalSyncSettingsRequest)
271      returns (SqlInstancesVerifyExternalSyncSettingsResponse) {
272    option (google.api.http) = {
273      post: "/v1/projects/{project}/instances/{instance}/verifyExternalSyncSettings"
274      body: "*"
275    };
276  }
277
278  // Start External primary instance migration.
279  rpc StartExternalSync(SqlInstancesStartExternalSyncRequest)
280      returns (Operation) {
281    option (google.api.http) = {
282      post: "/v1/projects/{project}/instances/{instance}/startExternalSync"
283      body: "*"
284    };
285  }
286
287  // Perform Disk Shrink on primary instance.
288  rpc PerformDiskShrink(SqlInstancesPerformDiskShrinkRequest)
289      returns (Operation) {
290    option (google.api.http) = {
291      post: "/v1/projects/{project}/instances/{instance}/performDiskShrink"
292      body: "body"
293    };
294  }
295
296  // Get Disk Shrink Config for a given instance.
297  rpc GetDiskShrinkConfig(SqlInstancesGetDiskShrinkConfigRequest)
298      returns (SqlInstancesGetDiskShrinkConfigResponse) {
299    option (google.api.http) = {
300      get: "/v1/projects/{project}/instances/{instance}/getDiskShrinkConfig"
301    };
302  }
303
304  // Reset Replica Size to primary instance disk size.
305  rpc ResetReplicaSize(SqlInstancesResetReplicaSizeRequest)
306      returns (Operation) {
307    option (google.api.http) = {
308      post: "/v1/projects/{project}/instances/{instance}/resetReplicaSize"
309      body: "*"
310    };
311  }
312
313  // Get Latest Recovery Time for a given instance.
314  rpc GetLatestRecoveryTime(SqlInstancesGetLatestRecoveryTimeRequest)
315      returns (SqlInstancesGetLatestRecoveryTimeResponse) {
316    option (google.api.http) = {
317      get: "/v1/projects/{project}/instances/{instance}/getLatestRecoveryTime"
318    };
319  }
320}
321
322// Instance add server CA request.
323message SqlInstancesAddServerCaRequest {
324  // Cloud SQL instance ID. This does not include the project ID.
325  string instance = 1;
326
327  // Project ID of the project that contains the instance.
328  string project = 2;
329}
330
331// Instance clone request.
332message SqlInstancesCloneRequest {
333  // The ID of the Cloud SQL instance to be cloned (source). This does not
334  // include the project ID.
335  string instance = 1;
336
337  // Project ID of the source as well as the clone Cloud SQL instance.
338  string project = 2;
339
340  InstancesCloneRequest body = 100;
341}
342
343// Instance delete request.
344message SqlInstancesDeleteRequest {
345  // Cloud SQL instance ID. This does not include the project ID.
346  string instance = 1;
347
348  // Project ID of the project that contains the instance to be deleted.
349  string project = 2;
350}
351
352// Instance demote master request.
353message SqlInstancesDemoteMasterRequest {
354  // Cloud SQL instance name.
355  string instance = 1;
356
357  // ID of the project that contains the instance.
358  string project = 2;
359
360  InstancesDemoteMasterRequest body = 100;
361}
362
363// Instance demote request.
364message SqlInstancesDemoteRequest {
365  // Required. Cloud SQL instance name.
366  string instance = 1 [(google.api.field_behavior) = REQUIRED];
367
368  // Required. ID of the project that contains the instance.
369  string project = 2 [(google.api.field_behavior) = REQUIRED];
370
371  // Required. The request body.
372  InstancesDemoteRequest body = 100 [(google.api.field_behavior) = REQUIRED];
373}
374
375// Instance export request.
376message SqlInstancesExportRequest {
377  // Cloud SQL instance ID. This does not include the project ID.
378  string instance = 1;
379
380  // Project ID of the project that contains the instance to be exported.
381  string project = 2;
382
383  InstancesExportRequest body = 100;
384}
385
386// Instance failover request.
387message SqlInstancesFailoverRequest {
388  // Cloud SQL instance ID. This does not include the project ID.
389  string instance = 1;
390
391  // ID of the project that contains the read replica.
392  string project = 2;
393
394  InstancesFailoverRequest body = 100;
395}
396
397// Instance get request.
398message SqlInstancesGetRequest {
399  // Database instance ID. This does not include the project ID.
400  string instance = 1;
401
402  // Project ID of the project that contains the instance.
403  string project = 2;
404}
405
406// Instance import request.
407message SqlInstancesImportRequest {
408  // Cloud SQL instance ID. This does not include the project ID.
409  string instance = 1;
410
411  // Project ID of the project that contains the instance.
412  string project = 2;
413
414  InstancesImportRequest body = 100;
415}
416
417// Instance insert request.
418message SqlInstancesInsertRequest {
419  // Project ID of the project to which the newly created Cloud SQL instances
420  // should belong.
421  string project = 1;
422
423  DatabaseInstance body = 100;
424}
425
426// Instance list request.
427message SqlInstancesListRequest {
428  // A filter expression that filters resources listed in the response.
429  // The expression is in the form of field:value. For example,
430  // 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per
431  // their JSON representation, such as 'settings.userLabels.auto_start:true'.
432  //
433  // Multiple filter queries are space-separated. For example.
434  // 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each
435  // expression is an AND expression. However, you can include AND and OR
436  // expressions explicitly.
437  string filter = 1;
438
439  // The maximum number of instances to return. The service may return fewer
440  // than this value.
441  // If unspecified, at most 500 instances are returned.
442  // The maximum value is 1000; values above 1000 are coerced to 1000.
443  uint32 max_results = 2;
444
445  // A previously-returned page token representing part of the larger set of
446  // results to view.
447  string page_token = 3;
448
449  // Project ID of the project for which to list Cloud SQL instances.
450  string project = 4;
451}
452
453// Instance list server CAs request.
454message SqlInstancesListServerCasRequest {
455  // Cloud SQL instance ID. This does not include the project ID.
456  string instance = 1;
457
458  // Project ID of the project that contains the instance.
459  string project = 2;
460}
461
462// Instance patch request.
463message SqlInstancesPatchRequest {
464  // Cloud SQL instance ID. This does not include the project ID.
465  string instance = 1;
466
467  // Project ID of the project that contains the instance.
468  string project = 2;
469
470  DatabaseInstance body = 100;
471}
472
473// Instance promote replica request.
474message SqlInstancesPromoteReplicaRequest {
475  // Cloud SQL read replica instance name.
476  string instance = 1;
477
478  // ID of the project that contains the read replica.
479  string project = 2;
480
481  // Set to true if the promote operation should attempt to re-add the original
482  // primary as a replica when it comes back online. Otherwise, if this value is
483  // false or not set, the original primary will be a standalone instance.
484  bool failover = 3;
485}
486
487// Instance switchover request.
488message SqlInstancesSwitchoverRequest {
489  // Cloud SQL read replica instance name.
490  string instance = 1;
491
492  // ID of the project that contains the replica.
493  string project = 2;
494
495  // Optional. (MySQL only) Cloud SQL instance operations timeout, which is a
496  // sum of all database operations. Default value is 10 minutes and can be
497  // modified to a maximum value of 24 hours.
498  google.protobuf.Duration db_timeout = 3
499      [(google.api.field_behavior) = OPTIONAL];
500}
501
502// Instance reset SSL config request.
503message SqlInstancesResetSslConfigRequest {
504  // Cloud SQL instance ID. This does not include the project ID.
505  string instance = 1;
506
507  // Project ID of the project that contains the instance.
508  string project = 2;
509}
510
511// Instance restart request.
512message SqlInstancesRestartRequest {
513  // Cloud SQL instance ID. This does not include the project ID.
514  string instance = 1;
515
516  // Project ID of the project that contains the instance to be restarted.
517  string project = 2;
518}
519
520// Instance restore backup request.
521message SqlInstancesRestoreBackupRequest {
522  // Cloud SQL instance ID. This does not include the project ID.
523  string instance = 1;
524
525  // Project ID of the project that contains the instance.
526  string project = 2;
527
528  InstancesRestoreBackupRequest body = 100;
529}
530
531// Instance rotate server CA request.
532message SqlInstancesRotateServerCaRequest {
533  // Cloud SQL instance ID. This does not include the project ID.
534  string instance = 1;
535
536  // Project ID of the project that contains the instance.
537  string project = 2;
538
539  InstancesRotateServerCaRequest body = 100;
540}
541
542// Instance start replica request.
543message SqlInstancesStartReplicaRequest {
544  // Cloud SQL read replica instance name.
545  string instance = 1;
546
547  // ID of the project that contains the read replica.
548  string project = 2;
549}
550
551// Instance stop replica request.
552message SqlInstancesStopReplicaRequest {
553  // Cloud SQL read replica instance name.
554  string instance = 1;
555
556  // ID of the project that contains the read replica.
557  string project = 2;
558}
559
560// Instance truncate log request.
561message SqlInstancesTruncateLogRequest {
562  // Cloud SQL instance ID. This does not include the project ID.
563  string instance = 1;
564
565  // Project ID of the Cloud SQL project.
566  string project = 2;
567
568  InstancesTruncateLogRequest body = 100;
569}
570
571// Instance perform disk shrink request.
572message SqlInstancesPerformDiskShrinkRequest {
573  // Cloud SQL instance ID. This does not include the project ID.
574  string instance = 1;
575
576  // Project ID of the project that contains the instance.
577  string project = 2;
578
579  // Perform disk shrink context.
580  PerformDiskShrinkContext body = 100;
581}
582
583// Instance update request.
584message SqlInstancesUpdateRequest {
585  // Cloud SQL instance ID. This does not include the project ID.
586  string instance = 1;
587
588  // Project ID of the project that contains the instance.
589  string project = 2;
590
591  DatabaseInstance body = 100;
592}
593
594// Instance reschedule maintenance request.
595message SqlInstancesRescheduleMaintenanceRequest {
596  // Cloud SQL instance ID. This does not include the project ID.
597  string instance = 1;
598
599  // ID of the project that contains the instance.
600  string project = 2;
601
602  SqlInstancesRescheduleMaintenanceRequestBody body = 100;
603}
604
605// Instance reencrypt request.
606message SqlInstancesReencryptRequest {
607  // Cloud SQL instance ID. This does not include the project ID.
608  string instance = 1;
609
610  // ID of the project that contains the instance.
611  string project = 2;
612
613  // Reencrypt body that users request
614  InstancesReencryptRequest body = 3;
615}
616
617// Database Instance reencrypt request.
618message InstancesReencryptRequest {
619  // Configuration specific to backup re-encryption
620  optional BackupReencryptionConfig backup_reencryption_config = 1;
621}
622
623// Backup Reencryption Config
624message BackupReencryptionConfig {
625  // Backup type for re-encryption
626  enum BackupType {
627    // Unknown backup type, will be defaulted to AUTOMATIC backup type
628    BACKUP_TYPE_UNSPECIFIED = 0;
629
630    // Reencrypt automatic backups
631    AUTOMATED = 1;
632
633    // Reencrypt on-demand backups
634    ON_DEMAND = 2;
635  }
636
637  // Backup re-encryption limit
638  optional int32 backup_limit = 1;
639
640  // Type of backups users want to re-encrypt.
641  optional BackupType backup_type = 2;
642}
643
644// External Sync parallel level.
645enum ExternalSyncParallelLevel {
646  // Unknown sync parallel level. Will be defaulted to OPTIMAL.
647  EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED = 0;
648
649  // Minimal parallel level.
650  MIN = 1;
651
652  // Optimal parallel level.
653  OPTIMAL = 2;
654
655  // Maximum parallel level.
656  MAX = 3;
657}
658
659// Instance get disk shrink config request.
660message SqlInstancesGetDiskShrinkConfigRequest {
661  // Cloud SQL instance ID. This does not include the project ID.
662  string instance = 1;
663
664  // Project ID of the project that contains the instance.
665  string project = 2;
666}
667
668// Instance verify external sync settings request.
669message SqlInstancesVerifyExternalSyncSettingsRequest {
670  enum ExternalSyncMode {
671    // Unknown external sync mode, will be defaulted to ONLINE mode
672    EXTERNAL_SYNC_MODE_UNSPECIFIED = 0;
673
674    // Online external sync will set up replication after initial data external
675    // sync
676    ONLINE = 1;
677
678    // Offline external sync only dumps and loads a one-time snapshot of
679    // the primary instance's data
680    OFFLINE = 2;
681  }
682
683  // Cloud SQL instance ID. This does not include the project ID.
684  string instance = 1;
685
686  // Project ID of the project that contains the instance.
687  string project = 2;
688
689  // Flag to enable verifying connection only
690  bool verify_connection_only = 3;
691
692  // External sync mode
693  ExternalSyncMode sync_mode = 4;
694
695  // Optional. Flag to verify settings required by replication setup only
696  bool verify_replication_only = 5 [(google.api.field_behavior) = OPTIONAL];
697
698  oneof sync_config {
699    // Optional. MySQL-specific settings for start external sync.
700    MySqlSyncConfig mysql_sync_config = 6
701        [(google.api.field_behavior) = OPTIONAL];
702  }
703}
704
705// Instance start external sync request.
706message SqlInstancesStartExternalSyncRequest {
707  // Cloud SQL instance ID. This does not include the project ID.
708  string instance = 1;
709
710  // ID of the project that contains the instance.
711  string project = 2;
712
713  // External sync mode.
714  SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode sync_mode = 3;
715
716  // Whether to skip the verification step (VESS).
717  bool skip_verification = 4;
718
719  oneof sync_config {
720    // MySQL-specific settings for start external sync.
721    MySqlSyncConfig mysql_sync_config = 6;
722  }
723
724  // Optional. Parallel level for initial data sync. Currently only applicable
725  // for MySQL.
726  ExternalSyncParallelLevel sync_parallel_level = 7
727      [(google.api.field_behavior) = OPTIONAL];
728}
729
730// Instance reset replica size request.
731message SqlInstancesResetReplicaSizeRequest {
732  // Cloud SQL read replica instance name.
733  string instance = 1;
734
735  // ID of the project that contains the read replica.
736  string project = 2;
737}
738
739// Instance create ephemeral certificate request.
740message SqlInstancesCreateEphemeralCertRequest {
741  // Cloud SQL instance ID. This does not include the project ID.
742  string instance = 1;
743
744  // Project ID of the Cloud SQL project.
745  string project = 2;
746
747  SslCertsCreateEphemeralRequest body = 100;
748}
749
750// Database instance clone request.
751message InstancesCloneRequest {
752  // Contains details about the clone operation.
753  CloneContext clone_context = 1;
754}
755
756// Database demote primary instance request.
757message InstancesDemoteMasterRequest {
758  // Contains details about the demoteMaster operation.
759  DemoteMasterContext demote_master_context = 1;
760}
761
762// This request is used to demote an existing standalone instance to be a
763// Cloud SQL read replica for an external database server.
764message InstancesDemoteRequest {
765  // Required. Contains details about the demote operation.
766  DemoteContext demote_context = 1 [(google.api.field_behavior) = REQUIRED];
767}
768
769// Database instance export request.
770message InstancesExportRequest {
771  // Contains details about the export operation.
772  ExportContext export_context = 1;
773}
774
775// Instance failover request.
776message InstancesFailoverRequest {
777  // Failover Context.
778  FailoverContext failover_context = 1;
779}
780
781// SslCerts create ephemeral certificate request.
782message SslCertsCreateEphemeralRequest {
783  // PEM encoded public key to include in the signed certificate.
784  string public_key = 1;
785
786  // Access token to include in the signed certificate.
787  string access_token = 2;
788}
789
790// Database instance import request.
791message InstancesImportRequest {
792  // Contains details about the import operation.
793  ImportContext import_context = 1;
794}
795
796// Database instances list response.
797message InstancesListResponse {
798  // This is always `sql#instancesList`.
799  string kind = 1;
800
801  // List of warnings that occurred while handling the request.
802  repeated ApiWarning warnings = 2;
803
804  // List of database instance resources.
805  repeated DatabaseInstance items = 3;
806
807  // The continuation token, used to page through large result sets. Provide
808  // this value in a subsequent request to return the next page of results.
809  string next_page_token = 4;
810}
811
812// Instances ListServerCas response.
813message InstancesListServerCasResponse {
814  // List of server CA certificates for the instance.
815  repeated SslCert certs = 1;
816
817  string active_version = 2;
818
819  // This is always `sql#instancesListServerCas`.
820  string kind = 3;
821}
822
823// Database instance restore backup request.
824message InstancesRestoreBackupRequest {
825  // Parameters required to perform the restore backup operation.
826  RestoreBackupContext restore_backup_context = 1;
827}
828
829// Rotate server CA request.
830message InstancesRotateServerCaRequest {
831  // Contains details about the rotate server CA operation.
832  RotateServerCaContext rotate_server_ca_context = 1;
833}
834
835// Instance truncate log request.
836message InstancesTruncateLogRequest {
837  // Contains details about the truncate log operation.
838  TruncateLogContext truncate_log_context = 1;
839}
840
841// Instance verify external sync settings response.
842message SqlInstancesVerifyExternalSyncSettingsResponse {
843  // This is always `sql#migrationSettingErrorList`.
844  string kind = 1;
845
846  // List of migration violations.
847  repeated SqlExternalSyncSettingError errors = 2;
848
849  // List of migration warnings.
850  repeated SqlExternalSyncSettingError warnings = 3;
851}
852
853// Instance get disk shrink config response.
854message SqlInstancesGetDiskShrinkConfigResponse {
855  // This is always `sql#getDiskShrinkConfig`.
856  string kind = 1;
857
858  // The minimum size to which a disk can be shrunk in GigaBytes.
859  int64 minimal_target_size_gb = 2;
860
861  // Additional message to customers.
862  string message = 3;
863}
864
865// Instance get latest recovery time request.
866message SqlInstancesGetLatestRecoveryTimeRequest {
867  // Cloud SQL instance ID. This does not include the project ID.
868  string instance = 1;
869
870  // Project ID of the project that contains the instance.
871  string project = 2;
872}
873
874// Instance get latest recovery time response.
875message SqlInstancesGetLatestRecoveryTimeResponse {
876  // This is always `sql#getLatestRecoveryTime`.
877  string kind = 1;
878
879  // Timestamp, identifies the latest recovery time of the source instance.
880  google.protobuf.Timestamp latest_recovery_time = 2;
881}
882
883// Database instance clone context.
884message CloneContext {
885  // This is always `sql#cloneContext`.
886  string kind = 1;
887
888  // Reserved for future use.
889  int64 pitr_timestamp_ms = 2;
890
891  // Name of the Cloud SQL instance to be created as a clone.
892  string destination_instance_name = 3;
893
894  // Binary log coordinates, if specified, identify the position up to which the
895  // source instance is cloned. If not specified, the source instance is
896  // cloned up to the most recent binary log coordinates.
897  BinLogCoordinates bin_log_coordinates = 4;
898
899  // Timestamp, if specified, identifies the time to which the source instance
900  // is cloned.
901  google.protobuf.Timestamp point_in_time = 5;
902
903  // The name of the allocated ip range for the private ip Cloud SQL instance.
904  // For example: "google-managed-services-default". If set, the cloned instance
905  // ip will be created in the allocated range. The range name must comply with
906  // [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name
907  // must be 1-63 characters long and match the regular expression
908  // [a-z]([-a-z0-9]*[a-z0-9])?.
909  // Reserved for future use.
910  string allocated_ip_range = 6;
911
912  // (SQL Server only) Clone only the specified databases from the source
913  // instance. Clone all databases if empty.
914  repeated string database_names = 9;
915
916  // Optional. (Point-in-time recovery for PostgreSQL only) Clone to an instance
917  // in the specified zone. If no zone is specified, clone to the same zone as
918  // the source instance.
919  optional string preferred_zone = 10 [(google.api.field_behavior) = OPTIONAL];
920}
921
922// Binary log coordinates.
923message BinLogCoordinates {
924  // Name of the binary log file for a Cloud SQL instance.
925  string bin_log_file_name = 1;
926
927  // Position (offset) within the binary log file.
928  int64 bin_log_position = 2;
929
930  // This is always `sql#binLogCoordinates`.
931  string kind = 3;
932}
933
934// A Cloud SQL instance resource.
935message DatabaseInstance {
936  // The current serving state of the database instance.
937  enum SqlInstanceState {
938    // The state of the instance is unknown.
939    SQL_INSTANCE_STATE_UNSPECIFIED = 0;
940
941    // The instance is running, or has been stopped by owner.
942    RUNNABLE = 1;
943
944    // The instance is not available, for example due to problems with billing.
945    SUSPENDED = 2;
946
947    // The instance is being deleted.
948    PENDING_DELETE = 3;
949
950    // The instance is being created.
951    PENDING_CREATE = 4;
952
953    // The instance is down for maintenance.
954    MAINTENANCE = 5;
955
956    // The creation of the instance failed or a fatal error occurred during
957    // maintenance.
958    FAILED = 6;
959
960    // Deprecated
961    ONLINE_MAINTENANCE = 7 [deprecated = true];
962  }
963
964  message SqlFailoverReplica {
965    // The name of the failover replica. If specified at instance creation, a
966    // failover replica is created for the instance. The name
967    // doesn't include the project ID.
968    string name = 1;
969
970    // The availability status of the failover replica. A false status indicates
971    // that the failover replica is out of sync. The primary instance can only
972    // failover to the failover replica when the status is true.
973    google.protobuf.BoolValue available = 2;
974  }
975
976  // Any scheduled maintenance for this instance.
977  message SqlScheduledMaintenance {
978    // The start time of any upcoming scheduled maintenance for this instance.
979    google.protobuf.Timestamp start_time = 1;
980
981    bool can_defer = 2 [deprecated = true];
982
983    // If the scheduled maintenance can be rescheduled.
984    bool can_reschedule = 3;
985
986    // Maintenance cannot be rescheduled to start beyond this deadline.
987    optional google.protobuf.Timestamp schedule_deadline_time = 4;
988  }
989
990  // This message wraps up the information written by out-of-disk detection job.
991  message SqlOutOfDiskReport {
992    // This enum lists all possible states regarding out-of-disk issues.
993    enum SqlOutOfDiskState {
994      // Unspecified state
995      SQL_OUT_OF_DISK_STATE_UNSPECIFIED = 0;
996
997      // The instance has plenty space on data disk
998      NORMAL = 1;
999
1000      // Data disk is almost used up. It is shutdown to prevent data
1001      // corruption.
1002      SOFT_SHUTDOWN = 2;
1003    }
1004
1005    // This field represents the state generated by the proactive database
1006    // wellness job for OutOfDisk issues.
1007    // *  Writers:
1008    //   *  the proactive database wellness job for OOD.
1009    // *  Readers:
1010    //   *  the proactive database wellness job
1011    optional SqlOutOfDiskState sql_out_of_disk_state = 1;
1012
1013    // The minimum recommended increase size in GigaBytes
1014    // This field is consumed by the frontend
1015    // *  Writers:
1016    //   *  the proactive database wellness job for OOD.
1017    // *  Readers:
1018    optional int32 sql_min_recommended_increase_size_gb = 2;
1019  }
1020
1021  // The SQL network architecture for the instance.
1022  enum SqlNetworkArchitecture {
1023    SQL_NETWORK_ARCHITECTURE_UNSPECIFIED = 0;
1024
1025    // The instance uses the new network architecture.
1026    NEW_NETWORK_ARCHITECTURE = 1;
1027
1028    // The instance uses the old network architecture.
1029    OLD_NETWORK_ARCHITECTURE = 2;
1030  }
1031
1032  // This is always `sql#instance`.
1033  string kind = 1;
1034
1035  // The current serving state of the Cloud SQL instance.
1036  SqlInstanceState state = 2;
1037
1038  // The database engine type and version. The `databaseVersion` field cannot
1039  // be changed after instance creation.
1040  SqlDatabaseVersion database_version = 3;
1041
1042  // The user settings.
1043  Settings settings = 4;
1044
1045  // This field is deprecated and will be removed from a future version of the
1046  // API. Use the `settings.settingsVersion` field instead.
1047  string etag = 5;
1048
1049  // The name and status of the failover replica.
1050  SqlFailoverReplica failover_replica = 6;
1051
1052  // The name of the instance which will act as primary in the replication
1053  // setup.
1054  string master_instance_name = 7;
1055
1056  // The replicas of the instance.
1057  repeated string replica_names = 8;
1058
1059  // The maximum disk size of the instance in bytes.
1060  google.protobuf.Int64Value max_disk_size = 9 [deprecated = true];
1061
1062  // The current disk usage of the instance in bytes. This property has been
1063  // deprecated. Use the
1064  // "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud
1065  // Monitoring API instead. Please see [this
1066  // announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ)
1067  // for details.
1068  google.protobuf.Int64Value current_disk_size = 10 [deprecated = true];
1069
1070  // The assigned IP addresses for the instance.
1071  repeated IpMapping ip_addresses = 11;
1072
1073  // SSL configuration.
1074  SslCert server_ca_cert = 12;
1075
1076  // The instance type.
1077  SqlInstanceType instance_type = 13;
1078
1079  // The project ID of the project containing the Cloud SQL instance. The Google
1080  // apps domain is prefixed if applicable.
1081  string project = 14;
1082
1083  // The IPv6 address assigned to the instance.
1084  // (Deprecated) This property was applicable only
1085  // to First Generation instances.
1086  string ipv6_address = 15 [deprecated = true];
1087
1088  // The service account email address assigned to the instance.\This
1089  // property is read-only.
1090  string service_account_email_address = 16;
1091
1092  // Configuration specific to on-premises instances.
1093  OnPremisesConfiguration on_premises_configuration = 17;
1094
1095  // Configuration specific to failover replicas and read replicas.
1096  ReplicaConfiguration replica_configuration = 18;
1097
1098  // The backend type.
1099  // `SECOND_GEN`: Cloud SQL database instance.
1100  // `EXTERNAL`: A database server that is not managed by Google.
1101  //
1102  // This property is read-only; use the `tier` property in the `settings`
1103  // object to determine the database type.
1104  SqlBackendType backend_type = 19;
1105
1106  // The URI of this resource.
1107  string self_link = 20;
1108
1109  // If the instance state is SUSPENDED, the reason for the suspension.
1110  repeated SqlSuspensionReason suspension_reason = 21;
1111
1112  // Connection name of the Cloud SQL instance used in connection strings.
1113  string connection_name = 22;
1114
1115  // Name of the Cloud SQL instance. This does not include the project ID.
1116  string name = 23;
1117
1118  // The geographical region of the Cloud SQL instance.
1119  //
1120  // It can be one of the
1121  // [regions](https://cloud.google.com/sql/docs/mysql/locations#location-r)
1122  // where Cloud SQL operates:
1123  //
1124  // For example,  `asia-east1`, `europe-west1`, and  `us-central1`.
1125  // The default value is `us-central1`.
1126  string region = 24;
1127
1128  // The Compute Engine zone that the instance is currently serving from. This
1129  // value could be different from the zone that was specified when the instance
1130  // was created if the instance has failed over to its secondary zone. WARNING:
1131  // Changing this might restart the instance.
1132  string gce_zone = 25;
1133
1134  // The Compute Engine zone that the failover instance is currently serving
1135  // from for a regional instance. This value could be different
1136  // from the zone that was specified when the instance
1137  // was created if the instance has failed over to its secondary/failover zone.
1138  string secondary_gce_zone = 34;
1139
1140  // Disk encryption configuration specific to an instance.
1141  DiskEncryptionConfiguration disk_encryption_configuration = 26;
1142
1143  // Disk encryption status specific to an instance.
1144  DiskEncryptionStatus disk_encryption_status = 27;
1145
1146  // Initial root password. Use only on creation. You must set root passwords
1147  // before you can connect to PostgreSQL instances.
1148  string root_password = 29;
1149
1150  // The start time of any upcoming scheduled maintenance for this instance.
1151  SqlScheduledMaintenance scheduled_maintenance = 30;
1152
1153  // The status indicating if instance satisfiesPzs.
1154  // Reserved for future use.
1155  google.protobuf.BoolValue satisfies_pzs = 35;
1156
1157  // Output only. Stores the current database version running on the instance
1158  // including minor version such as `MYSQL_8_0_18`.
1159  string database_installed_version = 40
1160      [(google.api.field_behavior) = OUTPUT_ONLY];
1161
1162  // This field represents the report generated by the proactive database
1163  // wellness job for OutOfDisk issues.
1164  // *  Writers:
1165  //   *  the proactive database wellness job for OOD.
1166  // *  Readers:
1167  //   *  the proactive database wellness job
1168  optional SqlOutOfDiskReport out_of_disk_report = 38;
1169
1170  // Output only. The time when the instance was created in
1171  // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
1172  // `2012-11-15T16:19:00.094Z`.
1173  google.protobuf.Timestamp create_time = 39
1174      [(google.api.field_behavior) = OUTPUT_ONLY];
1175
1176  // Output only. List all maintenance versions applicable on the instance
1177  repeated string available_maintenance_versions = 41
1178      [(google.api.field_behavior) = OUTPUT_ONLY];
1179
1180  // The current software version on the instance.
1181  string maintenance_version = 42;
1182
1183  optional SqlNetworkArchitecture sql_network_architecture = 47;
1184
1185  // Output only. The link to service attachment of PSC instance.
1186  optional string psc_service_attachment_link = 48
1187      [(google.api.field_behavior) = OUTPUT_ONLY];
1188
1189  // Output only. The dns name of the instance.
1190  optional string dns_name = 49 [(google.api.field_behavior) = OUTPUT_ONLY];
1191
1192  // Output only. DEPRECATED: please use write_endpoint instead.
1193  optional string primary_dns_name = 51
1194      [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY];
1195
1196  // Output only. The dns name of the primary instance in a replication group.
1197  optional string write_endpoint = 52
1198      [(google.api.field_behavior) = OUTPUT_ONLY];
1199}
1200
1201// Reschedule options for maintenance windows.
1202message SqlInstancesRescheduleMaintenanceRequestBody {
1203  enum RescheduleType {
1204    RESCHEDULE_TYPE_UNSPECIFIED = 0;
1205
1206    // Reschedules maintenance to happen now (within 5 minutes).
1207    IMMEDIATE = 1;
1208
1209    // Reschedules maintenance to occur within one week from the originally
1210    // scheduled day and time.
1211    NEXT_AVAILABLE_WINDOW = 2;
1212
1213    // Reschedules maintenance to a specific time and day.
1214    SPECIFIC_TIME = 3;
1215  }
1216
1217  message Reschedule {
1218    // Required. The type of the reschedule.
1219    RescheduleType reschedule_type = 1;
1220
1221    // Optional. Timestamp when the maintenance shall be rescheduled to if
1222    // reschedule_type=SPECIFIC_TIME, in
1223    // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
1224    // `2012-11-15T16:19:00.094Z`.
1225    google.protobuf.Timestamp schedule_time = 2
1226        [(google.api.field_behavior) = OPTIONAL];
1227  }
1228
1229  // Required. The type of the reschedule the user wants.
1230  Reschedule reschedule = 3;
1231}
1232
1233// Database instance demote primary instance context.
1234message DemoteMasterContext {
1235  // This is always `sql#demoteMasterContext`.
1236  string kind = 1;
1237
1238  // Verify the GTID consistency for demote operation. Default value:
1239  // `True`. Setting this flag to `false` enables you to bypass the GTID
1240  // consistency check between on-premises primary instance and Cloud SQL
1241  // instance during the demotion operation but also exposes you to the risk of
1242  // future replication failures. Change the value only if you know the reason
1243  // for the GTID divergence and are confident that doing so will not cause any
1244  // replication issues.
1245  google.protobuf.BoolValue verify_gtid_consistency = 2;
1246
1247  // The name of the instance which will act as on-premises primary instance
1248  // in the replication setup.
1249  string master_instance_name = 3;
1250
1251  // Configuration specific to read-replicas replicating from the on-premises
1252  // primary instance.
1253  DemoteMasterConfiguration replica_configuration = 4;
1254
1255  // Flag to skip replication setup on the instance.
1256  bool skip_replication_setup = 5;
1257}
1258
1259// This context is used to demote an existing standalone instance to be
1260// a Cloud SQL read replica for an external database server.
1261message DemoteContext {
1262  // This is always `sql#demoteContext`.
1263  string kind = 1;
1264
1265  // Required. The name of the instance which acts as the on-premises primary
1266  // instance in the replication setup.
1267  string source_representative_instance_name = 2
1268      [(google.api.field_behavior) = REQUIRED];
1269}
1270
1271// Database instance failover context.
1272message FailoverContext {
1273  // The current settings version of this instance. Request will be rejected if
1274  // this version doesn't match the current settings version.
1275  int64 settings_version = 1;
1276
1277  // This is always `sql#failoverContext`.
1278  string kind = 2;
1279}
1280
1281// Database instance restore from backup context.
1282// Backup context contains source instance id and project id.
1283message RestoreBackupContext {
1284  // This is always `sql#restoreBackupContext`.
1285  string kind = 1;
1286
1287  // The ID of the backup run to restore from.
1288  int64 backup_run_id = 2;
1289
1290  // The ID of the instance that the backup was taken from.
1291  string instance_id = 3;
1292
1293  // The full project ID of the source instance.
1294  string project = 4;
1295}
1296
1297// Instance rotate server CA context.
1298message RotateServerCaContext {
1299  // This is always `sql#rotateServerCaContext`.
1300  string kind = 1;
1301
1302  // The fingerprint of the next version to be rotated to. If left unspecified,
1303  // will be rotated to the most recently added server CA version.
1304  string next_version = 2;
1305}
1306
1307// Database Instance truncate log context.
1308message TruncateLogContext {
1309  // This is always `sql#truncateLogContext`.
1310  string kind = 1;
1311
1312  // The type of log to truncate. Valid values are `MYSQL_GENERAL_TABLE` and
1313  // `MYSQL_SLOW_TABLE`.
1314  string log_type = 2;
1315}
1316
1317// External primary instance migration setting error/warning.
1318message SqlExternalSyncSettingError {
1319  enum SqlExternalSyncSettingErrorType {
1320    SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED = 0;
1321
1322    CONNECTION_FAILURE = 1;
1323
1324    BINLOG_NOT_ENABLED = 2;
1325
1326    INCOMPATIBLE_DATABASE_VERSION = 3;
1327
1328    REPLICA_ALREADY_SETUP = 4;
1329
1330    // The replication user is missing privileges that are required.
1331    INSUFFICIENT_PRIVILEGE = 5;
1332
1333    // Unsupported migration type.
1334    UNSUPPORTED_MIGRATION_TYPE = 6;
1335
1336    // No pglogical extension installed on databases, applicable for postgres.
1337    NO_PGLOGICAL_INSTALLED = 7;
1338
1339    // pglogical node already exists on databases, applicable for postgres.
1340    PGLOGICAL_NODE_ALREADY_EXISTS = 8;
1341
1342    // The value of parameter wal_level is not set to logical.
1343    INVALID_WAL_LEVEL = 9;
1344
1345    // The value of parameter shared_preload_libraries does not include
1346    // pglogical.
1347    INVALID_SHARED_PRELOAD_LIBRARY = 10;
1348
1349    // The value of parameter max_replication_slots is not sufficient.
1350    INSUFFICIENT_MAX_REPLICATION_SLOTS = 11;
1351
1352    // The value of parameter max_wal_senders is not sufficient.
1353    INSUFFICIENT_MAX_WAL_SENDERS = 12;
1354
1355    // The value of parameter max_worker_processes is not sufficient.
1356    INSUFFICIENT_MAX_WORKER_PROCESSES = 13;
1357
1358    // Extensions installed are either not supported or having unsupported
1359    // versions.
1360    UNSUPPORTED_EXTENSIONS = 14;
1361
1362    // The value of parameter rds.logical_replication is not set to 1.
1363    INVALID_RDS_LOGICAL_REPLICATION = 15;
1364
1365    // The primary instance logging setup doesn't allow EM sync.
1366    INVALID_LOGGING_SETUP = 16;
1367
1368    // The primary instance database parameter setup doesn't allow EM sync.
1369    INVALID_DB_PARAM = 17;
1370
1371    // The gtid_mode is not supported, applicable for MySQL.
1372    UNSUPPORTED_GTID_MODE = 18;
1373
1374    // SQL Server Agent is not running.
1375    SQLSERVER_AGENT_NOT_RUNNING = 19;
1376
1377    // The table definition is not support due to missing primary key or replica
1378    // identity, applicable for postgres.
1379    UNSUPPORTED_TABLE_DEFINITION = 20;
1380
1381    // The customer has a definer that will break EM setup.
1382    UNSUPPORTED_DEFINER = 21;
1383
1384    // SQL Server @@SERVERNAME does not match actual host name.
1385    SQLSERVER_SERVERNAME_MISMATCH = 22;
1386
1387    // The primary instance has been setup and will fail the setup.
1388    PRIMARY_ALREADY_SETUP = 23;
1389
1390    // The primary instance has unsupported binary log format.
1391    UNSUPPORTED_BINLOG_FORMAT = 24;
1392
1393    // The primary instance's binary log retention setting.
1394    BINLOG_RETENTION_SETTING = 25;
1395
1396    // The primary instance has tables with unsupported storage engine.
1397    UNSUPPORTED_STORAGE_ENGINE = 26;
1398
1399    // Source has tables with limited support
1400    // eg: PostgreSQL tables without primary keys.
1401    LIMITED_SUPPORT_TABLES = 27;
1402
1403    // The replica instance contains existing data.
1404    EXISTING_DATA_IN_REPLICA = 28;
1405
1406    // The replication user is missing privileges that are optional.
1407    MISSING_OPTIONAL_PRIVILEGES = 29;
1408
1409    // Additional BACKUP_ADMIN privilege is granted to the replication user
1410    // which may lock source MySQL 8 instance for DDLs during initial sync.
1411    RISKY_BACKUP_ADMIN_PRIVILEGE = 30;
1412
1413    // The Cloud Storage bucket is missing necessary permissions.
1414    INSUFFICIENT_GCS_PERMISSIONS = 31;
1415
1416    // The Cloud Storage bucket has an error in the file or contains invalid
1417    // file information.
1418    INVALID_FILE_INFO = 32;
1419
1420    // The source instance has unsupported database settings for migration.
1421    UNSUPPORTED_DATABASE_SETTINGS = 33;
1422
1423    // The replication user is missing parallel import specific privileges.
1424    // (e.g. LOCK TABLES) for MySQL.
1425    MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE = 34;
1426
1427    // The global variable local_infile is off on external server replica.
1428    LOCAL_INFILE_OFF = 35;
1429
1430    // This code instructs customers to turn on point-in-time recovery manually
1431    // for the instance after promoting the Cloud SQL for PostgreSQL instance.
1432    TURN_ON_PITR_AFTER_PROMOTE = 36;
1433
1434    // The minor version of replica database is incompatible with the source.
1435    INCOMPATIBLE_DATABASE_MINOR_VERSION = 37;
1436
1437    // This warning message indicates that Cloud SQL uses the maximum number of
1438    // subscriptions to migrate data from the source to the destination.
1439    SOURCE_MAX_SUBSCRIPTIONS = 38;
1440
1441    // Unable to verify definers on the source for MySQL.
1442    UNABLE_TO_VERIFY_DEFINERS = 39;
1443
1444    // If a time out occurs while the subscription counts are calculated, then
1445    // this value is set to 1. Otherwise, this value is set to 2.
1446    SUBSCRIPTION_CALCULATION_STATUS = 40;
1447  }
1448
1449  // Can be `sql#externalSyncSettingError` or
1450  // `sql#externalSyncSettingWarning`.
1451  string kind = 1;
1452
1453  // Identifies the specific error that occurred.
1454  SqlExternalSyncSettingErrorType type = 2;
1455
1456  // Additional information about the error encountered.
1457  string detail = 3;
1458}
1459
1460// On-premises instance configuration.
1461message OnPremisesConfiguration {
1462  // The host and port of the on-premises instance in host:port format
1463  string host_port = 1;
1464
1465  // This is always `sql#onPremisesConfiguration`.
1466  string kind = 2;
1467
1468  // The username for connecting to on-premises instance.
1469  string username = 3;
1470
1471  // The password for connecting to on-premises instance.
1472  string password = 4;
1473
1474  // PEM representation of the trusted CA's x509 certificate.
1475  string ca_certificate = 5;
1476
1477  // PEM representation of the replica's x509 certificate.
1478  string client_certificate = 6;
1479
1480  // PEM representation of the replica's private key. The corresponsing public
1481  // key is encoded in the client's certificate.
1482  string client_key = 7;
1483
1484  // The dump file to create the Cloud SQL replica.
1485  string dump_file_path = 8;
1486
1487  // The reference to Cloud SQL instance if the source is Cloud SQL.
1488  InstanceReference source_instance = 15;
1489}
1490
1491// Read-replica configuration for connecting to the primary instance.
1492message ReplicaConfiguration {
1493  // This is always `sql#replicaConfiguration`.
1494  string kind = 1;
1495
1496  // MySQL specific configuration when replicating from a MySQL on-premises
1497  // primary instance. Replication configuration information such as the
1498  // username, password, certificates, and keys are not stored in the instance
1499  // metadata. The configuration information is used only to set up the
1500  // replication connection and is stored by MySQL in a file named
1501  // `master.info` in the data directory.
1502  MySqlReplicaConfiguration mysql_replica_configuration = 2;
1503
1504  // Specifies if the replica is the failover target. If the field is set to
1505  // `true`, the replica will be designated as a failover replica. In case the
1506  // primary instance fails, the replica instance will be promoted as the new
1507  // primary instance. Only one replica can be specified as failover target, and
1508  // the replica has to be in different zone with the primary instance.
1509  google.protobuf.BoolValue failover_target = 3;
1510
1511  // Optional. Specifies if a SQL Server replica is a cascadable replica. A
1512  // cascadable replica is a SQL Server cross region replica that supports
1513  // replica(s) under it.
1514  google.protobuf.BoolValue cascadable_replica = 5
1515      [(google.api.field_behavior) = OPTIONAL];
1516}
1517
1518enum SqlInstanceType {
1519  // This is an unknown Cloud SQL instance type.
1520  SQL_INSTANCE_TYPE_UNSPECIFIED = 0;
1521
1522  // A regular Cloud SQL instance that is not replicating from a primary
1523  // instance.
1524  CLOUD_SQL_INSTANCE = 1;
1525
1526  // An instance running on the customer's premises that is not managed by
1527  // Cloud SQL.
1528  ON_PREMISES_INSTANCE = 2;
1529
1530  // A Cloud SQL instance acting as a read-replica.
1531  READ_REPLICA_INSTANCE = 3;
1532}
1533
1534// The suspension reason of the database instance if the state is SUSPENDED.
1535enum SqlSuspensionReason {
1536  // This is an unknown suspension reason.
1537  SQL_SUSPENSION_REASON_UNSPECIFIED = 0;
1538
1539  // The instance is suspended due to billing issues (for example:, GCP account
1540  // issue)
1541  BILLING_ISSUE = 2;
1542
1543  // The instance is suspended due to illegal content (for example:, child
1544  // pornography, copyrighted material, etc.).
1545  LEGAL_ISSUE = 3;
1546
1547  // The instance is causing operational issues (for example:, causing the
1548  // database to crash).
1549  OPERATIONAL_ISSUE = 4;
1550
1551  // The KMS key used by the instance is either revoked or denied access to
1552  KMS_KEY_ISSUE = 5;
1553}
1554