// Copyright 2024 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.dataplex.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/dataplex/v1/service.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.Dataplex.V1";
option go_package = "cloud.google.com/go/dataplex/apiv1/dataplexpb;dataplexpb";
option java_multiple_files = true;
option java_outer_classname = "CatalogProto";
option java_package = "com.google.cloud.dataplex.v1";
option php_namespace = "Google\\Cloud\\Dataplex\\V1";
option ruby_package = "Google::Cloud::Dataplex::V1";

// The primary resources offered by this service are EntryGroups, EntryTypes,
// AspectTypes, Entry and Aspect which collectively allow a data administrator
// to organize, manage, secure and catalog data across their organization
// located across cloud projects in a variety of storage systems including Cloud
// Storage and BigQuery.
service CatalogService {
  option (google.api.default_host) = "dataplex.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Creates an EntryType
  rpc CreateEntryType(CreateEntryTypeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/entryTypes"
      body: "entry_type"
    };
    option (google.api.method_signature) = "parent,entry_type,entry_type_id";
    option (google.longrunning.operation_info) = {
      response_type: "EntryType"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates a EntryType resource.
  rpc UpdateEntryType(UpdateEntryTypeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{entry_type.name=projects/*/locations/*/entryTypes/*}"
      body: "entry_type"
    };
    option (google.api.method_signature) = "entry_type,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "EntryType"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a EntryType resource.
  rpc DeleteEntryType(DeleteEntryTypeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/entryTypes/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists EntryType resources in a project and location.
  rpc ListEntryTypes(ListEntryTypesRequest) returns (ListEntryTypesResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/entryTypes"
    };
    option (google.api.method_signature) = "parent";
  }

  // Retrieves a EntryType resource.
  rpc GetEntryType(GetEntryTypeRequest) returns (EntryType) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/entryTypes/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates an AspectType
  rpc CreateAspectType(CreateAspectTypeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/aspectTypes"
      body: "aspect_type"
    };
    option (google.api.method_signature) = "parent,aspect_type,aspect_type_id";
    option (google.longrunning.operation_info) = {
      response_type: "AspectType"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates a AspectType resource.
  rpc UpdateAspectType(UpdateAspectTypeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{aspect_type.name=projects/*/locations/*/aspectTypes/*}"
      body: "aspect_type"
    };
    option (google.api.method_signature) = "aspect_type,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "AspectType"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a AspectType resource.
  rpc DeleteAspectType(DeleteAspectTypeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/aspectTypes/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists AspectType resources in a project and location.
  rpc ListAspectTypes(ListAspectTypesRequest)
      returns (ListAspectTypesResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/aspectTypes"
    };
    option (google.api.method_signature) = "parent";
  }

  // Retrieves a AspectType resource.
  rpc GetAspectType(GetAspectTypeRequest) returns (AspectType) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/aspectTypes/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates an EntryGroup
  rpc CreateEntryGroup(CreateEntryGroupRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/entryGroups"
      body: "entry_group"
    };
    option (google.api.method_signature) = "parent,entry_group,entry_group_id";
    option (google.longrunning.operation_info) = {
      response_type: "EntryGroup"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates a EntryGroup resource.
  rpc UpdateEntryGroup(UpdateEntryGroupRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{entry_group.name=projects/*/locations/*/entryGroups/*}"
      body: "entry_group"
    };
    option (google.api.method_signature) = "entry_group,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "EntryGroup"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a EntryGroup resource.
  rpc DeleteEntryGroup(DeleteEntryGroupRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/entryGroups/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists EntryGroup resources in a project and location.
  rpc ListEntryGroups(ListEntryGroupsRequest)
      returns (ListEntryGroupsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/entryGroups"
    };
    option (google.api.method_signature) = "parent";
  }

  // Retrieves a EntryGroup resource.
  rpc GetEntryGroup(GetEntryGroupRequest) returns (EntryGroup) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/entryGroups/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates an Entry.
  rpc CreateEntry(CreateEntryRequest) returns (Entry) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/entryGroups/*}/entries"
      body: "entry"
    };
    option (google.api.method_signature) = "parent,entry,entry_id";
  }

  // Updates an Entry.
  rpc UpdateEntry(UpdateEntryRequest) returns (Entry) {
    option (google.api.http) = {
      patch: "/v1/{entry.name=projects/*/locations/*/entryGroups/*/entries/**}"
      body: "entry"
    };
    option (google.api.method_signature) = "entry,update_mask";
  }

  // Deletes an Entry.
  rpc DeleteEntry(DeleteEntryRequest) returns (Entry) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/entryGroups/*/entries/**}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists entries within an entry group.
  rpc ListEntries(ListEntriesRequest) returns (ListEntriesResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/entryGroups/*}/entries"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a single entry.
  rpc GetEntry(GetEntryRequest) returns (Entry) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/entryGroups/*/entries/**}"
    };
    option (google.api.method_signature) = "name";
  }

  // Looks up a single entry.
  rpc LookupEntry(LookupEntryRequest) returns (Entry) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*}:lookupEntry"
    };
  }

  // Searches for entries matching given query and scope.
  rpc SearchEntries(SearchEntriesRequest) returns (SearchEntriesResponse) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*}:searchEntries"
    };
    option (google.api.method_signature) = "name,query";
  }
}

// Aspect Type is a template for creating Aspects, and represents the
// JSON-schema for a given Entry, e.g., BigQuery Table Schema.
message AspectType {
  option (google.api.resource) = {
    type: "dataplex.googleapis.com/AspectType"
    pattern: "projects/{project}/locations/{location}/aspectTypes/{aspect_type}"
    plural: "aspectTypes"
    singular: "aspectType"
  };

  // Autorization for an Aspect Type.
  message Authorization {
    // Immutable. The IAM permission grantable on the Entry Group to allow
    // access to instantiate Aspects of Dataplex owned Aspect Types, only
    // settable for Dataplex owned Types.
    string alternate_use_permission = 1
        [(google.api.field_behavior) = IMMUTABLE];
  }

  // MetadataTemplate definition for AspectType
  message MetadataTemplate {
    // Definition of Enumvalue (to be used by enum fields)
    message EnumValue {
      // Required. Index for the enum. Cannot be modified.
      int32 index = 1 [(google.api.field_behavior) = REQUIRED];

      // Required. Name of the enumvalue. This is the actual value that the
      // aspect will contain.
      string name = 2 [(google.api.field_behavior) = REQUIRED];

      // Optional. Optional deprecation message to be set if an enum value needs
      // to be deprecated.
      string deprecated = 3 [(google.api.field_behavior) = OPTIONAL];
    }

    // Definition of the constraints of a field
    message Constraints {
      // Optional. Marks this as an optional/required field.
      bool required = 1 [(google.api.field_behavior) = OPTIONAL];
    }

    // Definition of the annotations of a field
    message Annotations {
      // Optional. Marks a field as deprecated, a deprecation message can be
      // included.
      string deprecated = 1 [(google.api.field_behavior) = OPTIONAL];

      // Optional. Specify a displayname for a field.
      string display_name = 2 [(google.api.field_behavior) = OPTIONAL];

      // Optional. Specify a description for a field
      string description = 3 [(google.api.field_behavior) = OPTIONAL];

      // Optional. Specify a display order for a field. Display order can be
      // used to reorder where a field is rendered
      int32 display_order = 4 [(google.api.field_behavior) = OPTIONAL];

      // Optional. String Type annotations can be used to specify special
      // meaning to string fields. The following values are supported: richText:
      // The field must be interpreted as a rich text field. url: A fully
      // qualified url link. resource: A service qualified resource reference.
      string string_type = 6 [(google.api.field_behavior) = OPTIONAL];

      // Optional. Suggested hints for string fields. These can be used to
      // suggest values to users, through an UI for example.
      repeated string string_values = 7
          [(google.api.field_behavior) = OPTIONAL];
    }

    // Optional. Index is used to encode Template messages. The value of index
    // can range between 1 and 2,147,483,647. Index must be unique within all
    // fields in a Template. (Nested Templates can reuse indexes). Once a
    // Template is defined, the index cannot be changed, because it identifies
    // the field in the actual storage format. Index is a mandatory field, but
    // it is optional for top level fields, and map/array "values" definitions.
    int32 index = 1 [(google.api.field_behavior) = OPTIONAL];

    // Required. The name of the field.
    string name = 2 [(google.api.field_behavior) = REQUIRED];

    // Required. The datatype of this field. The following values are supported:
    // Primitive types (string, integer, boolean, double, datetime); datetime
    // must be of the format RFC3339 UTC "Zulu" (Examples:
    // "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z"). Complex
    // types (enum, array, map, record).
    string type = 5 [(google.api.field_behavior) = REQUIRED];

    // Optional. Field definition, needs to be specified if the type is record.
    // Defines the nested fields.
    repeated MetadataTemplate record_fields = 6
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. The list of values for an enum type. Needs to be defined if the
    // type is enum.
    repeated EnumValue enum_values = 8 [(google.api.field_behavior) = OPTIONAL];

    // Optional. map_items needs to be set if the type is map. map_items can
    // refer to a primitive field or a complex (record only) field. To specify a
    // primitive field, just name and type needs to be set in the nested
    // MetadataTemplate. The recommended value for the name field is item, as
    // this is not used in the actual payload.
    MetadataTemplate map_items = 10 [(google.api.field_behavior) = OPTIONAL];

    // Optional. array_items needs to be set if the type is array. array_items
    // can refer to a primitive field or a complex (record only) field. To
    // specify a primitive field, just name and type needs to be set in the
    // nested MetadataTemplate. The recommended value for the name field is
    // item, as this is not used in the actual payload.
    MetadataTemplate array_items = 11 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Id can be used if this definition of the field needs to be
    // reused later. Id needs to be unique across the entire template. Id can
    // only be specified if the field type is record.
    string type_id = 12 [(google.api.field_behavior) = OPTIONAL];

    // Optional. A reference to another field definition (instead of an inline
    // definition). The value must be equal to the value of an id field defined
    // elsewhere in the MetadataTemplate. Only fields with type as record can
    // refer to other fields.
    string type_ref = 13 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Specifies the constraints on this field.
    Constraints constraints = 50 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Specifies annotations on this field.
    Annotations annotations = 51 [(google.api.field_behavior) = OPTIONAL];
  }

  // Output only. The relative resource name of the AspectType, of the form:
  // projects/{project_number}/locations/{location_id}/aspectTypes/{aspect_type_id}.
  string name = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/AspectType"
    }
  ];

  // Output only. System generated globally unique ID for the AspectType. This
  // ID will be different if the AspectType is deleted and re-created with the
  // same name.
  string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time when the AspectType was created.
  google.protobuf.Timestamp create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time when the AspectType was last updated.
  google.protobuf.Timestamp update_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Description of the AspectType.
  string description = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. User friendly display name.
  string display_name = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. User-defined labels for the AspectType.
  map<string, string> labels = 7 [(google.api.field_behavior) = OPTIONAL];

  // This checksum is computed by the server based on the value of other
  // fields, and may be sent on update and delete requests to ensure the
  // client has an up-to-date value before proceeding.
  string etag = 8;

  // Immutable. Authorization defined for this type.
  Authorization authorization = 52 [(google.api.field_behavior) = IMMUTABLE];

  // Required. MetadataTemplate of the aspect.
  MetadataTemplate metadata_template = 53
      [(google.api.field_behavior) = REQUIRED];

  // Output only. Denotes the transfer status of the Aspect Type. It is
  // unspecified for Aspect Types created from Dataplex API.
  TransferStatus transfer_status = 202
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// An Entry Group represents a logical grouping of one or more Entries.
message EntryGroup {
  option (google.api.resource) = {
    type: "dataplex.googleapis.com/EntryGroup"
    pattern: "projects/{project}/locations/{location}/entryGroups/{entry_group}"
    plural: "entryGroups"
    singular: "entryGroup"
  };

  // Output only. The relative resource name of the EntryGroup, of the form:
  // projects/{project_number}/locations/{location_id}/entryGroups/{entry_group_id}.
  string name = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/EntryGroup"
    }
  ];

  // Output only. System generated globally unique ID for the EntryGroup. This
  // ID will be different if the EntryGroup is deleted and re-created with the
  // same name.
  string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time when the EntryGroup was created.
  google.protobuf.Timestamp create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time when the EntryGroup was last updated.
  google.protobuf.Timestamp update_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Description of the EntryGroup.
  string description = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. User friendly display name.
  string display_name = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. User-defined labels for the EntryGroup.
  map<string, string> labels = 7 [(google.api.field_behavior) = OPTIONAL];

  // This checksum is computed by the server based on the value of other
  // fields, and may be sent on update and delete requests to ensure the
  // client has an up-to-date value before proceeding.
  string etag = 8;

  // Output only. Denotes the transfer status of the Entry Group. It is
  // unspecified for Entry Group created from Dataplex API.
  TransferStatus transfer_status = 202
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Entry Type is a template for creating Entries.
message EntryType {
  option (google.api.resource) = {
    type: "dataplex.googleapis.com/EntryType"
    pattern: "projects/{project}/locations/{location}/entryTypes/{entry_type}"
    plural: "entryTypes"
    singular: "entryType"
  };

  message AspectInfo {
    // Required aspect type for the entry type.
    string type = 1 [(google.api.resource_reference) = {
      type: "dataplex.googleapis.com/AspectType"
    }];
  }

  // Authorization for an Entry Type.
  message Authorization {
    // Immutable. The IAM permission grantable on the Entry Group to allow
    // access to instantiate Entries of Dataplex owned Entry Types, only
    // settable for Dataplex owned Types.
    string alternate_use_permission = 1
        [(google.api.field_behavior) = IMMUTABLE];
  }

  // Output only. The relative resource name of the EntryType, of the form:
  // projects/{project_number}/locations/{location_id}/entryTypes/{entry_type_id}.
  string name = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/EntryType"
    }
  ];

  // Output only. System generated globally unique ID for the EntryType. This ID
  // will be different if the EntryType is deleted and re-created with the same
  // name.
  string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time when the EntryType was created.
  google.protobuf.Timestamp create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time when the EntryType was last updated.
  google.protobuf.Timestamp update_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Description of the EntryType.
  string description = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. User friendly display name.
  string display_name = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. User-defined labels for the EntryType.
  map<string, string> labels = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. This checksum is computed by the server based on the value of
  // other fields, and may be sent on update and delete requests to ensure the
  // client has an up-to-date value before proceeding.
  string etag = 8 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Indicates the class this Entry Type belongs to, for example,
  // TABLE, DATABASE, MODEL.
  repeated string type_aliases = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The platform that Entries of this type belongs to.
  string platform = 10 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The system that Entries of this type belongs to. Examples include
  // CloudSQL, MariaDB etc
  string system = 11 [(google.api.field_behavior) = OPTIONAL];

  // AspectInfo for the entry type.
  repeated AspectInfo required_aspects = 50;

  // Immutable. Authorization defined for this type.
  Authorization authorization = 51 [(google.api.field_behavior) = IMMUTABLE];
}

// An aspect is a single piece of metadata describing an entry.
message Aspect {
  // Output only. The resource name of the type used to create this Aspect.
  string aspect_type = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The path in the entry under which the aspect is attached.
  string path = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time when the Aspect was created.
  google.protobuf.Timestamp create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time when the Aspect was last updated.
  google.protobuf.Timestamp update_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. The content of the aspect, according to its aspect type schema.
  // This will replace `content`.
  // The maximum size of the field is 120KB (encoded as UTF-8).
  google.protobuf.Struct data = 8 [(google.api.field_behavior) = REQUIRED];

  AspectSource aspect_source = 9 [(google.api.field_behavior) = OPTIONAL];
}

// AspectSource contains source system related information for the
// aspect.
message AspectSource {
  // The create time of the aspect in the source system.
  google.protobuf.Timestamp create_time = 10;

  // The update time of the aspect in the source system.
  google.protobuf.Timestamp update_time = 11;
}

// An entry is a representation of a data asset which can be described by
// various metadata.
message Entry {
  option (google.api.resource) = {
    type: "dataplex.googleapis.com/Entry"
    pattern: "projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}"
    plural: "entries"
    singular: "entry"
  };

  // Identifier. The relative resource name of the Entry, of the form:
  // projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Required. Immutable. The resource name of the EntryType used to create this
  // Entry.
  string entry_type = 4 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Output only. The time when the Entry was created.
  google.protobuf.Timestamp create_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time when the Entry was last updated.
  google.protobuf.Timestamp update_time = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The Aspects attached to the Entry.
  // The format for the key can be one of the following:
  // 1. {projectId}.{locationId}.{aspectTypeId} (if the aspect is attached
  // directly to the entry)
  // 2. {projectId}.{locationId}.{aspectTypeId}@{path} (if the aspect is
  // attached to an entry's path)
  map<string, Aspect> aspects = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Immutable. The resource name of the parent entry.
  string parent_entry = 10 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. A name for the entry that can reference it in an external system.
  // The maximum size of the field is 4000 characters.
  string fully_qualified_name = 12 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Source system related information for an entry.
  EntrySource entry_source = 15 [(google.api.field_behavior) = OPTIONAL];
}

// EntrySource contains source system related information for the
// entry.
message EntrySource {
  // Ancestor contains information about individual items in the hierarchy of
  // an Entry.
  message Ancestor {
    // Optional. The name of the ancestor resource.
    string name = 1 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The type of the ancestor resource.
    string type = 2 [(google.api.field_behavior) = OPTIONAL];
  }

  // The name of the resource in the source system.
  // The maximum size of the field is 4000 characters.
  string resource = 1;

  // The name of the source system.
  // The maximum size of the field is 64 characters.
  string system = 2;

  // The platform containing the source system.
  // The maximum size of the field is 64 characters.
  string platform = 3;

  // User friendly display name.
  // The maximum size of the field is 500 characters.
  string display_name = 5;

  // Description of the Entry.
  // The maximum size of the field is 2000 characters.
  string description = 6;

  // User-defined labels.
  // The maximum size of keys and values is 128 characters each.
  map<string, string> labels = 7;

  // Immutable. The ancestors of the Entry in the source system.
  repeated Ancestor ancestors = 9 [(google.api.field_behavior) = IMMUTABLE];

  // The create time of the resource in the source system.
  google.protobuf.Timestamp create_time = 10;

  // The update time of the resource in the source system.
  google.protobuf.Timestamp update_time = 11;

  // Output only. Location of the resource in the source system. Entry will be
  // searchable by this location. By default, this should match the location of
  // the EntryGroup containing this entry. A different value allows capturing
  // source location for data external to GCP.
  string location = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Create EntryGroup Request
message CreateEntryGroupRequest {
  // Required. The resource name of the entryGroup, of the form:
  // projects/{project_number}/locations/{location_id}
  // where `location_id` refers to a GCP region.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Required. EntryGroup identifier.
  string entry_group_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. EntryGroup Resource
  EntryGroup entry_group = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. Only validate the request, but do not perform mutations.
  // The default is false.
  bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Update EntryGroup Request
message UpdateEntryGroupRequest {
  // Required. EntryGroup Resource
  EntryGroup entry_group = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Mask of fields to update.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = REQUIRED];

  // Optional. Only validate the request, but do not perform mutations.
  // The default is false.
  bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Delele EntryGroup Request
message DeleteEntryGroupRequest {
  // Required. The resource name of the EntryGroup:
  // `projects/{project_number}/locations/{location_id}/entryGroups/{entry_group_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/EntryGroup"
    }
  ];

  // Optional. If the client provided etag value does not match the current etag
  // value, the DeleteEntryGroupRequest method returns an ABORTED error response
  string etag = 2 [(google.api.field_behavior) = OPTIONAL];
}

// List entryGroups request.
message ListEntryGroupsRequest {
  // Required. The resource name of the entryGroup location, of the form:
  // `projects/{project_number}/locations/{location_id}`
  // where `location_id` refers to a GCP region.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Optional. Maximum number of EntryGroups to return. The service may return
  // fewer than this value. If unspecified, at most 10 EntryGroups will be
  // returned. The maximum value is 1000; values above 1000 will be coerced to
  // 1000.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Page token received from a previous `ListEntryGroups` call.
  // Provide this to retrieve the subsequent page. When paginating, all other
  // parameters provided to `ListEntryGroups` must match the call that provided
  // the page token.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter request.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Order by fields for the result.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// List ListEntryGroups response.
message ListEntryGroupsResponse {
  // ListEntryGroups under the given parent location.
  repeated EntryGroup entry_groups = 1;

  // Token to retrieve the next page of results, or empty if there are no more
  // results in the list.
  string next_page_token = 2;

  // Locations that could not be reached.
  repeated string unreachable_locations = 3;
}

// Get EntryGroup request.
message GetEntryGroupRequest {
  // Required. The resource name of the EntryGroup:
  // `projects/{project_number}/locations/{location_id}/entryGroups/{entry_group_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/EntryGroup"
    }
  ];
}

// Create EntryType Request
message CreateEntryTypeRequest {
  // Required. The resource name of the EntryType, of the form:
  // projects/{project_number}/locations/{location_id}
  // where `location_id` refers to a GCP region.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Required. EntryType identifier.
  string entry_type_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. EntryType Resource
  EntryType entry_type = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. Only validate the request, but do not perform mutations.
  // The default is false.
  bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Update EntryType Request
message UpdateEntryTypeRequest {
  // Required. EntryType Resource
  EntryType entry_type = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Mask of fields to update.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = REQUIRED];

  // Optional. Only validate the request, but do not perform mutations.
  // The default is false.
  bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Delele EntryType Request
message DeleteEntryTypeRequest {
  // Required. The resource name of the EntryType:
  // `projects/{project_number}/locations/{location_id}/entryTypes/{entry_type_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/EntryType"
    }
  ];

  // Optional. If the client provided etag value does not match the current etag
  // value, the DeleteEntryTypeRequest method returns an ABORTED error response
  string etag = 2 [(google.api.field_behavior) = OPTIONAL];
}

// List EntryTypes request
message ListEntryTypesRequest {
  // Required. The resource name of the EntryType location, of the form:
  // `projects/{project_number}/locations/{location_id}`
  // where `location_id` refers to a GCP region.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Optional. Maximum number of EntryTypes to return. The service may return
  // fewer than this value. If unspecified, at most 10 EntryTypes will be
  // returned. The maximum value is 1000; values above 1000 will be coerced to
  // 1000.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Page token received from a previous `ListEntryTypes` call.
  // Provide this to retrieve the subsequent page. When paginating, all other
  // parameters provided to `ListEntryTypes` must match the call that provided
  // the page token.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter request. Filters are case-sensitive.
  // The following formats are supported:
  //
  // labels.key1 = "value1"
  // labels:key1
  // name = "value"
  // These restrictions can be coinjoined with AND, OR and NOT conjunctions.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Order by fields (`name` or `create_time`) for the result.
  // If not specified, the ordering is undefined.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// List EntryTypes response
message ListEntryTypesResponse {
  // ListEntryTypes under the given parent location.
  repeated EntryType entry_types = 1;

  // Token to retrieve the next page of results, or empty if there are no more
  // results in the list.
  string next_page_token = 2;

  // Locations that could not be reached.
  repeated string unreachable_locations = 3;
}

// Get EntryType request
message GetEntryTypeRequest {
  // Required. The resource name of the EntryType:
  // `projects/{project_number}/locations/{location_id}/entryTypes/{entry_type_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/EntryType"
    }
  ];
}

// Create AspectType Request
message CreateAspectTypeRequest {
  // Required. The resource name of the AspectType, of the form:
  // projects/{project_number}/locations/{location_id}
  // where `location_id` refers to a GCP region.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Required. AspectType identifier.
  string aspect_type_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. AspectType Resource
  AspectType aspect_type = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. Only validate the request, but do not perform mutations.
  // The default is false.
  bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Update AspectType Request
message UpdateAspectTypeRequest {
  // Required. AspectType Resource
  AspectType aspect_type = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Mask of fields to update.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = REQUIRED];

  // Optional. Only validate the request, but do not perform mutations.
  // The default is false.
  bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Delele AspectType Request
message DeleteAspectTypeRequest {
  // Required. The resource name of the AspectType:
  // `projects/{project_number}/locations/{location_id}/aspectTypes/{aspect_type_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/AspectType"
    }
  ];

  // Optional. If the client provided etag value does not match the current etag
  // value, the DeleteAspectTypeRequest method returns an ABORTED error response
  string etag = 2 [(google.api.field_behavior) = OPTIONAL];
}

// List AspectTypes request
message ListAspectTypesRequest {
  // Required. The resource name of the AspectType location, of the form:
  // `projects/{project_number}/locations/{location_id}`
  // where `location_id` refers to a GCP region.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Optional. Maximum number of AspectTypes to return. The service may return
  // fewer than this value. If unspecified, at most 10 AspectTypes will be
  // returned. The maximum value is 1000; values above 1000 will be coerced to
  // 1000.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Page token received from a previous `ListAspectTypes` call.
  // Provide this to retrieve the subsequent page. When paginating, all other
  // parameters provided to `ListAspectTypes` must match the call that provided
  // the page token.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter request. Filters are case-sensitive.
  // The following formats are supported:
  //
  // labels.key1 = "value1"
  // labels:key1
  // name = "value"
  // These restrictions can be coinjoined with AND, OR and NOT conjunctions.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Order by fields (`name` or `create_time`) for the result.
  // If not specified, the ordering is undefined.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// List AspectTypes response
message ListAspectTypesResponse {
  // ListAspectTypes under the given parent location.
  repeated AspectType aspect_types = 1;

  // Token to retrieve the next page of results, or empty if there are no more
  // results in the list.
  string next_page_token = 2;

  // Locations that could not be reached.
  repeated string unreachable_locations = 3;
}

// Get AspectType request
message GetAspectTypeRequest {
  // Required. The resource name of the AspectType:
  // `projects/{project_number}/locations/{location_id}/aspectTypes/{aspect_type_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/AspectType"
    }
  ];
}

message CreateEntryRequest {
  // Required. The resource name of the parent Entry Group:
  // `projects/{project}/locations/{location}/entryGroups/{entry_group}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/EntryGroup"
    }
  ];

  // Required. Entry identifier. It has to be unique within an Entry Group.
  //
  // Entries corresponding to Google Cloud resources use Entry ID format based
  // on Full Resource Names
  // (https://cloud.google.com/apis/design/resource_names#full_resource_name).
  // The format is a Full Resource Name of the resource without the
  // prefix double slashes in the API Service Name part of Full Resource Name.
  // This allows retrieval of entries using their associated resource name.
  //
  // For example if the Full Resource Name of a resource is
  // `//library.googleapis.com/shelves/shelf1/books/book2`,
  // then the suggested entry_id is
  // `library.googleapis.com/shelves/shelf1/books/book2`.
  //
  // It is also suggested to follow the same convention for entries
  // corresponding to resources from other providers or systems than Google
  // Cloud.
  //
  // The maximum size of the field is 4000 characters.
  string entry_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. Entry resource.
  Entry entry = 3 [(google.api.field_behavior) = REQUIRED];
}

message UpdateEntryRequest {
  // Required. Entry resource.
  Entry entry = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. Mask of fields to update. To update Aspects, the update_mask must
  // contain the value "aspects".
  //
  // If the update_mask is empty, all modifiable fields present in the request
  // will be updated.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. If set to true and the entry does not exist, it will be created.
  bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. If set to true and the aspect_keys specify aspect ranges, any
  // existing aspects from that range not provided in the request will be
  // deleted.
  bool delete_missing_aspects = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The map keys of the Aspects which should be modified. Supports
  // the following syntaxes:
  // * <aspect_type_reference> - matches aspect on given type and empty path
  // * <aspect_type_reference>@path - matches aspect on given type and specified
  // path
  // * <aspect_type_reference>* - matches aspects on given type for all paths
  // * *@path - matches aspects of all types on the given path
  //
  // Existing aspects matching the syntax will not be removed unless
  // `delete_missing_aspects` is set to true.
  //
  // If this field is left empty, it will be treated as specifying exactly those
  // Aspects present in the request.
  repeated string aspect_keys = 5 [(google.api.field_behavior) = OPTIONAL];
}

message DeleteEntryRequest {
  // Required. The resource name of the Entry:
  // `projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "dataplex.googleapis.com/Entry" }
  ];
}

message ListEntriesRequest {
  // Required. The resource name of the parent Entry Group:
  // `projects/{project}/locations/{location}/entryGroups/{entry_group}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "dataplex.googleapis.com/EntryGroup"
    }
  ];

  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The pagination token returned by a previous request.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A filter on the entries to return.
  // Filters are case-sensitive.
  // The request can be filtered by the following fields:
  // entry_type, entry_source.display_name.
  // The comparison operators are =, !=, <, >, <=, >= (strings are compared
  // according to lexical order)
  // The logical operators AND, OR, NOT can be used
  // in the filter. Wildcard "*" can be used, but for entry_type the full
  // project id or number needs to be provided. Example filter expressions:
  // "entry_source.display_name=AnExampleDisplayName"
  // "entry_type=projects/example-project/locations/global/entryTypes/example-entry_type"
  // "entry_type=projects/example-project/locations/us/entryTypes/a* OR
  //  entry_type=projects/another-project/locations/*"
  // "NOT entry_source.display_name=AnotherExampleDisplayName"
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];
}

message ListEntriesResponse {
  // The list of entries.
  repeated Entry entries = 1;

  // Pagination token.
  string next_page_token = 2;
}

message GetEntryRequest {
  // Required. The resource name of the Entry:
  // `projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "dataplex.googleapis.com/Entry" }
  ];

  // Optional. View for controlling which parts of an entry are to be returned.
  EntryView view = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Limits the aspects returned to the provided aspect types.
  // Only works if the CUSTOM view is selected.
  repeated string aspect_types = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Limits the aspects returned to those associated with the provided
  // paths within the Entry. Only works if the CUSTOM view is selected.
  repeated string paths = 4 [(google.api.field_behavior) = OPTIONAL];
}

message LookupEntryRequest {
  // Required. The project to which the request should be attributed in the
  // following form: `projects/{project}/locations/{location}`.
  string name = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. View for controlling which parts of an entry are to be returned.
  EntryView view = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Limits the aspects returned to the provided aspect types.
  // Only works if the CUSTOM view is selected.
  repeated string aspect_types = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Limits the aspects returned to those associated with the provided
  // paths within the Entry. Only works if the CUSTOM view is selected.
  repeated string paths = 4 [(google.api.field_behavior) = OPTIONAL];

  // Required. The resource name of the Entry:
  // `projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}`.
  string entry = 5 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "dataplex.googleapis.com/Entry" }
  ];
}

message SearchEntriesRequest {
  // Required. The project to which the request should be attributed in the
  // following form: `projects/{project}/locations/{location}`.
  string name = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The query against which entries in scope should be matched.
  string query = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. Pagination.
  int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];

  string page_token = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Ordering of the results. Supported options to be added later.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The scope under which the search should be operating. Should
  // either be organizations/<org_id> or projects/<project_ref>. If left
  // unspecified, it will default to the organization where the project provided
  // in `name` is located.
  string scope = 7 [(google.api.field_behavior) = OPTIONAL];
}

// A single result of a SearchEntries request.
message SearchEntriesResult {
  // Snippets for the entry, contains HTML-style highlighting for
  // matched tokens, will be used in UI.
  message Snippets {
    option deprecated = true;

    // Entry
    Entry dataplex_entry = 1 [deprecated = true];
  }

  // Linked resource name.
  string linked_resource = 8 [deprecated = true];

  Entry dataplex_entry = 9;

  // Snippets.
  Snippets snippets = 12 [deprecated = true];
}

message SearchEntriesResponse {
  // The results matching the search query.
  repeated SearchEntriesResult results = 1;

  // The estimated total number of matching entries. Not guaranteed to be
  // accurate.
  int32 total_size = 2;

  // Pagination token.
  string next_page_token = 3;

  // Unreachable locations. Search results don't include data from those
  // locations.
  repeated string unreachable = 4;
}

// View for controlling which parts of an entry are to be returned.
enum EntryView {
  // Unspecified EntryView. Defaults to FULL.
  ENTRY_VIEW_UNSPECIFIED = 0;

  // Returns entry only, without aspects.
  BASIC = 1;

  // Returns all required aspects as well as the keys of all non-required
  // aspects.
  FULL = 2;

  // Returns aspects matching custom fields in GetEntryRequest. If the number of
  // aspects would exceed 100, the first 100 will be returned.
  CUSTOM = 3;

  // Returns all aspects. If the number of aspects would exceed 100, the first
  // 100 will be returned.
  ALL = 4;
}

// Denotes the transfer status of a resource. It is unspecified for resources
// created from Dataplex API.
enum TransferStatus {
  // The default value. It is set for resources that were not subject for
  // migration from Data Catalog service.
  TRANSFER_STATUS_UNSPECIFIED = 0;

  // Indicates that a resource was migrated from Data Catalog service but it
  // hasn't been transferred yet. In particular the resource cannot be updated
  // from Dataplex API.
  TRANSFER_STATUS_MIGRATED = 1;

  // Indicates that a resource was transferred from Data Catalog service. The
  // resource can only be updated from Dataplex API.
  TRANSFER_STATUS_TRANSFERRED = 2;
}
