google-cloud-compute-v1 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/cloud/compute/v1/compute_pb.rb +27 -1
- data/lib/google/cloud/compute/v1/machine_images/rest/client.rb +100 -0
- data/lib/google/cloud/compute/v1/machine_images/rest/service_stub.rb +63 -0
- data/lib/google/cloud/compute/v1/reservation_blocks/credentials.rb +52 -0
- data/lib/google/cloud/compute/v1/reservation_blocks/rest/client.rb +661 -0
- data/lib/google/cloud/compute/v1/reservation_blocks/rest/service_stub.rb +273 -0
- data/lib/google/cloud/compute/v1/reservation_blocks/rest.rb +51 -0
- data/lib/google/cloud/compute/v1/reservation_blocks.rb +47 -0
- data/lib/google/cloud/compute/v1/reservations/rest/client.rb +105 -0
- data/lib/google/cloud/compute/v1/reservations/rest/service_stub.rb +64 -0
- data/lib/google/cloud/compute/v1/rest.rb +1 -0
- data/lib/google/cloud/compute/v1/version.rb +1 -1
- data/lib/google/cloud/compute/v1.rb +1 -0
- data/proto_docs/google/cloud/compute/v1/compute.rb +514 -20
- metadata +7 -2
@@ -92,6 +92,8 @@ module Google
|
|
92
92
|
|
93
93
|
default_config.rpcs.set_iam_policy.timeout = 600.0
|
94
94
|
|
95
|
+
default_config.rpcs.set_labels.timeout = 600.0
|
96
|
+
|
95
97
|
default_config.rpcs.test_iam_permissions.timeout = 600.0
|
96
98
|
|
97
99
|
default_config
|
@@ -730,6 +732,97 @@ module Google
|
|
730
732
|
raise ::Google::Cloud::Error.from_error(e)
|
731
733
|
end
|
732
734
|
|
735
|
+
##
|
736
|
+
# Sets the labels on a machine image. To learn more about labels, read the Labeling Resources documentation.
|
737
|
+
#
|
738
|
+
# @overload set_labels(request, options = nil)
|
739
|
+
# Pass arguments to `set_labels` via a request object, either of type
|
740
|
+
# {::Google::Cloud::Compute::V1::SetLabelsMachineImageRequest} or an equivalent Hash.
|
741
|
+
#
|
742
|
+
# @param request [::Google::Cloud::Compute::V1::SetLabelsMachineImageRequest, ::Hash]
|
743
|
+
# A request object representing the call parameters. Required. To specify no
|
744
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
745
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
746
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
747
|
+
#
|
748
|
+
# @overload set_labels(global_set_labels_request_resource: nil, project: nil, resource: nil)
|
749
|
+
# Pass arguments to `set_labels` via keyword arguments. Note that at
|
750
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
751
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
752
|
+
#
|
753
|
+
# @param global_set_labels_request_resource [::Google::Cloud::Compute::V1::GlobalSetLabelsRequest, ::Hash]
|
754
|
+
# The body resource for this request
|
755
|
+
# @param project [::String]
|
756
|
+
# Project ID for this request.
|
757
|
+
# @param resource [::String]
|
758
|
+
# Name or id of the resource for this request.
|
759
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
760
|
+
# @yieldparam result [::Gapic::GenericLRO::Operation]
|
761
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
762
|
+
#
|
763
|
+
# @return [::Gapic::GenericLRO::Operation]
|
764
|
+
#
|
765
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
766
|
+
#
|
767
|
+
# @example Basic example
|
768
|
+
# require "google/cloud/compute/v1"
|
769
|
+
#
|
770
|
+
# # Create a client object. The client can be reused for multiple calls.
|
771
|
+
# client = Google::Cloud::Compute::V1::MachineImages::Rest::Client.new
|
772
|
+
#
|
773
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
774
|
+
# request = Google::Cloud::Compute::V1::SetLabelsMachineImageRequest.new
|
775
|
+
#
|
776
|
+
# # Call the set_labels method.
|
777
|
+
# result = client.set_labels request
|
778
|
+
#
|
779
|
+
# # The returned object is of type Google::Cloud::Compute::V1::Operation.
|
780
|
+
# p result
|
781
|
+
#
|
782
|
+
def set_labels request, options = nil
|
783
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
784
|
+
|
785
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetLabelsMachineImageRequest
|
786
|
+
|
787
|
+
# Converts hash and nil to an options object
|
788
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
789
|
+
|
790
|
+
# Customize the options with defaults
|
791
|
+
call_metadata = @config.rpcs.set_labels.metadata.to_h
|
792
|
+
|
793
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
794
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
795
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
796
|
+
gapic_version: ::Google::Cloud::Compute::V1::VERSION,
|
797
|
+
transports_version_send: [:rest]
|
798
|
+
|
799
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
800
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
801
|
+
|
802
|
+
options.apply_defaults timeout: @config.rpcs.set_labels.timeout,
|
803
|
+
metadata: call_metadata,
|
804
|
+
retry_policy: @config.rpcs.set_labels.retry_policy
|
805
|
+
|
806
|
+
options.apply_defaults timeout: @config.timeout,
|
807
|
+
metadata: @config.metadata,
|
808
|
+
retry_policy: @config.retry_policy
|
809
|
+
|
810
|
+
@machine_images_stub.set_labels request, options do |result, response|
|
811
|
+
result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
|
812
|
+
operation: result,
|
813
|
+
client: global_operations,
|
814
|
+
request_values: {
|
815
|
+
"project" => request.project
|
816
|
+
},
|
817
|
+
options: options
|
818
|
+
)
|
819
|
+
yield result, response if block_given?
|
820
|
+
throw :response, result
|
821
|
+
end
|
822
|
+
rescue ::Gapic::Rest::Error => e
|
823
|
+
raise ::Google::Cloud::Error.from_error(e)
|
824
|
+
end
|
825
|
+
|
733
826
|
##
|
734
827
|
# Returns permissions that a caller has on the specified resource.
|
735
828
|
#
|
@@ -989,6 +1082,11 @@ module Google
|
|
989
1082
|
#
|
990
1083
|
attr_reader :set_iam_policy
|
991
1084
|
##
|
1085
|
+
# RPC-specific configuration for `set_labels`
|
1086
|
+
# @return [::Gapic::Config::Method]
|
1087
|
+
#
|
1088
|
+
attr_reader :set_labels
|
1089
|
+
##
|
992
1090
|
# RPC-specific configuration for `test_iam_permissions`
|
993
1091
|
# @return [::Gapic::Config::Method]
|
994
1092
|
#
|
@@ -1008,6 +1106,8 @@ module Google
|
|
1008
1106
|
@list = ::Gapic::Config::Method.new list_config
|
1009
1107
|
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
1010
1108
|
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
1109
|
+
set_labels_config = parent_rpcs.set_labels if parent_rpcs.respond_to? :set_labels
|
1110
|
+
@set_labels = ::Gapic::Config::Method.new set_labels_config
|
1011
1111
|
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
1012
1112
|
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
1013
1113
|
|
@@ -313,6 +313,46 @@ module Google
|
|
313
313
|
end
|
314
314
|
end
|
315
315
|
|
316
|
+
##
|
317
|
+
# Baseline implementation for the set_labels REST call
|
318
|
+
#
|
319
|
+
# @param request_pb [::Google::Cloud::Compute::V1::SetLabelsMachineImageRequest]
|
320
|
+
# A request object representing the call parameters. Required.
|
321
|
+
# @param options [::Gapic::CallOptions]
|
322
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
323
|
+
#
|
324
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
325
|
+
# @yieldparam result [::Google::Cloud::Compute::V1::Operation]
|
326
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
327
|
+
#
|
328
|
+
# @return [::Google::Cloud::Compute::V1::Operation]
|
329
|
+
# A result object deserialized from the server's reply
|
330
|
+
def set_labels request_pb, options = nil
|
331
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
332
|
+
|
333
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_set_labels_request request_pb
|
334
|
+
query_string_params = if query_string_params.any?
|
335
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
336
|
+
else
|
337
|
+
{}
|
338
|
+
end
|
339
|
+
|
340
|
+
response = @client_stub.make_http_request(
|
341
|
+
verb,
|
342
|
+
uri: uri,
|
343
|
+
body: body || "",
|
344
|
+
params: query_string_params,
|
345
|
+
method_name: "set_labels",
|
346
|
+
options: options
|
347
|
+
)
|
348
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
349
|
+
result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
|
350
|
+
catch :response do
|
351
|
+
yield result, operation if block_given?
|
352
|
+
result
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
316
356
|
##
|
317
357
|
# Baseline implementation for the test_iam_permissions REST call
|
318
358
|
#
|
@@ -485,6 +525,29 @@ module Google
|
|
485
525
|
transcoder.transcode request_pb
|
486
526
|
end
|
487
527
|
|
528
|
+
##
|
529
|
+
# @private
|
530
|
+
#
|
531
|
+
# GRPC transcoding helper method for the set_labels REST call
|
532
|
+
#
|
533
|
+
# @param request_pb [::Google::Cloud::Compute::V1::SetLabelsMachineImageRequest]
|
534
|
+
# A request object representing the call parameters. Required.
|
535
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
536
|
+
# Uri, Body, Query string parameters
|
537
|
+
def self.transcode_set_labels_request request_pb
|
538
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
539
|
+
.with_bindings(
|
540
|
+
uri_method: :post,
|
541
|
+
uri_template: "/compute/v1/projects/{project}/global/machineImages/{resource}/setLabels",
|
542
|
+
body: "global_set_labels_request_resource",
|
543
|
+
matches: [
|
544
|
+
["project", %r{^[^/]+/?$}, false],
|
545
|
+
["resource", %r{^[^/]+/?$}, false]
|
546
|
+
]
|
547
|
+
)
|
548
|
+
transcoder.transcode request_pb
|
549
|
+
end
|
550
|
+
|
488
551
|
##
|
489
552
|
# @private
|
490
553
|
#
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Compute
|
24
|
+
module V1
|
25
|
+
module ReservationBlocks
|
26
|
+
# Credentials for the ReservationBlocks API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/compute",
|
30
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
31
|
+
]
|
32
|
+
self.env_vars = [
|
33
|
+
"COMPUTE_CREDENTIALS",
|
34
|
+
"COMPUTE_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE",
|
37
|
+
"GCLOUD_KEYFILE",
|
38
|
+
"COMPUTE_CREDENTIALS_JSON",
|
39
|
+
"COMPUTE_KEYFILE_JSON",
|
40
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
41
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
42
|
+
"GCLOUD_KEYFILE_JSON"
|
43
|
+
]
|
44
|
+
self.paths = [
|
45
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
46
|
+
]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|