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.v1alpha; 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/v1alpha/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/apiv1alpha/metastorepb;metastorepb"; 30option java_multiple_files = true; 31option java_outer_classname = "MetastoreFederationProto"; 32option java_package = "com.google.cloud.metastore.v1alpha"; 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: "/v1alpha/{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: "/v1alpha/{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: "/v1alpha/{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.v1alpha.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: "/v1alpha/{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.v1alpha.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: "/v1alpha/{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.v1alpha.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 Dataplex. 192 DATAPLEX = 1; 193 194 // The backend metastore is BigQuery. 195 BIGQUERY = 2; 196 197 // The backend metastore is Dataproc Metastore. 198 DATAPROC_METASTORE = 3; 199 } 200 201 // The relative resource name of the metastore that is being federated. 202 // The formats of the relative resource names for the currently supported 203 // metastores are listed below: 204 // 205 // * BigQuery 206 // * `projects/{project_id}` 207 // * Dataproc Metastore 208 // * `projects/{project_id}/locations/{location}/services/{service_id}` 209 string name = 1; 210 211 // The type of the backend metastore. 212 MetastoreType metastore_type = 2; 213} 214 215// Request message for ListFederations. 216message ListFederationsRequest { 217 // Required. The relative resource name of the location of metastore 218 // federations to list, in the following form: 219 // `projects/{project_number}/locations/{location_id}`. 220 string parent = 1 [ 221 (google.api.field_behavior) = REQUIRED, 222 (google.api.resource_reference) = { 223 child_type: "metastore.googleapis.com/Federation" 224 } 225 ]; 226 227 // Optional. The maximum number of federations to return. The response may 228 // contain less than the maximum number. If unspecified, no more than 500 229 // services are returned. The maximum value is 1000; values above 1000 are 230 // changed to 1000. 231 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 232 233 // Optional. A page token, received from a previous ListFederationServices 234 // call. Provide this token to retrieve the subsequent page. 235 // 236 // To retrieve the first page, supply an empty page token. 237 // 238 // When paginating, other parameters provided to 239 // ListFederationServices must match the call that provided the 240 // page token. 241 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 242 243 // Optional. The filter to apply to list results. 244 string filter = 4 [(google.api.field_behavior) = OPTIONAL]; 245 246 // Optional. Specify the ordering of results as described in [Sorting 247 // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). 248 // If not specified, the results will be sorted in the default order. 249 string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; 250} 251 252// Response message for ListFederations 253message ListFederationsResponse { 254 // The services in the specified location. 255 repeated Federation federations = 1; 256 257 // A token that can be sent as `page_token` to retrieve the next page. If this 258 // field is omitted, there are no subsequent pages. 259 string next_page_token = 2; 260 261 // Locations that could not be reached. 262 repeated string unreachable = 3; 263} 264 265// Request message for GetFederation. 266message GetFederationRequest { 267 // Required. The relative resource name of the metastore federation to 268 // retrieve, in the following form: 269 // 270 // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. 271 string name = 1 [ 272 (google.api.field_behavior) = REQUIRED, 273 (google.api.resource_reference) = { 274 type: "metastore.googleapis.com/Federation" 275 } 276 ]; 277} 278 279// Request message for CreateFederation. 280message CreateFederationRequest { 281 // Required. The relative resource name of the location in which to create a 282 // federation service, in the following form: 283 // 284 // `projects/{project_number}/locations/{location_id}`. 285 string parent = 1 [ 286 (google.api.field_behavior) = REQUIRED, 287 (google.api.resource_reference) = { 288 child_type: "metastore.googleapis.com/Federation" 289 } 290 ]; 291 292 // Required. The ID of the metastore federation, which is used as the final 293 // component of the metastore federation's name. 294 // 295 // This value must be between 2 and 63 characters long inclusive, begin with a 296 // letter, end with a letter or number, and consist of alpha-numeric 297 // ASCII characters or hyphens. 298 string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; 299 300 // Required. The Metastore Federation to create. The `name` field is 301 // ignored. The ID of the created metastore federation must be 302 // provided in the request's `federation_id` field. 303 Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; 304 305 // Optional. A request ID. Specify a unique request ID to allow the server to 306 // ignore the request if it has completed. The server will ignore subsequent 307 // requests that provide a duplicate request ID for at least 60 minutes after 308 // the first request. 309 // 310 // For example, if an initial request times out, followed by another request 311 // with the same request ID, the server ignores the second request to prevent 312 // the creation of duplicate commitments. 313 // 314 // The request ID must be a valid 315 // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) 316 // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. 317 string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; 318} 319 320// Request message for UpdateFederation. 321message UpdateFederationRequest { 322 // Required. A field mask used to specify the fields to be overwritten in the 323 // metastore federation resource by the update. 324 // Fields specified in the `update_mask` are relative to the resource (not 325 // to the full request). A field is overwritten if it is in the mask. 326 google.protobuf.FieldMask update_mask = 1 327 [(google.api.field_behavior) = REQUIRED]; 328 329 // Required. The metastore federation to update. The server only merges fields 330 // in the service if they are specified in `update_mask`. 331 // 332 // The metastore federation's `name` field is used to identify the 333 // metastore service to be updated. 334 Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; 335 336 // Optional. A request ID. Specify a unique request ID to allow the server to 337 // ignore the request if it has completed. The server will ignore subsequent 338 // requests that provide a duplicate request ID for at least 60 minutes after 339 // the first request. 340 // 341 // For example, if an initial request times out, followed by another request 342 // with the same request ID, the server ignores the second request to prevent 343 // the creation of duplicate commitments. 344 // 345 // The request ID must be a valid 346 // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) 347 // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. 348 string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; 349} 350 351// Request message for DeleteFederation. 352message DeleteFederationRequest { 353 // Required. The relative resource name of the metastore federation to delete, 354 // in the following form: 355 // 356 // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. 357 string name = 1 [ 358 (google.api.field_behavior) = REQUIRED, 359 (google.api.resource_reference) = { 360 type: "metastore.googleapis.com/Federation" 361 } 362 ]; 363 364 // Optional. A request ID. Specify a unique request ID to allow the server to 365 // ignore the request if it has completed. The server will ignore subsequent 366 // requests that provide a duplicate request ID for at least 60 minutes after 367 // the first request. 368 // 369 // For example, if an initial request times out, followed by another request 370 // with the same request ID, the server ignores the second request to prevent 371 // the creation of duplicate commitments. 372 // 373 // The request ID must be a valid 374 // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) 375 // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. 376 string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; 377} 378