xref: /aosp_15_r20/external/googleapis/google/devtools/artifactregistry/v1/repository.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/duration.proto";
22import "google/protobuf/field_mask.proto";
23import "google/protobuf/timestamp.proto";
24
25option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1";
26option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb";
27option java_multiple_files = true;
28option java_outer_classname = "RepositoryProto";
29option java_package = "com.google.devtools.artifactregistry.v1";
30option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1";
31option ruby_package = "Google::Cloud::ArtifactRegistry::V1";
32option (google.api.resource_definition) = {
33  type: "secretmanager.googleapis.com/SecretVersion"
34  pattern: "projects/{project}/secrets/{secret}/versions/{secret_version}"
35};
36
37// Artifact policy configuration for the repository contents.
38message UpstreamPolicy {
39  // The user-provided ID of the upstream policy.
40  string id = 1;
41
42  // A reference to the repository resource, for example:
43  // `projects/p1/locations/us-central1/repositories/repo1`.
44  string repository = 2 [(google.api.resource_reference) = {
45    type: "artifactregistry.googleapis.com/Repository"
46  }];
47
48  // Entries with a greater priority value take precedence in the pull order.
49  int32 priority = 3;
50}
51
52// CleanupPolicyCondition is a set of conditions attached to a CleanupPolicy.
53// If multiple entries are set, all must be satisfied for the condition to be
54// satisfied.
55message CleanupPolicyCondition {
56  // Statuses applying to versions.
57  enum TagState {
58    // Tag status not specified.
59    TAG_STATE_UNSPECIFIED = 0;
60
61    // Applies to tagged versions only.
62    TAGGED = 1;
63
64    // Applies to untagged versions only.
65    UNTAGGED = 2;
66
67    // Applies to all versions.
68    ANY = 3;
69  }
70
71  // Match versions by tag status.
72  optional TagState tag_state = 2;
73
74  // Match versions by tag prefix. Applied on any prefix match.
75  repeated string tag_prefixes = 3;
76
77  // Match versions by version name prefix. Applied on any prefix match.
78  repeated string version_name_prefixes = 4;
79
80  // Match versions by package prefix. Applied on any prefix match.
81  repeated string package_name_prefixes = 5;
82
83  // Match versions older than a duration.
84  optional google.protobuf.Duration older_than = 6;
85
86  // Match versions newer than a duration.
87  optional google.protobuf.Duration newer_than = 7;
88}
89
90// CleanupPolicyMostRecentVersions is an alternate condition of a CleanupPolicy
91// for retaining a minimum number of versions.
92message CleanupPolicyMostRecentVersions {
93  // List of package name prefixes that will apply this rule.
94  repeated string package_name_prefixes = 1;
95
96  // Minimum number of versions to keep.
97  optional int32 keep_count = 2;
98}
99
100// Artifact policy configuration for repository cleanup policies.
101message CleanupPolicy {
102  // Action type for a cleanup policy.
103  enum Action {
104    // Action not specified.
105    ACTION_UNSPECIFIED = 0;
106
107    // Delete action.
108    DELETE = 1;
109
110    // Keep action.
111    KEEP = 2;
112  }
113
114  oneof condition_type {
115    // Policy condition for matching versions.
116    CleanupPolicyCondition condition = 2;
117
118    // Policy condition for retaining a minimum number of versions. May only be
119    // specified with a Keep action.
120    CleanupPolicyMostRecentVersions most_recent_versions = 4;
121  }
122
123  // The user-provided ID of the cleanup policy.
124  string id = 1;
125
126  // Policy action.
127  Action action = 3;
128}
129
130// Virtual repository configuration.
131message VirtualRepositoryConfig {
132  // Policies that configure the upstream artifacts distributed by the Virtual
133  // Repository. Upstream policies cannot be set on a standard repository.
134  repeated UpstreamPolicy upstream_policies = 1;
135}
136
137// Remote repository configuration.
138message RemoteRepositoryConfig {
139  // The credentials to access the remote repository.
140  message UpstreamCredentials {
141    // Username and password credentials.
142    message UsernamePasswordCredentials {
143      // The username to access the remote repository.
144      string username = 1;
145
146      // The Secret Manager key version that holds the password to access the
147      // remote repository. Must be in the format of
148      // `projects/{project}/secrets/{secret}/versions/{version}`.
149      string password_secret_version = 2 [(google.api.resource_reference) = {
150        type: "secretmanager.googleapis.com/SecretVersion"
151      }];
152    }
153
154    oneof credentials {
155      // Use username and password to access the remote repository.
156      UsernamePasswordCredentials username_password_credentials = 1;
157    }
158  }
159
160  // Configuration for a Docker remote repository.
161  message DockerRepository {
162    // Predefined list of publicly available Docker repositories like Docker
163    // Hub.
164    enum PublicRepository {
165      // Unspecified repository.
166      PUBLIC_REPOSITORY_UNSPECIFIED = 0;
167
168      // Docker Hub.
169      DOCKER_HUB = 1;
170    }
171
172    // Address of the remote repository.
173    oneof upstream {
174      // One of the publicly available Docker repositories supported by Artifact
175      // Registry.
176      PublicRepository public_repository = 1;
177    }
178  }
179
180  // Configuration for a Maven remote repository.
181  message MavenRepository {
182    // Predefined list of publicly available Maven repositories like Maven
183    // Central.
184    enum PublicRepository {
185      // Unspecified repository.
186      PUBLIC_REPOSITORY_UNSPECIFIED = 0;
187
188      // Maven Central.
189      MAVEN_CENTRAL = 1;
190    }
191
192    // Address of the remote repository.
193    oneof upstream {
194      // One of the publicly available Maven repositories supported by Artifact
195      // Registry.
196      PublicRepository public_repository = 1;
197    }
198  }
199
200  // Configuration for a Npm remote repository.
201  message NpmRepository {
202    // Predefined list of publicly available NPM repositories like npmjs.
203    enum PublicRepository {
204      // Unspecified repository.
205      PUBLIC_REPOSITORY_UNSPECIFIED = 0;
206
207      // npmjs.
208      NPMJS = 1;
209    }
210
211    // Address of the remote repository
212    oneof upstream {
213      // One of the publicly available Npm repositories supported by Artifact
214      // Registry.
215      PublicRepository public_repository = 1;
216    }
217  }
218
219  // Configuration for a Python remote repository.
220  message PythonRepository {
221    // Predefined list of publicly available Python repositories like PyPI.org.
222    enum PublicRepository {
223      // Unspecified repository.
224      PUBLIC_REPOSITORY_UNSPECIFIED = 0;
225
226      // PyPI.
227      PYPI = 1;
228    }
229
230    // Address of the remote repository.
231    oneof upstream {
232      // One of the publicly available Python repositories supported by Artifact
233      // Registry.
234      PublicRepository public_repository = 1;
235    }
236  }
237
238  // Configuration for an Apt remote repository.
239  message AptRepository {
240    // Publicly available Apt repositories constructed from a common repository
241    // base and a custom repository path.
242    message PublicRepository {
243      // Predefined list of publicly available repository bases for Apt.
244      enum RepositoryBase {
245        // Unspecified repository base.
246        REPOSITORY_BASE_UNSPECIFIED = 0;
247
248        // Debian.
249        DEBIAN = 1;
250
251        // Ubuntu LTS/Pro.
252        UBUNTU = 2;
253      }
254
255      // A common public repository base for Apt.
256      RepositoryBase repository_base = 1;
257
258      // A custom field to define a path to a specific repository from the base.
259      string repository_path = 2;
260    }
261
262    // Address of the remote repository.
263    oneof upstream {
264      // One of the publicly available Apt repositories supported by Artifact
265      // Registry.
266      PublicRepository public_repository = 1;
267    }
268  }
269
270  // Configuration for a Yum remote repository.
271  message YumRepository {
272    // Publicly available Yum repositories constructed from a common repository
273    // base and a custom repository path.
274    message PublicRepository {
275      // Predefined list of publicly available repository bases for Yum.
276      enum RepositoryBase {
277        // Unspecified repository base.
278        REPOSITORY_BASE_UNSPECIFIED = 0;
279
280        // CentOS.
281        CENTOS = 1;
282
283        // CentOS Debug.
284        CENTOS_DEBUG = 2;
285
286        // CentOS Vault.
287        CENTOS_VAULT = 3;
288
289        // CentOS Stream.
290        CENTOS_STREAM = 4;
291
292        // Rocky.
293        ROCKY = 5;
294
295        // Fedora Extra Packages for Enterprise Linux (EPEL).
296        EPEL = 6;
297      }
298
299      // A common public repository base for Yum.
300      RepositoryBase repository_base = 1;
301
302      // A custom field to define a path to a specific repository from the base.
303      string repository_path = 2;
304    }
305
306    // Address of the remote repository.
307    oneof upstream {
308      // One of the publicly available Yum repositories supported by Artifact
309      // Registry.
310      PublicRepository public_repository = 1;
311    }
312  }
313
314  // Settings specific to the remote repository.
315  oneof remote_source {
316    // Specific settings for a Docker remote repository.
317    DockerRepository docker_repository = 2;
318
319    // Specific settings for a Maven remote repository.
320    MavenRepository maven_repository = 3;
321
322    // Specific settings for an Npm remote repository.
323    NpmRepository npm_repository = 4;
324
325    // Specific settings for a Python remote repository.
326    PythonRepository python_repository = 5;
327
328    // Specific settings for an Apt remote repository.
329    AptRepository apt_repository = 6;
330
331    // Specific settings for a Yum remote repository.
332    YumRepository yum_repository = 7;
333  }
334
335  // The description of the remote source.
336  string description = 1;
337
338  // Optional. The credentials used to access the remote repository.
339  UpstreamCredentials upstream_credentials = 9
340      [(google.api.field_behavior) = OPTIONAL];
341}
342
343// A Repository for storing artifacts with a specific format.
344message Repository {
345  option (google.api.resource) = {
346    type: "artifactregistry.googleapis.com/Repository"
347    pattern: "projects/{project}/locations/{location}/repositories/{repository}"
348  };
349
350  // MavenRepositoryConfig is maven related repository details.
351  // Provides additional configuration details for repositories of the maven
352  // format type.
353  message MavenRepositoryConfig {
354    // VersionPolicy is the version policy for the repository.
355    enum VersionPolicy {
356      // VERSION_POLICY_UNSPECIFIED - the version policy is not defined.
357      // When the version policy is not defined, no validation is performed
358      // for the versions.
359      VERSION_POLICY_UNSPECIFIED = 0;
360
361      // RELEASE - repository will accept only Release versions.
362      RELEASE = 1;
363
364      // SNAPSHOT - repository will accept only Snapshot versions.
365      SNAPSHOT = 2;
366    }
367
368    // The repository with this flag will allow publishing
369    // the same snapshot versions.
370    bool allow_snapshot_overwrites = 1;
371
372    // Version policy defines the versions that the registry will accept.
373    VersionPolicy version_policy = 2;
374  }
375
376  // DockerRepositoryConfig is docker related repository details.
377  // Provides additional configuration details for repositories of the docker
378  // format type.
379  message DockerRepositoryConfig {
380    // The repository which enabled this flag prevents all tags from being
381    // modified, moved or deleted. This does not prevent tags from being
382    // created.
383    bool immutable_tags = 1;
384  }
385
386  // A package format.
387  enum Format {
388    // Unspecified package format.
389    FORMAT_UNSPECIFIED = 0;
390
391    // Docker package format.
392    DOCKER = 1;
393
394    // Maven package format.
395    MAVEN = 2;
396
397    // NPM package format.
398    NPM = 3;
399
400    // APT package format.
401    APT = 5;
402
403    // YUM package format.
404    YUM = 6;
405
406    // Python package format.
407    PYTHON = 8;
408
409    // Kubeflow Pipelines package format.
410    KFP = 9;
411
412    // Go package format.
413    GO = 10;
414  }
415
416  // The mode configures the repository to serve artifacts from different
417  // sources.
418  enum Mode {
419    // Unspecified mode.
420    MODE_UNSPECIFIED = 0;
421
422    // A standard repository storing artifacts.
423    STANDARD_REPOSITORY = 1;
424
425    // A virtual repository to serve artifacts from one or more sources.
426    VIRTUAL_REPOSITORY = 2;
427
428    // A remote repository to serve artifacts from a remote source.
429    REMOTE_REPOSITORY = 3;
430  }
431
432  // Repository-specific configurations.
433  oneof format_config {
434    // Maven repository config contains repository level configuration
435    // for the repositories of maven type.
436    MavenRepositoryConfig maven_config = 9;
437
438    // Docker repository config contains repository level configuration
439    // for the repositories of docker type.
440    DockerRepositoryConfig docker_config = 17;
441  }
442
443  // Repository configuration specific to the Mode value being selected (Remote
444  // or Virtual)
445  oneof mode_config {
446    // Configuration specific for a Virtual Repository.
447    VirtualRepositoryConfig virtual_repository_config = 14;
448
449    // Configuration specific for a Remote Repository.
450    RemoteRepositoryConfig remote_repository_config = 15;
451  }
452
453  // The name of the repository, for example:
454  // `projects/p1/locations/us-central1/repositories/repo1`.
455  string name = 1;
456
457  // Optional. The format of packages that are stored in the repository.
458  Format format = 2 [(google.api.field_behavior) = OPTIONAL];
459
460  // The user-provided description of the repository.
461  string description = 3;
462
463  // Labels with user-defined metadata.
464  // This field may contain up to 64 entries. Label keys and values may be no
465  // longer than 63 characters. Label keys must begin with a lowercase letter
466  // and may only contain lowercase letters, numeric characters, underscores,
467  // and dashes.
468  map<string, string> labels = 4;
469
470  // Output only. The time when the repository was created.
471  google.protobuf.Timestamp create_time = 5
472      [(google.api.field_behavior) = OUTPUT_ONLY];
473
474  // Output only. The time when the repository was last updated.
475  google.protobuf.Timestamp update_time = 6
476      [(google.api.field_behavior) = OUTPUT_ONLY];
477
478  // The Cloud KMS resource name of the customer managed encryption key that's
479  // used to encrypt the contents of the Repository. Has the form:
480  // `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`.
481  // This value may not be changed after the Repository has been created.
482  string kms_key_name = 8;
483
484  // Optional. The mode of the repository.
485  Mode mode = 10 [(google.api.field_behavior) = OPTIONAL];
486
487  // Optional. Cleanup policies for this repository. Cleanup policies indicate
488  // when certain package versions can be automatically deleted. Map keys are
489  // policy IDs supplied by users during policy creation. They must unique
490  // within a repository and be under 128 characters in length.
491  map<string, CleanupPolicy> cleanup_policies = 12
492      [(google.api.field_behavior) = OPTIONAL];
493
494  // Output only. The size, in bytes, of all artifact storage in this
495  // repository. Repositories that are generally available or in public preview
496  //  use this to calculate storage costs.
497  int64 size_bytes = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
498
499  // Output only. If set, the repository satisfies physical zone separation.
500  bool satisfies_pzs = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
501
502  // Optional. If true, the cleanup pipeline is prevented from deleting versions
503  // in this repository.
504  bool cleanup_policy_dry_run = 18 [(google.api.field_behavior) = OPTIONAL];
505}
506
507// The request to list repositories.
508message ListRepositoriesRequest {
509  // Required. The name of the parent resource whose repositories will be
510  // listed.
511  string parent = 1 [
512    (google.api.field_behavior) = REQUIRED,
513    (google.api.resource_reference) = {
514      child_type: "artifactregistry.googleapis.com/Repository"
515    }
516  ];
517
518  // The maximum number of repositories to return. Maximum page size is 1,000.
519  int32 page_size = 2;
520
521  // The next_page_token value returned from a previous list request, if any.
522  string page_token = 3;
523}
524
525// The response from listing repositories.
526message ListRepositoriesResponse {
527  // The repositories returned.
528  repeated Repository repositories = 1;
529
530  // The token to retrieve the next page of repositories, or empty if there are
531  // no more repositories to return.
532  string next_page_token = 2;
533}
534
535// The request to retrieve a repository.
536message GetRepositoryRequest {
537  // Required. The name of the repository to retrieve.
538  string name = 1 [
539    (google.api.field_behavior) = REQUIRED,
540    (google.api.resource_reference) = {
541      type: "artifactregistry.googleapis.com/Repository"
542    }
543  ];
544}
545
546// The request to create a new repository.
547message CreateRepositoryRequest {
548  // Required. The name of the parent resource where the repository will be
549  // created.
550  string parent = 1 [
551    (google.api.field_behavior) = REQUIRED,
552    (google.api.resource_reference) = {
553      child_type: "artifactregistry.googleapis.com/Repository"
554    }
555  ];
556
557  // Required. The repository id to use for this repository.
558  string repository_id = 2 [(google.api.field_behavior) = REQUIRED];
559
560  // Required. The repository to be created.
561  Repository repository = 3 [(google.api.field_behavior) = REQUIRED];
562}
563
564// The request to update a repository.
565message UpdateRepositoryRequest {
566  // The repository that replaces the resource on the server.
567  Repository repository = 1;
568
569  // The update mask applies to the resource. For the `FieldMask` definition,
570  // see
571  // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
572  google.protobuf.FieldMask update_mask = 2;
573}
574
575// The request to delete a repository.
576message DeleteRepositoryRequest {
577  // Required. The name of the repository to delete.
578  string name = 1 [
579    (google.api.field_behavior) = REQUIRED,
580    (google.api.resource_reference) = {
581      type: "artifactregistry.googleapis.com/Repository"
582    }
583  ];
584}
585