Skip to content

Commit eb28ca8

Browse files
feat: add ExportArtifact API (#32236)
* feat: add ExportArtifact API PiperOrigin-RevId: 839457154 Source-Link: googleapis/googleapis@535d161 Source-Link: googleapis/googleapis-gen@6d55877 Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLWFydGlmYWN0X3JlZ2lzdHJ5LXYxLy5Pd2xCb3QueWFtbCIsImgiOiI2ZDU1ODc3MTdhMjU2ZGJmNTczNDEzZmNkNzczMWQwZTVlYzY3OTAzIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent b36c275 commit eb28ca8

File tree

13 files changed

+665
-1
lines changed

13 files changed

+665
-1
lines changed

google-cloud-artifact_registry-v1/.owlbot-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"lib/google/devtools/artifactregistry/v1/apt_artifact_pb.rb",
3131
"lib/google/devtools/artifactregistry/v1/artifact_pb.rb",
3232
"lib/google/devtools/artifactregistry/v1/attachment_pb.rb",
33+
"lib/google/devtools/artifactregistry/v1/export_pb.rb",
3334
"lib/google/devtools/artifactregistry/v1/file_pb.rb",
3435
"lib/google/devtools/artifactregistry/v1/generic_pb.rb",
3536
"lib/google/devtools/artifactregistry/v1/go_pb.rb",
@@ -52,6 +53,7 @@
5253
"proto_docs/google/devtools/artifactregistry/v1/apt_artifact.rb",
5354
"proto_docs/google/devtools/artifactregistry/v1/artifact.rb",
5455
"proto_docs/google/devtools/artifactregistry/v1/attachment.rb",
56+
"proto_docs/google/devtools/artifactregistry/v1/export.rb",
5557
"proto_docs/google/devtools/artifactregistry/v1/file.rb",
5658
"proto_docs/google/devtools/artifactregistry/v1/generic.rb",
5759
"proto_docs/google/devtools/artifactregistry/v1/go.rb",
@@ -90,6 +92,7 @@
9092
"snippets/artifact_registry/delete_rule.rb",
9193
"snippets/artifact_registry/delete_tag.rb",
9294
"snippets/artifact_registry/delete_version.rb",
95+
"snippets/artifact_registry/export_artifact.rb",
9396
"snippets/artifact_registry/get_attachment.rb",
9497
"snippets/artifact_registry/get_docker_image.rb",
9598
"snippets/artifact_registry/get_file.rb",

google-cloud-artifact_registry-v1/gapic_metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@
254254
"methods": [
255255
"delete_attachment"
256256
]
257+
},
258+
"ExportArtifact": {
259+
"methods": [
260+
"export_artifact"
261+
]
257262
}
258263
}
259264
}

google-cloud-artifact_registry-v1/lib/google/cloud/artifact_registry/v1/artifact_registry/client.rb

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4912,6 +4912,117 @@ def delete_attachment request, options = nil
49124912
raise ::Google::Cloud::Error.from_error(e)
49134913
end
49144914

4915+
##
4916+
# Exports an artifact.
4917+
#
4918+
# @overload export_artifact(request, options = nil)
4919+
# Pass arguments to `export_artifact` via a request object, either of type
4920+
# {::Google::Cloud::ArtifactRegistry::V1::ExportArtifactRequest} or an equivalent Hash.
4921+
#
4922+
# @param request [::Google::Cloud::ArtifactRegistry::V1::ExportArtifactRequest, ::Hash]
4923+
# A request object representing the call parameters. Required. To specify no
4924+
# parameters, or to keep all the default parameter values, pass an empty Hash.
4925+
# @param options [::Gapic::CallOptions, ::Hash]
4926+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
4927+
#
4928+
# @overload export_artifact(source_version: nil, source_tag: nil, gcs_path: nil, repository: nil)
4929+
# Pass arguments to `export_artifact` via keyword arguments. Note that at
4930+
# least one keyword argument is required. To specify no parameters, or to keep all
4931+
# the default parameter values, pass an empty Hash as a request object (see above).
4932+
#
4933+
# @param source_version [::String]
4934+
# The artifact version to export.
4935+
# Format:
4936+
# projects/\\{project}/locations/\\{location}/repositories/\\{repository}/packages/\\{package}/versions/\\{version}
4937+
#
4938+
# Note: The following parameters are mutually exclusive: `source_version`, `source_tag`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
4939+
# @param source_tag [::String]
4940+
# The artifact tag to export.
4941+
# Format:projects/\\{project}/locations/\\{location}/repositories/\\{repository}/packages/\\{package}/tags/\\{tag}
4942+
#
4943+
# Note: The following parameters are mutually exclusive: `source_tag`, `source_version`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
4944+
# @param gcs_path [::String]
4945+
# The Cloud Storage path to export the artifact to. Should start with the
4946+
# bucket name, and optionally have a directory path. Examples:
4947+
# `dst_bucket`, `dst_bucket/sub_dir`.
4948+
# Existing objects with the same path will be overwritten.
4949+
# @param repository [::String]
4950+
# Required. The repository of the artifact to export.
4951+
# Format: projects/\\{project}/locations/\\{location}/repositories/\\{repository}
4952+
#
4953+
# @yield [response, operation] Access the result along with the RPC operation
4954+
# @yieldparam response [::Gapic::Operation]
4955+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
4956+
#
4957+
# @return [::Gapic::Operation]
4958+
#
4959+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
4960+
#
4961+
# @example Basic example
4962+
# require "google/cloud/artifact_registry/v1"
4963+
#
4964+
# # Create a client object. The client can be reused for multiple calls.
4965+
# client = Google::Cloud::ArtifactRegistry::V1::ArtifactRegistry::Client.new
4966+
#
4967+
# # Create a request. To set request fields, pass in keyword arguments.
4968+
# request = Google::Cloud::ArtifactRegistry::V1::ExportArtifactRequest.new
4969+
#
4970+
# # Call the export_artifact method.
4971+
# result = client.export_artifact request
4972+
#
4973+
# # The returned object is of type Gapic::Operation. You can use it to
4974+
# # check the status of an operation, cancel it, or wait for results.
4975+
# # Here is how to wait for a response.
4976+
# result.wait_until_done! timeout: 60
4977+
# if result.response?
4978+
# p result.response
4979+
# else
4980+
# puts "No response received."
4981+
# end
4982+
#
4983+
def export_artifact request, options = nil
4984+
raise ::ArgumentError, "request must be provided" if request.nil?
4985+
4986+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ArtifactRegistry::V1::ExportArtifactRequest
4987+
4988+
# Converts hash and nil to an options object
4989+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4990+
4991+
# Customize the options with defaults
4992+
metadata = @config.rpcs.export_artifact.metadata.to_h
4993+
4994+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
4995+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
4996+
lib_name: @config.lib_name, lib_version: @config.lib_version,
4997+
gapic_version: ::Google::Cloud::ArtifactRegistry::V1::VERSION
4998+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
4999+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
5000+
5001+
header_params = {}
5002+
if request.repository
5003+
header_params["repository"] = request.repository
5004+
end
5005+
5006+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
5007+
metadata[:"x-goog-request-params"] ||= request_params_header
5008+
5009+
options.apply_defaults timeout: @config.rpcs.export_artifact.timeout,
5010+
metadata: metadata,
5011+
retry_policy: @config.rpcs.export_artifact.retry_policy
5012+
5013+
options.apply_defaults timeout: @config.timeout,
5014+
metadata: @config.metadata,
5015+
retry_policy: @config.retry_policy
5016+
5017+
@artifact_registry_stub.call_rpc :export_artifact, request, options: options do |response, operation|
5018+
response = ::Gapic::Operation.new response, @operations_client, options: options
5019+
yield response, operation if block_given?
5020+
throw :response, response
5021+
end
5022+
rescue ::GRPC::BadStatus => e
5023+
raise ::Google::Cloud::Error.from_error(e)
5024+
end
5025+
49155026
##
49165027
# Configuration class for the ArtifactRegistry API.
49175028
#
@@ -5340,6 +5451,11 @@ class Rpcs
53405451
# @return [::Gapic::Config::Method]
53415452
#
53425453
attr_reader :delete_attachment
5454+
##
5455+
# RPC-specific configuration for `export_artifact`
5456+
# @return [::Gapic::Config::Method]
5457+
#
5458+
attr_reader :export_artifact
53435459

53445460
# @private
53455461
def initialize parent_rpcs = nil
@@ -5441,6 +5557,8 @@ def initialize parent_rpcs = nil
54415557
@create_attachment = ::Gapic::Config::Method.new create_attachment_config
54425558
delete_attachment_config = parent_rpcs.delete_attachment if parent_rpcs.respond_to? :delete_attachment
54435559
@delete_attachment = ::Gapic::Config::Method.new delete_attachment_config
5560+
export_artifact_config = parent_rpcs.export_artifact if parent_rpcs.respond_to? :export_artifact
5561+
@export_artifact = ::Gapic::Config::Method.new export_artifact_config
54445562

54455563
yield self if block_given?
54465564
end

google-cloud-artifact_registry-v1/lib/google/cloud/artifact_registry/v1/artifact_registry/rest/client.rb

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4563,6 +4563,110 @@ def delete_attachment request, options = nil
45634563
raise ::Google::Cloud::Error.from_error(e)
45644564
end
45654565

4566+
##
4567+
# Exports an artifact.
4568+
#
4569+
# @overload export_artifact(request, options = nil)
4570+
# Pass arguments to `export_artifact` via a request object, either of type
4571+
# {::Google::Cloud::ArtifactRegistry::V1::ExportArtifactRequest} or an equivalent Hash.
4572+
#
4573+
# @param request [::Google::Cloud::ArtifactRegistry::V1::ExportArtifactRequest, ::Hash]
4574+
# A request object representing the call parameters. Required. To specify no
4575+
# parameters, or to keep all the default parameter values, pass an empty Hash.
4576+
# @param options [::Gapic::CallOptions, ::Hash]
4577+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
4578+
#
4579+
# @overload export_artifact(source_version: nil, source_tag: nil, gcs_path: nil, repository: nil)
4580+
# Pass arguments to `export_artifact` via keyword arguments. Note that at
4581+
# least one keyword argument is required. To specify no parameters, or to keep all
4582+
# the default parameter values, pass an empty Hash as a request object (see above).
4583+
#
4584+
# @param source_version [::String]
4585+
# The artifact version to export.
4586+
# Format:
4587+
# projects/\\{project}/locations/\\{location}/repositories/\\{repository}/packages/\\{package}/versions/\\{version}
4588+
#
4589+
# Note: The following parameters are mutually exclusive: `source_version`, `source_tag`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
4590+
# @param source_tag [::String]
4591+
# The artifact tag to export.
4592+
# Format:projects/\\{project}/locations/\\{location}/repositories/\\{repository}/packages/\\{package}/tags/\\{tag}
4593+
#
4594+
# Note: The following parameters are mutually exclusive: `source_tag`, `source_version`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
4595+
# @param gcs_path [::String]
4596+
# The Cloud Storage path to export the artifact to. Should start with the
4597+
# bucket name, and optionally have a directory path. Examples:
4598+
# `dst_bucket`, `dst_bucket/sub_dir`.
4599+
# Existing objects with the same path will be overwritten.
4600+
# @param repository [::String]
4601+
# Required. The repository of the artifact to export.
4602+
# Format: projects/\\{project}/locations/\\{location}/repositories/\\{repository}
4603+
# @yield [result, operation] Access the result along with the TransportOperation object
4604+
# @yieldparam result [::Gapic::Operation]
4605+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
4606+
#
4607+
# @return [::Gapic::Operation]
4608+
#
4609+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
4610+
#
4611+
# @example Basic example
4612+
# require "google/cloud/artifact_registry/v1"
4613+
#
4614+
# # Create a client object. The client can be reused for multiple calls.
4615+
# client = Google::Cloud::ArtifactRegistry::V1::ArtifactRegistry::Rest::Client.new
4616+
#
4617+
# # Create a request. To set request fields, pass in keyword arguments.
4618+
# request = Google::Cloud::ArtifactRegistry::V1::ExportArtifactRequest.new
4619+
#
4620+
# # Call the export_artifact method.
4621+
# result = client.export_artifact request
4622+
#
4623+
# # The returned object is of type Gapic::Operation. You can use it to
4624+
# # check the status of an operation, cancel it, or wait for results.
4625+
# # Here is how to wait for a response.
4626+
# result.wait_until_done! timeout: 60
4627+
# if result.response?
4628+
# p result.response
4629+
# else
4630+
# puts "No response received."
4631+
# end
4632+
#
4633+
def export_artifact request, options = nil
4634+
raise ::ArgumentError, "request must be provided" if request.nil?
4635+
4636+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ArtifactRegistry::V1::ExportArtifactRequest
4637+
4638+
# Converts hash and nil to an options object
4639+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4640+
4641+
# Customize the options with defaults
4642+
call_metadata = @config.rpcs.export_artifact.metadata.to_h
4643+
4644+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
4645+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
4646+
lib_name: @config.lib_name, lib_version: @config.lib_version,
4647+
gapic_version: ::Google::Cloud::ArtifactRegistry::V1::VERSION,
4648+
transports_version_send: [:rest]
4649+
4650+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
4651+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
4652+
4653+
options.apply_defaults timeout: @config.rpcs.export_artifact.timeout,
4654+
metadata: call_metadata,
4655+
retry_policy: @config.rpcs.export_artifact.retry_policy
4656+
4657+
options.apply_defaults timeout: @config.timeout,
4658+
metadata: @config.metadata,
4659+
retry_policy: @config.retry_policy
4660+
4661+
@artifact_registry_stub.export_artifact request, options do |result, operation|
4662+
result = ::Gapic::Operation.new result, @operations_client, options: options
4663+
yield result, operation if block_given?
4664+
throw :response, result
4665+
end
4666+
rescue ::Gapic::Rest::Error => e
4667+
raise ::Google::Cloud::Error.from_error(e)
4668+
end
4669+
45664670
##
45674671
# Configuration class for the ArtifactRegistry REST API.
45684672
#
@@ -4961,6 +5065,11 @@ class Rpcs
49615065
# @return [::Gapic::Config::Method]
49625066
#
49635067
attr_reader :delete_attachment
5068+
##
5069+
# RPC-specific configuration for `export_artifact`
5070+
# @return [::Gapic::Config::Method]
5071+
#
5072+
attr_reader :export_artifact
49645073

49655074
# @private
49665075
def initialize parent_rpcs = nil
@@ -5062,6 +5171,8 @@ def initialize parent_rpcs = nil
50625171
@create_attachment = ::Gapic::Config::Method.new create_attachment_config
50635172
delete_attachment_config = parent_rpcs.delete_attachment if parent_rpcs.respond_to? :delete_attachment
50645173
@delete_attachment = ::Gapic::Config::Method.new delete_attachment_config
5174+
export_artifact_config = parent_rpcs.export_artifact if parent_rpcs.respond_to? :export_artifact
5175+
@export_artifact = ::Gapic::Config::Method.new export_artifact_config
50655176

50665177
yield self if block_given?
50675178
end

0 commit comments

Comments
 (0)