Skip to content

Commit 05f571e

Browse files
Google APIscopybara-github
authored andcommitted
feat: add MaterializedViews and LogicalViews APIs
PiperOrigin-RevId: 733101782
1 parent cd84730 commit 05f571e

3 files changed

Lines changed: 197 additions & 21 deletions

File tree

google/bigtable/admin/v2/bigtable_instance_admin.proto

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ service BigtableInstanceAdmin {
252252
delete: "/v2/{name=projects/*/instances/*/appProfiles/*}"
253253
};
254254
option (google.api.method_signature) = "name";
255+
option (google.api.method_signature) = "name,ignore_warnings";
255256
}
256257

257258
// Gets the access control policy for an instance resource. Returns an empty
@@ -261,6 +262,14 @@ service BigtableInstanceAdmin {
261262
option (google.api.http) = {
262263
post: "/v2/{resource=projects/*/instances/*}:getIamPolicy"
263264
body: "*"
265+
additional_bindings {
266+
post: "/v2/{resource=projects/*/instances/*/materializedViews/*}:getIamPolicy"
267+
body: "*"
268+
}
269+
additional_bindings {
270+
post: "/v2/{resource=projects/*/instances/*/logicalViews/*}:getIamPolicy"
271+
body: "*"
272+
}
264273
};
265274
option (google.api.method_signature) = "resource";
266275
}
@@ -272,6 +281,14 @@ service BigtableInstanceAdmin {
272281
option (google.api.http) = {
273282
post: "/v2/{resource=projects/*/instances/*}:setIamPolicy"
274283
body: "*"
284+
additional_bindings {
285+
post: "/v2/{resource=projects/*/instances/*/materializedViews/*}:setIamPolicy"
286+
body: "*"
287+
}
288+
additional_bindings {
289+
post: "/v2/{resource=projects/*/instances/*/logicalViews/*}:setIamPolicy"
290+
body: "*"
291+
}
275292
};
276293
option (google.api.method_signature) = "resource,policy";
277294
}
@@ -282,6 +299,14 @@ service BigtableInstanceAdmin {
282299
option (google.api.http) = {
283300
post: "/v2/{resource=projects/*/instances/*}:testIamPermissions"
284301
body: "*"
302+
additional_bindings {
303+
post: "/v2/{resource=projects/*/instances/*/materializedViews/*}:testIamPermissions"
304+
body: "*"
305+
}
306+
additional_bindings {
307+
post: "/v2/{resource=projects/*/instances/*/logicalViews/*}:testIamPermissions"
308+
body: "*"
309+
}
285310
};
286311
option (google.api.method_signature) = "resource,permissions";
287312
}
@@ -320,7 +345,6 @@ message CreateInstanceRequest {
320345
// cluster ID, e.g., just `mycluster` rather than
321346
// `projects/myproject/instances/myinstance/clusters/mycluster`.
322347
// Fields marked `OutputOnly` must be left blank.
323-
// Currently, at most four clusters can be specified.
324348
map<string, Cluster> clusters = 4 [(google.api.field_behavior) = REQUIRED];
325349
}
326350

@@ -749,3 +773,95 @@ message ListHotTabletsResponse {
749773
// page of results.
750774
string next_page_token = 2;
751775
}
776+
777+
// Request message for BigtableInstanceAdmin.CreateLogicalView.
778+
message CreateLogicalViewRequest {
779+
// Required. The parent instance where this logical view will be created.
780+
// Format: `projects/{project}/instances/{instance}`.
781+
string parent = 1 [
782+
(google.api.field_behavior) = REQUIRED,
783+
(google.api.resource_reference) = {
784+
type: "bigtableadmin.googleapis.com/Instance"
785+
}
786+
];
787+
788+
// Required. The ID to use for the logical view, which will become the final
789+
// component of the logical view's resource name.
790+
string logical_view_id = 2 [(google.api.field_behavior) = REQUIRED];
791+
792+
// Required. The logical view to create.
793+
LogicalView logical_view = 3 [(google.api.field_behavior) = REQUIRED];
794+
}
795+
796+
// The metadata for the Operation returned by CreateLogicalView.
797+
message CreateLogicalViewMetadata {
798+
// The request that prompted the initiation of this CreateLogicalView
799+
// operation.
800+
CreateLogicalViewRequest original_request = 1;
801+
802+
// The time at which this operation started.
803+
google.protobuf.Timestamp start_time = 2;
804+
805+
// If set, the time at which this operation finished or was canceled.
806+
google.protobuf.Timestamp end_time = 3;
807+
}
808+
809+
// Request message for BigtableInstanceAdmin.UpdateLogicalView.
810+
message UpdateLogicalViewRequest {
811+
// Required. The logical view to update.
812+
//
813+
// The logical view's `name` field is used to identify the view to update.
814+
// Format:
815+
// `projects/{project}/instances/{instance}/logicalViews/{logical_view}`.
816+
LogicalView logical_view = 1 [(google.api.field_behavior) = REQUIRED];
817+
818+
// Optional. The list of fields to update.
819+
google.protobuf.FieldMask update_mask = 2
820+
[(google.api.field_behavior) = OPTIONAL];
821+
}
822+
823+
// The metadata for the Operation returned by UpdateLogicalView.
824+
message UpdateLogicalViewMetadata {
825+
// The request that prompted the initiation of this UpdateLogicalView
826+
// operation.
827+
UpdateLogicalViewRequest original_request = 1;
828+
829+
// The time at which this operation was started.
830+
google.protobuf.Timestamp start_time = 2;
831+
832+
// If set, the time at which this operation finished or was canceled.
833+
google.protobuf.Timestamp end_time = 3;
834+
}
835+
836+
// Request message for BigtableInstanceAdmin.CreateMaterializedView.
837+
message CreateMaterializedViewRequest {
838+
// Required. The parent instance where this materialized view will be created.
839+
// Format: `projects/{project}/instances/{instance}`.
840+
string parent = 1 [
841+
(google.api.field_behavior) = REQUIRED,
842+
(google.api.resource_reference) = {
843+
type: "bigtableadmin.googleapis.com/Instance"
844+
}
845+
];
846+
847+
// Required. The ID to use for the materialized view, which will become the
848+
// final component of the materialized view's resource name.
849+
string materialized_view_id = 2 [(google.api.field_behavior) = REQUIRED];
850+
851+
// Required. The materialized view to create.
852+
MaterializedView materialized_view = 3
853+
[(google.api.field_behavior) = REQUIRED];
854+
}
855+
856+
// The metadata for the Operation returned by CreateMaterializedView.
857+
message CreateMaterializedViewMetadata {
858+
// The request that prompted the initiation of this CreateMaterializedView
859+
// operation.
860+
CreateMaterializedViewRequest original_request = 1;
861+
862+
// The time at which this operation started.
863+
google.protobuf.Timestamp start_time = 2;
864+
865+
// If set, the time at which this operation finished or was canceled.
866+
google.protobuf.Timestamp end_time = 3;
867+
}

google/bigtable/admin/v2/bigtableadmin_v2.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ types:
1414
- name: google.bigtable.admin.v2.CreateBackupMetadata
1515
- name: google.bigtable.admin.v2.CreateClusterMetadata
1616
- name: google.bigtable.admin.v2.CreateInstanceMetadata
17+
- name: google.bigtable.admin.v2.CreateLogicalViewMetadata
18+
- name: google.bigtable.admin.v2.CreateMaterializedViewMetadata
1719
- name: google.bigtable.admin.v2.CreateTableFromSnapshotMetadata
1820
- name: google.bigtable.admin.v2.OptimizeRestoredTableMetadata
1921
- name: google.bigtable.admin.v2.PartialUpdateClusterMetadata
@@ -24,6 +26,7 @@ types:
2426
- name: google.bigtable.admin.v2.UpdateAuthorizedViewMetadata
2527
- name: google.bigtable.admin.v2.UpdateClusterMetadata
2628
- name: google.bigtable.admin.v2.UpdateInstanceMetadata
29+
- name: google.bigtable.admin.v2.UpdateLogicalViewMetadata
2730
- name: google.bigtable.admin.v2.UpdateTableMetadata
2831

2932
documentation:

google/bigtable/admin/v2/instance.proto

Lines changed: 77 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ message Instance {
4141
option (google.api.resource) = {
4242
type: "bigtableadmin.googleapis.com/Instance"
4343
pattern: "projects/{project}/instances/{instance}"
44+
plural: "instances"
45+
singular: "instance"
4446
};
4547

4648
// Possible states of an instance.
@@ -82,9 +84,8 @@ message Instance {
8284
// to avoid confusion.
8385
string display_name = 2 [(google.api.field_behavior) = REQUIRED];
8486

85-
// (`OutputOnly`)
86-
// The current state of the instance.
87-
State state = 3;
87+
// Output only. The current state of the instance.
88+
State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
8889

8990
// The type of the instance. Defaults to `PRODUCTION`.
9091
Type type = 4;
@@ -102,14 +103,17 @@ message Instance {
102103
// * Keys and values must both be under 128 bytes.
103104
map<string, string> labels = 5;
104105

105-
// Output only. A server-assigned timestamp representing when this Instance
106-
// was created. For instances created before this field was added (August
107-
// 2021), this value is `seconds: 0, nanos: 1`.
106+
// Output only. A commit timestamp representing when this Instance was
107+
// created. For instances created before this field was added (August 2021),
108+
// this value is `seconds: 0, nanos: 1`.
108109
google.protobuf.Timestamp create_time = 7
109110
[(google.api.field_behavior) = OUTPUT_ONLY];
110111

111112
// Output only. Reserved for future use.
112113
optional bool satisfies_pzs = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
114+
115+
// Output only. Reserved for future use.
116+
optional bool satisfies_pzi = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
113117
}
114118

115119
// The Autoscaling targets for a Cluster. These determine the recommended nodes.
@@ -145,6 +149,8 @@ message Cluster {
145149
option (google.api.resource) = {
146150
type: "bigtableadmin.googleapis.com/Cluster"
147151
pattern: "projects/{project}/instances/{instance}/clusters/{cluster}"
152+
plural: "clusters"
153+
singular: "cluster"
148154
};
149155

150156
// Possible states of a cluster.
@@ -214,7 +220,6 @@ message Cluster {
214220
// `cloudkms.cryptoKeyEncrypterDecrypter` role on the CMEK key.
215221
// 2) Only regional keys can be used and the region of the CMEK key must
216222
// match the region of the cluster.
217-
// 3) All clusters within an instance must use the same CMEK key.
218223
// Values are of the form
219224
// `projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}`
220225
string kms_key_name = 1 [(google.api.resource_reference) = {
@@ -240,8 +245,9 @@ message Cluster {
240245
// Output only. The current state of the cluster.
241246
State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
242247

243-
// The number of nodes allocated to this cluster. More nodes enable higher
244-
// throughput and more consistent performance.
248+
// The number of nodes in the cluster. If no value is set,
249+
// Cloud Bigtable automatically allocates nodes based on your data footprint
250+
// and optimized for 50% storage utilization.
245251
int32 serve_nodes = 4;
246252

247253
// Immutable. The node scaling factor of this cluster.
@@ -269,6 +275,8 @@ message AppProfile {
269275
option (google.api.resource) = {
270276
type: "bigtableadmin.googleapis.com/AppProfile"
271277
pattern: "projects/{project}/instances/{instance}/appProfiles/{app_profile}"
278+
plural: "appProfiles"
279+
singular: "appProfile"
272280
};
273281

274282
// Read/write requests are routed to the nearest cluster in the instance, and
@@ -342,17 +350,10 @@ message AppProfile {
342350
}
343351

344352
// Data Boost is a serverless compute capability that lets you run
345-
// high-throughput read jobs on your Bigtable data, without impacting the
346-
// performance of the clusters that handle your application traffic.
347-
// Currently, Data Boost exclusively supports read-only use-cases with
348-
// single-cluster routing.
349-
//
350-
// Data Boost reads are only guaranteed to see the results of writes that
351-
// were written at least 30 minutes ago. This means newly written values may
352-
// not become visible for up to 30m, and also means that old values may
353-
// remain visible for up to 30m after being deleted or overwritten. To
354-
// mitigate the staleness of the data, users may either wait 30m, or use
355-
// CheckConsistency.
353+
// high-throughput read jobs and queries on your Bigtable data, without
354+
// impacting the performance of the clusters that handle your application
355+
// traffic. Data Boost supports read-only use cases with single-cluster
356+
// routing.
356357
message DataBoostIsolationReadOnly {
357358
// Compute Billing Owner specifies how usage should be accounted when using
358359
// Data Boost. Compute Billing Owner also configures which Cloud Project is
@@ -424,6 +425,8 @@ message HotTablet {
424425
option (google.api.resource) = {
425426
type: "bigtableadmin.googleapis.com/HotTablet"
426427
pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}"
428+
plural: "hotTablets"
429+
singular: "hotTablet"
427430
};
428431

429432
// The unique name of the hot tablet. Values are of the form
@@ -456,3 +459,57 @@ message HotTablet {
456459
// to 100% (the node spent all cycles serving the hot tablet).
457460
float node_cpu_usage_percent = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
458461
}
462+
463+
// A SQL logical view object that can be referenced in SQL queries.
464+
message LogicalView {
465+
option (google.api.resource) = {
466+
type: "bigtableadmin.googleapis.com/LogicalView"
467+
pattern: "projects/{project}/instances/{instance}/logicalViews/{logical_view}"
468+
plural: "logicalViews"
469+
singular: "logicalView"
470+
};
471+
472+
// Identifier. The unique name of the logical view.
473+
// Format:
474+
// `projects/{project}/instances/{instance}/logicalViews/{logical_view}
475+
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
476+
477+
// Required. The logical view's select query.
478+
string query = 2 [(google.api.field_behavior) = REQUIRED];
479+
480+
// Optional. The etag for this logical view.
481+
// This may be sent on update requests to ensure that the client has an
482+
// up-to-date value before proceeding. The server returns an ABORTED error on
483+
// a mismatched etag.
484+
string etag = 3 [(google.api.field_behavior) = OPTIONAL];
485+
}
486+
487+
// A materialized view object that can be referenced in SQL queries.
488+
message MaterializedView {
489+
option (google.api.resource) = {
490+
type: "bigtableadmin.googleapis.com/MaterializedView"
491+
pattern: "projects/{project}/instances/{instance}/materializedViews/{materialized_view}"
492+
plural: "materializedViews"
493+
singular: "materializedView"
494+
};
495+
496+
// Identifier. The unique name of the materialized view.
497+
// Format:
498+
// `projects/{project}/instances/{instance}/materializedViews/{materialized_view}
499+
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
500+
501+
// Required. Immutable. The materialized view's select query.
502+
string query = 2 [
503+
(google.api.field_behavior) = REQUIRED,
504+
(google.api.field_behavior) = IMMUTABLE
505+
];
506+
507+
// Optional. The etag for this materialized view.
508+
// This may be sent on update requests to ensure that the client has an
509+
// up-to-date value before proceeding. The server returns an ABORTED error on
510+
// a mismatched etag.
511+
string etag = 3 [(google.api.field_behavior) = OPTIONAL];
512+
513+
// Set to true to make the MaterializedView protected against deletion.
514+
bool deletion_protection = 6;
515+
}

0 commit comments

Comments
 (0)