xref: /aosp_15_r20/external/googleapis/google/devtools/resultstore/v2/resultstore_file_download.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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.devtools.resultstore.v2;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21
22option go_package = "google.golang.org/genproto/googleapis/devtools/resultstore/v2;resultstore";
23option java_multiple_files = true;
24option java_outer_classname = "ResultStoreFileDownloadProto";
25option java_package = "com.google.devtools.resultstore.v2";
26
27// This API allows download of File messages referenced in
28// ResultStore resources.
29service ResultStoreFileDownload {
30  option (google.api.default_host) = "resultstore.googleapis.com";
31  option (google.api.oauth_scopes) =
32      "https://www.googleapis.com/auth/cloud-platform";
33
34  // Retrieves the File with the given uri.
35  // returns a stream of bytes to be stitched together in order.
36  //
37  // An error will be reported in the following cases:
38  // - If the File is not found.
39  // - If the given File uri is badly formatted.
40  rpc GetFile(GetFileRequest) returns (stream GetFileResponse) {
41    option (google.api.http) = {
42      get: "/v2/{uri=file/*}"
43    };
44  }
45
46  // Retrieves the tail of a File with the given uri.
47  //
48  // An error will be reported in the following cases:
49  // - If the File is not found.
50  // - If the given File uri is badly formatted.
51  rpc GetFileTail(GetFileTailRequest) returns (GetFileTailResponse) {
52    option (google.api.http) = {
53      get: "/v2/{uri=file/tail/*}"
54    };
55  }
56}
57
58// Request object for GetFile
59message GetFileRequest {
60  // This corresponds to the uri field in the File message: for an obfuscated
61  // File.uri like
62  // CglidWlsZC5sb2cSJDI3YmI5ZWQxLTVjYzEtNGFlNi1iMWRkLTVlODY0YWEzYmE2ZQ, the
63  // value here should be
64  // files/CglidWlsZC5sb2cSJDI3YmI5ZWQxLTVjYzEtNGFlNi1iMWRkLTVlODY0YWEzYmE2ZQ
65  string uri = 1;
66
67  // The offset for the first byte to return in the read, relative to the start
68  // of the resource.
69  //
70  // A `read_offset` that is negative or greater than the size of the resource
71  // will cause an `OUT_OF_RANGE` error.
72  int64 read_offset = 2;
73
74  // The maximum number of `data` bytes the server is allowed to return in the
75  // sum of all `ReadResponse` messages. A `read_limit` of zero indicates that
76  // there is no limit, and a negative `read_limit` will cause an error.
77  //
78  // If the stream returns fewer bytes than allowed by the `read_limit` and no
79  // error occurred, the stream includes all data from the `read_offset` to the
80  // end of the resource.
81  int64 read_limit = 3;
82
83  // Only applies if the referenced file is a known archive type (ar, jar, zip)
84  // The above read_offset and read_limit fields are applied to this entry.
85  // If this file is not an archive, INVALID_ARGUMENT is thrown.
86  string archive_entry = 4;
87}
88
89// Response object for GetFile
90message GetFileResponse {
91  // The file data.
92  bytes data = 1;
93}
94
95// Request object for GetFileTail
96message GetFileTailRequest {
97  // This corresponds to the uri field in the File message: for an obfuscated
98  // File.uri like
99  // CglidWlsZC5sb2cSJDI3YmI5ZWQxLTVjYzEtNGFlNi1iMWRkLTVlODY0YWEzYmE2ZQ, the
100  // value here should be
101  // files/CglidWlsZC5sb2cSJDI3YmI5ZWQxLTVjYzEtNGFlNi1iMWRkLTVlODY0YWEzYmE2ZQ
102  string uri = 1;
103
104  // The offset for the first byte to return in the read, relative to the end
105  // of the resource.
106  //
107  // A `read_offset` that is negative or greater than the size of the resource
108  // will cause an `OUT_OF_RANGE` error.
109  int64 read_offset = 2;
110
111  // The maximum number of `data` bytes the server is allowed to return. The
112  // server will return bytes starting from the tail of the file.
113  //
114  // A `read_limit` of zero indicates that there is no limit, and a negative
115  // `read_limit` will cause an error.
116  int64 read_limit = 3;
117
118  // Only applies if the referenced file is a known archive type (ar, jar, zip)
119  // The above read_offset and read_limit fields are applied to this entry.
120  // If this file is not an archive, INVALID_ARGUMENT is thrown.
121  string archive_entry = 4;
122}
123
124// Response object for GetFileTail
125message GetFileTailResponse {
126  // The file data, encoded with UTF-8.
127  bytes data = 1;
128}
129