|
| 1 | +// Copyright 2024 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 | + |
| 15 | +syntax = "proto3"; |
| 16 | + |
| 17 | +package google.spanner.admin.database.v1; |
| 18 | + |
| 19 | +import "google/api/field_behavior.proto"; |
| 20 | +import "google/api/resource.proto"; |
| 21 | +import "google/protobuf/duration.proto"; |
| 22 | +import "google/protobuf/field_mask.proto"; |
| 23 | +import "google/protobuf/timestamp.proto"; |
| 24 | +import "google/spanner/admin/database/v1/backup.proto"; |
| 25 | + |
| 26 | +option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1"; |
| 27 | +option go_package = "cloud.google.com/go/spanner/admin/database/apiv1/databasepb;databasepb"; |
| 28 | +option java_multiple_files = true; |
| 29 | +option java_outer_classname = "BackupScheduleProto"; |
| 30 | +option java_package = "com.google.spanner.admin.database.v1"; |
| 31 | +option php_namespace = "Google\\Cloud\\Spanner\\Admin\\Database\\V1"; |
| 32 | +option ruby_package = "Google::Cloud::Spanner::Admin::Database::V1"; |
| 33 | + |
| 34 | +// Defines specifications of the backup schedule. |
| 35 | +message BackupScheduleSpec { |
| 36 | + // Required. |
| 37 | + oneof schedule_spec { |
| 38 | + // Cron style schedule specification. |
| 39 | + CrontabSpec cron_spec = 1; |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +// BackupSchedule expresses the automated backup creation specification for a |
| 44 | +// Spanner database. |
| 45 | +// Next ID: 10 |
| 46 | +message BackupSchedule { |
| 47 | + option (google.api.resource) = { |
| 48 | + type: "spanner.googleapis.com/BackupSchedule" |
| 49 | + pattern: "projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}" |
| 50 | + plural: "backupSchedules" |
| 51 | + singular: "backupSchedule" |
| 52 | + }; |
| 53 | + |
| 54 | + // Identifier. Output only for the |
| 55 | + // [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. |
| 56 | + // Required for the |
| 57 | + // [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] |
| 58 | + // operation. A globally unique identifier for the backup schedule which |
| 59 | + // cannot be changed. Values are of the form |
| 60 | + // `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` |
| 61 | + // The final segment of the name must be between 2 and 60 characters in |
| 62 | + // length. |
| 63 | + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; |
| 64 | + |
| 65 | + // Optional. The schedule specification based on which the backup creations |
| 66 | + // are triggered. |
| 67 | + BackupScheduleSpec spec = 6 [(google.api.field_behavior) = OPTIONAL]; |
| 68 | + |
| 69 | + // Optional. The retention duration of a backup that must be at least 6 hours |
| 70 | + // and at most 366 days. The backup is eligible to be automatically deleted |
| 71 | + // once the retention period has elapsed. |
| 72 | + google.protobuf.Duration retention_duration = 3 |
| 73 | + [(google.api.field_behavior) = OPTIONAL]; |
| 74 | + |
| 75 | + // Optional. The encryption configuration that will be used to encrypt the |
| 76 | + // backup. If this field is not specified, the backup will use the same |
| 77 | + // encryption configuration as the database. |
| 78 | + CreateBackupEncryptionConfig encryption_config = 4 |
| 79 | + [(google.api.field_behavior) = OPTIONAL]; |
| 80 | + |
| 81 | + // Required. Backup type spec determines the type of backup that is created by |
| 82 | + // the backup schedule. Currently, only full backups are supported. |
| 83 | + oneof backup_type_spec { |
| 84 | + // The schedule creates only full backups. |
| 85 | + FullBackupSpec full_backup_spec = 7; |
| 86 | + } |
| 87 | + |
| 88 | + // Output only. The timestamp at which the schedule was last updated. |
| 89 | + // If the schedule has never been updated, this field contains the timestamp |
| 90 | + // when the schedule was first created. |
| 91 | + google.protobuf.Timestamp update_time = 9 |
| 92 | + [(google.api.field_behavior) = OUTPUT_ONLY]; |
| 93 | +} |
| 94 | + |
| 95 | +// CrontabSpec can be used to specify the version time and frequency at |
| 96 | +// which the backup should be created. |
| 97 | +message CrontabSpec { |
| 98 | + // Required. Textual representation of the crontab. User can customize the |
| 99 | + // backup frequency and the backup version time using the cron |
| 100 | + // expression. The version time must be in UTC timzeone. |
| 101 | + // |
| 102 | + // The backup will contain an externally consistent copy of the |
| 103 | + // database at the version time. Allowed frequencies are 12 hour, 1 day, |
| 104 | + // 1 week and 1 month. Examples of valid cron specifications: |
| 105 | + // * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. |
| 106 | + // * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. |
| 107 | + // * `0 2 * * * ` : once a day at 2 past midnight in UTC. |
| 108 | + // * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. |
| 109 | + // * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. |
| 110 | + string text = 1 [(google.api.field_behavior) = REQUIRED]; |
| 111 | + |
| 112 | + // Output only. The time zone of the times in `CrontabSpec.text`. Currently |
| 113 | + // only UTC is supported. |
| 114 | + string time_zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; |
| 115 | + |
| 116 | + // Output only. Schedule backups will contain an externally consistent copy |
| 117 | + // of the database at the version time specified in |
| 118 | + // `schedule_spec.cron_spec`. However, Spanner may not initiate the creation |
| 119 | + // of the scheduled backups at that version time. Spanner will initiate |
| 120 | + // the creation of scheduled backups within the time window bounded by the |
| 121 | + // version_time specified in `schedule_spec.cron_spec` and version_time + |
| 122 | + // `creation_window`. |
| 123 | + google.protobuf.Duration creation_window = 3 |
| 124 | + [(google.api.field_behavior) = OUTPUT_ONLY]; |
| 125 | +} |
| 126 | + |
| 127 | +// The request for |
| 128 | +// [CreateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupSchedule]. |
| 129 | +message CreateBackupScheduleRequest { |
| 130 | + // Required. The name of the database that this backup schedule applies to. |
| 131 | + string parent = 1 [ |
| 132 | + (google.api.field_behavior) = REQUIRED, |
| 133 | + (google.api.resource_reference) = { |
| 134 | + type: "spanner.googleapis.com/Database" |
| 135 | + } |
| 136 | + ]; |
| 137 | + |
| 138 | + // Required. The Id to use for the backup schedule. The `backup_schedule_id` |
| 139 | + // appended to `parent` forms the full backup schedule name of the form |
| 140 | + // `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`. |
| 141 | + string backup_schedule_id = 2 [(google.api.field_behavior) = REQUIRED]; |
| 142 | + |
| 143 | + // Required. The backup schedule to create. |
| 144 | + BackupSchedule backup_schedule = 3 [(google.api.field_behavior) = REQUIRED]; |
| 145 | +} |
| 146 | + |
| 147 | +// The request for |
| 148 | +// [GetBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.GetBackupSchedule]. |
| 149 | +message GetBackupScheduleRequest { |
| 150 | + // Required. The name of the schedule to retrieve. |
| 151 | + // Values are of the form |
| 152 | + // `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`. |
| 153 | + string name = 1 [ |
| 154 | + (google.api.field_behavior) = REQUIRED, |
| 155 | + (google.api.resource_reference) = { |
| 156 | + type: "spanner.googleapis.com/BackupSchedule" |
| 157 | + } |
| 158 | + ]; |
| 159 | +} |
| 160 | + |
| 161 | +// The request for |
| 162 | +// [DeleteBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupSchedule]. |
| 163 | +message DeleteBackupScheduleRequest { |
| 164 | + // Required. The name of the schedule to delete. |
| 165 | + // Values are of the form |
| 166 | + // `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`. |
| 167 | + string name = 1 [ |
| 168 | + (google.api.field_behavior) = REQUIRED, |
| 169 | + (google.api.resource_reference) = { |
| 170 | + type: "spanner.googleapis.com/BackupSchedule" |
| 171 | + } |
| 172 | + ]; |
| 173 | +} |
| 174 | + |
| 175 | +// The request for |
| 176 | +// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]. |
| 177 | +message ListBackupSchedulesRequest { |
| 178 | + // Required. Database is the parent resource whose backup schedules should be |
| 179 | + // listed. Values are of the form |
| 180 | + // projects/<project>/instances/<instance>/databases/<database> |
| 181 | + string parent = 1 [ |
| 182 | + (google.api.field_behavior) = REQUIRED, |
| 183 | + (google.api.resource_reference) = { |
| 184 | + type: "spanner.googleapis.com/Database" |
| 185 | + } |
| 186 | + ]; |
| 187 | + |
| 188 | + // Optional. Number of backup schedules to be returned in the response. If 0 |
| 189 | + // or less, defaults to the server's maximum allowed page size. |
| 190 | + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; |
| 191 | + |
| 192 | + // Optional. If non-empty, `page_token` should contain a |
| 193 | + // [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] |
| 194 | + // from a previous |
| 195 | + // [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] |
| 196 | + // to the same `parent`. |
| 197 | + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; |
| 198 | +} |
| 199 | + |
| 200 | +// The response for |
| 201 | +// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]. |
| 202 | +message ListBackupSchedulesResponse { |
| 203 | + // The list of backup schedules for a database. |
| 204 | + repeated BackupSchedule backup_schedules = 1; |
| 205 | + |
| 206 | + // `next_page_token` can be sent in a subsequent |
| 207 | + // [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] |
| 208 | + // call to fetch more of the schedules. |
| 209 | + string next_page_token = 2; |
| 210 | +} |
| 211 | + |
| 212 | +// The request for |
| 213 | +// [UpdateBackupScheduleRequest][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule]. |
| 214 | +message UpdateBackupScheduleRequest { |
| 215 | + // Required. The backup schedule to update. `backup_schedule.name`, and the |
| 216 | + // fields to be updated as specified by `update_mask` are required. Other |
| 217 | + // fields are ignored. |
| 218 | + BackupSchedule backup_schedule = 1 [(google.api.field_behavior) = REQUIRED]; |
| 219 | + |
| 220 | + // Required. A mask specifying which fields in the BackupSchedule resource |
| 221 | + // should be updated. This mask is relative to the BackupSchedule resource, |
| 222 | + // not to the request message. The field mask must always be |
| 223 | + // specified; this prevents any future fields from being erased |
| 224 | + // accidentally. |
| 225 | + google.protobuf.FieldMask update_mask = 2 |
| 226 | + [(google.api.field_behavior) = REQUIRED]; |
| 227 | +} |
0 commit comments