google-cloud-compute-v1 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -116,6 +116,44 @@ module Google
116
116
  result
117
117
  end
118
118
 
119
+ ##
120
+ # Baseline implementation for the bulk_insert REST call
121
+ #
122
+ # @param request_pb [::Google::Cloud::Compute::V1::BulkInsertDiskRequest]
123
+ # A request object representing the call parameters. Required.
124
+ # @param options [::Gapic::CallOptions]
125
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
126
+ #
127
+ # @yield [result, operation] Access the result along with the TransportOperation object
128
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
129
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
130
+ #
131
+ # @return [::Google::Cloud::Compute::V1::Operation]
132
+ # A result object deserialized from the server's reply
133
+ def bulk_insert request_pb, options = nil
134
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
135
+
136
+ verb, uri, query_string_params, body = ServiceStub.transcode_bulk_insert_request request_pb
137
+ query_string_params = if query_string_params.any?
138
+ query_string_params.to_h { |p| p.split "=", 2 }
139
+ else
140
+ {}
141
+ end
142
+
143
+ response = @client_stub.make_http_request(
144
+ verb,
145
+ uri: uri,
146
+ body: body || "",
147
+ params: query_string_params,
148
+ options: options
149
+ )
150
+ operation = ::Gapic::Rest::TransportOperation.new response
151
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
152
+
153
+ yield result, operation if block_given?
154
+ result
155
+ end
156
+
119
157
  ##
120
158
  # Baseline implementation for the create_snapshot REST call
121
159
  #
@@ -496,6 +534,120 @@ module Google
496
534
  result
497
535
  end
498
536
 
537
+ ##
538
+ # Baseline implementation for the start_async_replication REST call
539
+ #
540
+ # @param request_pb [::Google::Cloud::Compute::V1::StartAsyncReplicationDiskRequest]
541
+ # A request object representing the call parameters. Required.
542
+ # @param options [::Gapic::CallOptions]
543
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
544
+ #
545
+ # @yield [result, operation] Access the result along with the TransportOperation object
546
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
547
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
548
+ #
549
+ # @return [::Google::Cloud::Compute::V1::Operation]
550
+ # A result object deserialized from the server's reply
551
+ def start_async_replication request_pb, options = nil
552
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
553
+
554
+ verb, uri, query_string_params, body = ServiceStub.transcode_start_async_replication_request request_pb
555
+ query_string_params = if query_string_params.any?
556
+ query_string_params.to_h { |p| p.split "=", 2 }
557
+ else
558
+ {}
559
+ end
560
+
561
+ response = @client_stub.make_http_request(
562
+ verb,
563
+ uri: uri,
564
+ body: body || "",
565
+ params: query_string_params,
566
+ options: options
567
+ )
568
+ operation = ::Gapic::Rest::TransportOperation.new response
569
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
570
+
571
+ yield result, operation if block_given?
572
+ result
573
+ end
574
+
575
+ ##
576
+ # Baseline implementation for the stop_async_replication REST call
577
+ #
578
+ # @param request_pb [::Google::Cloud::Compute::V1::StopAsyncReplicationDiskRequest]
579
+ # A request object representing the call parameters. Required.
580
+ # @param options [::Gapic::CallOptions]
581
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
582
+ #
583
+ # @yield [result, operation] Access the result along with the TransportOperation object
584
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
585
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
586
+ #
587
+ # @return [::Google::Cloud::Compute::V1::Operation]
588
+ # A result object deserialized from the server's reply
589
+ def stop_async_replication request_pb, options = nil
590
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
591
+
592
+ verb, uri, query_string_params, body = ServiceStub.transcode_stop_async_replication_request request_pb
593
+ query_string_params = if query_string_params.any?
594
+ query_string_params.to_h { |p| p.split "=", 2 }
595
+ else
596
+ {}
597
+ end
598
+
599
+ response = @client_stub.make_http_request(
600
+ verb,
601
+ uri: uri,
602
+ body: body || "",
603
+ params: query_string_params,
604
+ options: options
605
+ )
606
+ operation = ::Gapic::Rest::TransportOperation.new response
607
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
608
+
609
+ yield result, operation if block_given?
610
+ result
611
+ end
612
+
613
+ ##
614
+ # Baseline implementation for the stop_group_async_replication REST call
615
+ #
616
+ # @param request_pb [::Google::Cloud::Compute::V1::StopGroupAsyncReplicationDiskRequest]
617
+ # A request object representing the call parameters. Required.
618
+ # @param options [::Gapic::CallOptions]
619
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
620
+ #
621
+ # @yield [result, operation] Access the result along with the TransportOperation object
622
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
623
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
624
+ #
625
+ # @return [::Google::Cloud::Compute::V1::Operation]
626
+ # A result object deserialized from the server's reply
627
+ def stop_group_async_replication request_pb, options = nil
628
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
629
+
630
+ verb, uri, query_string_params, body = ServiceStub.transcode_stop_group_async_replication_request request_pb
631
+ query_string_params = if query_string_params.any?
632
+ query_string_params.to_h { |p| p.split "=", 2 }
633
+ else
634
+ {}
635
+ end
636
+
637
+ response = @client_stub.make_http_request(
638
+ verb,
639
+ uri: uri,
640
+ body: body || "",
641
+ params: query_string_params,
642
+ options: options
643
+ )
644
+ operation = ::Gapic::Rest::TransportOperation.new response
645
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
646
+
647
+ yield result, operation if block_given?
648
+ result
649
+ end
650
+
499
651
  ##
500
652
  # Baseline implementation for the test_iam_permissions REST call
501
653
  #
@@ -617,6 +769,29 @@ module Google
617
769
  transcoder.transcode request_pb
618
770
  end
619
771
 
772
+ ##
773
+ # @private
774
+ #
775
+ # GRPC transcoding helper method for the bulk_insert REST call
776
+ #
777
+ # @param request_pb [::Google::Cloud::Compute::V1::BulkInsertDiskRequest]
778
+ # A request object representing the call parameters. Required.
779
+ # @return [Array(String, [String, nil], Hash{String => String})]
780
+ # Uri, Body, Query string parameters
781
+ def self.transcode_bulk_insert_request request_pb
782
+ transcoder = Gapic::Rest::GrpcTranscoder.new
783
+ .with_bindings(
784
+ uri_method: :post,
785
+ uri_template: "/compute/v1/projects/{project}/zones/{zone}/disks/bulkInsert",
786
+ body: "bulk_insert_disk_resource_resource",
787
+ matches: [
788
+ ["project", %r{^[^/]+/?$}, false],
789
+ ["zone", %r{^[^/]+/?$}, false]
790
+ ]
791
+ )
792
+ transcoder.transcode request_pb
793
+ end
794
+
620
795
  ##
621
796
  # @private
622
797
  #
@@ -851,6 +1026,76 @@ module Google
851
1026
  transcoder.transcode request_pb
852
1027
  end
853
1028
 
1029
+ ##
1030
+ # @private
1031
+ #
1032
+ # GRPC transcoding helper method for the start_async_replication REST call
1033
+ #
1034
+ # @param request_pb [::Google::Cloud::Compute::V1::StartAsyncReplicationDiskRequest]
1035
+ # A request object representing the call parameters. Required.
1036
+ # @return [Array(String, [String, nil], Hash{String => String})]
1037
+ # Uri, Body, Query string parameters
1038
+ def self.transcode_start_async_replication_request request_pb
1039
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1040
+ .with_bindings(
1041
+ uri_method: :post,
1042
+ uri_template: "/compute/v1/projects/{project}/zones/{zone}/disks/{disk}/startAsyncReplication",
1043
+ body: "disks_start_async_replication_request_resource",
1044
+ matches: [
1045
+ ["project", %r{^[^/]+/?$}, false],
1046
+ ["zone", %r{^[^/]+/?$}, false],
1047
+ ["disk", %r{^[^/]+/?$}, false]
1048
+ ]
1049
+ )
1050
+ transcoder.transcode request_pb
1051
+ end
1052
+
1053
+ ##
1054
+ # @private
1055
+ #
1056
+ # GRPC transcoding helper method for the stop_async_replication REST call
1057
+ #
1058
+ # @param request_pb [::Google::Cloud::Compute::V1::StopAsyncReplicationDiskRequest]
1059
+ # A request object representing the call parameters. Required.
1060
+ # @return [Array(String, [String, nil], Hash{String => String})]
1061
+ # Uri, Body, Query string parameters
1062
+ def self.transcode_stop_async_replication_request request_pb
1063
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1064
+ .with_bindings(
1065
+ uri_method: :post,
1066
+ uri_template: "/compute/v1/projects/{project}/zones/{zone}/disks/{disk}/stopAsyncReplication",
1067
+ matches: [
1068
+ ["project", %r{^[^/]+/?$}, false],
1069
+ ["zone", %r{^[^/]+/?$}, false],
1070
+ ["disk", %r{^[^/]+/?$}, false]
1071
+ ]
1072
+ )
1073
+ transcoder.transcode request_pb
1074
+ end
1075
+
1076
+ ##
1077
+ # @private
1078
+ #
1079
+ # GRPC transcoding helper method for the stop_group_async_replication REST call
1080
+ #
1081
+ # @param request_pb [::Google::Cloud::Compute::V1::StopGroupAsyncReplicationDiskRequest]
1082
+ # A request object representing the call parameters. Required.
1083
+ # @return [Array(String, [String, nil], Hash{String => String})]
1084
+ # Uri, Body, Query string parameters
1085
+ def self.transcode_stop_group_async_replication_request request_pb
1086
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1087
+ .with_bindings(
1088
+ uri_method: :post,
1089
+ uri_template: "/compute/v1/projects/{project}/zones/{zone}/disks/stopGroupAsyncReplication",
1090
+ body: "disks_stop_group_async_replication_resource_resource",
1091
+ matches: [
1092
+ ["project", %r{^[^/]+/?$}, false],
1093
+ ["zone", %r{^[^/]+/?$}, false]
1094
+ ]
1095
+ )
1096
+ transcoder.transcode request_pb
1097
+ end
1098
+
854
1099
  ##
855
1100
  # @private
856
1101
  #
@@ -79,6 +79,8 @@ module Google
79
79
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
80
80
  }
81
81
 
82
+ default_config.rpcs.move.timeout = 600.0
83
+
82
84
  default_config.rpcs.set_labels.timeout = 600.0
83
85
 
84
86
  default_config
@@ -448,6 +450,82 @@ module Google
448
450
  raise ::Google::Cloud::Error.from_error(e)
449
451
  end
450
452
 
453
+ ##
454
+ # Moves the specified address resource from one project to another project.
455
+ #
456
+ # @overload move(request, options = nil)
457
+ # Pass arguments to `move` via a request object, either of type
458
+ # {::Google::Cloud::Compute::V1::MoveGlobalAddressRequest} or an equivalent Hash.
459
+ #
460
+ # @param request [::Google::Cloud::Compute::V1::MoveGlobalAddressRequest, ::Hash]
461
+ # A request object representing the call parameters. Required. To specify no
462
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
463
+ # @param options [::Gapic::CallOptions, ::Hash]
464
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
465
+ #
466
+ # @overload move(address: nil, global_addresses_move_request_resource: nil, project: nil, request_id: nil)
467
+ # Pass arguments to `move` via keyword arguments. Note that at
468
+ # least one keyword argument is required. To specify no parameters, or to keep all
469
+ # the default parameter values, pass an empty Hash as a request object (see above).
470
+ #
471
+ # @param address [::String]
472
+ # Name of the address resource to move.
473
+ # @param global_addresses_move_request_resource [::Google::Cloud::Compute::V1::GlobalAddressesMoveRequest, ::Hash]
474
+ # The body resource for this request
475
+ # @param project [::String]
476
+ # Source project ID which the Address is moved from.
477
+ # @param request_id [::String]
478
+ # 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).
479
+ # @yield [result, operation] Access the result along with the TransportOperation object
480
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
481
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
482
+ #
483
+ # @return [::Gapic::GenericLRO::Operation]
484
+ #
485
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
486
+ def move request, options = nil
487
+ raise ::ArgumentError, "request must be provided" if request.nil?
488
+
489
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::MoveGlobalAddressRequest
490
+
491
+ # Converts hash and nil to an options object
492
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
493
+
494
+ # Customize the options with defaults
495
+ call_metadata = @config.rpcs.move.metadata.to_h
496
+
497
+ # Set x-goog-api-client and x-goog-user-project headers
498
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
499
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
500
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
501
+ transports_version_send: [:rest]
502
+
503
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
504
+
505
+ options.apply_defaults timeout: @config.rpcs.move.timeout,
506
+ metadata: call_metadata,
507
+ retry_policy: @config.rpcs.move.retry_policy
508
+
509
+ options.apply_defaults timeout: @config.timeout,
510
+ metadata: @config.metadata,
511
+ retry_policy: @config.retry_policy
512
+
513
+ @global_addresses_stub.move request, options do |result, response|
514
+ result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
515
+ operation: result,
516
+ client: global_operations,
517
+ request_values: {
518
+ "project" => request.project
519
+ },
520
+ options: options
521
+ )
522
+ yield result, response if block_given?
523
+ return result
524
+ end
525
+ rescue ::Gapic::Rest::Error => e
526
+ raise ::Google::Cloud::Error.from_error(e)
527
+ end
528
+
451
529
  ##
452
530
  # Sets the labels on a GlobalAddress. To learn more about labels, read the Labeling Resources documentation.
453
531
  #
@@ -668,6 +746,11 @@ module Google
668
746
  #
669
747
  attr_reader :list
670
748
  ##
749
+ # RPC-specific configuration for `move`
750
+ # @return [::Gapic::Config::Method]
751
+ #
752
+ attr_reader :move
753
+ ##
671
754
  # RPC-specific configuration for `set_labels`
672
755
  # @return [::Gapic::Config::Method]
673
756
  #
@@ -683,6 +766,8 @@ module Google
683
766
  @insert = ::Gapic::Config::Method.new insert_config
684
767
  list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
685
768
  @list = ::Gapic::Config::Method.new list_config
769
+ move_config = parent_rpcs.move if parent_rpcs.respond_to? :move
770
+ @move = ::Gapic::Config::Method.new move_config
686
771
  set_labels_config = parent_rpcs.set_labels if parent_rpcs.respond_to? :set_labels
687
772
  @set_labels = ::Gapic::Config::Method.new set_labels_config
688
773
 
@@ -192,6 +192,44 @@ module Google
192
192
  result
193
193
  end
194
194
 
195
+ ##
196
+ # Baseline implementation for the move REST call
197
+ #
198
+ # @param request_pb [::Google::Cloud::Compute::V1::MoveGlobalAddressRequest]
199
+ # A request object representing the call parameters. Required.
200
+ # @param options [::Gapic::CallOptions]
201
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
202
+ #
203
+ # @yield [result, operation] Access the result along with the TransportOperation object
204
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
205
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
206
+ #
207
+ # @return [::Google::Cloud::Compute::V1::Operation]
208
+ # A result object deserialized from the server's reply
209
+ def move request_pb, options = nil
210
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
211
+
212
+ verb, uri, query_string_params, body = ServiceStub.transcode_move_request request_pb
213
+ query_string_params = if query_string_params.any?
214
+ query_string_params.to_h { |p| p.split "=", 2 }
215
+ else
216
+ {}
217
+ end
218
+
219
+ response = @client_stub.make_http_request(
220
+ verb,
221
+ uri: uri,
222
+ body: body || "",
223
+ params: query_string_params,
224
+ options: options
225
+ )
226
+ operation = ::Gapic::Rest::TransportOperation.new response
227
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
228
+
229
+ yield result, operation if block_given?
230
+ result
231
+ end
232
+
195
233
  ##
196
234
  # Baseline implementation for the set_labels REST call
197
235
  #
@@ -317,6 +355,29 @@ module Google
317
355
  transcoder.transcode request_pb
318
356
  end
319
357
 
358
+ ##
359
+ # @private
360
+ #
361
+ # GRPC transcoding helper method for the move REST call
362
+ #
363
+ # @param request_pb [::Google::Cloud::Compute::V1::MoveGlobalAddressRequest]
364
+ # A request object representing the call parameters. Required.
365
+ # @return [Array(String, [String, nil], Hash{String => String})]
366
+ # Uri, Body, Query string parameters
367
+ def self.transcode_move_request request_pb
368
+ transcoder = Gapic::Rest::GrpcTranscoder.new
369
+ .with_bindings(
370
+ uri_method: :post,
371
+ uri_template: "/compute/v1/projects/{project}/global/addresses/{address}/move",
372
+ body: "global_addresses_move_request_resource",
373
+ matches: [
374
+ ["project", %r{^[^/]+/?$}, false],
375
+ ["address", %r{^[^/]+/?$}, false]
376
+ ]
377
+ )
378
+ transcoder.transcode request_pb
379
+ end
380
+
320
381
  ##
321
382
  # @private
322
383
  #
@@ -2936,7 +2936,7 @@ module Google
2936
2936
  # @param options [::Gapic::CallOptions, ::Hash]
2937
2937
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2938
2938
  #
2939
- # @overload simulate_maintenance_event(instance: nil, project: nil, zone: nil)
2939
+ # @overload simulate_maintenance_event(instance: nil, project: nil, request_id: nil, zone: nil)
2940
2940
  # Pass arguments to `simulate_maintenance_event` via keyword arguments. Note that at
2941
2941
  # least one keyword argument is required. To specify no parameters, or to keep all
2942
2942
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -2945,6 +2945,8 @@ module Google
2945
2945
  # Name of the instance scoping this request.
2946
2946
  # @param project [::String]
2947
2947
  # Project ID for this request.
2948
+ # @param request_id [::String]
2949
+ # 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).
2948
2950
  # @param zone [::String]
2949
2951
  # The name of the zone for this request.
2950
2952
  # @yield [result, operation] Access the result along with the TransportOperation object
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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 InterconnectRemoteLocations
26
+ # Credentials for the InterconnectRemoteLocations API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/compute.readonly",
30
+ "https://www.googleapis.com/auth/compute",
31
+ "https://www.googleapis.com/auth/cloud-platform"
32
+ ]
33
+ self.env_vars = [
34
+ "COMPUTE_CREDENTIALS",
35
+ "COMPUTE_KEYFILE",
36
+ "GOOGLE_CLOUD_CREDENTIALS",
37
+ "GOOGLE_CLOUD_KEYFILE",
38
+ "GCLOUD_KEYFILE",
39
+ "COMPUTE_CREDENTIALS_JSON",
40
+ "COMPUTE_KEYFILE_JSON",
41
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
42
+ "GOOGLE_CLOUD_KEYFILE_JSON",
43
+ "GCLOUD_KEYFILE_JSON"
44
+ ]
45
+ self.paths = [
46
+ "~/.config/google_cloud/application_default_credentials.json"
47
+ ]
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end