// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.aiplatform.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/aiplatform/v1/annotation.proto";
import "google/cloud/aiplatform/v1/annotation_spec.proto";
import "google/cloud/aiplatform/v1/data_item.proto";
import "google/cloud/aiplatform/v1/dataset.proto";
import "google/cloud/aiplatform/v1/operation.proto";
import "google/cloud/aiplatform/v1/training_pipeline.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/field_mask.proto";

option csharp_namespace = "Google.Cloud.AIPlatform.V1";
option go_package = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1;aiplatform";
option java_multiple_files = true;
option java_outer_classname = "DatasetServiceProto";
option java_package = "com.google.cloud.aiplatform.v1";
option php_namespace = "Google\\Cloud\\AIPlatform\\V1";
option ruby_package = "Google::Cloud::AIPlatform::V1";

service DatasetService {
  option (google.api.default_host) = "aiplatform.googleapis.com";
  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";

  // Creates a Dataset.
  rpc CreateDataset(CreateDatasetRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/datasets"
      body: "dataset"
    };
    option (google.api.method_signature) = "parent,dataset";
    option (google.longrunning.operation_info) = {
      response_type: "Dataset"
      metadata_type: "CreateDatasetOperationMetadata"
    };
  }

  // Gets a Dataset.
  rpc GetDataset(GetDatasetRequest) returns (Dataset) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/datasets/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Updates a Dataset.
  rpc UpdateDataset(UpdateDatasetRequest) returns (Dataset) {
    option (google.api.http) = {
      patch: "/v1/{dataset.name=projects/*/locations/*/datasets/*}"
      body: "dataset"
    };
    option (google.api.method_signature) = "dataset,update_mask";
  }

  // Lists Datasets in a Location.
  rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/datasets"
    };
    option (google.api.method_signature) = "parent";
  }

  // Deletes a Dataset.
  rpc DeleteDataset(DeleteDatasetRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/datasets/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "DeleteOperationMetadata"
    };
  }

  // Imports data into a Dataset.
  rpc ImportData(ImportDataRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/datasets/*}:import"
      body: "*"
    };
    option (google.api.method_signature) = "name,import_configs";
    option (google.longrunning.operation_info) = {
      response_type: "ImportDataResponse"
      metadata_type: "ImportDataOperationMetadata"
    };
  }

  // Exports data from a Dataset.
  rpc ExportData(ExportDataRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/datasets/*}:export"
      body: "*"
    };
    option (google.api.method_signature) = "name,export_config";
    option (google.longrunning.operation_info) = {
      response_type: "ExportDataResponse"
      metadata_type: "ExportDataOperationMetadata"
    };
  }

  // Lists DataItems in a Dataset.
  rpc ListDataItems(ListDataItemsRequest) returns (ListDataItemsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/datasets/*}/dataItems"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets an AnnotationSpec.
  rpc GetAnnotationSpec(GetAnnotationSpecRequest) returns (AnnotationSpec) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists Annotations belongs to a dataitem
  rpc ListAnnotations(ListAnnotationsRequest) returns (ListAnnotationsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/datasets/*/dataItems/*}/annotations"
    };
    option (google.api.method_signature) = "parent";
  }
}

// Request message for [DatasetService.CreateDataset][google.cloud.aiplatform.v1.DatasetService.CreateDataset].
message CreateDatasetRequest {
  // Required. The resource name of the Location to create the Dataset in.
  // Format: `projects/{project}/locations/{location}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Required. The Dataset to create.
  Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED];
}

// Runtime operation information for [DatasetService.CreateDataset][google.cloud.aiplatform.v1.DatasetService.CreateDataset].
message CreateDatasetOperationMetadata {
  // The operation generic information.
  GenericOperationMetadata generic_metadata = 1;
}

// Request message for [DatasetService.GetDataset][google.cloud.aiplatform.v1.DatasetService.GetDataset].
message GetDatasetRequest {
  // Required. The name of the Dataset resource.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/Dataset"
    }
  ];

  // Mask specifying which fields to read.
  google.protobuf.FieldMask read_mask = 2;
}

// Request message for [DatasetService.UpdateDataset][google.cloud.aiplatform.v1.DatasetService.UpdateDataset].
message UpdateDatasetRequest {
  // Required. The Dataset which replaces the resource on the server.
  Dataset dataset = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The update mask applies to the resource.
  // For the `FieldMask` definition, see [google.protobuf.FieldMask][google.protobuf.FieldMask].
  // Updatable fields:
  //
  //   * `display_name`
  //   * `description`
  //   * `labels`
  google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request message for [DatasetService.ListDatasets][google.cloud.aiplatform.v1.DatasetService.ListDatasets].
message ListDatasetsRequest {
  // Required. The name of the Dataset's parent resource.
  // Format: `projects/{project}/locations/{location}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // An expression for filtering the results of the request. For field names
  // both snake_case and camelCase are supported.
  //
  //   * `display_name`: supports = and !=
  //   * `metadata_schema_uri`: supports = and !=
  //   * `labels` supports general map functions that is:
  //     * `labels.key=value` - key:value equality
  //     * `labels.key:* or labels:key - key existence
  //     * A key including a space must be quoted. `labels."a key"`.
  //
  // Some examples:
  //   * `displayName="myDisplayName"`
  //   * `labels.myKey="myValue"`
  string filter = 2;

  // The standard list page size.
  int32 page_size = 3;

  // The standard list page token.
  string page_token = 4;

  // Mask specifying which fields to read.
  google.protobuf.FieldMask read_mask = 5;

  // A comma-separated list of fields to order by, sorted in ascending order.
  // Use "desc" after a field name for descending.
  // Supported fields:
  //   * `display_name`
  //   * `create_time`
  //   * `update_time`
  string order_by = 6;
}

// Response message for [DatasetService.ListDatasets][google.cloud.aiplatform.v1.DatasetService.ListDatasets].
message ListDatasetsResponse {
  // A list of Datasets that matches the specified filter in the request.
  repeated Dataset datasets = 1;

  // The standard List next-page token.
  string next_page_token = 2;
}

// Request message for [DatasetService.DeleteDataset][google.cloud.aiplatform.v1.DatasetService.DeleteDataset].
message DeleteDatasetRequest {
  // Required. The resource name of the Dataset to delete.
  // Format:
  // `projects/{project}/locations/{location}/datasets/{dataset}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/Dataset"
    }
  ];
}

// Request message for [DatasetService.ImportData][google.cloud.aiplatform.v1.DatasetService.ImportData].
message ImportDataRequest {
  // Required. The name of the Dataset resource.
  // Format:
  // `projects/{project}/locations/{location}/datasets/{dataset}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/Dataset"
    }
  ];

  // Required. The desired input locations. The contents of all input locations will be
  // imported in one batch.
  repeated ImportDataConfig import_configs = 2 [(google.api.field_behavior) = REQUIRED];
}

// Response message for [DatasetService.ImportData][google.cloud.aiplatform.v1.DatasetService.ImportData].
message ImportDataResponse {

}

// Runtime operation information for [DatasetService.ImportData][google.cloud.aiplatform.v1.DatasetService.ImportData].
message ImportDataOperationMetadata {
  // The common part of the operation metadata.
  GenericOperationMetadata generic_metadata = 1;
}

// Request message for [DatasetService.ExportData][google.cloud.aiplatform.v1.DatasetService.ExportData].
message ExportDataRequest {
  // Required. The name of the Dataset resource.
  // Format:
  // `projects/{project}/locations/{location}/datasets/{dataset}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/Dataset"
    }
  ];

  // Required. The desired output location.
  ExportDataConfig export_config = 2 [(google.api.field_behavior) = REQUIRED];
}

// Response message for [DatasetService.ExportData][google.cloud.aiplatform.v1.DatasetService.ExportData].
message ExportDataResponse {
  // All of the files that are exported in this export operation.
  repeated string exported_files = 1;
}

// Runtime operation information for [DatasetService.ExportData][google.cloud.aiplatform.v1.DatasetService.ExportData].
message ExportDataOperationMetadata {
  // The common part of the operation metadata.
  GenericOperationMetadata generic_metadata = 1;

  // A Google Cloud Storage directory which path ends with '/'. The exported
  // data is stored in the directory.
  string gcs_output_directory = 2;
}

// Request message for [DatasetService.ListDataItems][google.cloud.aiplatform.v1.DatasetService.ListDataItems].
message ListDataItemsRequest {
  // Required. The resource name of the Dataset to list DataItems from.
  // Format:
  // `projects/{project}/locations/{location}/datasets/{dataset}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/Dataset"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The standard list page size.
  int32 page_size = 3;

  // The standard list page token.
  string page_token = 4;

  // Mask specifying which fields to read.
  google.protobuf.FieldMask read_mask = 5;

  // A comma-separated list of fields to order by, sorted in ascending order.
  // Use "desc" after a field name for descending.
  string order_by = 6;
}

// Response message for [DatasetService.ListDataItems][google.cloud.aiplatform.v1.DatasetService.ListDataItems].
message ListDataItemsResponse {
  // A list of DataItems that matches the specified filter in the request.
  repeated DataItem data_items = 1;

  // The standard List next-page token.
  string next_page_token = 2;
}

// Request message for [DatasetService.GetAnnotationSpec][google.cloud.aiplatform.v1.DatasetService.GetAnnotationSpec].
message GetAnnotationSpecRequest {
  // Required. The name of the AnnotationSpec resource.
  // Format:
  // `projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/AnnotationSpec"
    }
  ];

  // Mask specifying which fields to read.
  google.protobuf.FieldMask read_mask = 2;
}

// Request message for [DatasetService.ListAnnotations][google.cloud.aiplatform.v1.DatasetService.ListAnnotations].
message ListAnnotationsRequest {
  // Required. The resource name of the DataItem to list Annotations from.
  // Format:
  // `projects/{project}/locations/{location}/datasets/{dataset}/dataItems/{data_item}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/DataItem"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The standard list page size.
  int32 page_size = 3;

  // The standard list page token.
  string page_token = 4;

  // Mask specifying which fields to read.
  google.protobuf.FieldMask read_mask = 5;

  // A comma-separated list of fields to order by, sorted in ascending order.
  // Use "desc" after a field name for descending.
  string order_by = 6;
}

// Response message for [DatasetService.ListAnnotations][google.cloud.aiplatform.v1.DatasetService.ListAnnotations].
message ListAnnotationsResponse {
  // A list of Annotations that matches the specified filter in the request.
  repeated Annotation annotations = 1;

  // The standard List next-page token.
  string next_page_token = 2;
}
