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/cloud/sql/v1/cloud_sql_resources.proto"; 22 23option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; 24option java_multiple_files = true; 25option java_outer_classname = "CloudSqlDatabasesProto"; 26option java_package = "com.google.cloud.sql.v1"; 27 28// LINT: LEGACY_NAMES 29 30// Service to manage databases. 31service SqlDatabasesService { 32 option (google.api.default_host) = "sqladmin.googleapis.com"; 33 option (google.api.oauth_scopes) = 34 "https://www.googleapis.com/auth/cloud-platform," 35 "https://www.googleapis.com/auth/sqlservice.admin"; 36 37 // Deletes a database from a Cloud SQL instance. 38 rpc Delete(SqlDatabasesDeleteRequest) returns (Operation) { 39 option (google.api.http) = { 40 delete: "/v1/projects/{project}/instances/{instance}/databases/{database}" 41 }; 42 } 43 44 // Retrieves a resource containing information about a database inside a Cloud 45 // SQL instance. 46 rpc Get(SqlDatabasesGetRequest) returns (Database) { 47 option (google.api.http) = { 48 get: "/v1/projects/{project}/instances/{instance}/databases/{database}" 49 }; 50 } 51 52 // Inserts a resource containing information about a database inside a Cloud 53 // SQL instance. 54 // 55 // **Note:** You can't modify the default character set and collation. 56 rpc Insert(SqlDatabasesInsertRequest) returns (Operation) { 57 option (google.api.http) = { 58 post: "/v1/projects/{project}/instances/{instance}/databases" 59 body: "body" 60 }; 61 } 62 63 // Lists databases in the specified Cloud SQL instance. 64 rpc List(SqlDatabasesListRequest) returns (DatabasesListResponse) { 65 option (google.api.http) = { 66 get: "/v1/projects/{project}/instances/{instance}/databases" 67 }; 68 } 69 70 // Partially updates a resource containing information about a database inside 71 // a Cloud SQL instance. This method supports patch semantics. 72 rpc Patch(SqlDatabasesUpdateRequest) returns (Operation) { 73 option (google.api.http) = { 74 patch: "/v1/projects/{project}/instances/{instance}/databases/{database}" 75 body: "body" 76 }; 77 } 78 79 // Updates a resource containing information about a database inside a Cloud 80 // SQL instance. 81 rpc Update(SqlDatabasesUpdateRequest) returns (Operation) { 82 option (google.api.http) = { 83 put: "/v1/projects/{project}/instances/{instance}/databases/{database}" 84 body: "body" 85 }; 86 } 87} 88 89// Database delete request. 90message SqlDatabasesDeleteRequest { 91 // Name of the database to be deleted in the instance. 92 string database = 1; 93 94 // Database instance ID. This does not include the project ID. 95 string instance = 2; 96 97 // Project ID of the project that contains the instance. 98 string project = 3; 99} 100 101// Database get request. 102message SqlDatabasesGetRequest { 103 // Name of the database in the instance. 104 string database = 1; 105 106 // Database instance ID. This does not include the project ID. 107 string instance = 2; 108 109 // Project ID of the project that contains the instance. 110 string project = 3; 111} 112 113// Database insert request. 114message SqlDatabasesInsertRequest { 115 // Database instance ID. This does not include the project ID. 116 string instance = 1; 117 118 // Project ID of the project that contains the instance. 119 string project = 2; 120 121 Database body = 100; 122} 123 124// Database list request. 125message SqlDatabasesListRequest { 126 // Cloud SQL instance ID. This does not include the project ID. 127 string instance = 1; 128 129 // Project ID of the project that contains the instance. 130 string project = 2; 131} 132 133// Database update request. 134message SqlDatabasesUpdateRequest { 135 // Name of the database to be updated in the instance. 136 string database = 1; 137 138 // Database instance ID. This does not include the project ID. 139 string instance = 2; 140 141 // Project ID of the project that contains the instance. 142 string project = 3; 143 144 Database body = 100; 145} 146 147// Database list response. 148message DatabasesListResponse { 149 // This is always `sql#databasesList`. 150 string kind = 1; 151 152 // List of database resources in the instance. 153 repeated Database items = 2; 154} 155