google-cloud-service_directory-v1 0.3.1 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,13 +55,12 @@ module Google
55
55
  # See {::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client::Configuration}
56
56
  # for a description of the configuration fields.
57
57
  #
58
- # ## Example
58
+ # @example
59
59
  #
60
- # To modify the configuration for all RegistrationService clients:
61
- #
62
- # ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.configure do |config|
63
- # config.timeout = 10.0
64
- # end
60
+ # # Modify the configuration for all RegistrationService clients
61
+ # ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.configure do |config|
62
+ # config.timeout = 10.0
63
+ # end
65
64
  #
66
65
  # @yield [config] Configure the Client client.
67
66
  # @yieldparam config [Client::Configuration]
@@ -81,10 +80,7 @@ module Google
81
80
 
82
81
  default_config.timeout = 15.0
83
82
  default_config.retry_policy = {
84
- initial_delay: 1.0,
85
- max_delay: 60.0,
86
- multiplier: 1.3,
87
- retry_codes: [14, 2]
83
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 2]
88
84
  }
89
85
 
90
86
  default_config
@@ -116,19 +112,15 @@ module Google
116
112
  ##
117
113
  # Create a new RegistrationService client object.
118
114
  #
119
- # ## Examples
120
- #
121
- # To create a new RegistrationService client with the default
122
- # configuration:
123
- #
124
- # client = ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
115
+ # @example
125
116
  #
126
- # To create a new RegistrationService client with a custom
127
- # configuration:
117
+ # # Create a client using the default configuration
118
+ # client = ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
128
119
  #
129
- # client = ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new do |config|
130
- # config.timeout = 10.0
131
- # end
120
+ # # Create a client using a custom configuration
121
+ # client = ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new do |config|
122
+ # config.timeout = 10.0
123
+ # end
132
124
  #
133
125
  # @yield [config] Configure the RegistrationService client.
134
126
  # @yieldparam config [Client::Configuration]
@@ -148,14 +140,13 @@ module Google
148
140
 
149
141
  # Create credentials
150
142
  credentials = @config.credentials
151
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
143
+ # Use self-signed JWT if the endpoint is unchanged from default,
152
144
  # but only if the default endpoint does not have a region prefix.
153
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
154
- @config.endpoint == Client.configure.endpoint &&
145
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
155
146
  !@config.endpoint.split(".").first.include?("-")
156
147
  credentials ||= Credentials.default scope: @config.scope,
157
148
  enable_self_signed_jwt: enable_self_signed_jwt
158
- if credentials.is_a?(String) || credentials.is_a?(Hash)
149
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
159
150
  credentials = Credentials.new credentials, scope: @config.scope
160
151
  end
161
152
  @quota_project_id = @config.quota_project
@@ -212,6 +203,21 @@ module Google
212
203
  #
213
204
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
214
205
  #
206
+ # @example Basic example
207
+ # require "google/cloud/service_directory/v1"
208
+ #
209
+ # # Create a client object. The client can be reused for multiple calls.
210
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
211
+ #
212
+ # # Create a request. To set request fields, pass in keyword arguments.
213
+ # request = Google::Cloud::ServiceDirectory::V1::CreateNamespaceRequest.new
214
+ #
215
+ # # Call the create_namespace method.
216
+ # result = client.create_namespace request
217
+ #
218
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::Namespace.
219
+ # p result
220
+ #
215
221
  def create_namespace request, options = nil
216
222
  raise ::ArgumentError, "request must be provided" if request.nil?
217
223
 
@@ -229,16 +235,20 @@ module Google
229
235
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
230
236
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
231
237
 
232
- header_params = {
233
- "parent" => request.parent
234
- }
238
+ header_params = {}
239
+ if request.parent
240
+ header_params["parent"] = request.parent
241
+ end
242
+
235
243
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
236
244
  metadata[:"x-goog-request-params"] ||= request_params_header
237
245
 
238
246
  options.apply_defaults timeout: @config.rpcs.create_namespace.timeout,
239
247
  metadata: metadata,
240
248
  retry_policy: @config.rpcs.create_namespace.retry_policy
241
- options.apply_defaults metadata: @config.metadata,
249
+
250
+ options.apply_defaults timeout: @config.timeout,
251
+ metadata: @config.metadata,
242
252
  retry_policy: @config.retry_policy
243
253
 
244
254
  @registration_service_stub.call_rpc :create_namespace, request, options: options do |response, operation|
@@ -318,6 +328,27 @@ module Google
318
328
  #
319
329
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
320
330
  #
331
+ # @example Basic example
332
+ # require "google/cloud/service_directory/v1"
333
+ #
334
+ # # Create a client object. The client can be reused for multiple calls.
335
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
336
+ #
337
+ # # Create a request. To set request fields, pass in keyword arguments.
338
+ # request = Google::Cloud::ServiceDirectory::V1::ListNamespacesRequest.new
339
+ #
340
+ # # Call the list_namespaces method.
341
+ # result = client.list_namespaces request
342
+ #
343
+ # # The returned object is of type Gapic::PagedEnumerable. You can
344
+ # # iterate over all elements by calling #each, and the enumerable
345
+ # # will lazily make API calls to fetch subsequent pages. Other
346
+ # # methods are also available for managing paging directly.
347
+ # result.each do |response|
348
+ # # Each element is of type ::Google::Cloud::ServiceDirectory::V1::Namespace.
349
+ # p response
350
+ # end
351
+ #
321
352
  def list_namespaces request, options = nil
322
353
  raise ::ArgumentError, "request must be provided" if request.nil?
323
354
 
@@ -335,16 +366,20 @@ module Google
335
366
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
336
367
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
337
368
 
338
- header_params = {
339
- "parent" => request.parent
340
- }
369
+ header_params = {}
370
+ if request.parent
371
+ header_params["parent"] = request.parent
372
+ end
373
+
341
374
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
342
375
  metadata[:"x-goog-request-params"] ||= request_params_header
343
376
 
344
377
  options.apply_defaults timeout: @config.rpcs.list_namespaces.timeout,
345
378
  metadata: metadata,
346
379
  retry_policy: @config.rpcs.list_namespaces.retry_policy
347
- options.apply_defaults metadata: @config.metadata,
380
+
381
+ options.apply_defaults timeout: @config.timeout,
382
+ metadata: @config.metadata,
348
383
  retry_policy: @config.retry_policy
349
384
 
350
385
  @registration_service_stub.call_rpc :list_namespaces, request, options: options do |response, operation|
@@ -385,6 +420,21 @@ module Google
385
420
  #
386
421
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
387
422
  #
423
+ # @example Basic example
424
+ # require "google/cloud/service_directory/v1"
425
+ #
426
+ # # Create a client object. The client can be reused for multiple calls.
427
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
428
+ #
429
+ # # Create a request. To set request fields, pass in keyword arguments.
430
+ # request = Google::Cloud::ServiceDirectory::V1::GetNamespaceRequest.new
431
+ #
432
+ # # Call the get_namespace method.
433
+ # result = client.get_namespace request
434
+ #
435
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::Namespace.
436
+ # p result
437
+ #
388
438
  def get_namespace request, options = nil
389
439
  raise ::ArgumentError, "request must be provided" if request.nil?
390
440
 
@@ -402,16 +452,20 @@ module Google
402
452
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
403
453
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
404
454
 
405
- header_params = {
406
- "name" => request.name
407
- }
455
+ header_params = {}
456
+ if request.name
457
+ header_params["name"] = request.name
458
+ end
459
+
408
460
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
409
461
  metadata[:"x-goog-request-params"] ||= request_params_header
410
462
 
411
463
  options.apply_defaults timeout: @config.rpcs.get_namespace.timeout,
412
464
  metadata: metadata,
413
465
  retry_policy: @config.rpcs.get_namespace.retry_policy
414
- options.apply_defaults metadata: @config.metadata,
466
+
467
+ options.apply_defaults timeout: @config.timeout,
468
+ metadata: @config.metadata,
415
469
  retry_policy: @config.retry_policy
416
470
 
417
471
  @registration_service_stub.call_rpc :get_namespace, request, options: options do |response, operation|
@@ -453,6 +507,21 @@ module Google
453
507
  #
454
508
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
455
509
  #
510
+ # @example Basic example
511
+ # require "google/cloud/service_directory/v1"
512
+ #
513
+ # # Create a client object. The client can be reused for multiple calls.
514
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
515
+ #
516
+ # # Create a request. To set request fields, pass in keyword arguments.
517
+ # request = Google::Cloud::ServiceDirectory::V1::UpdateNamespaceRequest.new
518
+ #
519
+ # # Call the update_namespace method.
520
+ # result = client.update_namespace request
521
+ #
522
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::Namespace.
523
+ # p result
524
+ #
456
525
  def update_namespace request, options = nil
457
526
  raise ::ArgumentError, "request must be provided" if request.nil?
458
527
 
@@ -470,16 +539,20 @@ module Google
470
539
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
471
540
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
472
541
 
473
- header_params = {
474
- "namespace.name" => request.namespace.name
475
- }
542
+ header_params = {}
543
+ if request.namespace&.name
544
+ header_params["namespace.name"] = request.namespace.name
545
+ end
546
+
476
547
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
477
548
  metadata[:"x-goog-request-params"] ||= request_params_header
478
549
 
479
550
  options.apply_defaults timeout: @config.rpcs.update_namespace.timeout,
480
551
  metadata: metadata,
481
552
  retry_policy: @config.rpcs.update_namespace.retry_policy
482
- options.apply_defaults metadata: @config.metadata,
553
+
554
+ options.apply_defaults timeout: @config.timeout,
555
+ metadata: @config.metadata,
483
556
  retry_policy: @config.retry_policy
484
557
 
485
558
  @registration_service_stub.call_rpc :update_namespace, request, options: options do |response, operation|
@@ -520,6 +593,21 @@ module Google
520
593
  #
521
594
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
522
595
  #
596
+ # @example Basic example
597
+ # require "google/cloud/service_directory/v1"
598
+ #
599
+ # # Create a client object. The client can be reused for multiple calls.
600
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
601
+ #
602
+ # # Create a request. To set request fields, pass in keyword arguments.
603
+ # request = Google::Cloud::ServiceDirectory::V1::DeleteNamespaceRequest.new
604
+ #
605
+ # # Call the delete_namespace method.
606
+ # result = client.delete_namespace request
607
+ #
608
+ # # The returned object is of type Google::Protobuf::Empty.
609
+ # p result
610
+ #
523
611
  def delete_namespace request, options = nil
524
612
  raise ::ArgumentError, "request must be provided" if request.nil?
525
613
 
@@ -537,16 +625,20 @@ module Google
537
625
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
538
626
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
539
627
 
540
- header_params = {
541
- "name" => request.name
542
- }
628
+ header_params = {}
629
+ if request.name
630
+ header_params["name"] = request.name
631
+ end
632
+
543
633
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
544
634
  metadata[:"x-goog-request-params"] ||= request_params_header
545
635
 
546
636
  options.apply_defaults timeout: @config.rpcs.delete_namespace.timeout,
547
637
  metadata: metadata,
548
638
  retry_policy: @config.rpcs.delete_namespace.retry_policy
549
- options.apply_defaults metadata: @config.metadata,
639
+
640
+ options.apply_defaults timeout: @config.timeout,
641
+ metadata: @config.metadata,
550
642
  retry_policy: @config.retry_policy
551
643
 
552
644
  @registration_service_stub.call_rpc :delete_namespace, request, options: options do |response, operation|
@@ -596,6 +688,21 @@ module Google
596
688
  #
597
689
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
598
690
  #
691
+ # @example Basic example
692
+ # require "google/cloud/service_directory/v1"
693
+ #
694
+ # # Create a client object. The client can be reused for multiple calls.
695
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
696
+ #
697
+ # # Create a request. To set request fields, pass in keyword arguments.
698
+ # request = Google::Cloud::ServiceDirectory::V1::CreateServiceRequest.new
699
+ #
700
+ # # Call the create_service method.
701
+ # result = client.create_service request
702
+ #
703
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::Service.
704
+ # p result
705
+ #
599
706
  def create_service request, options = nil
600
707
  raise ::ArgumentError, "request must be provided" if request.nil?
601
708
 
@@ -613,16 +720,20 @@ module Google
613
720
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
614
721
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
615
722
 
616
- header_params = {
617
- "parent" => request.parent
618
- }
723
+ header_params = {}
724
+ if request.parent
725
+ header_params["parent"] = request.parent
726
+ end
727
+
619
728
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
620
729
  metadata[:"x-goog-request-params"] ||= request_params_header
621
730
 
622
731
  options.apply_defaults timeout: @config.rpcs.create_service.timeout,
623
732
  metadata: metadata,
624
733
  retry_policy: @config.rpcs.create_service.retry_policy
625
- options.apply_defaults metadata: @config.metadata,
734
+
735
+ options.apply_defaults timeout: @config.timeout,
736
+ metadata: @config.metadata,
626
737
  retry_policy: @config.retry_policy
627
738
 
628
739
  @registration_service_stub.call_rpc :create_service, request, options: options do |response, operation|
@@ -694,6 +805,27 @@ module Google
694
805
  #
695
806
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
696
807
  #
808
+ # @example Basic example
809
+ # require "google/cloud/service_directory/v1"
810
+ #
811
+ # # Create a client object. The client can be reused for multiple calls.
812
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
813
+ #
814
+ # # Create a request. To set request fields, pass in keyword arguments.
815
+ # request = Google::Cloud::ServiceDirectory::V1::ListServicesRequest.new
816
+ #
817
+ # # Call the list_services method.
818
+ # result = client.list_services request
819
+ #
820
+ # # The returned object is of type Gapic::PagedEnumerable. You can
821
+ # # iterate over all elements by calling #each, and the enumerable
822
+ # # will lazily make API calls to fetch subsequent pages. Other
823
+ # # methods are also available for managing paging directly.
824
+ # result.each do |response|
825
+ # # Each element is of type ::Google::Cloud::ServiceDirectory::V1::Service.
826
+ # p response
827
+ # end
828
+ #
697
829
  def list_services request, options = nil
698
830
  raise ::ArgumentError, "request must be provided" if request.nil?
699
831
 
@@ -711,16 +843,20 @@ module Google
711
843
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
712
844
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
713
845
 
714
- header_params = {
715
- "parent" => request.parent
716
- }
846
+ header_params = {}
847
+ if request.parent
848
+ header_params["parent"] = request.parent
849
+ end
850
+
717
851
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
718
852
  metadata[:"x-goog-request-params"] ||= request_params_header
719
853
 
720
854
  options.apply_defaults timeout: @config.rpcs.list_services.timeout,
721
855
  metadata: metadata,
722
856
  retry_policy: @config.rpcs.list_services.retry_policy
723
- options.apply_defaults metadata: @config.metadata,
857
+
858
+ options.apply_defaults timeout: @config.timeout,
859
+ metadata: @config.metadata,
724
860
  retry_policy: @config.retry_policy
725
861
 
726
862
  @registration_service_stub.call_rpc :list_services, request, options: options do |response, operation|
@@ -761,6 +897,21 @@ module Google
761
897
  #
762
898
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
763
899
  #
900
+ # @example Basic example
901
+ # require "google/cloud/service_directory/v1"
902
+ #
903
+ # # Create a client object. The client can be reused for multiple calls.
904
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
905
+ #
906
+ # # Create a request. To set request fields, pass in keyword arguments.
907
+ # request = Google::Cloud::ServiceDirectory::V1::GetServiceRequest.new
908
+ #
909
+ # # Call the get_service method.
910
+ # result = client.get_service request
911
+ #
912
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::Service.
913
+ # p result
914
+ #
764
915
  def get_service request, options = nil
765
916
  raise ::ArgumentError, "request must be provided" if request.nil?
766
917
 
@@ -778,16 +929,20 @@ module Google
778
929
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
779
930
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
780
931
 
781
- header_params = {
782
- "name" => request.name
783
- }
932
+ header_params = {}
933
+ if request.name
934
+ header_params["name"] = request.name
935
+ end
936
+
784
937
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
785
938
  metadata[:"x-goog-request-params"] ||= request_params_header
786
939
 
787
940
  options.apply_defaults timeout: @config.rpcs.get_service.timeout,
788
941
  metadata: metadata,
789
942
  retry_policy: @config.rpcs.get_service.retry_policy
790
- options.apply_defaults metadata: @config.metadata,
943
+
944
+ options.apply_defaults timeout: @config.timeout,
945
+ metadata: @config.metadata,
791
946
  retry_policy: @config.retry_policy
792
947
 
793
948
  @registration_service_stub.call_rpc :get_service, request, options: options do |response, operation|
@@ -829,6 +984,21 @@ module Google
829
984
  #
830
985
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
831
986
  #
987
+ # @example Basic example
988
+ # require "google/cloud/service_directory/v1"
989
+ #
990
+ # # Create a client object. The client can be reused for multiple calls.
991
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
992
+ #
993
+ # # Create a request. To set request fields, pass in keyword arguments.
994
+ # request = Google::Cloud::ServiceDirectory::V1::UpdateServiceRequest.new
995
+ #
996
+ # # Call the update_service method.
997
+ # result = client.update_service request
998
+ #
999
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::Service.
1000
+ # p result
1001
+ #
832
1002
  def update_service request, options = nil
833
1003
  raise ::ArgumentError, "request must be provided" if request.nil?
834
1004
 
@@ -846,16 +1016,20 @@ module Google
846
1016
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
847
1017
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
848
1018
 
849
- header_params = {
850
- "service.name" => request.service.name
851
- }
1019
+ header_params = {}
1020
+ if request.service&.name
1021
+ header_params["service.name"] = request.service.name
1022
+ end
1023
+
852
1024
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
853
1025
  metadata[:"x-goog-request-params"] ||= request_params_header
854
1026
 
855
1027
  options.apply_defaults timeout: @config.rpcs.update_service.timeout,
856
1028
  metadata: metadata,
857
1029
  retry_policy: @config.rpcs.update_service.retry_policy
858
- options.apply_defaults metadata: @config.metadata,
1030
+
1031
+ options.apply_defaults timeout: @config.timeout,
1032
+ metadata: @config.metadata,
859
1033
  retry_policy: @config.retry_policy
860
1034
 
861
1035
  @registration_service_stub.call_rpc :update_service, request, options: options do |response, operation|
@@ -896,6 +1070,21 @@ module Google
896
1070
  #
897
1071
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
898
1072
  #
1073
+ # @example Basic example
1074
+ # require "google/cloud/service_directory/v1"
1075
+ #
1076
+ # # Create a client object. The client can be reused for multiple calls.
1077
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
1078
+ #
1079
+ # # Create a request. To set request fields, pass in keyword arguments.
1080
+ # request = Google::Cloud::ServiceDirectory::V1::DeleteServiceRequest.new
1081
+ #
1082
+ # # Call the delete_service method.
1083
+ # result = client.delete_service request
1084
+ #
1085
+ # # The returned object is of type Google::Protobuf::Empty.
1086
+ # p result
1087
+ #
899
1088
  def delete_service request, options = nil
900
1089
  raise ::ArgumentError, "request must be provided" if request.nil?
901
1090
 
@@ -913,16 +1102,20 @@ module Google
913
1102
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
914
1103
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
915
1104
 
916
- header_params = {
917
- "name" => request.name
918
- }
1105
+ header_params = {}
1106
+ if request.name
1107
+ header_params["name"] = request.name
1108
+ end
1109
+
919
1110
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
920
1111
  metadata[:"x-goog-request-params"] ||= request_params_header
921
1112
 
922
1113
  options.apply_defaults timeout: @config.rpcs.delete_service.timeout,
923
1114
  metadata: metadata,
924
1115
  retry_policy: @config.rpcs.delete_service.retry_policy
925
- options.apply_defaults metadata: @config.metadata,
1116
+
1117
+ options.apply_defaults timeout: @config.timeout,
1118
+ metadata: @config.metadata,
926
1119
  retry_policy: @config.retry_policy
927
1120
 
928
1121
  @registration_service_stub.call_rpc :delete_service, request, options: options do |response, operation|
@@ -972,6 +1165,21 @@ module Google
972
1165
  #
973
1166
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
974
1167
  #
1168
+ # @example Basic example
1169
+ # require "google/cloud/service_directory/v1"
1170
+ #
1171
+ # # Create a client object. The client can be reused for multiple calls.
1172
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
1173
+ #
1174
+ # # Create a request. To set request fields, pass in keyword arguments.
1175
+ # request = Google::Cloud::ServiceDirectory::V1::CreateEndpointRequest.new
1176
+ #
1177
+ # # Call the create_endpoint method.
1178
+ # result = client.create_endpoint request
1179
+ #
1180
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::Endpoint.
1181
+ # p result
1182
+ #
975
1183
  def create_endpoint request, options = nil
976
1184
  raise ::ArgumentError, "request must be provided" if request.nil?
977
1185
 
@@ -989,16 +1197,20 @@ module Google
989
1197
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
990
1198
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
991
1199
 
992
- header_params = {
993
- "parent" => request.parent
994
- }
1200
+ header_params = {}
1201
+ if request.parent
1202
+ header_params["parent"] = request.parent
1203
+ end
1204
+
995
1205
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
996
1206
  metadata[:"x-goog-request-params"] ||= request_params_header
997
1207
 
998
1208
  options.apply_defaults timeout: @config.rpcs.create_endpoint.timeout,
999
1209
  metadata: metadata,
1000
1210
  retry_policy: @config.rpcs.create_endpoint.retry_policy
1001
- options.apply_defaults metadata: @config.metadata,
1211
+
1212
+ options.apply_defaults timeout: @config.timeout,
1213
+ metadata: @config.metadata,
1002
1214
  retry_policy: @config.retry_policy
1003
1215
 
1004
1216
  @registration_service_stub.call_rpc :create_endpoint, request, options: options do |response, operation|
@@ -1072,6 +1284,27 @@ module Google
1072
1284
  #
1073
1285
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1074
1286
  #
1287
+ # @example Basic example
1288
+ # require "google/cloud/service_directory/v1"
1289
+ #
1290
+ # # Create a client object. The client can be reused for multiple calls.
1291
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
1292
+ #
1293
+ # # Create a request. To set request fields, pass in keyword arguments.
1294
+ # request = Google::Cloud::ServiceDirectory::V1::ListEndpointsRequest.new
1295
+ #
1296
+ # # Call the list_endpoints method.
1297
+ # result = client.list_endpoints request
1298
+ #
1299
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1300
+ # # iterate over all elements by calling #each, and the enumerable
1301
+ # # will lazily make API calls to fetch subsequent pages. Other
1302
+ # # methods are also available for managing paging directly.
1303
+ # result.each do |response|
1304
+ # # Each element is of type ::Google::Cloud::ServiceDirectory::V1::Endpoint.
1305
+ # p response
1306
+ # end
1307
+ #
1075
1308
  def list_endpoints request, options = nil
1076
1309
  raise ::ArgumentError, "request must be provided" if request.nil?
1077
1310
 
@@ -1089,16 +1322,20 @@ module Google
1089
1322
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
1090
1323
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1091
1324
 
1092
- header_params = {
1093
- "parent" => request.parent
1094
- }
1325
+ header_params = {}
1326
+ if request.parent
1327
+ header_params["parent"] = request.parent
1328
+ end
1329
+
1095
1330
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1096
1331
  metadata[:"x-goog-request-params"] ||= request_params_header
1097
1332
 
1098
1333
  options.apply_defaults timeout: @config.rpcs.list_endpoints.timeout,
1099
1334
  metadata: metadata,
1100
1335
  retry_policy: @config.rpcs.list_endpoints.retry_policy
1101
- options.apply_defaults metadata: @config.metadata,
1336
+
1337
+ options.apply_defaults timeout: @config.timeout,
1338
+ metadata: @config.metadata,
1102
1339
  retry_policy: @config.retry_policy
1103
1340
 
1104
1341
  @registration_service_stub.call_rpc :list_endpoints, request, options: options do |response, operation|
@@ -1139,6 +1376,21 @@ module Google
1139
1376
  #
1140
1377
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1141
1378
  #
1379
+ # @example Basic example
1380
+ # require "google/cloud/service_directory/v1"
1381
+ #
1382
+ # # Create a client object. The client can be reused for multiple calls.
1383
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
1384
+ #
1385
+ # # Create a request. To set request fields, pass in keyword arguments.
1386
+ # request = Google::Cloud::ServiceDirectory::V1::GetEndpointRequest.new
1387
+ #
1388
+ # # Call the get_endpoint method.
1389
+ # result = client.get_endpoint request
1390
+ #
1391
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::Endpoint.
1392
+ # p result
1393
+ #
1142
1394
  def get_endpoint request, options = nil
1143
1395
  raise ::ArgumentError, "request must be provided" if request.nil?
1144
1396
 
@@ -1156,16 +1408,20 @@ module Google
1156
1408
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
1157
1409
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1158
1410
 
1159
- header_params = {
1160
- "name" => request.name
1161
- }
1411
+ header_params = {}
1412
+ if request.name
1413
+ header_params["name"] = request.name
1414
+ end
1415
+
1162
1416
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1163
1417
  metadata[:"x-goog-request-params"] ||= request_params_header
1164
1418
 
1165
1419
  options.apply_defaults timeout: @config.rpcs.get_endpoint.timeout,
1166
1420
  metadata: metadata,
1167
1421
  retry_policy: @config.rpcs.get_endpoint.retry_policy
1168
- options.apply_defaults metadata: @config.metadata,
1422
+
1423
+ options.apply_defaults timeout: @config.timeout,
1424
+ metadata: @config.metadata,
1169
1425
  retry_policy: @config.retry_policy
1170
1426
 
1171
1427
  @registration_service_stub.call_rpc :get_endpoint, request, options: options do |response, operation|
@@ -1207,6 +1463,21 @@ module Google
1207
1463
  #
1208
1464
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1209
1465
  #
1466
+ # @example Basic example
1467
+ # require "google/cloud/service_directory/v1"
1468
+ #
1469
+ # # Create a client object. The client can be reused for multiple calls.
1470
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
1471
+ #
1472
+ # # Create a request. To set request fields, pass in keyword arguments.
1473
+ # request = Google::Cloud::ServiceDirectory::V1::UpdateEndpointRequest.new
1474
+ #
1475
+ # # Call the update_endpoint method.
1476
+ # result = client.update_endpoint request
1477
+ #
1478
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::Endpoint.
1479
+ # p result
1480
+ #
1210
1481
  def update_endpoint request, options = nil
1211
1482
  raise ::ArgumentError, "request must be provided" if request.nil?
1212
1483
 
@@ -1224,16 +1495,20 @@ module Google
1224
1495
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
1225
1496
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1226
1497
 
1227
- header_params = {
1228
- "endpoint.name" => request.endpoint.name
1229
- }
1498
+ header_params = {}
1499
+ if request.endpoint&.name
1500
+ header_params["endpoint.name"] = request.endpoint.name
1501
+ end
1502
+
1230
1503
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1231
1504
  metadata[:"x-goog-request-params"] ||= request_params_header
1232
1505
 
1233
1506
  options.apply_defaults timeout: @config.rpcs.update_endpoint.timeout,
1234
1507
  metadata: metadata,
1235
1508
  retry_policy: @config.rpcs.update_endpoint.retry_policy
1236
- options.apply_defaults metadata: @config.metadata,
1509
+
1510
+ options.apply_defaults timeout: @config.timeout,
1511
+ metadata: @config.metadata,
1237
1512
  retry_policy: @config.retry_policy
1238
1513
 
1239
1514
  @registration_service_stub.call_rpc :update_endpoint, request, options: options do |response, operation|
@@ -1273,6 +1548,21 @@ module Google
1273
1548
  #
1274
1549
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1275
1550
  #
1551
+ # @example Basic example
1552
+ # require "google/cloud/service_directory/v1"
1553
+ #
1554
+ # # Create a client object. The client can be reused for multiple calls.
1555
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
1556
+ #
1557
+ # # Create a request. To set request fields, pass in keyword arguments.
1558
+ # request = Google::Cloud::ServiceDirectory::V1::DeleteEndpointRequest.new
1559
+ #
1560
+ # # Call the delete_endpoint method.
1561
+ # result = client.delete_endpoint request
1562
+ #
1563
+ # # The returned object is of type Google::Protobuf::Empty.
1564
+ # p result
1565
+ #
1276
1566
  def delete_endpoint request, options = nil
1277
1567
  raise ::ArgumentError, "request must be provided" if request.nil?
1278
1568
 
@@ -1290,16 +1580,20 @@ module Google
1290
1580
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
1291
1581
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1292
1582
 
1293
- header_params = {
1294
- "name" => request.name
1295
- }
1583
+ header_params = {}
1584
+ if request.name
1585
+ header_params["name"] = request.name
1586
+ end
1587
+
1296
1588
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1297
1589
  metadata[:"x-goog-request-params"] ||= request_params_header
1298
1590
 
1299
1591
  options.apply_defaults timeout: @config.rpcs.delete_endpoint.timeout,
1300
1592
  metadata: metadata,
1301
1593
  retry_policy: @config.rpcs.delete_endpoint.retry_policy
1302
- options.apply_defaults metadata: @config.metadata,
1594
+
1595
+ options.apply_defaults timeout: @config.timeout,
1596
+ metadata: @config.metadata,
1303
1597
  retry_policy: @config.retry_policy
1304
1598
 
1305
1599
  @registration_service_stub.call_rpc :delete_endpoint, request, options: options do |response, operation|
@@ -1343,6 +1637,21 @@ module Google
1343
1637
  #
1344
1638
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1345
1639
  #
1640
+ # @example Basic example
1641
+ # require "google/cloud/service_directory/v1"
1642
+ #
1643
+ # # Create a client object. The client can be reused for multiple calls.
1644
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
1645
+ #
1646
+ # # Create a request. To set request fields, pass in keyword arguments.
1647
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
1648
+ #
1649
+ # # Call the get_iam_policy method.
1650
+ # result = client.get_iam_policy request
1651
+ #
1652
+ # # The returned object is of type Google::Iam::V1::Policy.
1653
+ # p result
1654
+ #
1346
1655
  def get_iam_policy request, options = nil
1347
1656
  raise ::ArgumentError, "request must be provided" if request.nil?
1348
1657
 
@@ -1360,16 +1669,20 @@ module Google
1360
1669
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
1361
1670
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1362
1671
 
1363
- header_params = {
1364
- "resource" => request.resource
1365
- }
1672
+ header_params = {}
1673
+ if request.resource
1674
+ header_params["resource"] = request.resource
1675
+ end
1676
+
1366
1677
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1367
1678
  metadata[:"x-goog-request-params"] ||= request_params_header
1368
1679
 
1369
1680
  options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
1370
1681
  metadata: metadata,
1371
1682
  retry_policy: @config.rpcs.get_iam_policy.retry_policy
1372
- options.apply_defaults metadata: @config.metadata,
1683
+
1684
+ options.apply_defaults timeout: @config.timeout,
1685
+ metadata: @config.metadata,
1373
1686
  retry_policy: @config.retry_policy
1374
1687
 
1375
1688
  @registration_service_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
@@ -1415,6 +1728,21 @@ module Google
1415
1728
  #
1416
1729
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1417
1730
  #
1731
+ # @example Basic example
1732
+ # require "google/cloud/service_directory/v1"
1733
+ #
1734
+ # # Create a client object. The client can be reused for multiple calls.
1735
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
1736
+ #
1737
+ # # Create a request. To set request fields, pass in keyword arguments.
1738
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
1739
+ #
1740
+ # # Call the set_iam_policy method.
1741
+ # result = client.set_iam_policy request
1742
+ #
1743
+ # # The returned object is of type Google::Iam::V1::Policy.
1744
+ # p result
1745
+ #
1418
1746
  def set_iam_policy request, options = nil
1419
1747
  raise ::ArgumentError, "request must be provided" if request.nil?
1420
1748
 
@@ -1432,16 +1760,20 @@ module Google
1432
1760
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
1433
1761
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1434
1762
 
1435
- header_params = {
1436
- "resource" => request.resource
1437
- }
1763
+ header_params = {}
1764
+ if request.resource
1765
+ header_params["resource"] = request.resource
1766
+ end
1767
+
1438
1768
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1439
1769
  metadata[:"x-goog-request-params"] ||= request_params_header
1440
1770
 
1441
1771
  options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
1442
1772
  metadata: metadata,
1443
1773
  retry_policy: @config.rpcs.set_iam_policy.retry_policy
1444
- options.apply_defaults metadata: @config.metadata,
1774
+
1775
+ options.apply_defaults timeout: @config.timeout,
1776
+ metadata: @config.metadata,
1445
1777
  retry_policy: @config.retry_policy
1446
1778
 
1447
1779
  @registration_service_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
@@ -1487,6 +1819,21 @@ module Google
1487
1819
  #
1488
1820
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1489
1821
  #
1822
+ # @example Basic example
1823
+ # require "google/cloud/service_directory/v1"
1824
+ #
1825
+ # # Create a client object. The client can be reused for multiple calls.
1826
+ # client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new
1827
+ #
1828
+ # # Create a request. To set request fields, pass in keyword arguments.
1829
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
1830
+ #
1831
+ # # Call the test_iam_permissions method.
1832
+ # result = client.test_iam_permissions request
1833
+ #
1834
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
1835
+ # p result
1836
+ #
1490
1837
  def test_iam_permissions request, options = nil
1491
1838
  raise ::ArgumentError, "request must be provided" if request.nil?
1492
1839
 
@@ -1504,16 +1851,20 @@ module Google
1504
1851
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
1505
1852
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1506
1853
 
1507
- header_params = {
1508
- "resource" => request.resource
1509
- }
1854
+ header_params = {}
1855
+ if request.resource
1856
+ header_params["resource"] = request.resource
1857
+ end
1858
+
1510
1859
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1511
1860
  metadata[:"x-goog-request-params"] ||= request_params_header
1512
1861
 
1513
1862
  options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1514
1863
  metadata: metadata,
1515
1864
  retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1516
- options.apply_defaults metadata: @config.metadata,
1865
+
1866
+ options.apply_defaults timeout: @config.timeout,
1867
+ metadata: @config.metadata,
1517
1868
  retry_policy: @config.retry_policy
1518
1869
 
1519
1870
  @registration_service_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
@@ -1537,22 +1888,21 @@ module Google
1537
1888
  # Configuration can be applied globally to all clients, or to a single client
1538
1889
  # on construction.
1539
1890
  #
1540
- # # Examples
1541
- #
1542
- # To modify the global config, setting the timeout for create_namespace
1543
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1544
- #
1545
- # ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.configure do |config|
1546
- # config.timeout = 10.0
1547
- # config.rpcs.create_namespace.timeout = 20.0
1548
- # end
1549
- #
1550
- # To apply the above configuration only to a new client:
1551
- #
1552
- # client = ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new do |config|
1553
- # config.timeout = 10.0
1554
- # config.rpcs.create_namespace.timeout = 20.0
1555
- # end
1891
+ # @example
1892
+ #
1893
+ # # Modify the global config, setting the timeout for
1894
+ # # create_namespace to 20 seconds,
1895
+ # # and all remaining timeouts to 10 seconds.
1896
+ # ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.configure do |config|
1897
+ # config.timeout = 10.0
1898
+ # config.rpcs.create_namespace.timeout = 20.0
1899
+ # end
1900
+ #
1901
+ # # Apply the above configuration only to a new client.
1902
+ # client = ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new do |config|
1903
+ # config.timeout = 10.0
1904
+ # config.rpcs.create_namespace.timeout = 20.0
1905
+ # end
1556
1906
  #
1557
1907
  # @!attribute [rw] endpoint
1558
1908
  # The hostname or hostname:port of the service endpoint.