From 6e81decddc98620fe56c0535f958cacb3d3028e2 Mon Sep 17 00:00:00 2001 From: Google APIs Date: Mon, 3 Mar 2025 16:29:51 -0800 Subject: [PATCH] feat: add MaterializedViews and LogicalViews APIs PiperOrigin-RevId: 733101782 --- .../admin/v2/bigtable_instance_admin.proto | 119 +++++++++++++++++- .../bigtable/admin/v2/bigtableadmin_v2.yaml | 3 + google/bigtable/admin/v2/common.proto | 2 +- google/bigtable/admin/v2/instance.proto | 107 ++++++++++++---- 4 files changed, 205 insertions(+), 26 deletions(-) diff --git a/google/bigtable/admin/v2/bigtable_instance_admin.proto b/google/bigtable/admin/v2/bigtable_instance_admin.proto index 6ec21df59..3f741f216 100644 --- a/google/bigtable/admin/v2/bigtable_instance_admin.proto +++ b/google/bigtable/admin/v2/bigtable_instance_admin.proto @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -252,6 +252,7 @@ service BigtableInstanceAdmin { delete: "/v2/{name=projects/*/instances/*/appProfiles/*}" }; option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,ignore_warnings"; } // Gets the access control policy for an instance resource. Returns an empty @@ -261,6 +262,14 @@ service BigtableInstanceAdmin { option (google.api.http) = { post: "/v2/{resource=projects/*/instances/*}:getIamPolicy" body: "*" + additional_bindings { + post: "/v2/{resource=projects/*/instances/*/materializedViews/*}:getIamPolicy" + body: "*" + } + additional_bindings { + post: "/v2/{resource=projects/*/instances/*/logicalViews/*}:getIamPolicy" + body: "*" + } }; option (google.api.method_signature) = "resource"; } @@ -272,6 +281,14 @@ service BigtableInstanceAdmin { option (google.api.http) = { post: "/v2/{resource=projects/*/instances/*}:setIamPolicy" body: "*" + additional_bindings { + post: "/v2/{resource=projects/*/instances/*/materializedViews/*}:setIamPolicy" + body: "*" + } + additional_bindings { + post: "/v2/{resource=projects/*/instances/*/logicalViews/*}:setIamPolicy" + body: "*" + } }; option (google.api.method_signature) = "resource,policy"; } @@ -282,6 +299,14 @@ service BigtableInstanceAdmin { option (google.api.http) = { post: "/v2/{resource=projects/*/instances/*}:testIamPermissions" body: "*" + additional_bindings { + post: "/v2/{resource=projects/*/instances/*/materializedViews/*}:testIamPermissions" + body: "*" + } + additional_bindings { + post: "/v2/{resource=projects/*/instances/*/logicalViews/*}:testIamPermissions" + body: "*" + } }; option (google.api.method_signature) = "resource,permissions"; } @@ -748,3 +773,95 @@ message ListHotTabletsResponse { // page of results. string next_page_token = 2; } + +// Request message for BigtableInstanceAdmin.CreateLogicalView. +message CreateLogicalViewRequest { + // Required. The parent instance where this logical view will be created. + // Format: `projects/{project}/instances/{instance}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // Required. The ID to use for the logical view, which will become the final + // component of the logical view's resource name. + string logical_view_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The logical view to create. + LogicalView logical_view = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The metadata for the Operation returned by CreateLogicalView. +message CreateLogicalViewMetadata { + // The request that prompted the initiation of this CreateLogicalView + // operation. + CreateLogicalViewRequest original_request = 1; + + // The time at which this operation started. + google.protobuf.Timestamp start_time = 2; + + // If set, the time at which this operation finished or was canceled. + google.protobuf.Timestamp end_time = 3; +} + +// Request message for BigtableInstanceAdmin.UpdateLogicalView. +message UpdateLogicalViewRequest { + // Required. The logical view to update. + // + // The logical view's `name` field is used to identify the view to update. + // Format: + // `projects/{project}/instances/{instance}/logicalViews/{logical_view}`. + LogicalView logical_view = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The list of fields to update. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The metadata for the Operation returned by UpdateLogicalView. +message UpdateLogicalViewMetadata { + // The request that prompted the initiation of this UpdateLogicalView + // operation. + UpdateLogicalViewRequest original_request = 1; + + // The time at which this operation was started. + google.protobuf.Timestamp start_time = 2; + + // If set, the time at which this operation finished or was canceled. + google.protobuf.Timestamp end_time = 3; +} + +// Request message for BigtableInstanceAdmin.CreateMaterializedView. +message CreateMaterializedViewRequest { + // Required. The parent instance where this materialized view will be created. + // Format: `projects/{project}/instances/{instance}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // Required. The ID to use for the materialized view, which will become the + // final component of the materialized view's resource name. + string materialized_view_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The materialized view to create. + MaterializedView materialized_view = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// The metadata for the Operation returned by CreateMaterializedView. +message CreateMaterializedViewMetadata { + // The request that prompted the initiation of this CreateMaterializedView + // operation. + CreateMaterializedViewRequest original_request = 1; + + // The time at which this operation started. + google.protobuf.Timestamp start_time = 2; + + // If set, the time at which this operation finished or was canceled. + google.protobuf.Timestamp end_time = 3; +} diff --git a/google/bigtable/admin/v2/bigtableadmin_v2.yaml b/google/bigtable/admin/v2/bigtableadmin_v2.yaml index 561d80bbd..df1574e2c 100644 --- a/google/bigtable/admin/v2/bigtableadmin_v2.yaml +++ b/google/bigtable/admin/v2/bigtableadmin_v2.yaml @@ -16,6 +16,8 @@ types: - name: google.bigtable.admin.v2.CreateBackupMetadata - name: google.bigtable.admin.v2.CreateClusterMetadata - name: google.bigtable.admin.v2.CreateInstanceMetadata +- name: google.bigtable.admin.v2.CreateLogicalViewMetadata +- name: google.bigtable.admin.v2.CreateMaterializedViewMetadata - name: google.bigtable.admin.v2.CreateTableFromSnapshotMetadata - name: google.bigtable.admin.v2.OptimizeRestoredTableMetadata - name: google.bigtable.admin.v2.PartialUpdateClusterMetadata @@ -26,6 +28,7 @@ types: - name: google.bigtable.admin.v2.UpdateAuthorizedViewMetadata - name: google.bigtable.admin.v2.UpdateClusterMetadata - name: google.bigtable.admin.v2.UpdateInstanceMetadata +- name: google.bigtable.admin.v2.UpdateLogicalViewMetadata - name: google.bigtable.admin.v2.UpdateTableMetadata documentation: diff --git a/google/bigtable/admin/v2/common.proto b/google/bigtable/admin/v2/common.proto index fe28f5fa8..0d8c184ec 100644 --- a/google/bigtable/admin/v2/common.proto +++ b/google/bigtable/admin/v2/common.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/google/bigtable/admin/v2/instance.proto b/google/bigtable/admin/v2/instance.proto index 26110a8f1..d2d01248e 100644 --- a/google/bigtable/admin/v2/instance.proto +++ b/google/bigtable/admin/v2/instance.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -41,6 +41,8 @@ message Instance { option (google.api.resource) = { type: "bigtableadmin.googleapis.com/Instance" pattern: "projects/{project}/instances/{instance}" + plural: "instances" + singular: "instance" }; // Possible states of an instance. @@ -85,13 +87,13 @@ message Instance { // Output only. The current state of the instance. State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Required. The type of the instance. Defaults to `PRODUCTION`. - Type type = 4 [(google.api.field_behavior) = REQUIRED]; + // The type of the instance. Defaults to `PRODUCTION`. + Type type = 4; - // Required. Labels are a flexible and lightweight mechanism for organizing - // cloud resources into groups that reflect a customer's organizational needs - // and deployment strategies. They can be used to filter resources and - // aggregate metrics. + // Labels are a flexible and lightweight mechanism for organizing cloud + // resources into groups that reflect a customer's organizational needs and + // deployment strategies. They can be used to filter resources and aggregate + // metrics. // // * Label keys must be between 1 and 63 characters long and must conform to // the regular expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`. @@ -99,16 +101,19 @@ message Instance { // the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. // * No more than 64 labels can be associated with a given resource. // * Keys and values must both be under 128 bytes. - map labels = 5 [(google.api.field_behavior) = REQUIRED]; + map labels = 5; - // Output only. A server-assigned timestamp representing when this Instance - // was created. For instances created before this field was added (August - // 2021), this value is `seconds: 0, nanos: 1`. + // Output only. A commit timestamp representing when this Instance was + // created. For instances created before this field was added (August 2021), + // this value is `seconds: 0, nanos: 1`. google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Reserved for future use. optional bool satisfies_pzs = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Reserved for future use. + optional bool satisfies_pzi = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; } // The Autoscaling targets for a Cluster. These determine the recommended nodes. @@ -144,6 +149,8 @@ message Cluster { option (google.api.resource) = { type: "bigtableadmin.googleapis.com/Cluster" pattern: "projects/{project}/instances/{instance}/clusters/{cluster}" + plural: "clusters" + singular: "cluster" }; // Possible states of a cluster. @@ -238,8 +245,9 @@ message Cluster { // Output only. The current state of the cluster. State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - // The number of nodes allocated to this cluster. More nodes enable higher - // throughput and more consistent performance. + // The number of nodes in the cluster. If no value is set, + // Cloud Bigtable automatically allocates nodes based on your data footprint + // and optimized for 50% storage utilization. int32 serve_nodes = 4; // Immutable. The node scaling factor of this cluster. @@ -267,6 +275,8 @@ message AppProfile { option (google.api.resource) = { type: "bigtableadmin.googleapis.com/AppProfile" pattern: "projects/{project}/instances/{instance}/appProfiles/{app_profile}" + plural: "appProfiles" + singular: "appProfile" }; // Read/write requests are routed to the nearest cluster in the instance, and @@ -340,17 +350,10 @@ message AppProfile { } // Data Boost is a serverless compute capability that lets you run - // high-throughput read jobs on your Bigtable data, without impacting the - // performance of the clusters that handle your application traffic. - // Currently, Data Boost exclusively supports read-only use-cases with - // single-cluster routing. - // - // Data Boost reads are only guaranteed to see the results of writes that - // were written at least 30 minutes ago. This means newly written values may - // not become visible for up to 30m, and also means that old values may - // remain visible for up to 30m after being deleted or overwritten. To - // mitigate the staleness of the data, users may either wait 30m, or use - // CheckConsistency. + // high-throughput read jobs and queries on your Bigtable data, without + // impacting the performance of the clusters that handle your application + // traffic. Data Boost supports read-only use cases with single-cluster + // routing. message DataBoostIsolationReadOnly { // Compute Billing Owner specifies how usage should be accounted when using // Data Boost. Compute Billing Owner also configures which Cloud Project is @@ -422,6 +425,8 @@ message HotTablet { option (google.api.resource) = { type: "bigtableadmin.googleapis.com/HotTablet" pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}" + plural: "hotTablets" + singular: "hotTablet" }; // The unique name of the hot tablet. Values are of the form @@ -454,3 +459,57 @@ message HotTablet { // to 100% (the node spent all cycles serving the hot tablet). float node_cpu_usage_percent = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; } + +// A SQL logical view object that can be referenced in SQL queries. +message LogicalView { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/LogicalView" + pattern: "projects/{project}/instances/{instance}/logicalViews/{logical_view}" + plural: "logicalViews" + singular: "logicalView" + }; + + // Identifier. The unique name of the logical view. + // Format: + // `projects/{project}/instances/{instance}/logicalViews/{logical_view} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Required. The logical view's select query. + string query = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The etag for this logical view. + // This may be sent on update requests to ensure that the client has an + // up-to-date value before proceeding. The server returns an ABORTED error on + // a mismatched etag. + string etag = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A materialized view object that can be referenced in SQL queries. +message MaterializedView { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/MaterializedView" + pattern: "projects/{project}/instances/{instance}/materializedViews/{materialized_view}" + plural: "materializedViews" + singular: "materializedView" + }; + + // Identifier. The unique name of the materialized view. + // Format: + // `projects/{project}/instances/{instance}/materializedViews/{materialized_view} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Required. Immutable. The materialized view's select query. + string query = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Optional. The etag for this materialized view. + // This may be sent on update requests to ensure that the client has an + // up-to-date value before proceeding. The server returns an ABORTED error on + // a mismatched etag. + string etag = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Set to true to make the MaterializedView protected against deletion. + bool deletion_protection = 6; +}