1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.storageinsights.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/protobuf/empty.proto";
24import "google/protobuf/field_mask.proto";
25import "google/protobuf/timestamp.proto";
26import "google/rpc/status.proto";
27import "google/type/date.proto";
28import "google/type/datetime.proto";
29
30option csharp_namespace = "Google.Cloud.StorageInsights.V1";
31option go_package = "cloud.google.com/go/storageinsights/apiv1/storageinsightspb;storageinsightspb";
32option java_multiple_files = true;
33option java_outer_classname = "V1Proto";
34option java_package = "com.google.cloud.storageinsights.v1";
35option php_namespace = "Google\\Cloud\\StorageInsights\\V1";
36option ruby_package = "Google::Cloud::StorageInsights::V1";
37
38// Service describing handlers for resources
39service StorageInsights {
40  option (google.api.default_host) = "storageinsights.googleapis.com";
41  option (google.api.oauth_scopes) =
42      "https://www.googleapis.com/auth/cloud-platform";
43
44  // Lists ReportConfigs in a given project and location.
45  rpc ListReportConfigs(ListReportConfigsRequest)
46      returns (ListReportConfigsResponse) {
47    option (google.api.http) = {
48      get: "/v1/{parent=projects/*/locations/*}/reportConfigs"
49    };
50    option (google.api.method_signature) = "parent";
51  }
52
53  // Gets details of a single ReportConfig.
54  rpc GetReportConfig(GetReportConfigRequest) returns (ReportConfig) {
55    option (google.api.http) = {
56      get: "/v1/{name=projects/*/locations/*/reportConfigs/*}"
57    };
58    option (google.api.method_signature) = "name";
59  }
60
61  // Creates a new ReportConfig in a given project and location.
62  rpc CreateReportConfig(CreateReportConfigRequest) returns (ReportConfig) {
63    option (google.api.http) = {
64      post: "/v1/{parent=projects/*/locations/*}/reportConfigs"
65      body: "report_config"
66    };
67    option (google.api.method_signature) = "parent,report_config";
68  }
69
70  // Updates the parameters of a single ReportConfig.
71  rpc UpdateReportConfig(UpdateReportConfigRequest) returns (ReportConfig) {
72    option (google.api.http) = {
73      patch: "/v1/{report_config.name=projects/*/locations/*/reportConfigs/*}"
74      body: "report_config"
75    };
76    option (google.api.method_signature) = "report_config,update_mask";
77  }
78
79  // Deletes a single ReportConfig.
80  rpc DeleteReportConfig(DeleteReportConfigRequest)
81      returns (google.protobuf.Empty) {
82    option (google.api.http) = {
83      delete: "/v1/{name=projects/*/locations/*/reportConfigs/*}"
84    };
85    option (google.api.method_signature) = "name";
86  }
87
88  // Lists ReportDetails in a given project and location.
89  rpc ListReportDetails(ListReportDetailsRequest)
90      returns (ListReportDetailsResponse) {
91    option (google.api.http) = {
92      get: "/v1/{parent=projects/*/locations/*/reportConfigs/*}/reportDetails"
93    };
94    option (google.api.method_signature) = "parent";
95  }
96
97  // Gets details of a single ReportDetail.
98  rpc GetReportDetail(GetReportDetailRequest) returns (ReportDetail) {
99    option (google.api.http) = {
100      get: "/v1/{name=projects/*/locations/*/reportConfigs/*/reportDetails/*}"
101    };
102    option (google.api.method_signature) = "name";
103  }
104}
105
106// Message for requesting list of ReportConfigs
107message ListReportConfigsRequest {
108  // Required. Parent value for ListReportConfigsRequest
109  string parent = 1 [
110    (google.api.field_behavior) = REQUIRED,
111    (google.api.resource_reference) = {
112      child_type: "storageinsights.googleapis.com/ReportConfig"
113    }
114  ];
115
116  // Requested page size. Server may return fewer items than requested.
117  // If unspecified, server will pick an appropriate default.
118  int32 page_size = 2;
119
120  // A token identifying a page of results the server should return.
121  string page_token = 3;
122
123  // Filtering results
124  string filter = 4;
125
126  // Hint for how to order the results
127  string order_by = 5;
128}
129
130// Message for response to listing ReportConfigs
131message ListReportConfigsResponse {
132  // The list of ReportConfig
133  repeated ReportConfig report_configs = 1;
134
135  // A token identifying a page of results the server should return.
136  string next_page_token = 2;
137
138  // Locations that could not be reached.
139  repeated string unreachable = 3;
140}
141
142// Message for getting a ReportConfig
143message GetReportConfigRequest {
144  // Required. Name of the resource
145  string name = 1 [
146    (google.api.field_behavior) = REQUIRED,
147    (google.api.resource_reference) = {
148      type: "storageinsights.googleapis.com/ReportConfig"
149    }
150  ];
151}
152
153// Message for creating a ReportConfig
154message CreateReportConfigRequest {
155  // Required. Value for parent.
156  string parent = 1 [
157    (google.api.field_behavior) = REQUIRED,
158    (google.api.resource_reference) = {
159      child_type: "storageinsights.googleapis.com/ReportConfig"
160    }
161  ];
162
163  // Required. The resource being created
164  ReportConfig report_config = 3 [(google.api.field_behavior) = REQUIRED];
165
166  // Optional. An optional request ID to identify requests. Specify a unique
167  // request ID so that if you must retry your request, the server will know to
168  // ignore the request if it has already been completed. The server will
169  // guarantee that for at least 60 minutes since the first request.
170  //
171  // For example, consider a situation where you make an initial request and
172  // the request times out. If you make the request again with the same request
173  // ID, the server can check if original operation with the same request ID
174  // was received, and if so, will ignore the second request. This prevents
175  // clients from accidentally creating duplicate commitments.
176  //
177  // The request ID must be a valid UUID with the exception that zero UUID is
178  // not supported (00000000-0000-0000-0000-000000000000).
179  string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
180}
181
182// Message for updating a ReportConfig
183message UpdateReportConfigRequest {
184  // Required. Field mask is used to specify the fields to be overwritten in the
185  // ReportConfig resource by the update.
186  // The fields specified in the update_mask are relative to the resource, not
187  // the full request. A field will be overwritten if it is in the mask. If the
188  // user does not provide a mask then all fields will be overwritten.
189  google.protobuf.FieldMask update_mask = 1
190      [(google.api.field_behavior) = REQUIRED];
191
192  // Required. The resource being updated
193  ReportConfig report_config = 2 [(google.api.field_behavior) = REQUIRED];
194
195  // Optional. An optional request ID to identify requests. Specify a unique
196  // request ID so that if you must retry your request, the server will know to
197  // ignore the request if it has already been completed. The server will
198  // guarantee that for at least 60 minutes since the first request.
199  //
200  // For example, consider a situation where you make an initial request and
201  // the request times out. If you make the request again with the same request
202  // ID, the server can check if original operation with the same request ID
203  // was received, and if so, will ignore the second request. This prevents
204  // clients from accidentally creating duplicate commitments.
205  //
206  // The request ID must be a valid UUID with the exception that zero UUID is
207  // not supported (00000000-0000-0000-0000-000000000000).
208  string request_id = 3 [(google.api.field_behavior) = OPTIONAL];
209}
210
211// Message for deleting a ReportConfig
212message DeleteReportConfigRequest {
213  // Required. Name of the resource
214  string name = 1 [
215    (google.api.field_behavior) = REQUIRED,
216    (google.api.resource_reference) = {
217      type: "storageinsights.googleapis.com/ReportConfig"
218    }
219  ];
220
221  // Optional. If set, all ReportDetails for this ReportConfig will be deleted.
222  bool force = 2 [(google.api.field_behavior) = OPTIONAL];
223
224  // Optional. An optional request ID to identify requests. Specify a unique
225  // request ID so that if you must retry your request, the server will know to
226  // ignore the request if it has already been completed. The server will
227  // guarantee that for at least 60 minutes after the first request.
228  //
229  // For example, consider a situation where you make an initial request and
230  // the request times out. If you make the request again with the same request
231  // ID, the server can check if original operation with the same request ID
232  // was received, and if so, will ignore the second request. This prevents
233  // clients from accidentally creating duplicate commitments.
234  //
235  // The request ID must be a valid UUID with the exception that zero UUID is
236  // not supported (00000000-0000-0000-0000-000000000000).
237  string request_id = 3 [(google.api.field_behavior) = OPTIONAL];
238}
239
240// Message describing ReportDetail object. ReportDetail represents metadata of
241// generated reports for a ReportConfig.
242// Next ID: 10
243message ReportDetail {
244  option (google.api.resource) = {
245    type: "storageinsights.googleapis.com/ReportDetail"
246    pattern: "projects/{project}/locations/{location}/reportConfigs/{report_config}/reportDetails/{report_detail}"
247  };
248
249  // Different metrics associated with the generated report.
250  message Metrics {
251    // Count of Cloud Storage objects which are part of the report.
252    int64 processed_records_count = 1;
253  }
254
255  // Name of resource. It will be of form
256  // projects/<project>/locations/<location>/reportConfigs/<report-config-id>/reportDetails/<report-detail-id>.
257  string name = 1;
258
259  // The snapshot time.
260  // All the report data is referenced at this point of time.
261  google.protobuf.Timestamp snapshot_time = 2;
262
263  // Prefix of the object name of each report's shard. This will have full
264  // prefix except the "extension" and "shard_id".
265  // For example, if the `destination_path` is
266  // "{{report-config-id}}/dt={{datetime}}", the shard object name would be
267  // "gs://my-insights/1A34-F2E456-12B456-1C3D/dt=2022-05-20T06:35/1A34-F2E456-12B456-1C3D_2022-05-20T06:35_5.csv"
268  // and the value of `report_path_prefix` field would be
269  // "gs://my-insights/1A34-F2E456-12B456-1C3D/dt=2022-05-20T06:35/1A34-F2E456-12B456-1C3D_2022-05-20T06:35_".
270  string report_path_prefix = 8;
271
272  // Total shards generated for the report.
273  int64 shards_count = 9;
274
275  // Status of the ReportDetail.
276  google.rpc.Status status = 4;
277
278  // Labels as key value pairs
279  map<string, string> labels = 5;
280
281  // The date for which report is generated. The time part of target_datetime
282  // will be zero till we support multiple reports per day.
283  google.type.DateTime target_datetime = 6;
284
285  // Metrics of the report.
286  Metrics report_metrics = 7;
287}
288
289// Message for requesting list of ReportDetails
290message ListReportDetailsRequest {
291  // Required. Parent value for ListReportDetailsRequest
292  string parent = 1 [
293    (google.api.field_behavior) = REQUIRED,
294    (google.api.resource_reference) = {
295      child_type: "storageinsights.googleapis.com/ReportDetail"
296    }
297  ];
298
299  // Requested page size. Server may return fewer items than requested.
300  // If unspecified, server will pick an appropriate default.
301  int32 page_size = 2;
302
303  // A token identifying a page of results the server should return.
304  string page_token = 3;
305
306  // Filtering results
307  string filter = 4;
308
309  // Hint for how to order the results
310  string order_by = 5;
311}
312
313// Message for response to listing ReportDetails
314message ListReportDetailsResponse {
315  // The list of ReportDetail
316  repeated ReportDetail report_details = 1;
317
318  // A token identifying a page of results the server should return.
319  string next_page_token = 2;
320
321  // Locations that could not be reached.
322  repeated string unreachable = 3;
323}
324
325// Message for getting a ReportDetail
326message GetReportDetailRequest {
327  // Required. Name of the resource
328  string name = 1 [
329    (google.api.field_behavior) = REQUIRED,
330    (google.api.resource_reference) = {
331      type: "storageinsights.googleapis.com/ReportDetail"
332    }
333  ];
334}
335
336// Represents the metadata of the long-running operation.
337message OperationMetadata {
338  // Output only. The time the operation was created.
339  google.protobuf.Timestamp create_time = 1
340      [(google.api.field_behavior) = OUTPUT_ONLY];
341
342  // Output only. The time the operation finished running.
343  google.protobuf.Timestamp end_time = 2
344      [(google.api.field_behavior) = OUTPUT_ONLY];
345
346  // Output only. Server-defined resource path for the target of the operation.
347  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
348
349  // Output only. Name of the verb executed by the operation.
350  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
351
352  // Output only. Human-readable status of the operation, if any.
353  string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
354
355  // Output only. Identifies whether the user has requested cancellation
356  // of the operation. Operations that have been cancelled successfully
357  // have [Operation.error][] value with a
358  // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
359  // `Code.CANCELLED`.
360  bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
361
362  // Output only. API version used to start the operation.
363  string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
364}
365
366// ReportConfig Resource:
367//
368// Options to setup frequency of report generation.
369message FrequencyOptions {
370  // This ENUM specifies possible frequencies of report generation.
371  enum Frequency {
372    // Unspecified.
373    FREQUENCY_UNSPECIFIED = 0;
374
375    // Report will be generated daily.
376    DAILY = 1;
377
378    // Report will be generated weekly.
379    WEEKLY = 2;
380  }
381
382  // Frequency of report generation.
383  Frequency frequency = 1;
384
385  // The date from which report generation should start.
386  // UTC time zone.
387  google.type.Date start_date = 2;
388
389  // The date on which report generation should stop (Inclusive).
390  // UTC time zone.
391  google.type.Date end_date = 3;
392}
393
394// Options to configure CSV formatted reports.
395message CSVOptions {
396  // Record separator characters in CSV.
397  string record_separator = 1;
398
399  // Delimiter characters in CSV.
400  string delimiter = 2;
401
402  // If set, will include a header row in the CSV report.
403  bool header_required = 3;
404}
405
406// Options to configure Parquet formatted reports.
407message ParquetOptions {}
408
409// Options to filter data on storage systems.
410// Next ID: 2
411message CloudStorageFilters {
412  // Bucket for which the report will be generated.
413  string bucket = 1;
414}
415
416// Options to store reports in storage systems.
417// Next ID: 3
418message CloudStorageDestinationOptions {
419  // Destination bucket.
420  string bucket = 1;
421
422  // Destination path is the path in the bucket where the report should be
423  // generated.
424  string destination_path = 2;
425}
426
427// Report specification for exporting object metadata.
428// Next ID: 4
429message ObjectMetadataReportOptions {
430  // Metadata fields to be included in the report.
431  repeated string metadata_fields = 1;
432
433  // Filter options for storage systems.
434  oneof filter {
435    // Cloud Storage as the storage system.
436    CloudStorageFilters storage_filters = 2;
437  }
438
439  // Options on destination for storage systems.
440  oneof destination_options {
441    // Cloud Storage as the storage system.
442    CloudStorageDestinationOptions storage_destination_options = 3;
443  }
444}
445
446// Message describing ReportConfig object. ReportConfig is the configuration to
447// generate reports.
448// Next ID: 12
449message ReportConfig {
450  option (google.api.resource) = {
451    type: "storageinsights.googleapis.com/ReportConfig"
452    pattern: "projects/{project}/locations/{location}/reportConfigs/{report_config}"
453  };
454
455  // name of resource. It will be of form
456  // projects/<project>/locations/<location>/reportConfigs/<report-config-id>.
457  string name = 1;
458
459  // Output only. [Output only] Create time stamp
460  google.protobuf.Timestamp create_time = 2
461      [(google.api.field_behavior) = OUTPUT_ONLY];
462
463  // Output only. [Output only] Update time stamp
464  google.protobuf.Timestamp update_time = 3
465      [(google.api.field_behavior) = OUTPUT_ONLY];
466
467  // The frequency of report generation.
468  FrequencyOptions frequency_options = 5;
469
470  // Format in which report will be published.
471  oneof report_format {
472    // Options for CSV formatted reports.
473    CSVOptions csv_options = 6;
474
475    // Options for Parquet formatted reports.
476    ParquetOptions parquet_options = 7;
477  }
478
479  // Configuration options for report contents.
480  oneof report_kind {
481    // Report for exporting object metadata.
482    ObjectMetadataReportOptions object_metadata_report_options = 8;
483  }
484
485  // Labels as key value pairs
486  map<string, string> labels = 10;
487
488  // User provided display name which can be empty and limited to 256 characters
489  // that is editable.
490  string display_name = 11;
491}
492