Skip to content

Commit 6379d5f

Browse files
Google APIscopybara-github
authored andcommitted
Synchronize new proto/yaml changes.
PiperOrigin-RevId: 436114471
1 parent 5d85995 commit 6379d5f

4 files changed

Lines changed: 206 additions & 10 deletions

File tree

google/spanner/admin/database/v1/backup.proto

Lines changed: 174 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -119,6 +119,27 @@ message Backup {
119119

120120
// Output only. The database dialect information for the backup.
121121
DatabaseDialect database_dialect = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
122+
123+
// Output only. The names of the destination backups being created by copying
124+
// this source backup. The backup names are of the form
125+
// `projects/<project>/instances/<instance>/backups/<backup>`.
126+
// Referencing backups may exist in different instances. The existence of
127+
// any referencing backup prevents the backup from being deleted. When the
128+
// copy operation is done (either successfully completed or cancelled or the
129+
// destination backup is deleted), the reference to the backup is removed.
130+
repeated string referencing_backups = 11 [
131+
(google.api.field_behavior) = OUTPUT_ONLY,
132+
(google.api.resource_reference) = {
133+
type: "spanner.googleapis.com/Backup"
134+
}
135+
];
136+
137+
// Output only. The max allowed expiration time of the backup, with
138+
// microseconds granularity. A backup's expiration time can be configured in
139+
// multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or
140+
// copying an existing backup, the expiration time specified must be
141+
// less than `Backup.max_expire_time`.
142+
google.protobuf.Timestamp max_expire_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
122143
}
123144

124145
// The request for [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
@@ -184,6 +205,86 @@ message CreateBackupMetadata {
184205
google.protobuf.Timestamp cancel_time = 4;
185206
}
186207

208+
// The request for [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
209+
message CopyBackupRequest {
210+
// Required. The name of the destination instance that will contain the backup copy.
211+
// Values are of the form: `projects/<project>/instances/<instance>`.
212+
string parent = 1 [
213+
(google.api.field_behavior) = REQUIRED,
214+
(google.api.resource_reference) = {
215+
type: "spanner.googleapis.com/Instance"
216+
}
217+
];
218+
219+
// Required. The id of the backup copy.
220+
// The `backup_id` appended to `parent` forms the full backup_uri of the form
221+
// `projects/<project>/instances/<instance>/backups/<backup>`.
222+
string backup_id = 2 [(google.api.field_behavior) = REQUIRED];
223+
224+
// Required. The source backup to be copied.
225+
// The source backup needs to be in READY state for it to be copied.
226+
// Once CopyBackup is in progress, the source backup cannot be deleted or
227+
// cleaned up on expiration until CopyBackup is finished.
228+
// Values are of the form:
229+
// `projects/<project>/instances/<instance>/backups/<backup>`.
230+
string source_backup = 3 [
231+
(google.api.field_behavior) = REQUIRED,
232+
(google.api.resource_reference) = {
233+
type: "spanner.googleapis.com/Backup"
234+
}
235+
];
236+
237+
// Required. The expiration time of the backup in microsecond granularity.
238+
// The expiration time must be at least 6 hours and at most 366 days
239+
// from the `create_time` of the source backup. Once the `expire_time` has
240+
// passed, the backup is eligible to be automatically deleted by Cloud Spanner
241+
// to free the resources used by the backup.
242+
google.protobuf.Timestamp expire_time = 4 [(google.api.field_behavior) = REQUIRED];
243+
244+
// Optional. The encryption configuration used to encrypt the backup. If this field is
245+
// not specified, the backup will use the same
246+
// encryption configuration as the source backup by default, namely
247+
// [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] =
248+
// `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
249+
CopyBackupEncryptionConfig encryption_config = 5 [(google.api.field_behavior) = OPTIONAL];
250+
}
251+
252+
// Metadata type for the google.longrunning.Operation returned by
253+
// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
254+
message CopyBackupMetadata {
255+
// The name of the backup being created through the copy operation.
256+
// Values are of the form
257+
// `projects/<project>/instances/<instance>/backups/<backup>`.
258+
string name = 1 [(google.api.resource_reference) = {
259+
type: "spanner.googleapis.com/Backup"
260+
}];
261+
262+
// The name of the source backup that is being copied.
263+
// Values are of the form
264+
// `projects/<project>/instances/<instance>/backups/<backup>`.
265+
string source_backup = 2 [(google.api.resource_reference) = {
266+
type: "spanner.googleapis.com/Backup"
267+
}];
268+
269+
// The progress of the
270+
// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] operation.
271+
OperationProgress progress = 3;
272+
273+
// The time at which cancellation of CopyBackup operation was received.
274+
// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
275+
// starts asynchronous cancellation on a long-running operation. The server
276+
// makes a best effort to cancel the operation, but success is not guaranteed.
277+
// Clients can use
278+
// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
279+
// other methods to check whether the cancellation succeeded or whether the
280+
// operation completed despite cancellation. On successful cancellation,
281+
// the operation is not deleted; instead, it becomes an operation with
282+
// an [Operation.error][google.longrunning.Operation.error] value with a
283+
// [google.rpc.Status.code][google.rpc.Status.code] of 1,
284+
// corresponding to `Code.CANCELLED`.
285+
google.protobuf.Timestamp cancel_time = 4;
286+
}
287+
187288
// The request for [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup].
188289
message UpdateBackupRequest {
189290
// Required. The backup to update. `backup.name`, and the fields to be updated
@@ -326,6 +427,8 @@ message ListBackupOperationsRequest {
326427
// for [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] is
327428
// `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
328429
// * `metadata.<field_name>` - any field in metadata.value.
430+
// `metadata.@type` must be specified first if filtering on metadata
431+
// fields.
329432
// * `error` - Error associated with the long-running operation.
330433
// * `response.@type` - the type of response.
331434
// * `response.<field_name>` - any field in response.value.
@@ -337,8 +440,11 @@ message ListBackupOperationsRequest {
337440
// Here are a few examples:
338441
//
339442
// * `done:true` - The operation is complete.
340-
// * `metadata.database:prod` - The database the backup was taken from has
341-
// a name containing the string "prod".
443+
// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
444+
// `metadata.database:prod` - Returns operations where:
445+
// * The operation's metadata type is [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
446+
// * The database the backup was taken from has a name containing the
447+
// string "prod".
342448
// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
343449
// `(metadata.name:howl) AND` \
344450
// `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
@@ -347,6 +453,29 @@ message ListBackupOperationsRequest {
347453
// * The backup name contains the string "howl".
348454
// * The operation started before 2018-03-28T14:50:00Z.
349455
// * The operation resulted in an error.
456+
// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
457+
// `(metadata.source_backup:test) AND` \
458+
// `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
459+
// `(error:*)` - Returns operations where:
460+
// * The operation's metadata type is [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
461+
// * The source backup of the copied backup name contains the string
462+
// "test".
463+
// * The operation started before 2022-01-18T14:50:00Z.
464+
// * The operation resulted in an error.
465+
// * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
466+
// `(metadata.database:test_db)) OR` \
467+
// `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
468+
// AND` \
469+
// `(metadata.source_backup:test_bkp)) AND` \
470+
// `(error:*)` - Returns operations where:
471+
// * The operation's metadata matches either of criteria:
472+
// * The operation's metadata type is [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] AND the
473+
// database the backup was taken from has name containing string
474+
// "test_db"
475+
// * The operation's metadata type is [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] AND the
476+
// backup the backup was copied from has name containing string
477+
// "test_bkp"
478+
// * The operation resulted in an error.
350479
string filter = 2;
351480

352481
// Number of operations to be returned in the response. If 0 or
@@ -365,11 +494,11 @@ message ListBackupOperationsRequest {
365494
message ListBackupOperationsResponse {
366495
// The list of matching backup [long-running
367496
// operations][google.longrunning.Operation]. Each operation's name will be
368-
// prefixed by the backup's name and the operation's
369-
// [metadata][google.longrunning.Operation.metadata] will be of type
370-
// [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. Operations returned include those that are
371-
// pending or have completed/failed/canceled within the last 7 days.
372-
// Operations returned are ordered by
497+
// prefixed by the backup's name. The operation's
498+
// [metadata][google.longrunning.Operation.metadata] field type
499+
// `metadata.type_url` describes the type of the metadata. Operations returned
500+
// include those that are pending or have completed/failed/canceled within the
501+
// last 7 days. Operations returned are ordered by
373502
// `operation.metadata.value.progress.start_time` in descending order starting
374503
// from the most recently started operation.
375504
repeated google.longrunning.Operation operations = 1;
@@ -441,3 +570,40 @@ message CreateBackupEncryptionConfig {
441570
}
442571
];
443572
}
573+
574+
// Encryption configuration for the copied backup.
575+
message CopyBackupEncryptionConfig {
576+
// Encryption types for the backup.
577+
enum EncryptionType {
578+
// Unspecified. Do not use.
579+
ENCRYPTION_TYPE_UNSPECIFIED = 0;
580+
581+
// This is the default option for [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
582+
// when [encryption_config][google.spanner.admin.database.v1.CopyBackupEncryptionConfig] is not specified.
583+
// For example, if the source backup is using `Customer_Managed_Encryption`,
584+
// the backup will be using the same Cloud KMS key as the source backup.
585+
USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1;
586+
587+
// Use Google default encryption.
588+
GOOGLE_DEFAULT_ENCRYPTION = 2;
589+
590+
// Use customer managed encryption. If specified, `kms_key_name`
591+
// must contain a valid Cloud KMS key.
592+
CUSTOMER_MANAGED_ENCRYPTION = 3;
593+
}
594+
595+
// Required. The encryption type of the backup.
596+
EncryptionType encryption_type = 1 [(google.api.field_behavior) = REQUIRED];
597+
598+
// Optional. The Cloud KMS key that will be used to protect the backup.
599+
// This field should be set only when
600+
// [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] is
601+
// `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
602+
// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
603+
string kms_key_name = 2 [
604+
(google.api.field_behavior) = OPTIONAL,
605+
(google.api.resource_reference) = {
606+
type: "cloudkms.googleapis.com/CryptoKey"
607+
}
608+
];
609+
}

google/spanner/admin/database/v1/common.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

google/spanner/admin/database/v1/spanner_admin_database_grpc_service_config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@
8686
"service": "google.spanner.admin.database.v1.DatabaseAdmin",
8787
"method": "CreateBackup"
8888
},
89+
{
90+
"service": "google.spanner.admin.database.v1.DatabaseAdmin",
91+
"method": "CopyBackup"
92+
},
8993
{
9094
"service": "google.spanner.admin.database.v1.DatabaseAdmin",
9195
"method": "RestoreDatabase"

google/spanner/admin/database/v1/spanner_database_admin.proto

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -215,6 +215,30 @@ service DatabaseAdmin {
215215
};
216216
}
217217

218+
// Starts copying a Cloud Spanner Backup.
219+
// The returned backup [long-running operation][google.longrunning.Operation]
220+
// will have a name of the format
221+
// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
222+
// and can be used to track copying of the backup. The operation is associated
223+
// with the destination backup.
224+
// The [metadata][google.longrunning.Operation.metadata] field type is
225+
// [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
226+
// The [response][google.longrunning.Operation.response] field type is
227+
// [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned operation will stop the
228+
// copying and delete the backup.
229+
// Concurrent CopyBackup requests can run on the same source backup.
230+
rpc CopyBackup(CopyBackupRequest) returns (google.longrunning.Operation) {
231+
option (google.api.http) = {
232+
post: "/v1/{parent=projects/*/instances/*}/backups:copy"
233+
body: "*"
234+
};
235+
option (google.api.method_signature) = "parent,backup_id,source_backup,expire_time";
236+
option (google.longrunning.operation_info) = {
237+
response_type: "google.spanner.admin.database.v1.Backup"
238+
metadata_type: "google.spanner.admin.database.v1.CopyBackupMetadata"
239+
};
240+
}
241+
218242
// Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup].
219243
rpc GetBackup(GetBackupRequest) returns (Backup) {
220244
option (google.api.http) = {
@@ -644,6 +668,8 @@ message ListDatabaseOperationsRequest {
644668
// for [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] is
645669
// `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
646670
// * `metadata.<field_name>` - any field in metadata.value.
671+
// `metadata.@type` must be specified first, if filtering on metadata
672+
// fields.
647673
// * `error` - Error associated with the long-running operation.
648674
// * `response.@type` - the type of response.
649675
// * `response.<field_name>` - any field in response.value.

0 commit comments

Comments
 (0)