Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions google-cloud-compute-v1/.owlbot-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,21 @@
"lib/google/cloud/compute/v1/instant_snapshots/rest.rb",
"lib/google/cloud/compute/v1/instant_snapshots/rest/client.rb",
"lib/google/cloud/compute/v1/instant_snapshots/rest/service_stub.rb",
"lib/google/cloud/compute/v1/interconnect_attachment_groups.rb",
"lib/google/cloud/compute/v1/interconnect_attachment_groups/credentials.rb",
"lib/google/cloud/compute/v1/interconnect_attachment_groups/rest.rb",
"lib/google/cloud/compute/v1/interconnect_attachment_groups/rest/client.rb",
"lib/google/cloud/compute/v1/interconnect_attachment_groups/rest/service_stub.rb",
"lib/google/cloud/compute/v1/interconnect_attachments.rb",
"lib/google/cloud/compute/v1/interconnect_attachments/credentials.rb",
"lib/google/cloud/compute/v1/interconnect_attachments/rest.rb",
"lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb",
"lib/google/cloud/compute/v1/interconnect_attachments/rest/service_stub.rb",
"lib/google/cloud/compute/v1/interconnect_groups.rb",
"lib/google/cloud/compute/v1/interconnect_groups/credentials.rb",
"lib/google/cloud/compute/v1/interconnect_groups/rest.rb",
"lib/google/cloud/compute/v1/interconnect_groups/rest/client.rb",
"lib/google/cloud/compute/v1/interconnect_groups/rest/service_stub.rb",
"lib/google/cloud/compute/v1/interconnect_locations.rb",
"lib/google/cloud/compute/v1/interconnect_locations/credentials.rb",
"lib/google/cloud/compute/v1/interconnect_locations/rest.rb",
Expand Down Expand Up @@ -388,6 +398,11 @@
"lib/google/cloud/compute/v1/reservation_blocks/rest.rb",
"lib/google/cloud/compute/v1/reservation_blocks/rest/client.rb",
"lib/google/cloud/compute/v1/reservation_blocks/rest/service_stub.rb",
"lib/google/cloud/compute/v1/reservation_sub_blocks.rb",
"lib/google/cloud/compute/v1/reservation_sub_blocks/credentials.rb",
"lib/google/cloud/compute/v1/reservation_sub_blocks/rest.rb",
"lib/google/cloud/compute/v1/reservation_sub_blocks/rest/client.rb",
"lib/google/cloud/compute/v1/reservation_sub_blocks/rest/service_stub.rb",
"lib/google/cloud/compute/v1/reservations.rb",
"lib/google/cloud/compute/v1/reservations/credentials.rb",
"lib/google/cloud/compute/v1/reservations/rest.rb",
Expand Down Expand Up @@ -557,7 +572,9 @@
"test/google/cloud/compute/v1/instance_templates_rest_test.rb",
"test/google/cloud/compute/v1/instances_rest_test.rb",
"test/google/cloud/compute/v1/instant_snapshots_rest_test.rb",
"test/google/cloud/compute/v1/interconnect_attachment_groups_rest_test.rb",
"test/google/cloud/compute/v1/interconnect_attachments_rest_test.rb",
"test/google/cloud/compute/v1/interconnect_groups_rest_test.rb",
"test/google/cloud/compute/v1/interconnect_locations_rest_test.rb",
"test/google/cloud/compute/v1/interconnect_remote_locations_rest_test.rb",
"test/google/cloud/compute/v1/interconnects_rest_test.rb",
Expand Down Expand Up @@ -604,6 +621,7 @@
"test/google/cloud/compute/v1/region_zones_rest_test.rb",
"test/google/cloud/compute/v1/regions_rest_test.rb",
"test/google/cloud/compute/v1/reservation_blocks_rest_test.rb",
"test/google/cloud/compute/v1/reservation_sub_blocks_rest_test.rb",
"test/google/cloud/compute/v1/reservations_rest_test.rb",
"test/google/cloud/compute/v1/resource_policies_rest_test.rb",
"test/google/cloud/compute/v1/routers_rest_test.rb",
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-compute-v1/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source "https://rubygems.org"

gemspec

gem "google-style", "~> 1.31.0"
gem "google-style", "~> 1.31.1"
gem "minitest", "~> 5.22"
gem "minitest-focus", "~> 1.4"
gem "minitest-rg", "~> 5.3"
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-compute-v1/google-cloud-compute-v1.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |gem|

gem.required_ruby_version = ">= 3.1"

gem.add_dependency "gapic-common", "~> 1.0"
gem.add_dependency "gapic-common", "~> 1.1"
gem.add_dependency "google-cloud-common", "~> 1.0"
gem.add_dependency "google-cloud-errors", "~> 1.0"
end
3 changes: 3 additions & 0 deletions google-cloud-compute-v1/lib/google/cloud/compute/v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
require "google/cloud/compute/v1/instance_templates"
require "google/cloud/compute/v1/instances"
require "google/cloud/compute/v1/instant_snapshots"
require "google/cloud/compute/v1/interconnect_attachment_groups"
require "google/cloud/compute/v1/interconnect_attachments"
require "google/cloud/compute/v1/interconnect_groups"
require "google/cloud/compute/v1/interconnect_locations"
require "google/cloud/compute/v1/interconnect_remote_locations"
require "google/cloud/compute/v1/interconnects"
Expand Down Expand Up @@ -90,6 +92,7 @@
require "google/cloud/compute/v1/region_zones"
require "google/cloud/compute/v1/regions"
require "google/cloud/compute/v1/reservation_blocks"
require "google/cloud/compute/v1/reservation_sub_blocks"
require "google/cloud/compute/v1/reservations"
require "google/cloud/compute/v1/resource_policies"
require "google/cloud/compute/v1/routers"
Expand Down
127 changes: 125 additions & 2 deletions google-cloud-compute-v1/lib/google/cloud/compute/v1/compute_pb.rb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def self.configure

default_config.rpcs.bulk_insert.timeout = 600.0

default_config.rpcs.bulk_set_labels.timeout = 600.0

default_config.rpcs.create_snapshot.timeout = 600.0

default_config.rpcs.delete.timeout = 600.0
Expand Down Expand Up @@ -521,6 +523,102 @@ def bulk_insert request, options = nil
raise ::Google::Cloud::Error.from_error(e)
end

##
# Sets the labels on many disks at once. To learn more about labels, read the Labeling Resources documentation.
#
# @overload bulk_set_labels(request, options = nil)
# Pass arguments to `bulk_set_labels` via a request object, either of type
# {::Google::Cloud::Compute::V1::BulkSetLabelsDiskRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Compute::V1::BulkSetLabelsDiskRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @overload bulk_set_labels(bulk_zone_set_labels_request_resource: nil, project: nil, request_id: nil, resource: nil, zone: nil)
# Pass arguments to `bulk_set_labels` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param bulk_zone_set_labels_request_resource [::Google::Cloud::Compute::V1::BulkZoneSetLabelsRequest, ::Hash]
# The body resource for this request
# @param project [::String]
# Project ID for this request.
# @param request_id [::String]
# An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
# @param resource [::String]
# Name or id of the resource for this request.
# @param zone [::String]
# The name of the zone for this request.
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Gapic::GenericLRO::Operation]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
#
# @return [::Gapic::GenericLRO::Operation]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
#
# @example Basic example
# require "google/cloud/compute/v1"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Cloud::Compute::V1::Disks::Rest::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Cloud::Compute::V1::BulkSetLabelsDiskRequest.new
#
# # Call the bulk_set_labels method.
# result = client.bulk_set_labels request
#
# # The returned object is of type Google::Cloud::Compute::V1::Operation.
# p result
#
def bulk_set_labels request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::BulkSetLabelsDiskRequest

# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

# Customize the options with defaults
call_metadata = @config.rpcs.bulk_set_labels.metadata.to_h

# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Compute::V1::VERSION,
transports_version_send: [:rest]

call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

options.apply_defaults timeout: @config.rpcs.bulk_set_labels.timeout,
metadata: call_metadata,
retry_policy: @config.rpcs.bulk_set_labels.retry_policy

options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy

@disks_stub.bulk_set_labels request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
request_values: {
"project" => request.project,
"zone" => request.zone
},
options: options
)
yield result, response if block_given?
throw :response, result
end
rescue ::Gapic::Rest::Error => e
raise ::Google::Cloud::Error.from_error(e)
end

##
# Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.
#
Expand Down Expand Up @@ -2068,6 +2166,11 @@ class Rpcs
#
attr_reader :bulk_insert
##
# RPC-specific configuration for `bulk_set_labels`
# @return [::Gapic::Config::Method]
#
attr_reader :bulk_set_labels
##
# RPC-specific configuration for `create_snapshot`
# @return [::Gapic::Config::Method]
#
Expand Down Expand Up @@ -2151,6 +2254,8 @@ def initialize parent_rpcs = nil
@aggregated_list = ::Gapic::Config::Method.new aggregated_list_config
bulk_insert_config = parent_rpcs.bulk_insert if parent_rpcs.respond_to? :bulk_insert
@bulk_insert = ::Gapic::Config::Method.new bulk_insert_config
bulk_set_labels_config = parent_rpcs.bulk_set_labels if parent_rpcs.respond_to? :bulk_set_labels
@bulk_set_labels = ::Gapic::Config::Method.new bulk_set_labels_config
create_snapshot_config = parent_rpcs.create_snapshot if parent_rpcs.respond_to? :create_snapshot
@create_snapshot = ::Gapic::Config::Method.new create_snapshot_config
delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,46 @@ def bulk_insert request_pb, options = nil
end
end

##
# Baseline implementation for the bulk_set_labels REST call
#
# @param request_pb [::Google::Cloud::Compute::V1::BulkSetLabelsDiskRequest]
# A request object representing the call parameters. Required.
# @param options [::Gapic::CallOptions]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Google::Cloud::Compute::V1::Operation]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
#
# @return [::Google::Cloud::Compute::V1::Operation]
# A result object deserialized from the server's reply
def bulk_set_labels request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?

verb, uri, query_string_params, body = ServiceStub.transcode_bulk_set_labels_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end

response = @client_stub.make_http_request(
verb,
uri: uri,
body: body || "",
params: query_string_params,
method_name: "bulk_set_labels",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
catch :response do
yield result, operation if block_given?
result
end
end

##
# Baseline implementation for the create_snapshot REST call
#
Expand Down Expand Up @@ -861,6 +901,29 @@ def self.transcode_bulk_insert_request request_pb
transcoder.transcode request_pb
end

##
# @private
#
# GRPC transcoding helper method for the bulk_set_labels REST call
#
# @param request_pb [::Google::Cloud::Compute::V1::BulkSetLabelsDiskRequest]
# A request object representing the call parameters. Required.
# @return [Array(String, [String, nil], Hash{String => String})]
# Uri, Body, Query string parameters
def self.transcode_bulk_set_labels_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/compute/v1/projects/{project}/zones/{zone}/disks/bulkSetLabels",
body: "bulk_zone_set_labels_request_resource",
matches: [
["project", %r{^[^/]+/?$}, false],
["zone", %r{^[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end

##
# @private
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ def delete request, options = nil
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param operation [::String]
# Name of the Operations resource to return, or its unique numeric identifier.
# Name of the Operations resource to return. Parent is derived from this field.
# @param parent_id [::String]
# Parent ID for this request.
# Parent ID for this request. Not used. Parent is derived from resource_id.
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Google::Cloud::Compute::V1::Operation]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true

# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Auto-generated by gapic-generator-ruby. DO NOT EDIT!

require "gapic/config"
require "gapic/config/method"

require "google/cloud/compute/v1/version"

require "google/cloud/compute/v1/interconnect_attachment_groups/credentials"
require "google/cloud/compute/v1/interconnect_attachment_groups/rest"

module Google
module Cloud
module Compute
module V1
##
# The InterconnectAttachmentGroups API.
#
# @example Load this service and instantiate a REST client
#
# require "google/cloud/compute/v1/interconnect_attachment_groups/rest"
# client = ::Google::Cloud::Compute::V1::InterconnectAttachmentGroups::Rest::Client.new
#
module InterconnectAttachmentGroups
end
end
end
end
end

helper_path = ::File.join __dir__, "interconnect_attachment_groups", "helpers.rb"
require "google/cloud/compute/v1/interconnect_attachment_groups/helpers" if ::File.file? helper_path
Loading
Loading