google-cloud-compute-v1 3.2.0 → 3.4.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.
@@ -89,6 +89,8 @@ module Google
89
89
 
90
90
  default_config.rpcs.set_labels.timeout = 600.0
91
91
 
92
+ default_config.rpcs.test_iam_permissions.timeout = 600.0
93
+
92
94
  default_config
93
95
  end
94
96
  yield @configure if block_given?
@@ -743,6 +745,88 @@ module Google
743
745
  raise ::Google::Cloud::Error.from_error(e)
744
746
  end
745
747
 
748
+ ##
749
+ # Returns permissions that a caller has on the specified resource.
750
+ #
751
+ # @overload test_iam_permissions(request, options = nil)
752
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
753
+ # {::Google::Cloud::Compute::V1::TestIamPermissionsGlobalAddressRequest} or an equivalent Hash.
754
+ #
755
+ # @param request [::Google::Cloud::Compute::V1::TestIamPermissionsGlobalAddressRequest, ::Hash]
756
+ # A request object representing the call parameters. Required. To specify no
757
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
758
+ # @param options [::Gapic::CallOptions, ::Hash]
759
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
760
+ #
761
+ # @overload test_iam_permissions(project: nil, resource: nil, test_permissions_request_resource: nil)
762
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
763
+ # least one keyword argument is required. To specify no parameters, or to keep all
764
+ # the default parameter values, pass an empty Hash as a request object (see above).
765
+ #
766
+ # @param project [::String]
767
+ # Project ID for this request.
768
+ # @param resource [::String]
769
+ # Name or id of the resource for this request.
770
+ # @param test_permissions_request_resource [::Google::Cloud::Compute::V1::TestPermissionsRequest, ::Hash]
771
+ # The body resource for this request
772
+ # @yield [result, operation] Access the result along with the TransportOperation object
773
+ # @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
774
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
775
+ #
776
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
777
+ #
778
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
779
+ #
780
+ # @example Basic example
781
+ # require "google/cloud/compute/v1"
782
+ #
783
+ # # Create a client object. The client can be reused for multiple calls.
784
+ # client = Google::Cloud::Compute::V1::GlobalAddresses::Rest::Client.new
785
+ #
786
+ # # Create a request. To set request fields, pass in keyword arguments.
787
+ # request = Google::Cloud::Compute::V1::TestIamPermissionsGlobalAddressRequest.new
788
+ #
789
+ # # Call the test_iam_permissions method.
790
+ # result = client.test_iam_permissions request
791
+ #
792
+ # # The returned object is of type Google::Cloud::Compute::V1::TestPermissionsResponse.
793
+ # p result
794
+ #
795
+ def test_iam_permissions request, options = nil
796
+ raise ::ArgumentError, "request must be provided" if request.nil?
797
+
798
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::TestIamPermissionsGlobalAddressRequest
799
+
800
+ # Converts hash and nil to an options object
801
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
802
+
803
+ # Customize the options with defaults
804
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
805
+
806
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
807
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
808
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
809
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
810
+ transports_version_send: [:rest]
811
+
812
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
813
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
814
+
815
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
816
+ metadata: call_metadata,
817
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
818
+
819
+ options.apply_defaults timeout: @config.timeout,
820
+ metadata: @config.metadata,
821
+ retry_policy: @config.retry_policy
822
+
823
+ @global_addresses_stub.test_iam_permissions request, options do |result, operation|
824
+ yield result, operation if block_given?
825
+ end
826
+ rescue ::Gapic::Rest::Error => e
827
+ raise ::Google::Cloud::Error.from_error(e)
828
+ end
829
+
746
830
  ##
747
831
  # Configuration class for the GlobalAddresses REST API.
748
832
  #
@@ -919,6 +1003,11 @@ module Google
919
1003
  # @return [::Gapic::Config::Method]
920
1004
  #
921
1005
  attr_reader :set_labels
1006
+ ##
1007
+ # RPC-specific configuration for `test_iam_permissions`
1008
+ # @return [::Gapic::Config::Method]
1009
+ #
1010
+ attr_reader :test_iam_permissions
922
1011
 
923
1012
  # @private
924
1013
  def initialize parent_rpcs = nil
@@ -934,6 +1023,8 @@ module Google
934
1023
  @move = ::Gapic::Config::Method.new move_config
935
1024
  set_labels_config = parent_rpcs.set_labels if parent_rpcs.respond_to? :set_labels
936
1025
  @set_labels = ::Gapic::Config::Method.new set_labels_config
1026
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1027
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
937
1028
 
938
1029
  yield self if block_given?
939
1030
  end
@@ -313,6 +313,46 @@ module Google
313
313
  end
314
314
  end
315
315
 
316
+ ##
317
+ # Baseline implementation for the test_iam_permissions REST call
318
+ #
319
+ # @param request_pb [::Google::Cloud::Compute::V1::TestIamPermissionsGlobalAddressRequest]
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::TestPermissionsResponse]
326
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
327
+ #
328
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
329
+ # A result object deserialized from the server's reply
330
+ def test_iam_permissions 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_test_iam_permissions_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: "test_iam_permissions",
346
+ options: options
347
+ )
348
+ operation = ::Gapic::Rest::TransportOperation.new response
349
+ result = ::Google::Cloud::Compute::V1::TestPermissionsResponse.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
  # @private
318
358
  #
@@ -445,6 +485,29 @@ module Google
445
485
  )
446
486
  transcoder.transcode request_pb
447
487
  end
488
+
489
+ ##
490
+ # @private
491
+ #
492
+ # GRPC transcoding helper method for the test_iam_permissions REST call
493
+ #
494
+ # @param request_pb [::Google::Cloud::Compute::V1::TestIamPermissionsGlobalAddressRequest]
495
+ # A request object representing the call parameters. Required.
496
+ # @return [Array(String, [String, nil], Hash{String => String})]
497
+ # Uri, Body, Query string parameters
498
+ def self.transcode_test_iam_permissions_request request_pb
499
+ transcoder = Gapic::Rest::GrpcTranscoder.new
500
+ .with_bindings(
501
+ uri_method: :post,
502
+ uri_template: "/compute/v1/projects/{project}/global/addresses/{resource}/testIamPermissions",
503
+ body: "test_permissions_request_resource",
504
+ matches: [
505
+ ["project", %r{^[^/]+/?$}, false],
506
+ ["resource", %r{^[^/]+/?$}, false]
507
+ ]
508
+ )
509
+ transcoder.transcode request_pb
510
+ end
448
511
  end
449
512
  end
450
513
  end
@@ -98,6 +98,8 @@ module Google
98
98
 
99
99
  default_config.rpcs.set_named_ports.timeout = 600.0
100
100
 
101
+ default_config.rpcs.test_iam_permissions.timeout = 600.0
102
+
101
103
  default_config
102
104
  end
103
105
  yield @configure if block_given?
@@ -1056,6 +1058,90 @@ module Google
1056
1058
  raise ::Google::Cloud::Error.from_error(e)
1057
1059
  end
1058
1060
 
1061
+ ##
1062
+ # Returns permissions that a caller has on the specified resource.
1063
+ #
1064
+ # @overload test_iam_permissions(request, options = nil)
1065
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
1066
+ # {::Google::Cloud::Compute::V1::TestIamPermissionsInstanceGroupRequest} or an equivalent Hash.
1067
+ #
1068
+ # @param request [::Google::Cloud::Compute::V1::TestIamPermissionsInstanceGroupRequest, ::Hash]
1069
+ # A request object representing the call parameters. Required. To specify no
1070
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1071
+ # @param options [::Gapic::CallOptions, ::Hash]
1072
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1073
+ #
1074
+ # @overload test_iam_permissions(project: nil, resource: nil, test_permissions_request_resource: nil, zone: nil)
1075
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
1076
+ # least one keyword argument is required. To specify no parameters, or to keep all
1077
+ # the default parameter values, pass an empty Hash as a request object (see above).
1078
+ #
1079
+ # @param project [::String]
1080
+ # Project ID for this request.
1081
+ # @param resource [::String]
1082
+ # Name or id of the resource for this request.
1083
+ # @param test_permissions_request_resource [::Google::Cloud::Compute::V1::TestPermissionsRequest, ::Hash]
1084
+ # The body resource for this request
1085
+ # @param zone [::String]
1086
+ # The name of the zone for this request.
1087
+ # @yield [result, operation] Access the result along with the TransportOperation object
1088
+ # @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
1089
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1090
+ #
1091
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
1092
+ #
1093
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1094
+ #
1095
+ # @example Basic example
1096
+ # require "google/cloud/compute/v1"
1097
+ #
1098
+ # # Create a client object. The client can be reused for multiple calls.
1099
+ # client = Google::Cloud::Compute::V1::InstanceGroups::Rest::Client.new
1100
+ #
1101
+ # # Create a request. To set request fields, pass in keyword arguments.
1102
+ # request = Google::Cloud::Compute::V1::TestIamPermissionsInstanceGroupRequest.new
1103
+ #
1104
+ # # Call the test_iam_permissions method.
1105
+ # result = client.test_iam_permissions request
1106
+ #
1107
+ # # The returned object is of type Google::Cloud::Compute::V1::TestPermissionsResponse.
1108
+ # p result
1109
+ #
1110
+ def test_iam_permissions request, options = nil
1111
+ raise ::ArgumentError, "request must be provided" if request.nil?
1112
+
1113
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::TestIamPermissionsInstanceGroupRequest
1114
+
1115
+ # Converts hash and nil to an options object
1116
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1117
+
1118
+ # Customize the options with defaults
1119
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1120
+
1121
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1122
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1123
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1124
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
1125
+ transports_version_send: [:rest]
1126
+
1127
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1128
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1129
+
1130
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1131
+ metadata: call_metadata,
1132
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1133
+
1134
+ options.apply_defaults timeout: @config.timeout,
1135
+ metadata: @config.metadata,
1136
+ retry_policy: @config.retry_policy
1137
+
1138
+ @instance_groups_stub.test_iam_permissions request, options do |result, operation|
1139
+ yield result, operation if block_given?
1140
+ end
1141
+ rescue ::Gapic::Rest::Error => e
1142
+ raise ::Google::Cloud::Error.from_error(e)
1143
+ end
1144
+
1059
1145
  ##
1060
1146
  # Configuration class for the InstanceGroups REST API.
1061
1147
  #
@@ -1247,6 +1333,11 @@ module Google
1247
1333
  # @return [::Gapic::Config::Method]
1248
1334
  #
1249
1335
  attr_reader :set_named_ports
1336
+ ##
1337
+ # RPC-specific configuration for `test_iam_permissions`
1338
+ # @return [::Gapic::Config::Method]
1339
+ #
1340
+ attr_reader :test_iam_permissions
1250
1341
 
1251
1342
  # @private
1252
1343
  def initialize parent_rpcs = nil
@@ -1268,6 +1359,8 @@ module Google
1268
1359
  @remove_instances = ::Gapic::Config::Method.new remove_instances_config
1269
1360
  set_named_ports_config = parent_rpcs.set_named_ports if parent_rpcs.respond_to? :set_named_ports
1270
1361
  @set_named_ports = ::Gapic::Config::Method.new set_named_ports_config
1362
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1363
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1271
1364
 
1272
1365
  yield self if block_given?
1273
1366
  end
@@ -433,6 +433,46 @@ module Google
433
433
  end
434
434
  end
435
435
 
436
+ ##
437
+ # Baseline implementation for the test_iam_permissions REST call
438
+ #
439
+ # @param request_pb [::Google::Cloud::Compute::V1::TestIamPermissionsInstanceGroupRequest]
440
+ # A request object representing the call parameters. Required.
441
+ # @param options [::Gapic::CallOptions]
442
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
443
+ #
444
+ # @yield [result, operation] Access the result along with the TransportOperation object
445
+ # @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
446
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
447
+ #
448
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
449
+ # A result object deserialized from the server's reply
450
+ def test_iam_permissions request_pb, options = nil
451
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
452
+
453
+ verb, uri, query_string_params, body = ServiceStub.transcode_test_iam_permissions_request request_pb
454
+ query_string_params = if query_string_params.any?
455
+ query_string_params.to_h { |p| p.split "=", 2 }
456
+ else
457
+ {}
458
+ end
459
+
460
+ response = @client_stub.make_http_request(
461
+ verb,
462
+ uri: uri,
463
+ body: body || "",
464
+ params: query_string_params,
465
+ method_name: "test_iam_permissions",
466
+ options: options
467
+ )
468
+ operation = ::Gapic::Rest::TransportOperation.new response
469
+ result = ::Google::Cloud::Compute::V1::TestPermissionsResponse.decode_json response.body, ignore_unknown_fields: true
470
+ catch :response do
471
+ yield result, operation if block_given?
472
+ result
473
+ end
474
+ end
475
+
436
476
  ##
437
477
  # @private
438
478
  #
@@ -640,6 +680,30 @@ module Google
640
680
  )
641
681
  transcoder.transcode request_pb
642
682
  end
683
+
684
+ ##
685
+ # @private
686
+ #
687
+ # GRPC transcoding helper method for the test_iam_permissions REST call
688
+ #
689
+ # @param request_pb [::Google::Cloud::Compute::V1::TestIamPermissionsInstanceGroupRequest]
690
+ # A request object representing the call parameters. Required.
691
+ # @return [Array(String, [String, nil], Hash{String => String})]
692
+ # Uri, Body, Query string parameters
693
+ def self.transcode_test_iam_permissions_request request_pb
694
+ transcoder = Gapic::Rest::GrpcTranscoder.new
695
+ .with_bindings(
696
+ uri_method: :post,
697
+ uri_template: "/compute/v1/projects/{project}/zones/{zone}/instanceGroups/{resource}/testIamPermissions",
698
+ body: "test_permissions_request_resource",
699
+ matches: [
700
+ ["project", %r{^[^/]+/?$}, false],
701
+ ["zone", %r{^[^/]+/?$}, false],
702
+ ["resource", %r{^[^/]+/?$}, false]
703
+ ]
704
+ )
705
+ transcoder.transcode request_pb
706
+ end
643
707
  end
644
708
  end
645
709
  end
@@ -73,6 +73,8 @@ module Google
73
73
 
74
74
  default_config.rpcs.add_access_config.timeout = 600.0
75
75
 
76
+ default_config.rpcs.add_network_interface.timeout = 600.0
77
+
76
78
  default_config.rpcs.add_resource_policies.timeout = 600.0
77
79
 
78
80
  default_config.rpcs.aggregated_list.timeout = 600.0
@@ -88,6 +90,8 @@ module Google
88
90
 
89
91
  default_config.rpcs.delete_access_config.timeout = 600.0
90
92
 
93
+ default_config.rpcs.delete_network_interface.timeout = 600.0
94
+
91
95
  default_config.rpcs.detach_disk.timeout = 600.0
92
96
 
93
97
  default_config.rpcs.get.timeout = 600.0
@@ -415,6 +419,102 @@ module Google
415
419
  raise ::Google::Cloud::Error.from_error(e)
416
420
  end
417
421
 
422
+ ##
423
+ # Adds one dynamic network interface to an active instance.
424
+ #
425
+ # @overload add_network_interface(request, options = nil)
426
+ # Pass arguments to `add_network_interface` via a request object, either of type
427
+ # {::Google::Cloud::Compute::V1::AddNetworkInterfaceInstanceRequest} or an equivalent Hash.
428
+ #
429
+ # @param request [::Google::Cloud::Compute::V1::AddNetworkInterfaceInstanceRequest, ::Hash]
430
+ # A request object representing the call parameters. Required. To specify no
431
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
432
+ # @param options [::Gapic::CallOptions, ::Hash]
433
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
434
+ #
435
+ # @overload add_network_interface(instance: nil, network_interface_resource: nil, project: nil, request_id: nil, zone: nil)
436
+ # Pass arguments to `add_network_interface` via keyword arguments. Note that at
437
+ # least one keyword argument is required. To specify no parameters, or to keep all
438
+ # the default parameter values, pass an empty Hash as a request object (see above).
439
+ #
440
+ # @param instance [::String]
441
+ # The instance name for this request stored as resource_id. Name should conform to RFC1035 or be an unsigned long integer.
442
+ # @param network_interface_resource [::Google::Cloud::Compute::V1::NetworkInterface, ::Hash]
443
+ # The body resource for this request
444
+ # @param project [::String]
445
+ # Project ID for this request.
446
+ # @param request_id [::String]
447
+ # 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).
448
+ # @param zone [::String]
449
+ # The name of the zone for this request.
450
+ # @yield [result, operation] Access the result along with the TransportOperation object
451
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
452
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
453
+ #
454
+ # @return [::Gapic::GenericLRO::Operation]
455
+ #
456
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
457
+ #
458
+ # @example Basic example
459
+ # require "google/cloud/compute/v1"
460
+ #
461
+ # # Create a client object. The client can be reused for multiple calls.
462
+ # client = Google::Cloud::Compute::V1::Instances::Rest::Client.new
463
+ #
464
+ # # Create a request. To set request fields, pass in keyword arguments.
465
+ # request = Google::Cloud::Compute::V1::AddNetworkInterfaceInstanceRequest.new
466
+ #
467
+ # # Call the add_network_interface method.
468
+ # result = client.add_network_interface request
469
+ #
470
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
471
+ # p result
472
+ #
473
+ def add_network_interface request, options = nil
474
+ raise ::ArgumentError, "request must be provided" if request.nil?
475
+
476
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::AddNetworkInterfaceInstanceRequest
477
+
478
+ # Converts hash and nil to an options object
479
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
480
+
481
+ # Customize the options with defaults
482
+ call_metadata = @config.rpcs.add_network_interface.metadata.to_h
483
+
484
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
485
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
486
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
487
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
488
+ transports_version_send: [:rest]
489
+
490
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
491
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
492
+
493
+ options.apply_defaults timeout: @config.rpcs.add_network_interface.timeout,
494
+ metadata: call_metadata,
495
+ retry_policy: @config.rpcs.add_network_interface.retry_policy
496
+
497
+ options.apply_defaults timeout: @config.timeout,
498
+ metadata: @config.metadata,
499
+ retry_policy: @config.retry_policy
500
+
501
+ @instances_stub.add_network_interface request, options do |result, response|
502
+ result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
503
+ operation: result,
504
+ client: zone_operations,
505
+ request_values: {
506
+ "project" => request.project,
507
+ "zone" => request.zone
508
+ },
509
+ options: options
510
+ )
511
+ yield result, response if block_given?
512
+ throw :response, result
513
+ end
514
+ rescue ::Gapic::Rest::Error => e
515
+ raise ::Google::Cloud::Error.from_error(e)
516
+ end
517
+
418
518
  ##
419
519
  # Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
420
520
  #
@@ -989,6 +1089,102 @@ module Google
989
1089
  raise ::Google::Cloud::Error.from_error(e)
990
1090
  end
991
1091
 
1092
+ ##
1093
+ # Deletes one dynamic network interface from an active instance. InstancesDeleteNetworkInterfaceRequest indicates: - instance from which to delete, using project+zone+resource_id fields; - dynamic network interface to be deleted, using network_interface_name field;
1094
+ #
1095
+ # @overload delete_network_interface(request, options = nil)
1096
+ # Pass arguments to `delete_network_interface` via a request object, either of type
1097
+ # {::Google::Cloud::Compute::V1::DeleteNetworkInterfaceInstanceRequest} or an equivalent Hash.
1098
+ #
1099
+ # @param request [::Google::Cloud::Compute::V1::DeleteNetworkInterfaceInstanceRequest, ::Hash]
1100
+ # A request object representing the call parameters. Required. To specify no
1101
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1102
+ # @param options [::Gapic::CallOptions, ::Hash]
1103
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1104
+ #
1105
+ # @overload delete_network_interface(instance: nil, network_interface_name: nil, project: nil, request_id: nil, zone: nil)
1106
+ # Pass arguments to `delete_network_interface` via keyword arguments. Note that at
1107
+ # least one keyword argument is required. To specify no parameters, or to keep all
1108
+ # the default parameter values, pass an empty Hash as a request object (see above).
1109
+ #
1110
+ # @param instance [::String]
1111
+ # The instance name for this request stored as resource_id. Name should conform to RFC1035 or be an unsigned long integer.
1112
+ # @param network_interface_name [::String]
1113
+ # The name of the dynamic network interface to be deleted from the instance.
1114
+ # @param project [::String]
1115
+ # Project ID for this request.
1116
+ # @param request_id [::String]
1117
+ # 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).
1118
+ # @param zone [::String]
1119
+ # The name of the zone for this request.
1120
+ # @yield [result, operation] Access the result along with the TransportOperation object
1121
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
1122
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1123
+ #
1124
+ # @return [::Gapic::GenericLRO::Operation]
1125
+ #
1126
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1127
+ #
1128
+ # @example Basic example
1129
+ # require "google/cloud/compute/v1"
1130
+ #
1131
+ # # Create a client object. The client can be reused for multiple calls.
1132
+ # client = Google::Cloud::Compute::V1::Instances::Rest::Client.new
1133
+ #
1134
+ # # Create a request. To set request fields, pass in keyword arguments.
1135
+ # request = Google::Cloud::Compute::V1::DeleteNetworkInterfaceInstanceRequest.new
1136
+ #
1137
+ # # Call the delete_network_interface method.
1138
+ # result = client.delete_network_interface request
1139
+ #
1140
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
1141
+ # p result
1142
+ #
1143
+ def delete_network_interface request, options = nil
1144
+ raise ::ArgumentError, "request must be provided" if request.nil?
1145
+
1146
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DeleteNetworkInterfaceInstanceRequest
1147
+
1148
+ # Converts hash and nil to an options object
1149
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1150
+
1151
+ # Customize the options with defaults
1152
+ call_metadata = @config.rpcs.delete_network_interface.metadata.to_h
1153
+
1154
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1155
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1156
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1157
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
1158
+ transports_version_send: [:rest]
1159
+
1160
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1161
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1162
+
1163
+ options.apply_defaults timeout: @config.rpcs.delete_network_interface.timeout,
1164
+ metadata: call_metadata,
1165
+ retry_policy: @config.rpcs.delete_network_interface.retry_policy
1166
+
1167
+ options.apply_defaults timeout: @config.timeout,
1168
+ metadata: @config.metadata,
1169
+ retry_policy: @config.retry_policy
1170
+
1171
+ @instances_stub.delete_network_interface request, options do |result, response|
1172
+ result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
1173
+ operation: result,
1174
+ client: zone_operations,
1175
+ request_values: {
1176
+ "project" => request.project,
1177
+ "zone" => request.zone
1178
+ },
1179
+ options: options
1180
+ )
1181
+ yield result, response if block_given?
1182
+ throw :response, result
1183
+ end
1184
+ rescue ::Gapic::Rest::Error => e
1185
+ raise ::Google::Cloud::Error.from_error(e)
1186
+ end
1187
+
992
1188
  ##
993
1189
  # Detaches a disk from an instance.
994
1190
  #
@@ -5049,6 +5245,11 @@ module Google
5049
5245
  #
5050
5246
  attr_reader :add_access_config
5051
5247
  ##
5248
+ # RPC-specific configuration for `add_network_interface`
5249
+ # @return [::Gapic::Config::Method]
5250
+ #
5251
+ attr_reader :add_network_interface
5252
+ ##
5052
5253
  # RPC-specific configuration for `add_resource_policies`
5053
5254
  # @return [::Gapic::Config::Method]
5054
5255
  #
@@ -5079,6 +5280,11 @@ module Google
5079
5280
  #
5080
5281
  attr_reader :delete_access_config
5081
5282
  ##
5283
+ # RPC-specific configuration for `delete_network_interface`
5284
+ # @return [::Gapic::Config::Method]
5285
+ #
5286
+ attr_reader :delete_network_interface
5287
+ ##
5082
5288
  # RPC-specific configuration for `detach_disk`
5083
5289
  # @return [::Gapic::Config::Method]
5084
5290
  #
@@ -5293,6 +5499,8 @@ module Google
5293
5499
  def initialize parent_rpcs = nil
5294
5500
  add_access_config_config = parent_rpcs.add_access_config if parent_rpcs.respond_to? :add_access_config
5295
5501
  @add_access_config = ::Gapic::Config::Method.new add_access_config_config
5502
+ add_network_interface_config = parent_rpcs.add_network_interface if parent_rpcs.respond_to? :add_network_interface
5503
+ @add_network_interface = ::Gapic::Config::Method.new add_network_interface_config
5296
5504
  add_resource_policies_config = parent_rpcs.add_resource_policies if parent_rpcs.respond_to? :add_resource_policies
5297
5505
  @add_resource_policies = ::Gapic::Config::Method.new add_resource_policies_config
5298
5506
  aggregated_list_config = parent_rpcs.aggregated_list if parent_rpcs.respond_to? :aggregated_list
@@ -5305,6 +5513,8 @@ module Google
5305
5513
  @delete = ::Gapic::Config::Method.new delete_config
5306
5514
  delete_access_config_config = parent_rpcs.delete_access_config if parent_rpcs.respond_to? :delete_access_config
5307
5515
  @delete_access_config = ::Gapic::Config::Method.new delete_access_config_config
5516
+ delete_network_interface_config = parent_rpcs.delete_network_interface if parent_rpcs.respond_to? :delete_network_interface
5517
+ @delete_network_interface = ::Gapic::Config::Method.new delete_network_interface_config
5308
5518
  detach_disk_config = parent_rpcs.detach_disk if parent_rpcs.respond_to? :detach_disk
5309
5519
  @detach_disk = ::Gapic::Config::Method.new detach_disk_config
5310
5520
  get_config = parent_rpcs.get if parent_rpcs.respond_to? :get