google-cloud-functions-v1 0.3.2 → 0.5.1

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.
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::Functions::V1::CloudFunctionsService::Client::Configuration}
42
42
  # for a description of the configuration fields.
43
43
  #
44
- # ## Example
44
+ # @example
45
45
  #
46
- # To modify the configuration for all CloudFunctionsService clients:
47
- #
48
- # ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.configure do |config|
49
- # config.timeout = 10.0
50
- # end
46
+ # # Modify the configuration for all CloudFunctionsService clients
47
+ # ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
51
50
  #
52
51
  # @yield [config] Configure the Client client.
53
52
  # @yieldparam config [Client::Configuration]
@@ -118,19 +117,15 @@ module Google
118
117
  ##
119
118
  # Create a new CloudFunctionsService client object.
120
119
  #
121
- # ## Examples
122
- #
123
- # To create a new CloudFunctionsService client with the default
124
- # configuration:
125
- #
126
- # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
120
+ # @example
127
121
  #
128
- # To create a new CloudFunctionsService client with a custom
129
- # configuration:
122
+ # # Create a client using the default configuration
123
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
130
124
  #
131
- # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config|
132
- # config.timeout = 10.0
133
- # end
125
+ # # Create a client using a custom configuration
126
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config|
127
+ # config.timeout = 10.0
128
+ # end
134
129
  #
135
130
  # @yield [config] Configure the CloudFunctionsService client.
136
131
  # @yieldparam config [Client::Configuration]
@@ -150,10 +145,9 @@ module Google
150
145
 
151
146
  # Create credentials
152
147
  credentials = @config.credentials
153
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
148
+ # Use self-signed JWT if the endpoint is unchanged from default,
154
149
  # but only if the default endpoint does not have a region prefix.
155
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
156
- @config.endpoint == Client.configure.endpoint &&
150
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
157
151
  !@config.endpoint.split(".").first.include?("-")
158
152
  credentials ||= Credentials.default scope: @config.scope,
159
153
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -165,6 +159,7 @@ module Google
165
159
 
166
160
  @operations_client = Operations.new do |config|
167
161
  config.credentials = credentials
162
+ config.quota_project = @quota_project_id
168
163
  config.endpoint = @config.endpoint
169
164
  end
170
165
 
@@ -227,6 +222,27 @@ module Google
227
222
  #
228
223
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
229
224
  #
225
+ # @example Basic example
226
+ # require "google/cloud/functions/v1"
227
+ #
228
+ # # Create a client object. The client can be reused for multiple calls.
229
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
230
+ #
231
+ # # Create a request. To set request fields, pass in keyword arguments.
232
+ # request = Google::Cloud::Functions::V1::ListFunctionsRequest.new
233
+ #
234
+ # # Call the list_functions method.
235
+ # result = client.list_functions request
236
+ #
237
+ # # The returned object is of type Gapic::PagedEnumerable. You can
238
+ # # iterate over all elements by calling #each, and the enumerable
239
+ # # will lazily make API calls to fetch subsequent pages. Other
240
+ # # methods are also available for managing paging directly.
241
+ # result.each do |response|
242
+ # # Each element is of type ::Google::Cloud::Functions::V1::CloudFunction.
243
+ # p response
244
+ # end
245
+ #
230
246
  def list_functions request, options = nil
231
247
  raise ::ArgumentError, "request must be provided" if request.nil?
232
248
 
@@ -244,16 +260,20 @@ module Google
244
260
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
245
261
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
246
262
 
247
- header_params = {
248
- "parent" => request.parent
249
- }
263
+ header_params = {}
264
+ if request.parent
265
+ header_params["parent"] = request.parent
266
+ end
267
+
250
268
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
251
269
  metadata[:"x-goog-request-params"] ||= request_params_header
252
270
 
253
271
  options.apply_defaults timeout: @config.rpcs.list_functions.timeout,
254
272
  metadata: metadata,
255
273
  retry_policy: @config.rpcs.list_functions.retry_policy
256
- options.apply_defaults metadata: @config.metadata,
274
+
275
+ options.apply_defaults timeout: @config.timeout,
276
+ metadata: @config.metadata,
257
277
  retry_policy: @config.retry_policy
258
278
 
259
279
  @cloud_functions_service_stub.call_rpc :list_functions, request, options: options do |response, operation|
@@ -294,6 +314,21 @@ module Google
294
314
  #
295
315
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
296
316
  #
317
+ # @example Basic example
318
+ # require "google/cloud/functions/v1"
319
+ #
320
+ # # Create a client object. The client can be reused for multiple calls.
321
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
322
+ #
323
+ # # Create a request. To set request fields, pass in keyword arguments.
324
+ # request = Google::Cloud::Functions::V1::GetFunctionRequest.new
325
+ #
326
+ # # Call the get_function method.
327
+ # result = client.get_function request
328
+ #
329
+ # # The returned object is of type Google::Cloud::Functions::V1::CloudFunction.
330
+ # p result
331
+ #
297
332
  def get_function request, options = nil
298
333
  raise ::ArgumentError, "request must be provided" if request.nil?
299
334
 
@@ -311,16 +346,20 @@ module Google
311
346
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
312
347
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
313
348
 
314
- header_params = {
315
- "name" => request.name
316
- }
349
+ header_params = {}
350
+ if request.name
351
+ header_params["name"] = request.name
352
+ end
353
+
317
354
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
318
355
  metadata[:"x-goog-request-params"] ||= request_params_header
319
356
 
320
357
  options.apply_defaults timeout: @config.rpcs.get_function.timeout,
321
358
  metadata: metadata,
322
359
  retry_policy: @config.rpcs.get_function.retry_policy
323
- options.apply_defaults metadata: @config.metadata,
360
+
361
+ options.apply_defaults timeout: @config.timeout,
362
+ metadata: @config.metadata,
324
363
  retry_policy: @config.retry_policy
325
364
 
326
365
  @cloud_functions_service_stub.call_rpc :get_function, request, options: options do |response, operation|
@@ -365,6 +404,28 @@ module Google
365
404
  #
366
405
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
367
406
  #
407
+ # @example Basic example
408
+ # require "google/cloud/functions/v1"
409
+ #
410
+ # # Create a client object. The client can be reused for multiple calls.
411
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
412
+ #
413
+ # # Create a request. To set request fields, pass in keyword arguments.
414
+ # request = Google::Cloud::Functions::V1::CreateFunctionRequest.new
415
+ #
416
+ # # Call the create_function method.
417
+ # result = client.create_function request
418
+ #
419
+ # # The returned object is of type Gapic::Operation. You can use this
420
+ # # object to check the status of an operation, cancel it, or wait
421
+ # # for results. Here is how to block until completion:
422
+ # result.wait_until_done! timeout: 60
423
+ # if result.response?
424
+ # p result.response
425
+ # else
426
+ # puts "Error!"
427
+ # end
428
+ #
368
429
  def create_function request, options = nil
369
430
  raise ::ArgumentError, "request must be provided" if request.nil?
370
431
 
@@ -382,16 +443,20 @@ module Google
382
443
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
383
444
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
384
445
 
385
- header_params = {
386
- "location" => request.location
387
- }
446
+ header_params = {}
447
+ if request.location
448
+ header_params["location"] = request.location
449
+ end
450
+
388
451
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
389
452
  metadata[:"x-goog-request-params"] ||= request_params_header
390
453
 
391
454
  options.apply_defaults timeout: @config.rpcs.create_function.timeout,
392
455
  metadata: metadata,
393
456
  retry_policy: @config.rpcs.create_function.retry_policy
394
- options.apply_defaults metadata: @config.metadata,
457
+
458
+ options.apply_defaults timeout: @config.timeout,
459
+ metadata: @config.metadata,
395
460
  retry_policy: @config.retry_policy
396
461
 
397
462
  @cloud_functions_service_stub.call_rpc :create_function, request, options: options do |response, operation|
@@ -434,6 +499,28 @@ module Google
434
499
  #
435
500
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
436
501
  #
502
+ # @example Basic example
503
+ # require "google/cloud/functions/v1"
504
+ #
505
+ # # Create a client object. The client can be reused for multiple calls.
506
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
507
+ #
508
+ # # Create a request. To set request fields, pass in keyword arguments.
509
+ # request = Google::Cloud::Functions::V1::UpdateFunctionRequest.new
510
+ #
511
+ # # Call the update_function method.
512
+ # result = client.update_function request
513
+ #
514
+ # # The returned object is of type Gapic::Operation. You can use this
515
+ # # object to check the status of an operation, cancel it, or wait
516
+ # # for results. Here is how to block until completion:
517
+ # result.wait_until_done! timeout: 60
518
+ # if result.response?
519
+ # p result.response
520
+ # else
521
+ # puts "Error!"
522
+ # end
523
+ #
437
524
  def update_function request, options = nil
438
525
  raise ::ArgumentError, "request must be provided" if request.nil?
439
526
 
@@ -451,16 +538,20 @@ module Google
451
538
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
452
539
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
453
540
 
454
- header_params = {
455
- "function.name" => request.function.name
456
- }
541
+ header_params = {}
542
+ if request.function&.name
543
+ header_params["function.name"] = request.function.name
544
+ end
545
+
457
546
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
458
547
  metadata[:"x-goog-request-params"] ||= request_params_header
459
548
 
460
549
  options.apply_defaults timeout: @config.rpcs.update_function.timeout,
461
550
  metadata: metadata,
462
551
  retry_policy: @config.rpcs.update_function.retry_policy
463
- options.apply_defaults metadata: @config.metadata,
552
+
553
+ options.apply_defaults timeout: @config.timeout,
554
+ metadata: @config.metadata,
464
555
  retry_policy: @config.retry_policy
465
556
 
466
557
  @cloud_functions_service_stub.call_rpc :update_function, request, options: options do |response, operation|
@@ -503,6 +594,28 @@ module Google
503
594
  #
504
595
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
505
596
  #
597
+ # @example Basic example
598
+ # require "google/cloud/functions/v1"
599
+ #
600
+ # # Create a client object. The client can be reused for multiple calls.
601
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
602
+ #
603
+ # # Create a request. To set request fields, pass in keyword arguments.
604
+ # request = Google::Cloud::Functions::V1::DeleteFunctionRequest.new
605
+ #
606
+ # # Call the delete_function method.
607
+ # result = client.delete_function request
608
+ #
609
+ # # The returned object is of type Gapic::Operation. You can use this
610
+ # # object to check the status of an operation, cancel it, or wait
611
+ # # for results. Here is how to block until completion:
612
+ # result.wait_until_done! timeout: 60
613
+ # if result.response?
614
+ # p result.response
615
+ # else
616
+ # puts "Error!"
617
+ # end
618
+ #
506
619
  def delete_function request, options = nil
507
620
  raise ::ArgumentError, "request must be provided" if request.nil?
508
621
 
@@ -520,16 +633,20 @@ module Google
520
633
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
521
634
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
522
635
 
523
- header_params = {
524
- "name" => request.name
525
- }
636
+ header_params = {}
637
+ if request.name
638
+ header_params["name"] = request.name
639
+ end
640
+
526
641
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
527
642
  metadata[:"x-goog-request-params"] ||= request_params_header
528
643
 
529
644
  options.apply_defaults timeout: @config.rpcs.delete_function.timeout,
530
645
  metadata: metadata,
531
646
  retry_policy: @config.rpcs.delete_function.retry_policy
532
- options.apply_defaults metadata: @config.metadata,
647
+
648
+ options.apply_defaults timeout: @config.timeout,
649
+ metadata: @config.metadata,
533
650
  retry_policy: @config.retry_policy
534
651
 
535
652
  @cloud_functions_service_stub.call_rpc :delete_function, request, options: options do |response, operation|
@@ -575,6 +692,21 @@ module Google
575
692
  #
576
693
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
577
694
  #
695
+ # @example Basic example
696
+ # require "google/cloud/functions/v1"
697
+ #
698
+ # # Create a client object. The client can be reused for multiple calls.
699
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
700
+ #
701
+ # # Create a request. To set request fields, pass in keyword arguments.
702
+ # request = Google::Cloud::Functions::V1::CallFunctionRequest.new
703
+ #
704
+ # # Call the call_function method.
705
+ # result = client.call_function request
706
+ #
707
+ # # The returned object is of type Google::Cloud::Functions::V1::CallFunctionResponse.
708
+ # p result
709
+ #
578
710
  def call_function request, options = nil
579
711
  raise ::ArgumentError, "request must be provided" if request.nil?
580
712
 
@@ -592,16 +724,20 @@ module Google
592
724
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
593
725
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
594
726
 
595
- header_params = {
596
- "name" => request.name
597
- }
727
+ header_params = {}
728
+ if request.name
729
+ header_params["name"] = request.name
730
+ end
731
+
598
732
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
599
733
  metadata[:"x-goog-request-params"] ||= request_params_header
600
734
 
601
735
  options.apply_defaults timeout: @config.rpcs.call_function.timeout,
602
736
  metadata: metadata,
603
737
  retry_policy: @config.rpcs.call_function.retry_policy
604
- options.apply_defaults metadata: @config.metadata,
738
+
739
+ options.apply_defaults timeout: @config.timeout,
740
+ metadata: @config.metadata,
605
741
  retry_policy: @config.retry_policy
606
742
 
607
743
  @cloud_functions_service_stub.call_rpc :call_function, request, options: options do |response, operation|
@@ -666,6 +802,21 @@ module Google
666
802
  #
667
803
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
668
804
  #
805
+ # @example Basic example
806
+ # require "google/cloud/functions/v1"
807
+ #
808
+ # # Create a client object. The client can be reused for multiple calls.
809
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
810
+ #
811
+ # # Create a request. To set request fields, pass in keyword arguments.
812
+ # request = Google::Cloud::Functions::V1::GenerateUploadUrlRequest.new
813
+ #
814
+ # # Call the generate_upload_url method.
815
+ # result = client.generate_upload_url request
816
+ #
817
+ # # The returned object is of type Google::Cloud::Functions::V1::GenerateUploadUrlResponse.
818
+ # p result
819
+ #
669
820
  def generate_upload_url request, options = nil
670
821
  raise ::ArgumentError, "request must be provided" if request.nil?
671
822
 
@@ -683,16 +834,20 @@ module Google
683
834
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
684
835
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
685
836
 
686
- header_params = {
687
- "parent" => request.parent
688
- }
837
+ header_params = {}
838
+ if request.parent
839
+ header_params["parent"] = request.parent
840
+ end
841
+
689
842
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
690
843
  metadata[:"x-goog-request-params"] ||= request_params_header
691
844
 
692
845
  options.apply_defaults timeout: @config.rpcs.generate_upload_url.timeout,
693
846
  metadata: metadata,
694
847
  retry_policy: @config.rpcs.generate_upload_url.retry_policy
695
- options.apply_defaults metadata: @config.metadata,
848
+
849
+ options.apply_defaults timeout: @config.timeout,
850
+ metadata: @config.metadata,
696
851
  retry_policy: @config.retry_policy
697
852
 
698
853
  @cloud_functions_service_stub.call_rpc :generate_upload_url, request, options: options do |response, operation|
@@ -740,6 +895,21 @@ module Google
740
895
  #
741
896
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
742
897
  #
898
+ # @example Basic example
899
+ # require "google/cloud/functions/v1"
900
+ #
901
+ # # Create a client object. The client can be reused for multiple calls.
902
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
903
+ #
904
+ # # Create a request. To set request fields, pass in keyword arguments.
905
+ # request = Google::Cloud::Functions::V1::GenerateDownloadUrlRequest.new
906
+ #
907
+ # # Call the generate_download_url method.
908
+ # result = client.generate_download_url request
909
+ #
910
+ # # The returned object is of type Google::Cloud::Functions::V1::GenerateDownloadUrlResponse.
911
+ # p result
912
+ #
743
913
  def generate_download_url request, options = nil
744
914
  raise ::ArgumentError, "request must be provided" if request.nil?
745
915
 
@@ -757,16 +927,20 @@ module Google
757
927
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
758
928
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
759
929
 
760
- header_params = {
761
- "name" => request.name
762
- }
930
+ header_params = {}
931
+ if request.name
932
+ header_params["name"] = request.name
933
+ end
934
+
763
935
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
764
936
  metadata[:"x-goog-request-params"] ||= request_params_header
765
937
 
766
938
  options.apply_defaults timeout: @config.rpcs.generate_download_url.timeout,
767
939
  metadata: metadata,
768
940
  retry_policy: @config.rpcs.generate_download_url.retry_policy
769
- options.apply_defaults metadata: @config.metadata,
941
+
942
+ options.apply_defaults timeout: @config.timeout,
943
+ metadata: @config.metadata,
770
944
  retry_policy: @config.retry_policy
771
945
 
772
946
  @cloud_functions_service_stub.call_rpc :generate_download_url, request, options: options do |response, operation|
@@ -813,6 +987,21 @@ module Google
813
987
  #
814
988
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
815
989
  #
990
+ # @example Basic example
991
+ # require "google/cloud/functions/v1"
992
+ #
993
+ # # Create a client object. The client can be reused for multiple calls.
994
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
995
+ #
996
+ # # Create a request. To set request fields, pass in keyword arguments.
997
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
998
+ #
999
+ # # Call the set_iam_policy method.
1000
+ # result = client.set_iam_policy request
1001
+ #
1002
+ # # The returned object is of type Google::Iam::V1::Policy.
1003
+ # p result
1004
+ #
816
1005
  def set_iam_policy request, options = nil
817
1006
  raise ::ArgumentError, "request must be provided" if request.nil?
818
1007
 
@@ -830,16 +1019,20 @@ module Google
830
1019
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
831
1020
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
832
1021
 
833
- header_params = {
834
- "resource" => request.resource
835
- }
1022
+ header_params = {}
1023
+ if request.resource
1024
+ header_params["resource"] = request.resource
1025
+ end
1026
+
836
1027
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
837
1028
  metadata[:"x-goog-request-params"] ||= request_params_header
838
1029
 
839
1030
  options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
840
1031
  metadata: metadata,
841
1032
  retry_policy: @config.rpcs.set_iam_policy.retry_policy
842
- options.apply_defaults metadata: @config.metadata,
1033
+
1034
+ options.apply_defaults timeout: @config.timeout,
1035
+ metadata: @config.metadata,
843
1036
  retry_policy: @config.retry_policy
844
1037
 
845
1038
  @cloud_functions_service_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
@@ -885,6 +1078,21 @@ module Google
885
1078
  #
886
1079
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
887
1080
  #
1081
+ # @example Basic example
1082
+ # require "google/cloud/functions/v1"
1083
+ #
1084
+ # # Create a client object. The client can be reused for multiple calls.
1085
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
1086
+ #
1087
+ # # Create a request. To set request fields, pass in keyword arguments.
1088
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
1089
+ #
1090
+ # # Call the get_iam_policy method.
1091
+ # result = client.get_iam_policy request
1092
+ #
1093
+ # # The returned object is of type Google::Iam::V1::Policy.
1094
+ # p result
1095
+ #
888
1096
  def get_iam_policy request, options = nil
889
1097
  raise ::ArgumentError, "request must be provided" if request.nil?
890
1098
 
@@ -902,16 +1110,20 @@ module Google
902
1110
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
903
1111
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
904
1112
 
905
- header_params = {
906
- "resource" => request.resource
907
- }
1113
+ header_params = {}
1114
+ if request.resource
1115
+ header_params["resource"] = request.resource
1116
+ end
1117
+
908
1118
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
909
1119
  metadata[:"x-goog-request-params"] ||= request_params_header
910
1120
 
911
1121
  options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
912
1122
  metadata: metadata,
913
1123
  retry_policy: @config.rpcs.get_iam_policy.retry_policy
914
- options.apply_defaults metadata: @config.metadata,
1124
+
1125
+ options.apply_defaults timeout: @config.timeout,
1126
+ metadata: @config.metadata,
915
1127
  retry_policy: @config.retry_policy
916
1128
 
917
1129
  @cloud_functions_service_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
@@ -960,6 +1172,21 @@ module Google
960
1172
  #
961
1173
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
962
1174
  #
1175
+ # @example Basic example
1176
+ # require "google/cloud/functions/v1"
1177
+ #
1178
+ # # Create a client object. The client can be reused for multiple calls.
1179
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
1180
+ #
1181
+ # # Create a request. To set request fields, pass in keyword arguments.
1182
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
1183
+ #
1184
+ # # Call the test_iam_permissions method.
1185
+ # result = client.test_iam_permissions request
1186
+ #
1187
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
1188
+ # p result
1189
+ #
963
1190
  def test_iam_permissions request, options = nil
964
1191
  raise ::ArgumentError, "request must be provided" if request.nil?
965
1192
 
@@ -977,16 +1204,20 @@ module Google
977
1204
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
978
1205
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
979
1206
 
980
- header_params = {
981
- "resource" => request.resource
982
- }
1207
+ header_params = {}
1208
+ if request.resource
1209
+ header_params["resource"] = request.resource
1210
+ end
1211
+
983
1212
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
984
1213
  metadata[:"x-goog-request-params"] ||= request_params_header
985
1214
 
986
1215
  options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
987
1216
  metadata: metadata,
988
1217
  retry_policy: @config.rpcs.test_iam_permissions.retry_policy
989
- options.apply_defaults metadata: @config.metadata,
1218
+
1219
+ options.apply_defaults timeout: @config.timeout,
1220
+ metadata: @config.metadata,
990
1221
  retry_policy: @config.retry_policy
991
1222
 
992
1223
  @cloud_functions_service_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
@@ -1010,22 +1241,21 @@ module Google
1010
1241
  # Configuration can be applied globally to all clients, or to a single client
1011
1242
  # on construction.
1012
1243
  #
1013
- # # Examples
1014
- #
1015
- # To modify the global config, setting the timeout for list_functions
1016
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1017
- #
1018
- # ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.configure do |config|
1019
- # config.timeout = 10.0
1020
- # config.rpcs.list_functions.timeout = 20.0
1021
- # end
1022
- #
1023
- # To apply the above configuration only to a new client:
1024
- #
1025
- # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config|
1026
- # config.timeout = 10.0
1027
- # config.rpcs.list_functions.timeout = 20.0
1028
- # end
1244
+ # @example
1245
+ #
1246
+ # # Modify the global config, setting the timeout for
1247
+ # # list_functions to 20 seconds,
1248
+ # # and all remaining timeouts to 10 seconds.
1249
+ # ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.configure do |config|
1250
+ # config.timeout = 10.0
1251
+ # config.rpcs.list_functions.timeout = 20.0
1252
+ # end
1253
+ #
1254
+ # # Apply the above configuration only to a new client.
1255
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config|
1256
+ # config.timeout = 10.0
1257
+ # config.rpcs.list_functions.timeout = 20.0
1258
+ # end
1029
1259
  #
1030
1260
  # @!attribute [rw] endpoint
1031
1261
  # The hostname or hostname:port of the service endpoint.