Skip to content

Commit 535d161

Browse files
Google APIscopybara-github
authored andcommitted
feat: add ExportArtifact API
PiperOrigin-RevId: 839457154
1 parent 2faf4a6 commit 535d161

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed

google/devtools/artifactregistry/v1/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ proto_library(
2727
"apt_artifact.proto",
2828
"artifact.proto",
2929
"attachment.proto",
30+
"export.proto",
3031
"file.proto",
3132
"generic.proto",
3233
"go.proto",

google/devtools/artifactregistry/v1/artifactregistry_v1.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ apis:
1010

1111
types:
1212
- name: google.devtools.artifactregistry.v1.BatchDeleteVersionsMetadata
13+
- name: google.devtools.artifactregistry.v1.ExportArtifactMetadata
14+
- name: google.devtools.artifactregistry.v1.ExportArtifactResponse
1315
- name: google.devtools.artifactregistry.v1.GenericArtifact
1416
- name: google.devtools.artifactregistry.v1.GoModule
1517
- name: google.devtools.artifactregistry.v1.ImportAptArtifactsMetadata
@@ -116,6 +118,10 @@ authentication:
116118
oauth:
117119
canonical_scopes: |-
118120
https://www.googleapis.com/auth/cloud-platform
121+
- selector: google.devtools.artifactregistry.v1.ArtifactRegistry.ExportArtifact
122+
oauth:
123+
canonical_scopes: |-
124+
https://www.googleapis.com/auth/cloud-platform
119125
- selector: google.devtools.artifactregistry.v1.ArtifactRegistry.ImportAptArtifacts
120126
oauth:
121127
canonical_scopes: |-
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// Copyright 2025 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.v1;
18+
19+
import "google/api/field_behavior.proto";
20+
import "google/api/resource.proto";
21+
import "google/devtools/artifactregistry/v1/file.proto";
22+
import "google/devtools/artifactregistry/v1/version.proto";
23+
24+
option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1";
25+
option go_package = "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb;artifactregistrypb";
26+
option java_multiple_files = true;
27+
option java_outer_classname = "ExportProto";
28+
option java_package = "com.google.devtools.artifactregistry.v1";
29+
option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1";
30+
option ruby_package = "Google::Cloud::ArtifactRegistry::V1";
31+
32+
// The request for exporting an artifact to a destination.
33+
message ExportArtifactRequest {
34+
// The artifact to be exported.
35+
oneof source_artifact {
36+
// The artifact version to export.
37+
// Format:
38+
// projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}
39+
string source_version = 2 [(google.api.resource_reference) = {
40+
type: "artifactregistry.googleapis.com/Version"
41+
}];
42+
43+
// The artifact tag to export.
44+
// Format:projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}
45+
string source_tag = 4 [(google.api.resource_reference) = {
46+
type: "artifactregistry.googleapis.com/Tag"
47+
}];
48+
}
49+
50+
// The destination to export the artifact to.
51+
oneof destination {
52+
// The Cloud Storage path to export the artifact to. Should start with the
53+
// bucket name, and optionally have a directory path. Examples:
54+
// `dst_bucket`, `dst_bucket/sub_dir`.
55+
// Existing objects with the same path will be overwritten.
56+
string gcs_path = 3;
57+
}
58+
59+
// Required. The repository of the artifact to export.
60+
// Format: projects/{project}/locations/{location}/repositories/{repository}
61+
string repository = 1 [
62+
(google.api.field_behavior) = REQUIRED,
63+
(google.api.resource_reference) = {
64+
type: "artifactregistry.googleapis.com/Repository"
65+
}
66+
];
67+
}
68+
69+
// The response for exporting an artifact to a destination.
70+
message ExportArtifactResponse {
71+
// The exported version. Should be the same as the request version with
72+
// fingerprint resource name.
73+
Version exported_version = 1;
74+
}
75+
76+
// The LRO metadata for exporting an artifact.
77+
message ExportArtifactMetadata {
78+
// The exported artifact file.
79+
message ExportedFile {
80+
// The destination the file was exported to.
81+
oneof destination {
82+
// Cloud Storage Object path of the exported file. Examples:
83+
// `dst_bucket/file1`, `dst_bucket/sub_dir/file1`
84+
string gcs_object_path = 2;
85+
}
86+
87+
// Name of the exported artifact file.
88+
// Format: `projects/p1/locations/us/repositories/repo1/files/file1`
89+
string name = 1 [(google.api.resource_reference) = {
90+
type: "artifactregistry.googleapis.com/File"
91+
}];
92+
93+
// The hashes of the file content.
94+
repeated Hash hashes = 3;
95+
}
96+
97+
// The exported artifact files.
98+
repeated ExportedFile exported_files = 1;
99+
}

google/devtools/artifactregistry/v1/service.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import "google/api/client.proto";
2121
import "google/devtools/artifactregistry/v1/apt_artifact.proto";
2222
import "google/devtools/artifactregistry/v1/artifact.proto";
2323
import "google/devtools/artifactregistry/v1/attachment.proto";
24+
import "google/devtools/artifactregistry/v1/export.proto";
2425
import "google/devtools/artifactregistry/v1/file.proto";
2526
import "google/devtools/artifactregistry/v1/package.proto";
2627
import "google/devtools/artifactregistry/v1/repository.proto";
@@ -541,6 +542,19 @@ service ArtifactRegistry {
541542
metadata_type: "google.devtools.artifactregistry.v1.OperationMetadata"
542543
};
543544
}
545+
546+
// Exports an artifact.
547+
rpc ExportArtifact(ExportArtifactRequest)
548+
returns (google.longrunning.Operation) {
549+
option (google.api.http) = {
550+
post: "/v1/{repository=projects/*/locations/*/repositories/*}:exportArtifact"
551+
body: "*"
552+
};
553+
option (google.longrunning.operation_info) = {
554+
response_type: "google.devtools.artifactregistry.v1.ExportArtifactResponse"
555+
metadata_type: "google.devtools.artifactregistry.v1.ExportArtifactMetadata"
556+
};
557+
}
544558
}
545559

546560
// Metadata type for longrunning-operations, currently empty.

0 commit comments

Comments
 (0)