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.aiplatform.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/aiplatform/v1/annotation.proto";
24import "google/cloud/aiplatform/v1/annotation_spec.proto";
25import "google/cloud/aiplatform/v1/data_item.proto";
26import "google/cloud/aiplatform/v1/dataset.proto";
27import "google/cloud/aiplatform/v1/operation.proto";
28import "google/cloud/aiplatform/v1/saved_query.proto";
29import "google/longrunning/operations.proto";
30import "google/protobuf/empty.proto";
31import "google/protobuf/field_mask.proto";
32
33option csharp_namespace = "Google.Cloud.AIPlatform.V1";
34option go_package = "cloud.google.com/go/aiplatform/apiv1/aiplatformpb;aiplatformpb";
35option java_multiple_files = true;
36option java_outer_classname = "DatasetServiceProto";
37option java_package = "com.google.cloud.aiplatform.v1";
38option php_namespace = "Google\\Cloud\\AIPlatform\\V1";
39option ruby_package = "Google::Cloud::AIPlatform::V1";
40
41// The service that handles the CRUD of Vertex AI Dataset and its child
42// resources.
43service DatasetService {
44  option (google.api.default_host) = "aiplatform.googleapis.com";
45  option (google.api.oauth_scopes) =
46      "https://www.googleapis.com/auth/cloud-platform";
47
48  // Creates a Dataset.
49  rpc CreateDataset(CreateDatasetRequest)
50      returns (google.longrunning.Operation) {
51    option (google.api.http) = {
52      post: "/v1/{parent=projects/*/locations/*}/datasets"
53      body: "dataset"
54    };
55    option (google.api.method_signature) = "parent,dataset";
56    option (google.longrunning.operation_info) = {
57      response_type: "Dataset"
58      metadata_type: "CreateDatasetOperationMetadata"
59    };
60  }
61
62  // Gets a Dataset.
63  rpc GetDataset(GetDatasetRequest) returns (Dataset) {
64    option (google.api.http) = {
65      get: "/v1/{name=projects/*/locations/*/datasets/*}"
66    };
67    option (google.api.method_signature) = "name";
68  }
69
70  // Updates a Dataset.
71  rpc UpdateDataset(UpdateDatasetRequest) returns (Dataset) {
72    option (google.api.http) = {
73      patch: "/v1/{dataset.name=projects/*/locations/*/datasets/*}"
74      body: "dataset"
75    };
76    option (google.api.method_signature) = "dataset,update_mask";
77  }
78
79  // Lists Datasets in a Location.
80  rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) {
81    option (google.api.http) = {
82      get: "/v1/{parent=projects/*/locations/*}/datasets"
83    };
84    option (google.api.method_signature) = "parent";
85  }
86
87  // Deletes a Dataset.
88  rpc DeleteDataset(DeleteDatasetRequest)
89      returns (google.longrunning.Operation) {
90    option (google.api.http) = {
91      delete: "/v1/{name=projects/*/locations/*/datasets/*}"
92    };
93    option (google.api.method_signature) = "name";
94    option (google.longrunning.operation_info) = {
95      response_type: "google.protobuf.Empty"
96      metadata_type: "DeleteOperationMetadata"
97    };
98  }
99
100  // Imports data into a Dataset.
101  rpc ImportData(ImportDataRequest) returns (google.longrunning.Operation) {
102    option (google.api.http) = {
103      post: "/v1/{name=projects/*/locations/*/datasets/*}:import"
104      body: "*"
105    };
106    option (google.api.method_signature) = "name,import_configs";
107    option (google.longrunning.operation_info) = {
108      response_type: "ImportDataResponse"
109      metadata_type: "ImportDataOperationMetadata"
110    };
111  }
112
113  // Exports data from a Dataset.
114  rpc ExportData(ExportDataRequest) returns (google.longrunning.Operation) {
115    option (google.api.http) = {
116      post: "/v1/{name=projects/*/locations/*/datasets/*}:export"
117      body: "*"
118    };
119    option (google.api.method_signature) = "name,export_config";
120    option (google.longrunning.operation_info) = {
121      response_type: "ExportDataResponse"
122      metadata_type: "ExportDataOperationMetadata"
123    };
124  }
125
126  // Lists DataItems in a Dataset.
127  rpc ListDataItems(ListDataItemsRequest) returns (ListDataItemsResponse) {
128    option (google.api.http) = {
129      get: "/v1/{parent=projects/*/locations/*/datasets/*}/dataItems"
130    };
131    option (google.api.method_signature) = "parent";
132  }
133
134  // Searches DataItems in a Dataset.
135  rpc SearchDataItems(SearchDataItemsRequest)
136      returns (SearchDataItemsResponse) {
137    option (google.api.http) = {
138      get: "/v1/{dataset=projects/*/locations/*/datasets/*}:searchDataItems"
139    };
140  }
141
142  // Lists SavedQueries in a Dataset.
143  rpc ListSavedQueries(ListSavedQueriesRequest)
144      returns (ListSavedQueriesResponse) {
145    option (google.api.http) = {
146      get: "/v1/{parent=projects/*/locations/*/datasets/*}/savedQueries"
147    };
148    option (google.api.method_signature) = "parent";
149  }
150
151  // Gets an AnnotationSpec.
152  rpc GetAnnotationSpec(GetAnnotationSpecRequest) returns (AnnotationSpec) {
153    option (google.api.http) = {
154      get: "/v1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}"
155    };
156    option (google.api.method_signature) = "name";
157  }
158
159  // Lists Annotations belongs to a dataitem
160  rpc ListAnnotations(ListAnnotationsRequest)
161      returns (ListAnnotationsResponse) {
162    option (google.api.http) = {
163      get: "/v1/{parent=projects/*/locations/*/datasets/*/dataItems/*}/annotations"
164    };
165    option (google.api.method_signature) = "parent";
166  }
167}
168
169// Request message for
170// [DatasetService.CreateDataset][google.cloud.aiplatform.v1.DatasetService.CreateDataset].
171message CreateDatasetRequest {
172  // Required. The resource name of the Location to create the Dataset in.
173  // Format: `projects/{project}/locations/{location}`
174  string parent = 1 [
175    (google.api.field_behavior) = REQUIRED,
176    (google.api.resource_reference) = {
177      type: "locations.googleapis.com/Location"
178    }
179  ];
180
181  // Required. The Dataset to create.
182  Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED];
183}
184
185// Runtime operation information for
186// [DatasetService.CreateDataset][google.cloud.aiplatform.v1.DatasetService.CreateDataset].
187message CreateDatasetOperationMetadata {
188  // The operation generic information.
189  GenericOperationMetadata generic_metadata = 1;
190}
191
192// Request message for
193// [DatasetService.GetDataset][google.cloud.aiplatform.v1.DatasetService.GetDataset].
194message GetDatasetRequest {
195  // Required. The name of the Dataset resource.
196  string name = 1 [
197    (google.api.field_behavior) = REQUIRED,
198    (google.api.resource_reference) = {
199      type: "aiplatform.googleapis.com/Dataset"
200    }
201  ];
202
203  // Mask specifying which fields to read.
204  google.protobuf.FieldMask read_mask = 2;
205}
206
207// Request message for
208// [DatasetService.UpdateDataset][google.cloud.aiplatform.v1.DatasetService.UpdateDataset].
209message UpdateDatasetRequest {
210  // Required. The Dataset which replaces the resource on the server.
211  Dataset dataset = 1 [(google.api.field_behavior) = REQUIRED];
212
213  // Required. The update mask applies to the resource.
214  // For the `FieldMask` definition, see
215  // [google.protobuf.FieldMask][google.protobuf.FieldMask]. Updatable fields:
216  //
217  //   * `display_name`
218  //   * `description`
219  //   * `labels`
220  google.protobuf.FieldMask update_mask = 2
221      [(google.api.field_behavior) = REQUIRED];
222}
223
224// Request message for
225// [DatasetService.ListDatasets][google.cloud.aiplatform.v1.DatasetService.ListDatasets].
226message ListDatasetsRequest {
227  // Required. The name of the Dataset's parent resource.
228  // Format: `projects/{project}/locations/{location}`
229  string parent = 1 [
230    (google.api.field_behavior) = REQUIRED,
231    (google.api.resource_reference) = {
232      type: "locations.googleapis.com/Location"
233    }
234  ];
235
236  // An expression for filtering the results of the request. For field names
237  // both snake_case and camelCase are supported.
238  //
239  //   * `display_name`: supports = and !=
240  //   * `metadata_schema_uri`: supports = and !=
241  //   * `labels` supports general map functions that is:
242  //     * `labels.key=value` - key:value equality
243  //     * `labels.key:* or labels:key - key existence
244  //     * A key including a space must be quoted. `labels."a key"`.
245  //
246  // Some examples:
247  //
248  //   * `displayName="myDisplayName"`
249  //   * `labels.myKey="myValue"`
250  string filter = 2;
251
252  // The standard list page size.
253  int32 page_size = 3;
254
255  // The standard list page token.
256  string page_token = 4;
257
258  // Mask specifying which fields to read.
259  google.protobuf.FieldMask read_mask = 5;
260
261  // A comma-separated list of fields to order by, sorted in ascending order.
262  // Use "desc" after a field name for descending.
263  // Supported fields:
264  //
265  //   * `display_name`
266  //   * `create_time`
267  //   * `update_time`
268  string order_by = 6;
269}
270
271// Response message for
272// [DatasetService.ListDatasets][google.cloud.aiplatform.v1.DatasetService.ListDatasets].
273message ListDatasetsResponse {
274  // A list of Datasets that matches the specified filter in the request.
275  repeated Dataset datasets = 1;
276
277  // The standard List next-page token.
278  string next_page_token = 2;
279}
280
281// Request message for
282// [DatasetService.DeleteDataset][google.cloud.aiplatform.v1.DatasetService.DeleteDataset].
283message DeleteDatasetRequest {
284  // Required. The resource name of the Dataset to delete.
285  // Format:
286  // `projects/{project}/locations/{location}/datasets/{dataset}`
287  string name = 1 [
288    (google.api.field_behavior) = REQUIRED,
289    (google.api.resource_reference) = {
290      type: "aiplatform.googleapis.com/Dataset"
291    }
292  ];
293}
294
295// Request message for
296// [DatasetService.ImportData][google.cloud.aiplatform.v1.DatasetService.ImportData].
297message ImportDataRequest {
298  // Required. The name of the Dataset resource.
299  // Format:
300  // `projects/{project}/locations/{location}/datasets/{dataset}`
301  string name = 1 [
302    (google.api.field_behavior) = REQUIRED,
303    (google.api.resource_reference) = {
304      type: "aiplatform.googleapis.com/Dataset"
305    }
306  ];
307
308  // Required. The desired input locations. The contents of all input locations
309  // will be imported in one batch.
310  repeated ImportDataConfig import_configs = 2
311      [(google.api.field_behavior) = REQUIRED];
312}
313
314// Response message for
315// [DatasetService.ImportData][google.cloud.aiplatform.v1.DatasetService.ImportData].
316message ImportDataResponse {}
317
318// Runtime operation information for
319// [DatasetService.ImportData][google.cloud.aiplatform.v1.DatasetService.ImportData].
320message ImportDataOperationMetadata {
321  // The common part of the operation metadata.
322  GenericOperationMetadata generic_metadata = 1;
323}
324
325// Request message for
326// [DatasetService.ExportData][google.cloud.aiplatform.v1.DatasetService.ExportData].
327message ExportDataRequest {
328  // Required. The name of the Dataset resource.
329  // Format:
330  // `projects/{project}/locations/{location}/datasets/{dataset}`
331  string name = 1 [
332    (google.api.field_behavior) = REQUIRED,
333    (google.api.resource_reference) = {
334      type: "aiplatform.googleapis.com/Dataset"
335    }
336  ];
337
338  // Required. The desired output location.
339  ExportDataConfig export_config = 2 [(google.api.field_behavior) = REQUIRED];
340}
341
342// Response message for
343// [DatasetService.ExportData][google.cloud.aiplatform.v1.DatasetService.ExportData].
344message ExportDataResponse {
345  // All of the files that are exported in this export operation.
346  repeated string exported_files = 1;
347}
348
349// Runtime operation information for
350// [DatasetService.ExportData][google.cloud.aiplatform.v1.DatasetService.ExportData].
351message ExportDataOperationMetadata {
352  // The common part of the operation metadata.
353  GenericOperationMetadata generic_metadata = 1;
354
355  // A Google Cloud Storage directory which path ends with '/'. The exported
356  // data is stored in the directory.
357  string gcs_output_directory = 2;
358}
359
360// Request message for
361// [DatasetService.ListDataItems][google.cloud.aiplatform.v1.DatasetService.ListDataItems].
362message ListDataItemsRequest {
363  // Required. The resource name of the Dataset to list DataItems from.
364  // Format:
365  // `projects/{project}/locations/{location}/datasets/{dataset}`
366  string parent = 1 [
367    (google.api.field_behavior) = REQUIRED,
368    (google.api.resource_reference) = {
369      type: "aiplatform.googleapis.com/Dataset"
370    }
371  ];
372
373  // The standard list filter.
374  string filter = 2;
375
376  // The standard list page size.
377  int32 page_size = 3;
378
379  // The standard list page token.
380  string page_token = 4;
381
382  // Mask specifying which fields to read.
383  google.protobuf.FieldMask read_mask = 5;
384
385  // A comma-separated list of fields to order by, sorted in ascending order.
386  // Use "desc" after a field name for descending.
387  string order_by = 6;
388}
389
390// Response message for
391// [DatasetService.ListDataItems][google.cloud.aiplatform.v1.DatasetService.ListDataItems].
392message ListDataItemsResponse {
393  // A list of DataItems that matches the specified filter in the request.
394  repeated DataItem data_items = 1;
395
396  // The standard List next-page token.
397  string next_page_token = 2;
398}
399
400// Request message for
401// [DatasetService.SearchDataItems][google.cloud.aiplatform.v1.DatasetService.SearchDataItems].
402message SearchDataItemsRequest {
403  // Expression that allows ranking results based on annotation's property.
404  message OrderByAnnotation {
405    // Required. Saved query of the Annotation. Only Annotations belong to this
406    // saved query will be considered for ordering.
407    string saved_query = 1 [(google.api.field_behavior) = REQUIRED];
408
409    // A comma-separated list of annotation fields to order by, sorted in
410    // ascending order. Use "desc" after a field name for descending. Must also
411    // specify saved_query.
412    string order_by = 2;
413  }
414
415  oneof order {
416    // A comma-separated list of data item fields to order by, sorted in
417    // ascending order. Use "desc" after a field name for descending.
418    string order_by_data_item = 12;
419
420    // Expression that allows ranking results based on annotation's property.
421    OrderByAnnotation order_by_annotation = 13;
422  }
423
424  // Required. The resource name of the Dataset from which to search DataItems.
425  // Format:
426  // `projects/{project}/locations/{location}/datasets/{dataset}`
427  string dataset = 1 [
428    (google.api.field_behavior) = REQUIRED,
429    (google.api.resource_reference) = {
430      type: "aiplatform.googleapis.com/Dataset"
431    }
432  ];
433
434  // The resource name of a SavedQuery(annotation set in UI).
435  // Format:
436  // `projects/{project}/locations/{location}/datasets/{dataset}/savedQueries/{saved_query}`
437  // All of the search will be done in the context of this SavedQuery.
438  string saved_query = 2 [
439    deprecated = true,
440    (google.api.resource_reference) = {
441      type: "aiplatform.googleapis.com/SavedQuery"
442    }
443  ];
444
445  // The resource name of a DataLabelingJob.
446  // Format:
447  // `projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}`
448  // If this field is set, all of the search will be done in the context of
449  // this DataLabelingJob.
450  string data_labeling_job = 3;
451
452  // An expression for filtering the DataItem that will be returned.
453  //
454  //   * `data_item_id` - for = or !=.
455  //   * `labeled` - for = or !=.
456  //   * `has_annotation(ANNOTATION_SPEC_ID)` - true only for DataItem that
457  //     have at least one annotation with annotation_spec_id =
458  //     `ANNOTATION_SPEC_ID` in the context of SavedQuery or DataLabelingJob.
459  //
460  // For example:
461  //
462  // * `data_item=1`
463  // * `has_annotation(5)`
464  string data_item_filter = 4;
465
466  // An expression for filtering the Annotations that will be returned per
467  // DataItem.
468  //   * `annotation_spec_id` - for = or !=.
469  string annotations_filter = 5 [deprecated = true];
470
471  // An expression that specifies what Annotations will be returned per
472  // DataItem. Annotations satisfied either of the conditions will be returned.
473  //   * `annotation_spec_id` - for = or !=.
474  // Must specify `saved_query_id=` - saved query id that annotations should
475  // belong to.
476  repeated string annotation_filters = 11;
477
478  // Mask specifying which fields of
479  // [DataItemView][google.cloud.aiplatform.v1.DataItemView] to read.
480  google.protobuf.FieldMask field_mask = 6;
481
482  // If set, only up to this many of Annotations will be returned per
483  // DataItemView. The maximum value is 1000. If not set, the maximum value will
484  // be used.
485  int32 annotations_limit = 7;
486
487  // Requested page size. Server may return fewer results than requested.
488  // Default and maximum page size is 100.
489  int32 page_size = 8;
490
491  // A comma-separated list of fields to order by, sorted in ascending order.
492  // Use "desc" after a field name for descending.
493  string order_by = 9 [deprecated = true];
494
495  // A token identifying a page of results for the server to return
496  // Typically obtained via
497  // [SearchDataItemsResponse.next_page_token][google.cloud.aiplatform.v1.SearchDataItemsResponse.next_page_token]
498  // of the previous
499  // [DatasetService.SearchDataItems][google.cloud.aiplatform.v1.DatasetService.SearchDataItems]
500  // call.
501  string page_token = 10;
502}
503
504// Response message for
505// [DatasetService.SearchDataItems][google.cloud.aiplatform.v1.DatasetService.SearchDataItems].
506message SearchDataItemsResponse {
507  // The DataItemViews read.
508  repeated DataItemView data_item_views = 1;
509
510  // A token to retrieve next page of results.
511  // Pass to
512  // [SearchDataItemsRequest.page_token][google.cloud.aiplatform.v1.SearchDataItemsRequest.page_token]
513  // to obtain that page.
514  string next_page_token = 2;
515}
516
517// A container for a single DataItem and Annotations on it.
518message DataItemView {
519  // The DataItem.
520  DataItem data_item = 1;
521
522  // The Annotations on the DataItem. If too many Annotations should be returned
523  // for the DataItem, this field will be truncated per annotations_limit in
524  // request. If it was, then the has_truncated_annotations will be set to true.
525  repeated Annotation annotations = 2;
526
527  // True if and only if the Annotations field has been truncated. It happens if
528  // more Annotations for this DataItem met the request's annotation_filter than
529  // are allowed to be returned by annotations_limit.
530  // Note that if Annotations field is not being returned due to field mask,
531  // then this field will not be set to true no matter how many Annotations are
532  // there.
533  bool has_truncated_annotations = 3;
534}
535
536// Request message for
537// [DatasetService.ListSavedQueries][google.cloud.aiplatform.v1.DatasetService.ListSavedQueries].
538message ListSavedQueriesRequest {
539  // Required. The resource name of the Dataset to list SavedQueries from.
540  // Format:
541  // `projects/{project}/locations/{location}/datasets/{dataset}`
542  string parent = 1 [
543    (google.api.field_behavior) = REQUIRED,
544    (google.api.resource_reference) = {
545      type: "aiplatform.googleapis.com/Dataset"
546    }
547  ];
548
549  // The standard list filter.
550  string filter = 2;
551
552  // The standard list page size.
553  int32 page_size = 3;
554
555  // The standard list page token.
556  string page_token = 4;
557
558  // Mask specifying which fields to read.
559  google.protobuf.FieldMask read_mask = 5;
560
561  // A comma-separated list of fields to order by, sorted in ascending order.
562  // Use "desc" after a field name for descending.
563  string order_by = 6;
564}
565
566// Response message for
567// [DatasetService.ListSavedQueries][google.cloud.aiplatform.v1.DatasetService.ListSavedQueries].
568message ListSavedQueriesResponse {
569  // A list of SavedQueries that match the specified filter in the request.
570  repeated SavedQuery saved_queries = 1;
571
572  // The standard List next-page token.
573  string next_page_token = 2;
574}
575
576// Request message for
577// [DatasetService.GetAnnotationSpec][google.cloud.aiplatform.v1.DatasetService.GetAnnotationSpec].
578message GetAnnotationSpecRequest {
579  // Required. The name of the AnnotationSpec resource.
580  // Format:
581  // `projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}`
582  string name = 1 [
583    (google.api.field_behavior) = REQUIRED,
584    (google.api.resource_reference) = {
585      type: "aiplatform.googleapis.com/AnnotationSpec"
586    }
587  ];
588
589  // Mask specifying which fields to read.
590  google.protobuf.FieldMask read_mask = 2;
591}
592
593// Request message for
594// [DatasetService.ListAnnotations][google.cloud.aiplatform.v1.DatasetService.ListAnnotations].
595message ListAnnotationsRequest {
596  // Required. The resource name of the DataItem to list Annotations from.
597  // Format:
598  // `projects/{project}/locations/{location}/datasets/{dataset}/dataItems/{data_item}`
599  string parent = 1 [
600    (google.api.field_behavior) = REQUIRED,
601    (google.api.resource_reference) = {
602      type: "aiplatform.googleapis.com/DataItem"
603    }
604  ];
605
606  // The standard list filter.
607  string filter = 2;
608
609  // The standard list page size.
610  int32 page_size = 3;
611
612  // The standard list page token.
613  string page_token = 4;
614
615  // Mask specifying which fields to read.
616  google.protobuf.FieldMask read_mask = 5;
617
618  // A comma-separated list of fields to order by, sorted in ascending order.
619  // Use "desc" after a field name for descending.
620  string order_by = 6;
621}
622
623// Response message for
624// [DatasetService.ListAnnotations][google.cloud.aiplatform.v1.DatasetService.ListAnnotations].
625message ListAnnotationsResponse {
626  // A list of Annotations that matches the specified filter in the request.
627  repeated Annotation annotations = 1;
628
629  // The standard List next-page token.
630  string next_page_token = 2;
631}
632