google-cloud-network_connectivity-v1 0.1.0 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -81,10 +81,6 @@ module Google
81
81
 
82
82
  default_config.rpcs.update_spoke.timeout = 60.0
83
83
 
84
- default_config.rpcs.deactivate_spoke.timeout = 60.0
85
-
86
- default_config.rpcs.activate_spoke.timeout = 60.0
87
-
88
84
  default_config.rpcs.delete_spoke.timeout = 60.0
89
85
 
90
86
  default_config
@@ -158,6 +154,7 @@ module Google
158
154
 
159
155
  @operations_client = Operations.new do |config|
160
156
  config.credentials = credentials
157
+ config.quota_project = @quota_project_id
161
158
  config.endpoint = @config.endpoint
162
159
  end
163
160
 
@@ -216,6 +213,27 @@ module Google
216
213
  #
217
214
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
218
215
  #
216
+ # @example Basic example
217
+ # require "google/cloud/network_connectivity/v1"
218
+ #
219
+ # # Create a client object. The client can be reused for multiple calls.
220
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
221
+ #
222
+ # # Create a request. To set request fields, pass in keyword arguments.
223
+ # request = Google::Cloud::NetworkConnectivity::V1::ListHubsRequest.new
224
+ #
225
+ # # Call the list_hubs method.
226
+ # result = client.list_hubs request
227
+ #
228
+ # # The returned object is of type Gapic::PagedEnumerable. You can
229
+ # # iterate over all elements by calling #each, and the enumerable
230
+ # # will lazily make API calls to fetch subsequent pages. Other
231
+ # # methods are also available for managing paging directly.
232
+ # result.each do |response|
233
+ # # Each element is of type ::Google::Cloud::NetworkConnectivity::V1::Hub.
234
+ # p response
235
+ # end
236
+ #
219
237
  def list_hubs request, options = nil
220
238
  raise ::ArgumentError, "request must be provided" if request.nil?
221
239
 
@@ -233,9 +251,11 @@ module Google
233
251
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
234
252
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
235
253
 
236
- header_params = {
237
- "parent" => request.parent
238
- }
254
+ header_params = {}
255
+ if request.parent
256
+ header_params["parent"] = request.parent
257
+ end
258
+
239
259
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
240
260
  metadata[:"x-goog-request-params"] ||= request_params_header
241
261
 
@@ -285,6 +305,21 @@ module Google
285
305
  #
286
306
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
287
307
  #
308
+ # @example Basic example
309
+ # require "google/cloud/network_connectivity/v1"
310
+ #
311
+ # # Create a client object. The client can be reused for multiple calls.
312
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
313
+ #
314
+ # # Create a request. To set request fields, pass in keyword arguments.
315
+ # request = Google::Cloud::NetworkConnectivity::V1::GetHubRequest.new
316
+ #
317
+ # # Call the get_hub method.
318
+ # result = client.get_hub request
319
+ #
320
+ # # The returned object is of type Google::Cloud::NetworkConnectivity::V1::Hub.
321
+ # p result
322
+ #
288
323
  def get_hub request, options = nil
289
324
  raise ::ArgumentError, "request must be provided" if request.nil?
290
325
 
@@ -302,9 +337,11 @@ module Google
302
337
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
303
338
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
304
339
 
305
- header_params = {
306
- "name" => request.name
307
- }
340
+ header_params = {}
341
+ if request.name
342
+ header_params["name"] = request.name
343
+ end
344
+
308
345
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
309
346
  metadata[:"x-goog-request-params"] ||= request_params_header
310
347
 
@@ -345,7 +382,7 @@ module Google
345
382
  # @param parent [::String]
346
383
  # Required. The parent resource.
347
384
  # @param hub_id [::String]
348
- # Optional. A unique identifier for the hub.
385
+ # Required. A unique identifier for the hub.
349
386
  # @param hub [::Google::Cloud::NetworkConnectivity::V1::Hub, ::Hash]
350
387
  # Required. The initial values for a new hub.
351
388
  # @param request_id [::String]
@@ -372,6 +409,28 @@ module Google
372
409
  #
373
410
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
374
411
  #
412
+ # @example Basic example
413
+ # require "google/cloud/network_connectivity/v1"
414
+ #
415
+ # # Create a client object. The client can be reused for multiple calls.
416
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
417
+ #
418
+ # # Create a request. To set request fields, pass in keyword arguments.
419
+ # request = Google::Cloud::NetworkConnectivity::V1::CreateHubRequest.new
420
+ #
421
+ # # Call the create_hub method.
422
+ # result = client.create_hub request
423
+ #
424
+ # # The returned object is of type Gapic::Operation. You can use this
425
+ # # object to check the status of an operation, cancel it, or wait
426
+ # # for results. Here is how to block until completion:
427
+ # result.wait_until_done! timeout: 60
428
+ # if result.response?
429
+ # p result.response
430
+ # else
431
+ # puts "Error!"
432
+ # end
433
+ #
375
434
  def create_hub request, options = nil
376
435
  raise ::ArgumentError, "request must be provided" if request.nil?
377
436
 
@@ -389,9 +448,11 @@ module Google
389
448
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
390
449
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
391
450
 
392
- header_params = {
393
- "parent" => request.parent
394
- }
451
+ header_params = {}
452
+ if request.parent
453
+ header_params["parent"] = request.parent
454
+ end
455
+
395
456
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
396
457
  metadata[:"x-goog-request-params"] ||= request_params_header
397
458
 
@@ -462,6 +523,28 @@ module Google
462
523
  #
463
524
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
464
525
  #
526
+ # @example Basic example
527
+ # require "google/cloud/network_connectivity/v1"
528
+ #
529
+ # # Create a client object. The client can be reused for multiple calls.
530
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
531
+ #
532
+ # # Create a request. To set request fields, pass in keyword arguments.
533
+ # request = Google::Cloud::NetworkConnectivity::V1::UpdateHubRequest.new
534
+ #
535
+ # # Call the update_hub method.
536
+ # result = client.update_hub request
537
+ #
538
+ # # The returned object is of type Gapic::Operation. You can use this
539
+ # # object to check the status of an operation, cancel it, or wait
540
+ # # for results. Here is how to block until completion:
541
+ # result.wait_until_done! timeout: 60
542
+ # if result.response?
543
+ # p result.response
544
+ # else
545
+ # puts "Error!"
546
+ # end
547
+ #
465
548
  def update_hub request, options = nil
466
549
  raise ::ArgumentError, "request must be provided" if request.nil?
467
550
 
@@ -479,9 +562,11 @@ module Google
479
562
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
480
563
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
481
564
 
482
- header_params = {
483
- "hub.name" => request.hub.name
484
- }
565
+ header_params = {}
566
+ if request.hub&.name
567
+ header_params["hub.name"] = request.hub.name
568
+ end
569
+
485
570
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
486
571
  metadata[:"x-goog-request-params"] ||= request_params_header
487
572
 
@@ -546,6 +631,28 @@ module Google
546
631
  #
547
632
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
548
633
  #
634
+ # @example Basic example
635
+ # require "google/cloud/network_connectivity/v1"
636
+ #
637
+ # # Create a client object. The client can be reused for multiple calls.
638
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
639
+ #
640
+ # # Create a request. To set request fields, pass in keyword arguments.
641
+ # request = Google::Cloud::NetworkConnectivity::V1::DeleteHubRequest.new
642
+ #
643
+ # # Call the delete_hub method.
644
+ # result = client.delete_hub request
645
+ #
646
+ # # The returned object is of type Gapic::Operation. You can use this
647
+ # # object to check the status of an operation, cancel it, or wait
648
+ # # for results. Here is how to block until completion:
649
+ # result.wait_until_done! timeout: 60
650
+ # if result.response?
651
+ # p result.response
652
+ # else
653
+ # puts "Error!"
654
+ # end
655
+ #
549
656
  def delete_hub request, options = nil
550
657
  raise ::ArgumentError, "request must be provided" if request.nil?
551
658
 
@@ -563,9 +670,11 @@ module Google
563
670
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
564
671
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
565
672
 
566
- header_params = {
567
- "name" => request.name
568
- }
673
+ header_params = {}
674
+ if request.name
675
+ header_params["name"] = request.name
676
+ end
677
+
569
678
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
570
679
  metadata[:"x-goog-request-params"] ||= request_params_header
571
680
 
@@ -623,6 +732,27 @@ module Google
623
732
  #
624
733
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
625
734
  #
735
+ # @example Basic example
736
+ # require "google/cloud/network_connectivity/v1"
737
+ #
738
+ # # Create a client object. The client can be reused for multiple calls.
739
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
740
+ #
741
+ # # Create a request. To set request fields, pass in keyword arguments.
742
+ # request = Google::Cloud::NetworkConnectivity::V1::ListSpokesRequest.new
743
+ #
744
+ # # Call the list_spokes method.
745
+ # result = client.list_spokes request
746
+ #
747
+ # # The returned object is of type Gapic::PagedEnumerable. You can
748
+ # # iterate over all elements by calling #each, and the enumerable
749
+ # # will lazily make API calls to fetch subsequent pages. Other
750
+ # # methods are also available for managing paging directly.
751
+ # result.each do |response|
752
+ # # Each element is of type ::Google::Cloud::NetworkConnectivity::V1::Spoke.
753
+ # p response
754
+ # end
755
+ #
626
756
  def list_spokes request, options = nil
627
757
  raise ::ArgumentError, "request must be provided" if request.nil?
628
758
 
@@ -640,9 +770,11 @@ module Google
640
770
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
641
771
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
642
772
 
643
- header_params = {
644
- "parent" => request.parent
645
- }
773
+ header_params = {}
774
+ if request.parent
775
+ header_params["parent"] = request.parent
776
+ end
777
+
646
778
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
647
779
  metadata[:"x-goog-request-params"] ||= request_params_header
648
780
 
@@ -692,6 +824,21 @@ module Google
692
824
  #
693
825
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
694
826
  #
827
+ # @example Basic example
828
+ # require "google/cloud/network_connectivity/v1"
829
+ #
830
+ # # Create a client object. The client can be reused for multiple calls.
831
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
832
+ #
833
+ # # Create a request. To set request fields, pass in keyword arguments.
834
+ # request = Google::Cloud::NetworkConnectivity::V1::GetSpokeRequest.new
835
+ #
836
+ # # Call the get_spoke method.
837
+ # result = client.get_spoke request
838
+ #
839
+ # # The returned object is of type Google::Cloud::NetworkConnectivity::V1::Spoke.
840
+ # p result
841
+ #
695
842
  def get_spoke request, options = nil
696
843
  raise ::ArgumentError, "request must be provided" if request.nil?
697
844
 
@@ -709,9 +856,11 @@ module Google
709
856
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
710
857
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
711
858
 
712
- header_params = {
713
- "name" => request.name
714
- }
859
+ header_params = {}
860
+ if request.name
861
+ header_params["name"] = request.name
862
+ end
863
+
715
864
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
716
865
  metadata[:"x-goog-request-params"] ||= request_params_header
717
866
 
@@ -752,7 +901,7 @@ module Google
752
901
  # @param parent [::String]
753
902
  # Required. The parent resource.
754
903
  # @param spoke_id [::String]
755
- # Optional. Unique id for the spoke to create.
904
+ # Required. Unique id for the spoke to create.
756
905
  # @param spoke [::Google::Cloud::NetworkConnectivity::V1::Spoke, ::Hash]
757
906
  # Required. The initial values for a new spoke.
758
907
  # @param request_id [::String]
@@ -779,6 +928,28 @@ module Google
779
928
  #
780
929
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
781
930
  #
931
+ # @example Basic example
932
+ # require "google/cloud/network_connectivity/v1"
933
+ #
934
+ # # Create a client object. The client can be reused for multiple calls.
935
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
936
+ #
937
+ # # Create a request. To set request fields, pass in keyword arguments.
938
+ # request = Google::Cloud::NetworkConnectivity::V1::CreateSpokeRequest.new
939
+ #
940
+ # # Call the create_spoke method.
941
+ # result = client.create_spoke request
942
+ #
943
+ # # The returned object is of type Gapic::Operation. You can use this
944
+ # # object to check the status of an operation, cancel it, or wait
945
+ # # for results. Here is how to block until completion:
946
+ # result.wait_until_done! timeout: 60
947
+ # if result.response?
948
+ # p result.response
949
+ # else
950
+ # puts "Error!"
951
+ # end
952
+ #
782
953
  def create_spoke request, options = nil
783
954
  raise ::ArgumentError, "request must be provided" if request.nil?
784
955
 
@@ -796,9 +967,11 @@ module Google
796
967
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
797
968
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
798
969
 
799
- header_params = {
800
- "parent" => request.parent
801
- }
970
+ header_params = {}
971
+ if request.parent
972
+ header_params["parent"] = request.parent
973
+ end
974
+
802
975
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
803
976
  metadata[:"x-goog-request-params"] ||= request_params_header
804
977
 
@@ -869,102 +1042,38 @@ module Google
869
1042
  #
870
1043
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
871
1044
  #
872
- def update_spoke request, options = nil
873
- raise ::ArgumentError, "request must be provided" if request.nil?
874
-
875
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1::UpdateSpokeRequest
876
-
877
- # Converts hash and nil to an options object
878
- options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
879
-
880
- # Customize the options with defaults
881
- metadata = @config.rpcs.update_spoke.metadata.to_h
882
-
883
- # Set x-goog-api-client and x-goog-user-project headers
884
- metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
885
- lib_name: @config.lib_name, lib_version: @config.lib_version,
886
- gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
887
- metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
888
-
889
- header_params = {
890
- "spoke.name" => request.spoke.name
891
- }
892
- request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
893
- metadata[:"x-goog-request-params"] ||= request_params_header
894
-
895
- options.apply_defaults timeout: @config.rpcs.update_spoke.timeout,
896
- metadata: metadata,
897
- retry_policy: @config.rpcs.update_spoke.retry_policy
898
-
899
- options.apply_defaults timeout: @config.timeout,
900
- metadata: @config.metadata,
901
- retry_policy: @config.retry_policy
902
-
903
- @hub_service_stub.call_rpc :update_spoke, request, options: options do |response, operation|
904
- response = ::Gapic::Operation.new response, @operations_client, options: options
905
- yield response, operation if block_given?
906
- return response
907
- end
908
- rescue ::GRPC::BadStatus => e
909
- raise ::Google::Cloud::Error.from_error(e)
910
- end
911
-
912
- ##
913
- # Deactivates the specified spoke. Deactivating keeps the spoke information
914
- # for future re-activation, but disconnects the Google Cloud network from
915
- # non-Google-Cloud network.
916
- #
917
- # @overload deactivate_spoke(request, options = nil)
918
- # Pass arguments to `deactivate_spoke` via a request object, either of type
919
- # {::Google::Cloud::NetworkConnectivity::V1::DeactivateSpokeRequest} or an equivalent Hash.
920
- #
921
- # @param request [::Google::Cloud::NetworkConnectivity::V1::DeactivateSpokeRequest, ::Hash]
922
- # A request object representing the call parameters. Required. To specify no
923
- # parameters, or to keep all the default parameter values, pass an empty Hash.
924
- # @param options [::Gapic::CallOptions, ::Hash]
925
- # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
926
- #
927
- # @overload deactivate_spoke(name: nil, request_id: nil)
928
- # Pass arguments to `deactivate_spoke` via keyword arguments. Note that at
929
- # least one keyword argument is required. To specify no parameters, or to keep all
930
- # the default parameter values, pass an empty Hash as a request object (see above).
931
- #
932
- # @param name [::String]
933
- # Required. The name of the spoke to deactivate.
934
- # @param request_id [::String]
935
- # Optional. A unique request ID (optional). If you specify this ID, you can use it
936
- # in cases when you need to retry your request. When you need to retry, this
937
- # ID lets the server know that it can ignore the request if it has already
938
- # been completed. The server guarantees that for at least 60 minutes after
939
- # the first request.
940
- #
941
- # For example, consider a situation where you make an initial request and
942
- # the request times out. If you make the request again with the same request
943
- # ID, the server can check to see whether the original operation
944
- # was received. If it was, the server ignores the second request. This
945
- # behavior prevents clients from mistakenly creating duplicate commitments.
1045
+ # @example Basic example
1046
+ # require "google/cloud/network_connectivity/v1"
946
1047
  #
947
- # The request ID must be a valid UUID, with the exception that zero UUID is
948
- # not supported (00000000-0000-0000-0000-000000000000).
1048
+ # # Create a client object. The client can be reused for multiple calls.
1049
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
949
1050
  #
950
- # @yield [response, operation] Access the result along with the RPC operation
951
- # @yieldparam response [::Gapic::Operation]
952
- # @yieldparam operation [::GRPC::ActiveCall::Operation]
1051
+ # # Create a request. To set request fields, pass in keyword arguments.
1052
+ # request = Google::Cloud::NetworkConnectivity::V1::UpdateSpokeRequest.new
953
1053
  #
954
- # @return [::Gapic::Operation]
1054
+ # # Call the update_spoke method.
1055
+ # result = client.update_spoke request
955
1056
  #
956
- # @raise [::Google::Cloud::Error] if the RPC is aborted.
1057
+ # # The returned object is of type Gapic::Operation. You can use this
1058
+ # # object to check the status of an operation, cancel it, or wait
1059
+ # # for results. Here is how to block until completion:
1060
+ # result.wait_until_done! timeout: 60
1061
+ # if result.response?
1062
+ # p result.response
1063
+ # else
1064
+ # puts "Error!"
1065
+ # end
957
1066
  #
958
- def deactivate_spoke request, options = nil
1067
+ def update_spoke request, options = nil
959
1068
  raise ::ArgumentError, "request must be provided" if request.nil?
960
1069
 
961
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1::DeactivateSpokeRequest
1070
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1::UpdateSpokeRequest
962
1071
 
963
1072
  # Converts hash and nil to an options object
964
1073
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
965
1074
 
966
1075
  # Customize the options with defaults
967
- metadata = @config.rpcs.deactivate_spoke.metadata.to_h
1076
+ metadata = @config.rpcs.update_spoke.metadata.to_h
968
1077
 
969
1078
  # Set x-goog-api-client and x-goog-user-project headers
970
1079
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -972,106 +1081,23 @@ module Google
972
1081
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
973
1082
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
974
1083
 
975
- header_params = {
976
- "name" => request.name
977
- }
978
- request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
979
- metadata[:"x-goog-request-params"] ||= request_params_header
980
-
981
- options.apply_defaults timeout: @config.rpcs.deactivate_spoke.timeout,
982
- metadata: metadata,
983
- retry_policy: @config.rpcs.deactivate_spoke.retry_policy
984
-
985
- options.apply_defaults timeout: @config.timeout,
986
- metadata: @config.metadata,
987
- retry_policy: @config.retry_policy
988
-
989
- @hub_service_stub.call_rpc :deactivate_spoke, request, options: options do |response, operation|
990
- response = ::Gapic::Operation.new response, @operations_client, options: options
991
- yield response, operation if block_given?
992
- return response
1084
+ header_params = {}
1085
+ if request.spoke&.name
1086
+ header_params["spoke.name"] = request.spoke.name
993
1087
  end
994
- rescue ::GRPC::BadStatus => e
995
- raise ::Google::Cloud::Error.from_error(e)
996
- end
997
1088
 
998
- ##
999
- # Activates the specified spoke. Activating reconnects the Google Cloud
1000
- # network with the non-Google-Cloud network.
1001
- #
1002
- # @overload activate_spoke(request, options = nil)
1003
- # Pass arguments to `activate_spoke` via a request object, either of type
1004
- # {::Google::Cloud::NetworkConnectivity::V1::ActivateSpokeRequest} or an equivalent Hash.
1005
- #
1006
- # @param request [::Google::Cloud::NetworkConnectivity::V1::ActivateSpokeRequest, ::Hash]
1007
- # A request object representing the call parameters. Required. To specify no
1008
- # parameters, or to keep all the default parameter values, pass an empty Hash.
1009
- # @param options [::Gapic::CallOptions, ::Hash]
1010
- # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1011
- #
1012
- # @overload activate_spoke(name: nil, request_id: nil)
1013
- # Pass arguments to `activate_spoke` via keyword arguments. Note that at
1014
- # least one keyword argument is required. To specify no parameters, or to keep all
1015
- # the default parameter values, pass an empty Hash as a request object (see above).
1016
- #
1017
- # @param name [::String]
1018
- # Required. The name of the spoke to activate.
1019
- # @param request_id [::String]
1020
- # Optional. A unique request ID (optional). If you specify this ID, you can use it
1021
- # in cases when you need to retry your request. When you need to retry, this
1022
- # ID lets the server know that it can ignore the request if it has already
1023
- # been completed. The server guarantees that for at least 60 minutes after
1024
- # the first request.
1025
- #
1026
- # For example, consider a situation where you make an initial request and
1027
- # the request times out. If you make the request again with the same request
1028
- # ID, the server can check to see whether the original operation
1029
- # was received. If it was, the server ignores the second request. This
1030
- # behavior prevents clients from mistakenly creating duplicate commitments.
1031
- #
1032
- # The request ID must be a valid UUID, with the exception that zero UUID is
1033
- # not supported (00000000-0000-0000-0000-000000000000).
1034
- #
1035
- # @yield [response, operation] Access the result along with the RPC operation
1036
- # @yieldparam response [::Gapic::Operation]
1037
- # @yieldparam operation [::GRPC::ActiveCall::Operation]
1038
- #
1039
- # @return [::Gapic::Operation]
1040
- #
1041
- # @raise [::Google::Cloud::Error] if the RPC is aborted.
1042
- #
1043
- def activate_spoke request, options = nil
1044
- raise ::ArgumentError, "request must be provided" if request.nil?
1045
-
1046
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1::ActivateSpokeRequest
1047
-
1048
- # Converts hash and nil to an options object
1049
- options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1050
-
1051
- # Customize the options with defaults
1052
- metadata = @config.rpcs.activate_spoke.metadata.to_h
1053
-
1054
- # Set x-goog-api-client and x-goog-user-project headers
1055
- metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1056
- lib_name: @config.lib_name, lib_version: @config.lib_version,
1057
- gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
1058
- metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1059
-
1060
- header_params = {
1061
- "name" => request.name
1062
- }
1063
1089
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1064
1090
  metadata[:"x-goog-request-params"] ||= request_params_header
1065
1091
 
1066
- options.apply_defaults timeout: @config.rpcs.activate_spoke.timeout,
1092
+ options.apply_defaults timeout: @config.rpcs.update_spoke.timeout,
1067
1093
  metadata: metadata,
1068
- retry_policy: @config.rpcs.activate_spoke.retry_policy
1094
+ retry_policy: @config.rpcs.update_spoke.retry_policy
1069
1095
 
1070
1096
  options.apply_defaults timeout: @config.timeout,
1071
1097
  metadata: @config.metadata,
1072
1098
  retry_policy: @config.retry_policy
1073
1099
 
1074
- @hub_service_stub.call_rpc :activate_spoke, request, options: options do |response, operation|
1100
+ @hub_service_stub.call_rpc :update_spoke, request, options: options do |response, operation|
1075
1101
  response = ::Gapic::Operation.new response, @operations_client, options: options
1076
1102
  yield response, operation if block_given?
1077
1103
  return response
@@ -1124,6 +1150,28 @@ module Google
1124
1150
  #
1125
1151
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1126
1152
  #
1153
+ # @example Basic example
1154
+ # require "google/cloud/network_connectivity/v1"
1155
+ #
1156
+ # # Create a client object. The client can be reused for multiple calls.
1157
+ # client = Google::Cloud::NetworkConnectivity::V1::HubService::Client.new
1158
+ #
1159
+ # # Create a request. To set request fields, pass in keyword arguments.
1160
+ # request = Google::Cloud::NetworkConnectivity::V1::DeleteSpokeRequest.new
1161
+ #
1162
+ # # Call the delete_spoke method.
1163
+ # result = client.delete_spoke request
1164
+ #
1165
+ # # The returned object is of type Gapic::Operation. You can use this
1166
+ # # object to check the status of an operation, cancel it, or wait
1167
+ # # for results. Here is how to block until completion:
1168
+ # result.wait_until_done! timeout: 60
1169
+ # if result.response?
1170
+ # p result.response
1171
+ # else
1172
+ # puts "Error!"
1173
+ # end
1174
+ #
1127
1175
  def delete_spoke request, options = nil
1128
1176
  raise ::ArgumentError, "request must be provided" if request.nil?
1129
1177
 
@@ -1141,9 +1189,11 @@ module Google
1141
1189
  gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
1142
1190
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1143
1191
 
1144
- header_params = {
1145
- "name" => request.name
1146
- }
1192
+ header_params = {}
1193
+ if request.name
1194
+ header_params["name"] = request.name
1195
+ end
1196
+
1147
1197
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1148
1198
  metadata[:"x-goog-request-params"] ||= request_params_header
1149
1199
 
@@ -1345,16 +1395,6 @@ module Google
1345
1395
  #
1346
1396
  attr_reader :update_spoke
1347
1397
  ##
1348
- # RPC-specific configuration for `deactivate_spoke`
1349
- # @return [::Gapic::Config::Method]
1350
- #
1351
- attr_reader :deactivate_spoke
1352
- ##
1353
- # RPC-specific configuration for `activate_spoke`
1354
- # @return [::Gapic::Config::Method]
1355
- #
1356
- attr_reader :activate_spoke
1357
- ##
1358
1398
  # RPC-specific configuration for `delete_spoke`
1359
1399
  # @return [::Gapic::Config::Method]
1360
1400
  #
@@ -1380,10 +1420,6 @@ module Google
1380
1420
  @create_spoke = ::Gapic::Config::Method.new create_spoke_config
1381
1421
  update_spoke_config = parent_rpcs.update_spoke if parent_rpcs.respond_to? :update_spoke
1382
1422
  @update_spoke = ::Gapic::Config::Method.new update_spoke_config
1383
- deactivate_spoke_config = parent_rpcs.deactivate_spoke if parent_rpcs.respond_to? :deactivate_spoke
1384
- @deactivate_spoke = ::Gapic::Config::Method.new deactivate_spoke_config
1385
- activate_spoke_config = parent_rpcs.activate_spoke if parent_rpcs.respond_to? :activate_spoke
1386
- @activate_spoke = ::Gapic::Config::Method.new activate_spoke_config
1387
1423
  delete_spoke_config = parent_rpcs.delete_spoke if parent_rpcs.respond_to? :delete_spoke
1388
1424
  @delete_spoke = ::Gapic::Config::Method.new delete_spoke_config
1389
1425