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/timestamp.proto"; 24 25option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; 26option java_multiple_files = true; 27option java_outer_classname = "CloudSqlBackupRunsProto"; 28option java_package = "com.google.cloud.sql.v1"; 29 30// LINT: LEGACY_NAMES 31 32// Service for managing database backups. 33service SqlBackupRunsService { 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 // Deletes the backup taken by a backup run. 40 rpc Delete(SqlBackupRunsDeleteRequest) returns (Operation) { 41 option (google.api.http) = { 42 delete: "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" 43 }; 44 } 45 46 // Retrieves a resource containing information about a backup run. 47 rpc Get(SqlBackupRunsGetRequest) returns (BackupRun) { 48 option (google.api.http) = { 49 get: "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" 50 }; 51 } 52 53 // Creates a new backup run on demand. 54 rpc Insert(SqlBackupRunsInsertRequest) returns (Operation) { 55 option (google.api.http) = { 56 post: "/v1/projects/{project}/instances/{instance}/backupRuns" 57 body: "body" 58 }; 59 } 60 61 // Lists all backup runs associated with the project or a given instance 62 // and configuration in the reverse chronological order of the backup 63 // initiation time. 64 rpc List(SqlBackupRunsListRequest) returns (BackupRunsListResponse) { 65 option (google.api.http) = { 66 get: "/v1/projects/{project}/instances/{instance}/backupRuns" 67 }; 68 } 69} 70 71// Backup runs delete request. 72message SqlBackupRunsDeleteRequest { 73 // The ID of the backup run to delete. To find a backup run ID, use the 74 // [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) 75 // method. 76 int64 id = 1; 77 78 // Cloud SQL instance ID. This does not include the project ID. 79 string instance = 2; 80 81 // Project ID of the project that contains the instance. 82 string project = 3; 83} 84 85// Backup runs get request. 86message SqlBackupRunsGetRequest { 87 // The ID of this backup run. 88 int64 id = 1; 89 90 // Cloud SQL instance ID. This does not include the project ID. 91 string instance = 2; 92 93 // Project ID of the project that contains the instance. 94 string project = 3; 95} 96 97// Backup runs insert request. 98message SqlBackupRunsInsertRequest { 99 // Cloud SQL instance ID. This does not include the project ID. 100 string instance = 1; 101 102 // Project ID of the project that contains the instance. 103 string project = 2; 104 105 BackupRun body = 100; 106} 107 108// Backup runs list request. 109message SqlBackupRunsListRequest { 110 // Cloud SQL instance ID, or "-" for all instances. This does not include 111 // the project ID. 112 string instance = 1; 113 114 // Maximum number of backup runs per response. 115 int32 max_results = 2; 116 117 // A previously-returned page token representing part of the larger set of 118 // results to view. 119 string page_token = 3; 120 121 // Project ID of the project that contains the instance. 122 string project = 4; 123} 124 125// A BackupRun resource. 126message BackupRun { 127 // This is always `sql#backupRun`. 128 string kind = 1; 129 130 // The status of this run. 131 SqlBackupRunStatus status = 2; 132 133 // The time the run was enqueued in UTC timezone in 134 // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example 135 // `2012-11-15T16:19:00.094Z`. 136 google.protobuf.Timestamp enqueued_time = 3; 137 138 // The identifier for this backup run. Unique only for a specific Cloud SQL 139 // instance. 140 int64 id = 4; 141 142 // The time the backup operation actually started in UTC timezone in 143 // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example 144 // `2012-11-15T16:19:00.094Z`. 145 google.protobuf.Timestamp start_time = 5; 146 147 // The time the backup operation completed in UTC timezone in 148 // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example 149 // `2012-11-15T16:19:00.094Z`. 150 google.protobuf.Timestamp end_time = 6; 151 152 // Information about why the backup operation failed. This is only present if 153 // the run has the FAILED status. 154 OperationError error = 7; 155 156 // The type of this run; can be either "AUTOMATED" or "ON_DEMAND" or "FINAL". 157 // This field defaults to "ON_DEMAND" and is ignored, when specified for 158 // insert requests. 159 SqlBackupRunType type = 8; 160 161 // The description of this run, only applicable to on-demand backups. 162 string description = 9; 163 164 // The start time of the backup window during which this the backup was 165 // attempted in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for 166 // example `2012-11-15T16:19:00.094Z`. 167 google.protobuf.Timestamp window_start_time = 10; 168 169 // Name of the database instance. 170 string instance = 11; 171 172 // The URI of this resource. 173 string self_link = 12; 174 175 // Location of the backups. 176 string location = 13; 177 178 // Encryption configuration specific to a backup. 179 DiskEncryptionConfiguration disk_encryption_configuration = 16; 180 181 // Encryption status specific to a backup. 182 DiskEncryptionStatus disk_encryption_status = 17; 183 184 // Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. 185 SqlBackupKind backup_kind = 19; 186 187 // Backup time zone to prevent restores to an instance with 188 // a different time zone. Now relevant only for SQL Server. 189 string time_zone = 23; 190} 191 192// Backup run list results. 193message BackupRunsListResponse { 194 // This is always `sql#backupRunsList`. 195 string kind = 1; 196 197 // A list of backup runs in reverse chronological order of the enqueued time. 198 repeated BackupRun items = 2; 199 200 // The continuation token, used to page through large result sets. Provide 201 // this value in a subsequent request to return the next page of results. 202 string next_page_token = 3; 203} 204 205// The status of a backup run. 206enum SqlBackupRunStatus { 207 // The status of the run is unknown. 208 SQL_BACKUP_RUN_STATUS_UNSPECIFIED = 0; 209 210 // The backup operation was enqueued. 211 ENQUEUED = 1; 212 213 // The backup is overdue across a given backup window. Indicates a 214 // problem. Example: Long-running operation in progress during 215 // the whole window. 216 OVERDUE = 2; 217 218 // The backup is in progress. 219 RUNNING = 3; 220 221 // The backup failed. 222 FAILED = 4; 223 224 // The backup was successful. 225 SUCCESSFUL = 5; 226 227 // The backup was skipped (without problems) for a given backup 228 // window. Example: Instance was idle. 229 SKIPPED = 6; 230 231 // The backup is about to be deleted. 232 DELETION_PENDING = 7; 233 234 // The backup deletion failed. 235 DELETION_FAILED = 8; 236 237 // The backup has been deleted. 238 DELETED = 9; 239} 240 241// Defines the supported backup kinds. 242enum SqlBackupKind { 243 // This is an unknown BackupKind. 244 SQL_BACKUP_KIND_UNSPECIFIED = 0; 245 246 // The snapshot based backups 247 SNAPSHOT = 1; 248 249 // Physical backups 250 PHYSICAL = 2; 251} 252 253// Type of backup (i.e. automated, on demand, etc). 254enum SqlBackupRunType { 255 // This is an unknown BackupRun type. 256 SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0; 257 258 // The backup schedule automatically triggers a backup. 259 AUTOMATED = 1; 260 261 // The user manually triggers a backup. 262 ON_DEMAND = 2; 263} 264