Skip to content

Commit 76ff1e5

Browse files
Google APIscopybara-github
authored andcommitted
feat: add APIs for importing and uploading Apt and Yum artifacts
feat: add version policy support for Maven repositories feat: add order_by support for listing versions fix!: mark a few resource name fields as required PiperOrigin-RevId: 423145765
1 parent 86c3294 commit 76ff1e5

10 files changed

Lines changed: 486 additions & 40 deletions

File tree

google/devtools/artifactregistry/v1beta2/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ proto_library(
2828
"settings.proto",
2929
"tag.proto",
3030
"version.proto",
31+
"apt_artifact.proto",
32+
"yum_artifact.proto",
3133
],
3234
deps = [
3335
"//google/api:annotations_proto",
@@ -37,8 +39,10 @@ proto_library(
3739
"//google/iam/v1:iam_policy_proto",
3840
"//google/iam/v1:policy_proto",
3941
"//google/longrunning:operations_proto",
42+
"//google/rpc:status_proto",
4043
"@com_google_protobuf//:empty_proto",
4144
"@com_google_protobuf//:field_mask_proto",
45+
"@com_google_protobuf//:struct_proto",
4246
"@com_google_protobuf//:timestamp_proto",
4347
],
4448
)
@@ -127,6 +131,7 @@ go_proto_library(
127131
"//google/api:annotations_go_proto",
128132
"//google/iam/v1:iam_go_proto",
129133
"//google/longrunning:longrunning_go_proto",
134+
"//google/rpc:status_go_proto",
130135
],
131136
)
132137

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// Copyright 2022 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+
15+
syntax = "proto3";
16+
17+
package google.devtools.artifactregistry.v1beta2;
18+
19+
import "google/api/annotations.proto";
20+
import "google/api/field_behavior.proto";
21+
import "google/api/resource.proto";
22+
import "google/longrunning/operations.proto";
23+
import "google/rpc/status.proto";
24+
25+
option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2";
26+
option go_package = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2;artifactregistry";
27+
option java_multiple_files = true;
28+
option java_outer_classname = "AptArtifactProto";
29+
option java_package = "com.google.devtools.artifactregistry.v1beta2";
30+
option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2";
31+
option ruby_package = "Google::Cloud::ArtifactRegistry::V1beta2";
32+
33+
// A detailed representation of an Apt artifact. Information in the record
34+
// is derived from the archive's control file.
35+
// See https://www.debian.org/doc/debian-policy/ch-controlfields.html
36+
message AptArtifact {
37+
option (google.api.resource) = {
38+
type: "artifactregistry.googleapis.com/AptArtifact"
39+
pattern: "projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}"
40+
};
41+
42+
// Package type is either binary or source.
43+
enum PackageType {
44+
// Package type is not specified.
45+
PACKAGE_TYPE_UNSPECIFIED = 0;
46+
47+
// Binary package.
48+
BINARY = 1;
49+
50+
// Source package.
51+
SOURCE = 2;
52+
}
53+
54+
// Output only. The Artifact Registry resource name of the artifact.
55+
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
56+
57+
// Output only. The Apt package name of the artifact.
58+
string package_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
59+
60+
// Output only. An artifact is a binary or source package.
61+
PackageType package_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
62+
63+
// Output only. Operating system architecture of the artifact.
64+
string architecture = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
65+
66+
// Output only. Repository component of the artifact.
67+
string component = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
68+
69+
// Output only. Contents of the artifact's control metadata file.
70+
bytes control_file = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
71+
}
72+
73+
// Google Cloud Storage location where the artifacts currently reside.
74+
message ImportAptArtifactsGcsSource {
75+
// Cloud Storage paths URI (e.g., gs://my_bucket//my_object).
76+
repeated string uris = 1;
77+
78+
// Supports URI wildcards for matching multiple objects from a single URI.
79+
bool use_wildcards = 2;
80+
}
81+
82+
// The request to import new apt artifacts.
83+
message ImportAptArtifactsRequest {
84+
// The source location of the package binaries.
85+
oneof source {
86+
// Google Cloud Storage location where input content is located.
87+
ImportAptArtifactsGcsSource gcs_source = 2;
88+
}
89+
90+
// The name of the parent resource where the artifacts will be imported.
91+
string parent = 1;
92+
}
93+
94+
// Error information explaining why a package was not imported.
95+
message ImportAptArtifactsErrorInfo {
96+
// The source that was not imported.
97+
oneof source {
98+
// Google Cloud Storage location requested.
99+
ImportAptArtifactsGcsSource gcs_source = 1;
100+
}
101+
102+
// The detailed error status.
103+
google.rpc.Status error = 2;
104+
}
105+
106+
// The response message from importing APT artifacts.
107+
message ImportAptArtifactsResponse {
108+
// The Apt artifacts imported.
109+
repeated AptArtifact apt_artifacts = 1;
110+
111+
// Detailed error info for artifacts that were not imported.
112+
repeated ImportAptArtifactsErrorInfo errors = 2;
113+
}
114+
115+
// The operation metadata for importing artifacts.
116+
message ImportAptArtifactsMetadata {
117+
}

google/devtools/artifactregistry/v1beta2/artifactregistry_v1beta2.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ title: Artifact Registry API
66
apis:
77
- name: google.devtools.artifactregistry.v1beta2.ArtifactRegistry
88

9+
types:
10+
- name: google.devtools.artifactregistry.v1beta2.ImportAptArtifactsResponse
11+
- name: google.devtools.artifactregistry.v1beta2.ImportAptArtifactsMetadata
12+
- name: google.devtools.artifactregistry.v1beta2.ImportYumArtifactsResponse
13+
- name: google.devtools.artifactregistry.v1beta2.ImportYumArtifactsMetadata
14+
- name: google.devtools.artifactregistry.v1beta2.OperationMetadata
15+
916
documentation:
1017
summary: |-
1118
Store and manage build artifacts in a scalable and integrated service built

google/devtools/artifactregistry/v1beta2/file.proto

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ syntax = "proto3";
1616

1717
package google.devtools.artifactregistry.v1beta2;
1818

19+
import "google/api/annotations.proto";
1920
import "google/api/resource.proto";
2021
import "google/protobuf/timestamp.proto";
21-
import "google/api/annotations.proto";
2222

2323
option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2";
2424
option go_package = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2;artifactregistry";
@@ -37,6 +37,9 @@ message Hash {
3737

3838
// SHA256 hash.
3939
SHA256 = 1;
40+
41+
// MD5 hash.
42+
MD5 = 2;
4043
}
4144

4245
// The algorithm used to compute the hash value.
@@ -54,7 +57,8 @@ message File {
5457
};
5558

5659
// The name of the file, for example:
57-
// "projects/p1/locations/us-central1/repositories/repo1/files/a/b/c.txt".
60+
// "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt".
61+
// If the file ID part contains slashes, they are escaped.
5862
string name = 1;
5963

6064
// The size of the File in bytes.

google/devtools/artifactregistry/v1beta2/repository.proto

Lines changed: 80 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ syntax = "proto3";
1616

1717
package google.devtools.artifactregistry.v1beta2;
1818

19+
import "google/api/annotations.proto";
20+
import "google/api/field_behavior.proto";
1921
import "google/api/resource.proto";
2022
import "google/protobuf/field_mask.proto";
2123
import "google/protobuf/timestamp.proto";
22-
import "google/api/annotations.proto";
2324

2425
option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2";
2526
option go_package = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2;artifactregistry";
@@ -36,13 +37,61 @@ message Repository {
3637
pattern: "projects/{project}/locations/{location}/repositories/{repository}"
3738
};
3839

40+
// MavenRepositoryConfig is maven related repository details.
41+
// Provides additional configuration details for repositories of the maven
42+
// format type.
43+
message MavenRepositoryConfig {
44+
// VersionPolicy is the version policy for the repository.
45+
enum VersionPolicy {
46+
// VERSION_POLICY_UNSPECIFIED - the version policy is not defined.
47+
// When the version policy is not defined, no validation is performed
48+
// for the versions.
49+
VERSION_POLICY_UNSPECIFIED = 0;
50+
51+
// RELEASE - repository will accept only Release versions.
52+
RELEASE = 1;
53+
54+
// SNAPSHOT - repository will accept only Snapshot versions.
55+
SNAPSHOT = 2;
56+
}
57+
58+
// The repository with this flag will allow publishing
59+
// the same snapshot versions.
60+
bool allow_snapshot_overwrites = 1;
61+
62+
// Version policy defines the versions that the registry will accept.
63+
VersionPolicy version_policy = 2;
64+
}
65+
3966
// A package format.
4067
enum Format {
4168
// Unspecified package format.
4269
FORMAT_UNSPECIFIED = 0;
4370

4471
// Docker package format.
4572
DOCKER = 1;
73+
74+
// Maven package format.
75+
MAVEN = 2;
76+
77+
// NPM package format.
78+
NPM = 3;
79+
80+
// APT package format.
81+
APT = 5;
82+
83+
// YUM package format.
84+
YUM = 6;
85+
86+
// Python package format.
87+
PYTHON = 8;
88+
}
89+
90+
// Repository-specific configurations.
91+
oneof format_config {
92+
// Maven repository config contains repository level configuration
93+
// for the repositories of maven type.
94+
MavenRepositoryConfig maven_config = 9;
4695
}
4796

4897
// The name of the repository, for example:
@@ -77,11 +126,15 @@ message Repository {
77126

78127
// The request to list repositories.
79128
message ListRepositoriesRequest {
80-
// The name of the parent resource whose repositories will be listed.
81-
string parent = 1;
82-
83-
// The maximum number of repositories to return.
84-
// Maximum page size is 10,000.
129+
// Required. The name of the parent resource whose repositories will be listed.
130+
string parent = 1 [
131+
(google.api.field_behavior) = REQUIRED,
132+
(google.api.resource_reference) = {
133+
child_type: "artifactregistry.googleapis.com/Repository"
134+
}
135+
];
136+
137+
// The maximum number of repositories to return. Maximum page size is 1,000.
85138
int32 page_size = 2;
86139

87140
// The next_page_token value returned from a previous list request, if any.
@@ -100,14 +153,24 @@ message ListRepositoriesResponse {
100153

101154
// The request to retrieve a repository.
102155
message GetRepositoryRequest {
103-
// The name of the repository to retrieve.
104-
string name = 1;
156+
// Required. The name of the repository to retrieve.
157+
string name = 1 [
158+
(google.api.field_behavior) = REQUIRED,
159+
(google.api.resource_reference) = {
160+
type: "artifactregistry.googleapis.com/Repository"
161+
}
162+
];
105163
}
106164

107165
// The request to create a new repository.
108166
message CreateRepositoryRequest {
109-
// The name of the parent resource where the repository will be created.
110-
string parent = 1;
167+
// Required. The name of the parent resource where the repository will be created.
168+
string parent = 1 [
169+
(google.api.field_behavior) = REQUIRED,
170+
(google.api.resource_reference) = {
171+
child_type: "artifactregistry.googleapis.com/Repository"
172+
}
173+
];
111174

112175
// The repository id to use for this repository.
113176
string repository_id = 2;
@@ -129,6 +192,11 @@ message UpdateRepositoryRequest {
129192

130193
// The request to delete a repository.
131194
message DeleteRepositoryRequest {
132-
// The name of the repository to delete.
133-
string name = 1;
195+
// Required. The name of the repository to delete.
196+
string name = 1 [
197+
(google.api.field_behavior) = REQUIRED,
198+
(google.api.resource_reference) = {
199+
type: "artifactregistry.googleapis.com/Repository"
200+
}
201+
];
134202
}

0 commit comments

Comments
 (0)