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.v1beta4; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/cloud/sql/v1beta4/cloud_sql_resources.proto"; 23import "google/protobuf/duration.proto"; 24import "google/protobuf/timestamp.proto"; 25 26option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; 27option java_multiple_files = true; 28option java_outer_classname = "CloudSqlConnectProto"; 29option java_package = "com.google.cloud.sql.v1beta4"; 30 31// LINT: LEGACY_NAMES 32 33// Cloud SQL connect service. 34service SqlConnectService { 35 option (google.api.default_host) = "sqladmin.googleapis.com"; 36 option (google.api.oauth_scopes) = 37 "https://www.googleapis.com/auth/cloud-platform," 38 "https://www.googleapis.com/auth/sqlservice.admin"; 39 40 // Retrieves connect settings about a Cloud SQL instance. 41 rpc GetConnectSettings(GetConnectSettingsRequest) returns (ConnectSettings) { 42 option (google.api.http) = { 43 get: "/sql/v1beta4/projects/{project}/instances/{instance}/connectSettings" 44 }; 45 } 46 47 // Generates a short-lived X509 certificate containing the provided public key 48 // and signed by a private key specific to the target instance. Users may use 49 // the certificate to authenticate as themselves when connecting to the 50 // database. 51 rpc GenerateEphemeralCert(GenerateEphemeralCertRequest) 52 returns (GenerateEphemeralCertResponse) { 53 option (google.api.http) = { 54 post: "/sql/v1beta4/projects/{project}/instances/{instance}:generateEphemeralCert" 55 body: "*" 56 }; 57 } 58} 59 60// Connect settings retrieval request. 61message GetConnectSettingsRequest { 62 // Cloud SQL instance ID. This does not include the project ID. 63 string instance = 1; 64 65 // Project ID of the project that contains the instance. 66 string project = 2; 67 68 // Optional. Optional snapshot read timestamp to trade freshness for 69 // performance. 70 google.protobuf.Timestamp read_time = 7 71 [(google.api.field_behavior) = OPTIONAL]; 72} 73 74// Connect settings retrieval response. 75message ConnectSettings { 76 // This is always `sql#connectSettings`. 77 string kind = 1; 78 79 // SSL configuration. 80 SslCert server_ca_cert = 2; 81 82 // The assigned IP addresses for the instance. 83 repeated IpMapping ip_addresses = 3; 84 85 // The cloud region for the instance. e.g. `us-central1`, `europe-west1`. 86 // The region cannot be changed after instance creation. 87 string region = 4; 88 89 // The database engine type and version. The `databaseVersion` 90 // field cannot be changed after instance creation. 91 // MySQL instances: `MYSQL_8_0`, `MYSQL_5_7` (default), 92 // or `MYSQL_5_6`. 93 // PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, 94 // `POSTGRES_11` or `POSTGRES_12` (default), `POSTGRES_13`, or `POSTGRES_14`. 95 // SQL Server instances: `SQLSERVER_2017_STANDARD` (default), 96 // `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, 97 // `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, 98 // `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or 99 // `SQLSERVER_2019_WEB`. 100 SqlDatabaseVersion database_version = 31; 101 102 // `SECOND_GEN`: Cloud SQL database instance. 103 // `EXTERNAL`: A database server that is not managed by Google. 104 // This property is read-only; use the `tier` property in the `settings` 105 // object to determine the database type. 106 SqlBackendType backend_type = 32; 107 108 // Whether PSC connectivity is enabled for this instance. 109 bool psc_enabled = 33; 110 111 // The dns name of the instance. 112 string dns_name = 34; 113} 114 115// Ephemeral certificate creation request. 116message GenerateEphemeralCertRequest { 117 // Cloud SQL instance ID. This does not include the project ID. 118 string instance = 1; 119 120 // Project ID of the project that contains the instance. 121 string project = 2; 122 123 // PEM encoded public key to include in the signed certificate. 124 string public_key = 3; 125 126 // Optional. Access token to include in the signed certificate. 127 string access_token = 4 [(google.api.field_behavior) = OPTIONAL]; 128 129 // Optional. Optional snapshot read timestamp to trade freshness for 130 // performance. 131 google.protobuf.Timestamp read_time = 7 132 [(google.api.field_behavior) = OPTIONAL]; 133 134 // Optional. If set, it will contain the cert valid duration. 135 google.protobuf.Duration valid_duration = 12 136 [(google.api.field_behavior) = OPTIONAL]; 137} 138 139// Ephemeral certificate creation request. 140message GenerateEphemeralCertResponse { 141 // Generated cert 142 SslCert ephemeral_cert = 1; 143} 144