1// Copyright 2023 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 15syntax = "proto3"; 16 17package google.cloud.metastore.v1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/metastore/v1/metastore.proto"; 24import "google/longrunning/operations.proto"; 25import "google/protobuf/empty.proto"; 26import "google/protobuf/field_mask.proto"; 27import "google/protobuf/timestamp.proto"; 28 29option go_package = "cloud.google.com/go/metastore/apiv1/metastorepb;metastorepb"; 30option java_multiple_files = true; 31option java_outer_classname = "MetastoreFederationProto"; 32option java_package = "com.google.cloud.metastore.v1"; 33 34// Configures and manages metastore federation services. 35// Dataproc Metastore Federation Service allows federating a collection of 36// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc 37// Metastores. The Federation Service exposes a gRPC URL through which metadata 38// from the backend metastores are served at query time. 39// 40// The Dataproc Metastore Federation API defines the following resource model: 41// * The service works with a collection of Google Cloud projects. 42// * Each project has a collection of available locations. 43// * Each location has a collection of federations. 44// * Dataproc Metastore Federations are resources with names of the 45// form: 46// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. 47service DataprocMetastoreFederation { 48 option (google.api.default_host) = "metastore.googleapis.com"; 49 option (google.api.oauth_scopes) = 50 "https://www.googleapis.com/auth/cloud-platform"; 51 52 // Lists federations in a project and location. 53 rpc ListFederations(ListFederationsRequest) 54 returns (ListFederationsResponse) { 55 option (google.api.http) = { 56 get: "/v1/{parent=projects/*/locations/*}/federations" 57 }; 58 option (google.api.method_signature) = "parent"; 59 } 60 61 // Gets the details of a single federation. 62 rpc GetFederation(GetFederationRequest) returns (Federation) { 63 option (google.api.http) = { 64 get: "/v1/{name=projects/*/locations/*/federations/*}" 65 }; 66 option (google.api.method_signature) = "name"; 67 } 68 69 // Creates a metastore federation in a project and location. 70 rpc CreateFederation(CreateFederationRequest) 71 returns (google.longrunning.Operation) { 72 option (google.api.http) = { 73 post: "/v1/{parent=projects/*/locations/*}/federations" 74 body: "federation" 75 }; 76 option (google.api.method_signature) = "parent,federation,federation_id"; 77 option (google.longrunning.operation_info) = { 78 response_type: "Federation" 79 metadata_type: "google.cloud.metastore.v1.OperationMetadata" 80 }; 81 } 82 83 // Updates the fields of a federation. 84 rpc UpdateFederation(UpdateFederationRequest) 85 returns (google.longrunning.Operation) { 86 option (google.api.http) = { 87 patch: "/v1/{federation.name=projects/*/locations/*/federations/*}" 88 body: "federation" 89 }; 90 option (google.api.method_signature) = "federation,update_mask"; 91 option (google.longrunning.operation_info) = { 92 response_type: "Federation" 93 metadata_type: "google.cloud.metastore.v1.OperationMetadata" 94 }; 95 } 96 97 // Deletes a single federation. 98 rpc DeleteFederation(DeleteFederationRequest) 99 returns (google.longrunning.Operation) { 100 option (google.api.http) = { 101 delete: "/v1/{name=projects/*/locations/*/federations/*}" 102 }; 103 option (google.api.method_signature) = "name"; 104 option (google.longrunning.operation_info) = { 105 response_type: "google.protobuf.Empty" 106 metadata_type: "google.cloud.metastore.v1.OperationMetadata" 107 }; 108 } 109} 110 111// Represents a federation of multiple backend metastores. 112message Federation { 113 option (google.api.resource) = { 114 type: "metastore.googleapis.com/Federation" 115 pattern: "projects/{project}/locations/{location}/federations/{federation}" 116 }; 117 118 // The current state of the federation. 119 enum State { 120 // The state of the metastore federation is unknown. 121 STATE_UNSPECIFIED = 0; 122 123 // The metastore federation is in the process of being created. 124 CREATING = 1; 125 126 // The metastore federation is running and ready to serve queries. 127 ACTIVE = 2; 128 129 // The metastore federation is being updated. It remains usable but cannot 130 // accept additional update requests or be deleted at this time. 131 UPDATING = 3; 132 133 // The metastore federation is undergoing deletion. It cannot be used. 134 DELETING = 4; 135 136 // The metastore federation has encountered an error and cannot be used. The 137 // metastore federation should be deleted. 138 ERROR = 5; 139 } 140 141 // Immutable. The relative resource name of the federation, of the 142 // form: 143 // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. 144 string name = 1 [(google.api.field_behavior) = IMMUTABLE]; 145 146 // Output only. The time when the metastore federation was created. 147 google.protobuf.Timestamp create_time = 2 148 [(google.api.field_behavior) = OUTPUT_ONLY]; 149 150 // Output only. The time when the metastore federation was last updated. 151 google.protobuf.Timestamp update_time = 3 152 [(google.api.field_behavior) = OUTPUT_ONLY]; 153 154 // User-defined labels for the metastore federation. 155 map<string, string> labels = 4; 156 157 // Immutable. The Apache Hive metastore version of the federation. All backend 158 // metastore versions must be compatible with the federation version. 159 string version = 5 [(google.api.field_behavior) = IMMUTABLE]; 160 161 // A map from `BackendMetastore` rank to `BackendMetastore`s from which the 162 // federation service serves metadata at query time. The map key represents 163 // the order in which `BackendMetastore`s should be evaluated to resolve 164 // database names at query time and should be greater than or equal to zero. A 165 // `BackendMetastore` with a lower number will be evaluated before a 166 // `BackendMetastore` with a higher number. 167 map<int32, BackendMetastore> backend_metastores = 6; 168 169 // Output only. The federation endpoint. 170 string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; 171 172 // Output only. The current state of the federation. 173 State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; 174 175 // Output only. Additional information about the current state of the 176 // metastore federation, if available. 177 string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; 178 179 // Output only. The globally unique resource identifier of the metastore 180 // federation. 181 string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; 182} 183 184// Represents a backend metastore for the federation. 185message BackendMetastore { 186 // The type of the backend metastore. 187 enum MetastoreType { 188 // The metastore type is not set. 189 METASTORE_TYPE_UNSPECIFIED = 0; 190 191 // The backend metastore is BigQuery. 192 BIGQUERY = 2; 193 194 // The backend metastore is Dataproc Metastore. 195 DATAPROC_METASTORE = 3; 196 } 197 198 // The relative resource name of the metastore that is being federated. 199 // The formats of the relative resource names for the currently supported 200 // metastores are listed below: 201 // 202 // * BigQuery 203 // * `projects/{project_id}` 204 // * Dataproc Metastore 205 // * `projects/{project_id}/locations/{location}/services/{service_id}` 206 string name = 1; 207 208 // The type of the backend metastore. 209 MetastoreType metastore_type = 2; 210} 211 212// Request message for ListFederations. 213message ListFederationsRequest { 214 // Required. The relative resource name of the location of metastore 215 // federations to list, in the following form: 216 // `projects/{project_number}/locations/{location_id}`. 217 string parent = 1 [ 218 (google.api.field_behavior) = REQUIRED, 219 (google.api.resource_reference) = { 220 child_type: "metastore.googleapis.com/Federation" 221 } 222 ]; 223 224 // Optional. The maximum number of federations to return. The response may 225 // contain less than the maximum number. If unspecified, no more than 500 226 // services are returned. The maximum value is 1000; values above 1000 are 227 // changed to 1000. 228 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 229 230 // Optional. A page token, received from a previous ListFederationServices 231 // call. Provide this token to retrieve the subsequent page. 232 // 233 // To retrieve the first page, supply an empty page token. 234 // 235 // When paginating, other parameters provided to 236 // ListFederationServices must match the call that provided the 237 // page token. 238 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 239 240 // Optional. The filter to apply to list results. 241 string filter = 4 [(google.api.field_behavior) = OPTIONAL]; 242 243 // Optional. Specify the ordering of results as described in [Sorting 244 // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). 245 // If not specified, the results will be sorted in the default order. 246 string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; 247} 248 249// Response message for ListFederations 250message ListFederationsResponse { 251 // The services in the specified location. 252 repeated Federation federations = 1; 253 254 // A token that can be sent as `page_token` to retrieve the next page. If this 255 // field is omitted, there are no subsequent pages. 256 string next_page_token = 2; 257 258 // Locations that could not be reached. 259 repeated string unreachable = 3; 260} 261 262// Request message for GetFederation. 263message GetFederationRequest { 264 // Required. The relative resource name of the metastore federation to 265 // retrieve, in the following form: 266 // 267 // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. 268 string name = 1 [ 269 (google.api.field_behavior) = REQUIRED, 270 (google.api.resource_reference) = { 271 type: "metastore.googleapis.com/Federation" 272 } 273 ]; 274} 275 276// Request message for CreateFederation. 277message CreateFederationRequest { 278 // Required. The relative resource name of the location in which to create a 279 // federation service, in the following form: 280 // 281 // `projects/{project_number}/locations/{location_id}`. 282 string parent = 1 [ 283 (google.api.field_behavior) = REQUIRED, 284 (google.api.resource_reference) = { 285 child_type: "metastore.googleapis.com/Federation" 286 } 287 ]; 288 289 // Required. The ID of the metastore federation, which is used as the final 290 // component of the metastore federation's name. 291 // 292 // This value must be between 2 and 63 characters long inclusive, begin with a 293 // letter, end with a letter or number, and consist of alpha-numeric 294 // ASCII characters or hyphens. 295 string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; 296 297 // Required. The Metastore Federation to create. The `name` field is 298 // ignored. The ID of the created metastore federation must be 299 // provided in the request's `federation_id` field. 300 Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; 301 302 // Optional. A request ID. Specify a unique request ID to allow the server to 303 // ignore the request if it has completed. The server will ignore subsequent 304 // requests that provide a duplicate request ID for at least 60 minutes after 305 // the first request. 306 // 307 // For example, if an initial request times out, followed by another request 308 // with the same request ID, the server ignores the second request to prevent 309 // the creation of duplicate commitments. 310 // 311 // The request ID must be a valid 312 // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) 313 // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. 314 string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; 315} 316 317// Request message for UpdateFederation. 318message UpdateFederationRequest { 319 // Required. A field mask used to specify the fields to be overwritten in the 320 // metastore federation resource by the update. 321 // Fields specified in the `update_mask` are relative to the resource (not 322 // to the full request). A field is overwritten if it is in the mask. 323 google.protobuf.FieldMask update_mask = 1 324 [(google.api.field_behavior) = REQUIRED]; 325 326 // Required. The metastore federation to update. The server only merges fields 327 // in the service if they are specified in `update_mask`. 328 // 329 // The metastore federation's `name` field is used to identify the 330 // metastore service to be updated. 331 Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; 332 333 // Optional. A request ID. Specify a unique request ID to allow the server to 334 // ignore the request if it has completed. The server will ignore subsequent 335 // requests that provide a duplicate request ID for at least 60 minutes after 336 // the first request. 337 // 338 // For example, if an initial request times out, followed by another request 339 // with the same request ID, the server ignores the second request to prevent 340 // the creation of duplicate commitments. 341 // 342 // The request ID must be a valid 343 // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) 344 // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. 345 string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; 346} 347 348// Request message for DeleteFederation. 349message DeleteFederationRequest { 350 // Required. The relative resource name of the metastore federation to delete, 351 // in the following form: 352 // 353 // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. 354 string name = 1 [ 355 (google.api.field_behavior) = REQUIRED, 356 (google.api.resource_reference) = { 357 type: "metastore.googleapis.com/Federation" 358 } 359 ]; 360 361 // Optional. A request ID. Specify a unique request ID to allow the server to 362 // ignore the request if it has completed. The server will ignore subsequent 363 // requests that provide a duplicate request ID for at least 60 minutes after 364 // the first request. 365 // 366 // For example, if an initial request times out, followed by another request 367 // with the same request ID, the server ignores the second request to prevent 368 // the creation of duplicate commitments. 369 // 370 // The request ID must be a valid 371 // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) 372 // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. 373 string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; 374} 375