// Copyright 2025 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.storageinsights.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";
import "google/type/date.proto";
import "google/type/datetime.proto";

option csharp_namespace = "Google.Cloud.StorageInsights.V1";
option go_package = "cloud.google.com/go/storageinsights/apiv1/storageinsightspb;storageinsightspb";
option java_multiple_files = true;
option java_outer_classname = "V1Proto";
option java_package = "com.google.cloud.storageinsights.v1";
option php_namespace = "Google\\Cloud\\StorageInsights\\V1";
option ruby_package = "Google::Cloud::StorageInsights::V1";

// Service describing handlers for resources
service StorageInsights {
  option (google.api.default_host) = "storageinsights.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Lists ReportConfigs in a given project and location.
  rpc ListReportConfigs(ListReportConfigsRequest)
      returns (ListReportConfigsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/reportConfigs"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single ReportConfig.
  rpc GetReportConfig(GetReportConfigRequest) returns (ReportConfig) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/reportConfigs/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new ReportConfig in a given project and location.
  rpc CreateReportConfig(CreateReportConfigRequest) returns (ReportConfig) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/reportConfigs"
      body: "report_config"
    };
    option (google.api.method_signature) = "parent,report_config";
  }

  // Updates the parameters of a single ReportConfig.
  rpc UpdateReportConfig(UpdateReportConfigRequest) returns (ReportConfig) {
    option (google.api.http) = {
      patch: "/v1/{report_config.name=projects/*/locations/*/reportConfigs/*}"
      body: "report_config"
    };
    option (google.api.method_signature) = "report_config,update_mask";
  }

  // Deletes a single ReportConfig.
  rpc DeleteReportConfig(DeleteReportConfigRequest)
      returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/reportConfigs/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists ReportDetails in a given project and location.
  rpc ListReportDetails(ListReportDetailsRequest)
      returns (ListReportDetailsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/reportConfigs/*}/reportDetails"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single ReportDetail.
  rpc GetReportDetail(GetReportDetailRequest) returns (ReportDetail) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/reportConfigs/*/reportDetails/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists the dataset configurations in a given project for a given location.
  rpc ListDatasetConfigs(ListDatasetConfigsRequest)
      returns (ListDatasetConfigsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/datasetConfigs"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets the dataset configuration in a given project for a given location.
  rpc GetDatasetConfig(GetDatasetConfigRequest) returns (DatasetConfig) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/datasetConfigs/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a dataset configuration in a given project for a given location.
  rpc CreateDatasetConfig(CreateDatasetConfigRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/datasetConfigs"
      body: "dataset_config"
    };
    option (google.api.method_signature) =
        "parent,dataset_config,dataset_config_id";
    option (google.longrunning.operation_info) = {
      response_type: "DatasetConfig"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates a dataset configuration in a given project for a given location.
  rpc UpdateDatasetConfig(UpdateDatasetConfigRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{dataset_config.name=projects/*/locations/*/datasetConfigs/*}"
      body: "dataset_config"
    };
    option (google.api.method_signature) = "dataset_config,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "DatasetConfig"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a dataset configuration in a given project for a given location.
  rpc DeleteDatasetConfig(DeleteDatasetConfigRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/datasetConfigs/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Links a dataset to BigQuery in a given project for a given location.
  rpc LinkDataset(LinkDatasetRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/datasetConfigs/*}:linkDataset"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "LinkDatasetResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Unlinks a dataset from BigQuery in a given project
  // for a given location.
  rpc UnlinkDataset(UnlinkDatasetRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/datasetConfigs/*}:unlinkDataset"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }
}

// Request message for
// [`ListReportConfigs`][google.cloud.storageinsights.v1.StorageInsights.ListReportConfigs]
message ListReportConfigsRequest {
  // Required. Parent value for ListReportConfigsRequest
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "storageinsights.googleapis.com/ReportConfig"
    }
  ];

  // Requested page size. Server may return fewer items than requested.
  // If unspecified, server will pick an appropriate default.
  int32 page_size = 2;

  // A token identifying a page of results the server should return.
  string page_token = 3;

  // Filtering results
  string filter = 4;

  // Hint for how to order the results
  string order_by = 5;
}

// Message for response to listing ReportConfigs
message ListReportConfigsResponse {
  // The list of ReportConfig
  repeated ReportConfig report_configs = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;

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

// Message for getting a ReportConfig
message GetReportConfigRequest {
  // Required. Name of the resource
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "storageinsights.googleapis.com/ReportConfig"
    }
  ];
}

// Message for creating a ReportConfig
message CreateReportConfigRequest {
  // Required. Value for parent.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "storageinsights.googleapis.com/ReportConfig"
    }
  ];

  // Required. The resource being created
  ReportConfig report_config = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. An optional request ID to identify requests. Specify a unique
  // request ID so that if you must retry your request, the server will know to
  // ignore the request if it has already been completed. The server will
  // guarantee that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and
  // the request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Message for updating a ReportConfig
message UpdateReportConfigRequest {
  // Required. Field mask is used to specify the fields to be overwritten in the
  // ReportConfig resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask. If the
  // user does not provide a mask then all fields will be overwritten.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = REQUIRED];

  // Required. The resource being updated
  ReportConfig report_config = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. An optional request ID to identify requests. Specify a unique
  // request ID so that if you must retry your request, the server will know to
  // ignore the request if it has already been completed. The server will
  // guarantee that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and
  // the request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Message for deleting a ReportConfig
message DeleteReportConfigRequest {
  // Required. Name of the resource
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "storageinsights.googleapis.com/ReportConfig"
    }
  ];

  // Optional. If set, all ReportDetails for this ReportConfig will be deleted.
  bool force = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. An optional request ID to identify requests. Specify a unique
  // request ID so that if you must retry your request, the server will know to
  // ignore the request if it has already been completed. The server will
  // guarantee that for at least 60 minutes after the first request.
  //
  // For example, consider a situation where you make an initial request and
  // the request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Message describing ReportDetail object. ReportDetail represents metadata of
// generated reports for a ReportConfig.
// Next ID: 10
message ReportDetail {
  option (google.api.resource) = {
    type: "storageinsights.googleapis.com/ReportDetail"
    pattern: "projects/{project}/locations/{location}/reportConfigs/{report_config}/reportDetails/{report_detail}"
  };

  // Different metrics associated with the generated report.
  message Metrics {
    // Count of Cloud Storage objects which are part of the report.
    int64 processed_records_count = 1;
  }

  // Name of resource. It will be of form
  // projects/<project>/locations/<location>/reportConfigs/<report-config-id>/reportDetails/<report-detail-id>.
  string name = 1;

  // The snapshot time.
  // All the report data is referenced at this point of time.
  google.protobuf.Timestamp snapshot_time = 2;

  // Prefix of the object name of each report's shard. This will have full
  // prefix except the "extension" and "shard_id".
  // For example, if the `destination_path` is
  // `{{report-config-id}}/dt={{datetime}}`, the shard object name would be
  // `gs://my-insights/1A34-F2E456-12B456-1C3D/dt=2022-05-20T06:35/1A34-F2E456-12B456-1C3D_2022-05-20T06:35_5.csv`
  // and the value of `report_path_prefix` field would be
  // `gs://my-insights/1A34-F2E456-12B456-1C3D/dt=2022-05-20T06:35/1A34-F2E456-12B456-1C3D_2022-05-20T06:35_`.
  string report_path_prefix = 8;

  // Total shards generated for the report.
  int64 shards_count = 9;

  // Status of the ReportDetail.
  google.rpc.Status status = 4;

  // Labels as key value pairs
  map<string, string> labels = 5;

  // The date for which report is generated. The time part of target_datetime
  // will be zero till we support multiple reports per day.
  google.type.DateTime target_datetime = 6;

  // Metrics of the report.
  Metrics report_metrics = 7;
}

// Message for requesting list of ReportDetails
message ListReportDetailsRequest {
  // Required. Parent value for ListReportDetailsRequest
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "storageinsights.googleapis.com/ReportDetail"
    }
  ];

  // Requested page size. Server may return fewer items than requested.
  // If unspecified, server will pick an appropriate default.
  int32 page_size = 2;

  // A token identifying a page of results the server should return.
  string page_token = 3;

  // Filtering results
  string filter = 4;

  // Hint for how to order the results
  string order_by = 5;
}

// Message for response to listing ReportDetails
message ListReportDetailsResponse {
  // The list of ReportDetail
  repeated ReportDetail report_details = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;

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

// Message for getting a ReportDetail
message GetReportDetailRequest {
  // Required. Name of the resource
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "storageinsights.googleapis.com/ReportDetail"
    }
  ];
}

// Represents the metadata of the long-running operation.
message OperationMetadata {
  // Output only. The time the operation was created.
  google.protobuf.Timestamp create_time = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time the operation finished running.
  google.protobuf.Timestamp end_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Server-defined resource path for the target of the operation.
  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Name of the verb executed by the operation.
  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Human-readable status of the operation, if any.
  string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Identifies whether the user has requested cancellation
  // of the operation. Operations that have been cancelled successfully
  // have [Operation.error][] value with a
  // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
  // `Code.CANCELLED`.
  bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. API version used to start the operation.
  string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// ReportConfig Resource:
//
// Options to setup frequency of report generation.
message FrequencyOptions {
  // This ENUM specifies possible frequencies of report generation.
  enum Frequency {
    // Unspecified.
    FREQUENCY_UNSPECIFIED = 0;

    // Report will be generated daily.
    DAILY = 1;

    // Report will be generated weekly.
    WEEKLY = 2;
  }

  // Frequency of report generation.
  Frequency frequency = 1;

  // The date from which report generation should start.
  // UTC time zone.
  google.type.Date start_date = 2;

  // The date on which report generation should stop (Inclusive).
  // UTC time zone.
  google.type.Date end_date = 3;
}

// Options to configure CSV formatted reports.
message CSVOptions {
  // Record separator characters in CSV.
  string record_separator = 1;

  // Delimiter characters in CSV.
  string delimiter = 2;

  // If set, will include a header row in the CSV report.
  bool header_required = 3;
}

// Options to configure Parquet formatted reports.
message ParquetOptions {}

// Options to filter data on storage systems.
// Next ID: 2
message CloudStorageFilters {
  // Bucket for which the report will be generated.
  string bucket = 1;
}

// Options to store reports in storage systems.
// Next ID: 3
message CloudStorageDestinationOptions {
  // Destination bucket.
  string bucket = 1;

  // Destination path is the path in the bucket where the report should be
  // generated.
  string destination_path = 2;
}

// Report specification for exporting object metadata.
// Next ID: 4
message ObjectMetadataReportOptions {
  // Metadata fields to be included in the report.
  repeated string metadata_fields = 1;

  // Filter options for storage systems.
  oneof filter {
    // Cloud Storage as the storage system.
    CloudStorageFilters storage_filters = 2;
  }

  // Options on destination for storage systems.
  oneof destination_options {
    // Cloud Storage as the storage system.
    CloudStorageDestinationOptions storage_destination_options = 3;
  }
}

// Message describing ReportConfig object. ReportConfig is the configuration to
// generate reports.
// See
// https://cloud.google.com/storage/docs/insights/using-inventory-reports#create-config-rest
// for more details on how to set various fields.
// Next ID: 12
message ReportConfig {
  option (google.api.resource) = {
    type: "storageinsights.googleapis.com/ReportConfig"
    pattern: "projects/{project}/locations/{location}/reportConfigs/{report_config}"
  };

  // name of resource. It will be of form
  // projects/<project>/locations/<location>/reportConfigs/<report-config-id>.
  string name = 1;

  // Output only. [Output only] Create time stamp
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. [Output only] Update time stamp
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // The frequency of report generation.
  FrequencyOptions frequency_options = 5;

  // Format in which report will be published.
  oneof report_format {
    // Options for CSV formatted reports.
    CSVOptions csv_options = 6;

    // Options for Parquet formatted reports.
    ParquetOptions parquet_options = 7;
  }

  // Configuration options for report contents.
  oneof report_kind {
    // Report for exporting object metadata.
    ObjectMetadataReportOptions object_metadata_report_options = 8;
  }

  // Labels as key value pairs
  map<string, string> labels = 10;

  // User provided display name which can be empty and limited to 256 characters
  // that is editable.
  string display_name = 11;
}

// Identity lets the user provide the type of identity to use, and outputs
// the identity string that can be used for IAM policy changes.
message Identity {
  // Type of service account to use for the dataset configuration.
  enum IdentityType {
    // Default is unspecified and should not be used.
    IDENTITY_TYPE_UNSPECIFIED = 0;

    // Google managed service account per resource.
    IDENTITY_TYPE_PER_CONFIG = 1;

    // Google managed service account per project.
    IDENTITY_TYPE_PER_PROJECT = 2;
  }

  // Output only. Name of the identity.
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Type of identity to use for the datasetConfig.
  IdentityType type = 2;
}

// Message describing the dataset configuration properties. For more
// information, see [Dataset configuration
// properties](https://cloud.google.com/storage/docs/insights/datasets#dataset-config).
message DatasetConfig {
  option (google.api.resource) = {
    type: "storageinsights.googleapis.com/DatasetConfig"
    pattern: "projects/{project}/locations/{location}/datasetConfigs/{dataset_config}"
  };

  // Collection of project numbers
  message SourceProjects {
    repeated int64 project_numbers = 1;
  }

  // Specifies a set of folders to include in the dataset
  message SourceFolders {
    // Optional. The list of folder numbers to include in the dataset.
    repeated int64 folder_numbers = 1 [(google.api.field_behavior) = OPTIONAL];
  }

  // Collection of Cloud Storage locations.
  message CloudStorageLocations {
    repeated string locations = 1;
  }

  // Collection of Cloud Storage buckets.
  message CloudStorageBuckets {
    // Defines the bucket by its name or a regex pattern to match buckets.
    message CloudStorageBucket {
      oneof cloud_storage_bucket {
        // Cloud Storage bucket name.
        string bucket_name = 1;

        // A regex pattern for bucket names matching the regex. Regex should
        // follow the syntax specified in `google/re2` on GitHub.
        string bucket_prefix_regex = 2;
      }
    }

    repeated CloudStorageBucket cloud_storage_buckets = 1;
  }

  // Defines the details about the linked dataset.
  message Link {
    // Output only. Dataset name for linked dataset.
    string dataset = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. State of the linked dataset.
    bool linked = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // State of the configuration.
  enum ConfigState {
    // Unspecified state.
    CONFIG_STATE_UNSPECIFIED = 0;

    // Active configuration indicates that the configuration is
    // actively ingesting data.
    CONFIG_STATE_ACTIVE = 1;

    // In this state, the configuration is being verified for various
    // permissions.
    CONFIG_STATE_VERIFICATION_IN_PROGRESS = 2;

    // Configuration is created and further processing needs to happen.
    CONFIG_STATE_CREATED = 3;

    // Configuration is under processing
    CONFIG_STATE_PROCESSING = 4;
  }

  // Provides a summary of the bucket level error statistics.
  message BucketErrors {
    // Optional. Count of successfully validated buckets.
    int64 validated_count = 1 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Count of buckets with permission denied errors.
    int64 permission_denied_count = 2 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Subset of bucket names that have permission denied.
    repeated string permission_denied_bucket_ids = 3
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Count of buckets that are not subscribed to Storage
    // Intelligence.
    int64 non_management_hub_entitled_count = 5
        [deprecated = true, (google.api.field_behavior) = OPTIONAL];

    // Optional. Number of buckets that encountered internal errors during the
    // validation process. These buckets are automatically retried in subsequent
    // validation attempts.
    int64 internal_error_count = 4 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Count of buckets that are not subscribed to Storage
    // Intelligence.
    int64 non_storage_intelligence_entitled_count = 7
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Subset of bucket names that are not subscribed to Storage
    // Intelligence.
    repeated string non_storage_intelligence_entitled_bucket_ids = 8
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Provides a summary of the project level error statistics.
  message ProjectErrors {
    // Optional. Count of successfully validated projects.
    optional int64 validated_count = 1 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Count of projects which are not in the same organization.
    optional int64 outside_org_error_count = 2
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Subset of project numbers which are not in the same
    // organization.
    repeated int64 outside_org_project_numbers = 3
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Count of projects that are not subscribed to Storage
    // Intelligence.
    optional int64 non_management_hub_entitled_error_count = 7
        [deprecated = true, (google.api.field_behavior) = OPTIONAL];

    // Optional. Subset of project numbers that are not subscribed to Storage
    // Intelligence.
    repeated int64 non_management_hub_entitled_project_numbers = 8
        [deprecated = true, (google.api.field_behavior) = OPTIONAL];

    // Optional. Count of projects that are not subscribed to Storage
    // Intelligence.
    optional int64 non_storage_intelligence_entitled_error_count = 9
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Subset of project numbers that are not subscribed to Storage
    // Intelligence.
    repeated int64 non_storage_intelligence_entitled_project_numbers = 10
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Number of projects that encountered internal errors during
    // validation and are automatically retried.
    optional int64 internal_error_count = 4
        [(google.api.field_behavior) = OPTIONAL];

    // The destination project check result. It indicates whether the project
    // is in the correct organization or if an internal error occurred during
    // the check.
    oneof destination_project_check_result {
      // Optional. Indicates if the destination project resides within the same
      // organization as the source project.
      bool destination_project_org_error = 5
          [(google.api.field_behavior) = OPTIONAL];

      // Optional. Indicates whether the destination project check failed due to
      // an internal error. If `true`, the system automatically retries the
      // check.
      bool destination_project_check_has_internal_error = 6
          [(google.api.field_behavior) = OPTIONAL];
    }
  }

  // Summary of validation errors that occurred during the verification phase.
  message ValidationErrorsBeforeIngestion {
    // Optional. Provides a summary of the bucket level error stats.
    BucketErrors bucket_errors = 1 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Provides a summary of the project level error stats.
    ProjectErrors project_errors = 2 [(google.api.field_behavior) = OPTIONAL];
  }

  // Identifier. name of resource
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Output only. The UTC time at which the dataset configuration was created.
  // This is auto-populated.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The UTC time at which the dataset configuration was last
  // updated. This is auto-populated.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Labels as key value pairs
  map<string, string> labels = 4;

  // Output only. System generated unique identifier for the resource.
  string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Organization resource ID that the source projects should belong
  // to. Projects that do not belong to the provided organization are not
  // considered when creating the dataset.
  int64 organization_number = 22 [(google.api.field_behavior) = OPTIONAL];

  // Defines the options for providing source identifiers for the dataset.
  oneof source_options {
    // Defines the options for providing source projects for the dataset.
    SourceProjects source_projects = 7;

    // Defines the options for providing source folders for the dataset.
    SourceFolders source_folders = 24;

    // Defines the options for providing a source organization for the dataset.
    bool organization_scope = 25;

    // Input only. Cloud Storage object path containing a list of
    // project or folder numbers to include in the dataset;
    // it cannot contain a mix of project and folders.
    //
    // The object must be a text file where each line has one of the following
    // entries:
    //
    // - Project number, formatted as `projects/{project_number}`, for example,
    // `projects/1234567890`.
    // - Folder identifier, formatted as `folders/{folder_number}`, for example,
    // `folders/9876543210`.
    // Path must be in the format `gs://{bucket_name}/{object_name}`.
    string cloud_storage_object_path = 21
        [(google.api.field_behavior) = INPUT_ONLY];
  }

  // Cloud Storage locations to include or exclude.
  oneof cloud_storage_locations {
    CloudStorageLocations include_cloud_storage_locations = 8;

    CloudStorageLocations exclude_cloud_storage_locations = 9;
  }

  // Cloud Storage buckets to include or exclude.
  oneof cloud_storage_buckets {
    CloudStorageBuckets include_cloud_storage_buckets = 10;

    CloudStorageBuckets exclude_cloud_storage_buckets = 11;
  }

  // If set to `true`, the request includes all the newly created buckets in the
  // dataset that meet the inclusion and exclusion rules.
  bool include_newly_created_buckets = 12;

  // Optional. If set to `false`, then all the permission checks must be
  // successful before the system can start ingesting data. This field can only
  // be updated before the system ingests data for the first time. Any attempt
  // to modify the field after data ingestion starts results in an error.
  bool skip_verification_and_ingest = 19
      [deprecated = true, (google.api.field_behavior) = OPTIONAL];

  // Number of days of history that must be retained.
  int32 retention_period_days = 14;

  // Details of the linked dataset.
  Link link = 15;

  // Identity used by this `datasetConfig`.
  Identity identity = 16;

  // Output only. Status of the `datasetConfig`.
  google.rpc.Status status = 17 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. State of the `datasetConfig`.
  ConfigState dataset_config_state = 18
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. A user-provided description for the dataset configuration.
  //
  // Maximum length: 256 characters.
  string description = 20 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [`ListDatasetConfigs`][google.cloud.storageinsights.v1.StorageInsights.ListDatasetConfigs]
message ListDatasetConfigsRequest {
  // Required. Parent value for ListDatasetConfigsRequest
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "storageinsights.googleapis.com/DatasetConfig"
    }
  ];

  // Requested page size. Server might return fewer items than requested.
  // If unspecified, server picks an appropriate default.
  int32 page_size = 2;

  // A token identifying a page of results the server should return.
  string page_token = 3;

  // Filtering results
  string filter = 4;

  // Hint for how to order the results
  string order_by = 5;
}

// Response message for
// [`ListDatasetConfigs`][google.cloud.storageinsights.v1.StorageInsights.ListDatasetConfigs]
message ListDatasetConfigsResponse {
  // The list of `DatasetConfigs`
  repeated DatasetConfig dataset_configs = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;

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

// Request message for
// [`GetDatasetConfig`][google.cloud.storageinsights.v1.StorageInsights.GetDatasetConfig]
message GetDatasetConfigRequest {
  // Required. Name of the resource
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "storageinsights.googleapis.com/DatasetConfig"
    }
  ];
}

// Request message for
// [`CreateDatasetConfig`][google.cloud.storageinsights.v1.StorageInsights.CreateDatasetConfig]
message CreateDatasetConfigRequest {
  // Required. Value for parent.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "storageinsights.googleapis.com/DatasetConfig"
    }
  ];

  // Required. ID of the requesting object.
  // If auto-generating ID is enabled on the server-side, remove this field and
  // `dataset_config_id` from the method_signature of Create RPC
  // Note: The value should not contain any hyphens.
  string dataset_config_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The resource being created
  DatasetConfig dataset_config = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. A unique identifier for your request.
  // Specify the request ID if you need to retry the request.
  // If you retry the request with the same ID within 60 minutes, the server
  // ignores the request if it has already completed the original request.
  //
  // For example, if your initial request times out and you retry the request
  // using the same request ID, the server recognizes the original request and
  // does not process the new request.
  //
  // The request ID must be a valid UUID and cannot be a zero UUID
  // (00000000-0000-0000-0000-000000000000).
  string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [`UpdateDatasetConfig`][google.cloud.storageinsights.v1.StorageInsights.UpdateDatasetConfig]
message UpdateDatasetConfigRequest {
  // Required. Field mask is used to specify the fields to be overwritten in the
  // `DatasetConfig` resource by the update.
  // The fields specified in the `update_mask` are relative to the resource, not
  // the full request. A field is overwritten if it is in the mask. If the
  // user does not provide a mask then it returns an "Invalid Argument" error.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = REQUIRED];

  // Required. The resource being updated
  DatasetConfig dataset_config = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. A unique identifier for your request.
  // Specify the request ID if you need to retry the request.
  // If you retry the request with the same ID within 60 minutes, the server
  // ignores the request if it has already completed the original request.
  //
  // For example, if your initial request times out and you retry the request
  // using the same request ID, the server recognizes the original request and
  // does not process the new request.
  //
  // The request ID must be a valid UUID and cannot be a zero UUID
  // (00000000-0000-0000-0000-000000000000).
  string request_id = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [`DeleteDatasetConfig`][google.cloud.storageinsights.v1.StorageInsights.DeleteDatasetConfig]
message DeleteDatasetConfigRequest {
  // Required. Name of the resource
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "storageinsights.googleapis.com/DatasetConfig"
    }
  ];

  // Optional. A unique identifier for your request.
  // Specify the request ID if you need to retry the request.
  // If you retry the request with the same ID within 60 minutes, the server
  // ignores the request if it has already completed the original request.
  //
  // For example, if your initial request times out and you retry the request
  // using the same request ID, the server recognizes the original request and
  // does not process the new request.
  //
  // The request ID must be a valid UUID and cannot be a zero UUID
  // (00000000-0000-0000-0000-000000000000).
  string request_id = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [`LinkDataset`][google.cloud.storageinsights.v1.StorageInsights.LinkDataset]
message LinkDatasetRequest {
  // Required. Name of the resource
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "storageinsights.googleapis.com/DatasetConfig"
    }
  ];
}

// Response message for
// [`LinkDataset`][google.cloud.storageinsights.v1.StorageInsights.LinkDataset]
message LinkDatasetResponse {}

// Request message for
// [`UnlinkDataset`][google.cloud.storageinsights.v1.StorageInsights.UnlinkDataset]
message UnlinkDatasetRequest {
  // Required. Name of the resource
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "storageinsights.googleapis.com/DatasetConfig"
    }
  ];
}

// Metadata that helps discover which resources are available in a location.
message LocationMetadata {
  // If true, `storageinsights.googleapis.com/ReportConfig` resource is
  // available at the location.
  bool report_config_available = 1;

  // If true, `storageinsights.googleapis.com/DatasetConfig` resource is
  // available at the location.
  bool dataset_config_available = 2;
}
