Skip to content

Commit e210283

Browse files
Google APIscopybara-github
authored andcommitted
feat: Publish CBT deletion_protection field in Table, UpdateTableRequest, and UpdateTable API in **stable** proto to external customers
PiperOrigin-RevId: 474010093
1 parent 450fbd0 commit e210283

3 files changed

Lines changed: 58 additions & 2 deletions

File tree

google/bigtable/admin/v2/bigtable_table_admin.proto

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ service BigtableTableAdmin {
100100
option (google.api.method_signature) = "name";
101101
}
102102

103+
// Updates a specified table.
104+
rpc UpdateTable(UpdateTableRequest) returns (google.longrunning.Operation) {
105+
option (google.api.http) = {
106+
patch: "/v2/{table.name=projects/*/instances/*/tables/*}"
107+
body: "table"
108+
};
109+
option (google.api.method_signature) = "table,update_mask";
110+
option (google.longrunning.operation_info) = {
111+
response_type: "Table"
112+
metadata_type: "UpdateTableMetadata"
113+
};
114+
}
115+
103116
// Permanently deletes a specified table and all of its data.
104117
rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) {
105118
option (google.api.http) = {
@@ -368,8 +381,8 @@ message RestoreTableRequest {
368381
// Name of the backup from which to restore. Values are of the form
369382
// `projects/<project>/instances/<instance>/clusters/<cluster>/backups/<backup>`.
370383
string backup = 3 [(google.api.resource_reference) = {
371-
type: "bigtableadmin.googleapis.com/Backup"
372-
}];
384+
type: "bigtableadmin.googleapis.com/Backup"
385+
}];
373386
}
374387
}
375388

@@ -579,6 +592,40 @@ message GetTableRequest {
579592
Table.View view = 2;
580593
}
581594

595+
// The request for
596+
// [UpdateTable][google.bigtable.admin.v2.BigtableTableAdmin.UpdateTable].
597+
message UpdateTableRequest {
598+
// Required. The table to update.
599+
// The table's `name` field is used to identify the table to update.
600+
// Format:
601+
// `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`
602+
Table table = 1 [(google.api.field_behavior) = REQUIRED];
603+
604+
// Required. The list of fields to update.
605+
// A mask specifying which fields (e.g. `deletion_protection`) in the `table`
606+
// field should be updated. This mask is relative to the `table` field, not to
607+
// the request message. The wildcard (*) path is currently not supported.
608+
// Currently UpdateTable is only supported for the following field:
609+
// * `deletion_protection`
610+
// If `column_families` is set in `update_mask`, it will return an
611+
// UNIMPLEMENTED error.
612+
google.protobuf.FieldMask update_mask = 2
613+
[(google.api.field_behavior) = REQUIRED];
614+
}
615+
616+
// Metadata type for the operation returned by
617+
// [UpdateTable][google.bigtable.admin.v2.BigtableTableAdmin.UpdateTable].
618+
message UpdateTableMetadata {
619+
// The name of the table being updated.
620+
string name = 1;
621+
622+
// The time at which this operation started.
623+
google.protobuf.Timestamp start_time = 2;
624+
625+
// If set, the time at which this operation finished or was canceled.
626+
google.protobuf.Timestamp end_time = 3;
627+
}
628+
582629
// Request message for
583630
// [google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable]
584631
message DeleteTableRequest {

google/bigtable/admin/v2/bigtableadmin_v2.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ types:
2121
- name: google.bigtable.admin.v2.UpdateAppProfileMetadata
2222
- name: google.bigtable.admin.v2.UpdateClusterMetadata
2323
- name: google.bigtable.admin.v2.UpdateInstanceMetadata
24+
- name: google.bigtable.admin.v2.UpdateTableMetadata
2425

2526
documentation:
2627
summary: Administer your Cloud Bigtable tables and instances.

google/bigtable/admin/v2/table.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ message Table {
156156
// Output only. If this table was restored from another data source (e.g. a backup), this
157157
// field will be populated with information about the restore.
158158
RestoreInfo restore_info = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
159+
160+
// Set to true to make the table protected against data loss. i.e. deleting
161+
// the following resources through Admin APIs are prohibited:
162+
// - The table.
163+
// - The column families in the table.
164+
// - The instance containing the table.
165+
// Note one can still delete the data stored in the table through Data APIs.
166+
bool deletion_protection = 9;
159167
}
160168

161169
// A set of columns within a table which share a common configuration.

0 commit comments

Comments
 (0)