xref: /aosp_15_r20/external/googleapis/google/devtools/artifactregistry/v1/file.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.artifactregistry.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/protobuf/timestamp.proto";
22
23option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1";
24option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb";
25option java_multiple_files = true;
26option java_outer_classname = "FileProto";
27option java_package = "com.google.devtools.artifactregistry.v1";
28option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1";
29option ruby_package = "Google::Cloud::ArtifactRegistry::V1";
30
31// A hash of file content.
32message Hash {
33  // The algorithm used to compute the hash.
34  enum HashType {
35    // Unspecified.
36    HASH_TYPE_UNSPECIFIED = 0;
37
38    // SHA256 hash.
39    SHA256 = 1;
40
41    // MD5 hash.
42    MD5 = 2;
43  }
44
45  // The algorithm used to compute the hash value.
46  HashType type = 1;
47
48  // The hash value.
49  bytes value = 2;
50}
51
52// Files store content that is potentially associated with Packages or Versions.
53message File {
54  option (google.api.resource) = {
55    type: "artifactregistry.googleapis.com/File"
56    pattern: "projects/{project}/locations/{location}/repositories/{repository}/files/{file}"
57  };
58
59  // The name of the file, for example:
60  // "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt".
61  // If the file ID part contains slashes, they are escaped.
62  string name = 1;
63
64  // The size of the File in bytes.
65  int64 size_bytes = 3;
66
67  // The hashes of the file content.
68  repeated Hash hashes = 4;
69
70  // Output only. The time when the File was created.
71  google.protobuf.Timestamp create_time = 5
72      [(google.api.field_behavior) = OUTPUT_ONLY];
73
74  // Output only. The time when the File was last updated.
75  google.protobuf.Timestamp update_time = 6
76      [(google.api.field_behavior) = OUTPUT_ONLY];
77
78  // The name of the Package or Version that owns this file, if any.
79  string owner = 7;
80
81  // Output only. The time when the last attempt to refresh the file's data was
82  // made. Only set when the repository is remote.
83  google.protobuf.Timestamp fetch_time = 8
84      [(google.api.field_behavior) = OUTPUT_ONLY];
85}
86
87// The request to list files.
88message ListFilesRequest {
89  // Required. The name of the repository whose files will be listed. For
90  // example: "projects/p1/locations/us-central1/repositories/repo1
91  string parent = 1 [
92    (google.api.field_behavior) = REQUIRED,
93    (google.api.resource_reference) = {
94      child_type: "artifactregistry.googleapis.com/File"
95    }
96  ];
97
98  // An expression for filtering the results of the request. Filter rules are
99  // case insensitive. The fields eligible for filtering are:
100  //
101  //   * `name`
102  //   * `owner`
103  //
104  //  An example of using a filter:
105  //
106  //   * `name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"` --> Files with an
107  //   ID starting with "a/b/".
108  //   * `owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"` -->
109  //   Files owned by the version `1.0` in package `pkg1`.
110  string filter = 4;
111
112  // The maximum number of files to return.
113  int32 page_size = 2;
114
115  // The next_page_token value returned from a previous list request, if any.
116  string page_token = 3;
117
118  // The field to order the results by.
119  string order_by = 5;
120}
121
122// The response from listing files.
123message ListFilesResponse {
124  // The files returned.
125  repeated File files = 1;
126
127  // The token to retrieve the next page of files, or empty if there are no
128  // more files to return.
129  string next_page_token = 2;
130}
131
132// The request to retrieve a file.
133message GetFileRequest {
134  // Required. The name of the file to retrieve.
135  string name = 1 [
136    (google.api.field_behavior) = REQUIRED,
137    (google.api.resource_reference) = {
138      type: "artifactregistry.googleapis.com/File"
139    }
140  ];
141}
142