google-cloud-functions-v1 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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]
@@ -67,36 +66,24 @@ module Google
67
66
 
68
67
  default_config.rpcs.list_functions.timeout = 600.0
69
68
  default_config.rpcs.list_functions.retry_policy = {
70
- initial_delay: 0.1,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: [14, 4]
69
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
74
70
  }
75
71
 
76
72
  default_config.rpcs.get_function.timeout = 600.0
77
73
  default_config.rpcs.get_function.retry_policy = {
78
- initial_delay: 0.1,
79
- max_delay: 60.0,
80
- multiplier: 1.3,
81
- retry_codes: [14, 4]
74
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
82
75
  }
83
76
 
84
77
  default_config.rpcs.create_function.timeout = 600.0
85
78
 
86
79
  default_config.rpcs.update_function.timeout = 600.0
87
80
  default_config.rpcs.update_function.retry_policy = {
88
- initial_delay: 0.1,
89
- max_delay: 60.0,
90
- multiplier: 1.3,
91
- retry_codes: [14, 4]
81
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
92
82
  }
93
83
 
94
84
  default_config.rpcs.delete_function.timeout = 600.0
95
85
  default_config.rpcs.delete_function.retry_policy = {
96
- initial_delay: 0.1,
97
- max_delay: 60.0,
98
- multiplier: 1.3,
99
- retry_codes: [14, 4]
86
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
100
87
  }
101
88
 
102
89
  default_config.rpcs.call_function.timeout = 600.0
@@ -130,19 +117,15 @@ module Google
130
117
  ##
131
118
  # Create a new CloudFunctionsService client object.
132
119
  #
133
- # ## Examples
134
- #
135
- # To create a new CloudFunctionsService client with the default
136
- # configuration:
137
- #
138
- # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
120
+ # @example
139
121
  #
140
- # To create a new CloudFunctionsService client with a custom
141
- # configuration:
122
+ # # Create a client using the default configuration
123
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
142
124
  #
143
- # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config|
144
- # config.timeout = 10.0
145
- # 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
146
129
  #
147
130
  # @yield [config] Configure the CloudFunctionsService client.
148
131
  # @yieldparam config [Client::Configuration]
@@ -162,14 +145,13 @@ module Google
162
145
 
163
146
  # Create credentials
164
147
  credentials = @config.credentials
165
- # 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,
166
149
  # but only if the default endpoint does not have a region prefix.
167
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
168
- @config.endpoint == Client.configure.endpoint &&
150
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
169
151
  !@config.endpoint.split(".").first.include?("-")
170
152
  credentials ||= Credentials.default scope: @config.scope,
171
153
  enable_self_signed_jwt: enable_self_signed_jwt
172
- if credentials.is_a?(String) || credentials.is_a?(Hash)
154
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
173
155
  credentials = Credentials.new credentials, scope: @config.scope
174
156
  end
175
157
  @quota_project_id = @config.quota_project
@@ -239,6 +221,27 @@ module Google
239
221
  #
240
222
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
241
223
  #
224
+ # @example Basic example
225
+ # require "google/cloud/functions/v1"
226
+ #
227
+ # # Create a client object. The client can be reused for multiple calls.
228
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
229
+ #
230
+ # # Create a request. To set request fields, pass in keyword arguments.
231
+ # request = Google::Cloud::Functions::V1::ListFunctionsRequest.new
232
+ #
233
+ # # Call the list_functions method.
234
+ # result = client.list_functions request
235
+ #
236
+ # # The returned object is of type Gapic::PagedEnumerable. You can
237
+ # # iterate over all elements by calling #each, and the enumerable
238
+ # # will lazily make API calls to fetch subsequent pages. Other
239
+ # # methods are also available for managing paging directly.
240
+ # result.each do |response|
241
+ # # Each element is of type ::Google::Cloud::Functions::V1::CloudFunction.
242
+ # p response
243
+ # end
244
+ #
242
245
  def list_functions request, options = nil
243
246
  raise ::ArgumentError, "request must be provided" if request.nil?
244
247
 
@@ -256,16 +259,20 @@ module Google
256
259
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
257
260
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
258
261
 
259
- header_params = {
260
- "parent" => request.parent
261
- }
262
+ header_params = {}
263
+ if request.parent
264
+ header_params["parent"] = request.parent
265
+ end
266
+
262
267
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
263
268
  metadata[:"x-goog-request-params"] ||= request_params_header
264
269
 
265
270
  options.apply_defaults timeout: @config.rpcs.list_functions.timeout,
266
271
  metadata: metadata,
267
272
  retry_policy: @config.rpcs.list_functions.retry_policy
268
- options.apply_defaults metadata: @config.metadata,
273
+
274
+ options.apply_defaults timeout: @config.timeout,
275
+ metadata: @config.metadata,
269
276
  retry_policy: @config.retry_policy
270
277
 
271
278
  @cloud_functions_service_stub.call_rpc :list_functions, request, options: options do |response, operation|
@@ -306,6 +313,21 @@ module Google
306
313
  #
307
314
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
308
315
  #
316
+ # @example Basic example
317
+ # require "google/cloud/functions/v1"
318
+ #
319
+ # # Create a client object. The client can be reused for multiple calls.
320
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
321
+ #
322
+ # # Create a request. To set request fields, pass in keyword arguments.
323
+ # request = Google::Cloud::Functions::V1::GetFunctionRequest.new
324
+ #
325
+ # # Call the get_function method.
326
+ # result = client.get_function request
327
+ #
328
+ # # The returned object is of type Google::Cloud::Functions::V1::CloudFunction.
329
+ # p result
330
+ #
309
331
  def get_function request, options = nil
310
332
  raise ::ArgumentError, "request must be provided" if request.nil?
311
333
 
@@ -323,16 +345,20 @@ module Google
323
345
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
324
346
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
325
347
 
326
- header_params = {
327
- "name" => request.name
328
- }
348
+ header_params = {}
349
+ if request.name
350
+ header_params["name"] = request.name
351
+ end
352
+
329
353
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
330
354
  metadata[:"x-goog-request-params"] ||= request_params_header
331
355
 
332
356
  options.apply_defaults timeout: @config.rpcs.get_function.timeout,
333
357
  metadata: metadata,
334
358
  retry_policy: @config.rpcs.get_function.retry_policy
335
- options.apply_defaults metadata: @config.metadata,
359
+
360
+ options.apply_defaults timeout: @config.timeout,
361
+ metadata: @config.metadata,
336
362
  retry_policy: @config.retry_policy
337
363
 
338
364
  @cloud_functions_service_stub.call_rpc :get_function, request, options: options do |response, operation|
@@ -377,6 +403,28 @@ module Google
377
403
  #
378
404
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
379
405
  #
406
+ # @example Basic example
407
+ # require "google/cloud/functions/v1"
408
+ #
409
+ # # Create a client object. The client can be reused for multiple calls.
410
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
411
+ #
412
+ # # Create a request. To set request fields, pass in keyword arguments.
413
+ # request = Google::Cloud::Functions::V1::CreateFunctionRequest.new
414
+ #
415
+ # # Call the create_function method.
416
+ # result = client.create_function request
417
+ #
418
+ # # The returned object is of type Gapic::Operation. You can use this
419
+ # # object to check the status of an operation, cancel it, or wait
420
+ # # for results. Here is how to block until completion:
421
+ # result.wait_until_done! timeout: 60
422
+ # if result.response?
423
+ # p result.response
424
+ # else
425
+ # puts "Error!"
426
+ # end
427
+ #
380
428
  def create_function request, options = nil
381
429
  raise ::ArgumentError, "request must be provided" if request.nil?
382
430
 
@@ -394,16 +442,20 @@ module Google
394
442
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
395
443
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
396
444
 
397
- header_params = {
398
- "location" => request.location
399
- }
445
+ header_params = {}
446
+ if request.location
447
+ header_params["location"] = request.location
448
+ end
449
+
400
450
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
401
451
  metadata[:"x-goog-request-params"] ||= request_params_header
402
452
 
403
453
  options.apply_defaults timeout: @config.rpcs.create_function.timeout,
404
454
  metadata: metadata,
405
455
  retry_policy: @config.rpcs.create_function.retry_policy
406
- options.apply_defaults metadata: @config.metadata,
456
+
457
+ options.apply_defaults timeout: @config.timeout,
458
+ metadata: @config.metadata,
407
459
  retry_policy: @config.retry_policy
408
460
 
409
461
  @cloud_functions_service_stub.call_rpc :create_function, request, options: options do |response, operation|
@@ -446,6 +498,28 @@ module Google
446
498
  #
447
499
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
448
500
  #
501
+ # @example Basic example
502
+ # require "google/cloud/functions/v1"
503
+ #
504
+ # # Create a client object. The client can be reused for multiple calls.
505
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
506
+ #
507
+ # # Create a request. To set request fields, pass in keyword arguments.
508
+ # request = Google::Cloud::Functions::V1::UpdateFunctionRequest.new
509
+ #
510
+ # # Call the update_function method.
511
+ # result = client.update_function request
512
+ #
513
+ # # The returned object is of type Gapic::Operation. You can use this
514
+ # # object to check the status of an operation, cancel it, or wait
515
+ # # for results. Here is how to block until completion:
516
+ # result.wait_until_done! timeout: 60
517
+ # if result.response?
518
+ # p result.response
519
+ # else
520
+ # puts "Error!"
521
+ # end
522
+ #
449
523
  def update_function request, options = nil
450
524
  raise ::ArgumentError, "request must be provided" if request.nil?
451
525
 
@@ -463,16 +537,20 @@ module Google
463
537
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
464
538
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
465
539
 
466
- header_params = {
467
- "function.name" => request.function.name
468
- }
540
+ header_params = {}
541
+ if request.function&.name
542
+ header_params["function.name"] = request.function.name
543
+ end
544
+
469
545
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
470
546
  metadata[:"x-goog-request-params"] ||= request_params_header
471
547
 
472
548
  options.apply_defaults timeout: @config.rpcs.update_function.timeout,
473
549
  metadata: metadata,
474
550
  retry_policy: @config.rpcs.update_function.retry_policy
475
- options.apply_defaults metadata: @config.metadata,
551
+
552
+ options.apply_defaults timeout: @config.timeout,
553
+ metadata: @config.metadata,
476
554
  retry_policy: @config.retry_policy
477
555
 
478
556
  @cloud_functions_service_stub.call_rpc :update_function, request, options: options do |response, operation|
@@ -515,6 +593,28 @@ module Google
515
593
  #
516
594
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
517
595
  #
596
+ # @example Basic example
597
+ # require "google/cloud/functions/v1"
598
+ #
599
+ # # Create a client object. The client can be reused for multiple calls.
600
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
601
+ #
602
+ # # Create a request. To set request fields, pass in keyword arguments.
603
+ # request = Google::Cloud::Functions::V1::DeleteFunctionRequest.new
604
+ #
605
+ # # Call the delete_function method.
606
+ # result = client.delete_function request
607
+ #
608
+ # # The returned object is of type Gapic::Operation. You can use this
609
+ # # object to check the status of an operation, cancel it, or wait
610
+ # # for results. Here is how to block until completion:
611
+ # result.wait_until_done! timeout: 60
612
+ # if result.response?
613
+ # p result.response
614
+ # else
615
+ # puts "Error!"
616
+ # end
617
+ #
518
618
  def delete_function request, options = nil
519
619
  raise ::ArgumentError, "request must be provided" if request.nil?
520
620
 
@@ -532,16 +632,20 @@ module Google
532
632
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
533
633
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
534
634
 
535
- header_params = {
536
- "name" => request.name
537
- }
635
+ header_params = {}
636
+ if request.name
637
+ header_params["name"] = request.name
638
+ end
639
+
538
640
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
539
641
  metadata[:"x-goog-request-params"] ||= request_params_header
540
642
 
541
643
  options.apply_defaults timeout: @config.rpcs.delete_function.timeout,
542
644
  metadata: metadata,
543
645
  retry_policy: @config.rpcs.delete_function.retry_policy
544
- options.apply_defaults metadata: @config.metadata,
646
+
647
+ options.apply_defaults timeout: @config.timeout,
648
+ metadata: @config.metadata,
545
649
  retry_policy: @config.retry_policy
546
650
 
547
651
  @cloud_functions_service_stub.call_rpc :delete_function, request, options: options do |response, operation|
@@ -587,6 +691,21 @@ module Google
587
691
  #
588
692
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
589
693
  #
694
+ # @example Basic example
695
+ # require "google/cloud/functions/v1"
696
+ #
697
+ # # Create a client object. The client can be reused for multiple calls.
698
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
699
+ #
700
+ # # Create a request. To set request fields, pass in keyword arguments.
701
+ # request = Google::Cloud::Functions::V1::CallFunctionRequest.new
702
+ #
703
+ # # Call the call_function method.
704
+ # result = client.call_function request
705
+ #
706
+ # # The returned object is of type Google::Cloud::Functions::V1::CallFunctionResponse.
707
+ # p result
708
+ #
590
709
  def call_function request, options = nil
591
710
  raise ::ArgumentError, "request must be provided" if request.nil?
592
711
 
@@ -604,16 +723,20 @@ module Google
604
723
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
605
724
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
606
725
 
607
- header_params = {
608
- "name" => request.name
609
- }
726
+ header_params = {}
727
+ if request.name
728
+ header_params["name"] = request.name
729
+ end
730
+
610
731
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
611
732
  metadata[:"x-goog-request-params"] ||= request_params_header
612
733
 
613
734
  options.apply_defaults timeout: @config.rpcs.call_function.timeout,
614
735
  metadata: metadata,
615
736
  retry_policy: @config.rpcs.call_function.retry_policy
616
- options.apply_defaults metadata: @config.metadata,
737
+
738
+ options.apply_defaults timeout: @config.timeout,
739
+ metadata: @config.metadata,
617
740
  retry_policy: @config.retry_policy
618
741
 
619
742
  @cloud_functions_service_stub.call_rpc :call_function, request, options: options do |response, operation|
@@ -678,6 +801,21 @@ module Google
678
801
  #
679
802
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
680
803
  #
804
+ # @example Basic example
805
+ # require "google/cloud/functions/v1"
806
+ #
807
+ # # Create a client object. The client can be reused for multiple calls.
808
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
809
+ #
810
+ # # Create a request. To set request fields, pass in keyword arguments.
811
+ # request = Google::Cloud::Functions::V1::GenerateUploadUrlRequest.new
812
+ #
813
+ # # Call the generate_upload_url method.
814
+ # result = client.generate_upload_url request
815
+ #
816
+ # # The returned object is of type Google::Cloud::Functions::V1::GenerateUploadUrlResponse.
817
+ # p result
818
+ #
681
819
  def generate_upload_url request, options = nil
682
820
  raise ::ArgumentError, "request must be provided" if request.nil?
683
821
 
@@ -695,16 +833,20 @@ module Google
695
833
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
696
834
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
697
835
 
698
- header_params = {
699
- "parent" => request.parent
700
- }
836
+ header_params = {}
837
+ if request.parent
838
+ header_params["parent"] = request.parent
839
+ end
840
+
701
841
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
702
842
  metadata[:"x-goog-request-params"] ||= request_params_header
703
843
 
704
844
  options.apply_defaults timeout: @config.rpcs.generate_upload_url.timeout,
705
845
  metadata: metadata,
706
846
  retry_policy: @config.rpcs.generate_upload_url.retry_policy
707
- options.apply_defaults metadata: @config.metadata,
847
+
848
+ options.apply_defaults timeout: @config.timeout,
849
+ metadata: @config.metadata,
708
850
  retry_policy: @config.retry_policy
709
851
 
710
852
  @cloud_functions_service_stub.call_rpc :generate_upload_url, request, options: options do |response, operation|
@@ -752,6 +894,21 @@ module Google
752
894
  #
753
895
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
754
896
  #
897
+ # @example Basic example
898
+ # require "google/cloud/functions/v1"
899
+ #
900
+ # # Create a client object. The client can be reused for multiple calls.
901
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
902
+ #
903
+ # # Create a request. To set request fields, pass in keyword arguments.
904
+ # request = Google::Cloud::Functions::V1::GenerateDownloadUrlRequest.new
905
+ #
906
+ # # Call the generate_download_url method.
907
+ # result = client.generate_download_url request
908
+ #
909
+ # # The returned object is of type Google::Cloud::Functions::V1::GenerateDownloadUrlResponse.
910
+ # p result
911
+ #
755
912
  def generate_download_url request, options = nil
756
913
  raise ::ArgumentError, "request must be provided" if request.nil?
757
914
 
@@ -769,16 +926,20 @@ module Google
769
926
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
770
927
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
771
928
 
772
- header_params = {
773
- "name" => request.name
774
- }
929
+ header_params = {}
930
+ if request.name
931
+ header_params["name"] = request.name
932
+ end
933
+
775
934
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
776
935
  metadata[:"x-goog-request-params"] ||= request_params_header
777
936
 
778
937
  options.apply_defaults timeout: @config.rpcs.generate_download_url.timeout,
779
938
  metadata: metadata,
780
939
  retry_policy: @config.rpcs.generate_download_url.retry_policy
781
- options.apply_defaults metadata: @config.metadata,
940
+
941
+ options.apply_defaults timeout: @config.timeout,
942
+ metadata: @config.metadata,
782
943
  retry_policy: @config.retry_policy
783
944
 
784
945
  @cloud_functions_service_stub.call_rpc :generate_download_url, request, options: options do |response, operation|
@@ -825,6 +986,21 @@ module Google
825
986
  #
826
987
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
827
988
  #
989
+ # @example Basic example
990
+ # require "google/cloud/functions/v1"
991
+ #
992
+ # # Create a client object. The client can be reused for multiple calls.
993
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
994
+ #
995
+ # # Create a request. To set request fields, pass in keyword arguments.
996
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
997
+ #
998
+ # # Call the set_iam_policy method.
999
+ # result = client.set_iam_policy request
1000
+ #
1001
+ # # The returned object is of type Google::Iam::V1::Policy.
1002
+ # p result
1003
+ #
828
1004
  def set_iam_policy request, options = nil
829
1005
  raise ::ArgumentError, "request must be provided" if request.nil?
830
1006
 
@@ -842,16 +1018,20 @@ module Google
842
1018
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
843
1019
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
844
1020
 
845
- header_params = {
846
- "resource" => request.resource
847
- }
1021
+ header_params = {}
1022
+ if request.resource
1023
+ header_params["resource"] = request.resource
1024
+ end
1025
+
848
1026
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
849
1027
  metadata[:"x-goog-request-params"] ||= request_params_header
850
1028
 
851
1029
  options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
852
1030
  metadata: metadata,
853
1031
  retry_policy: @config.rpcs.set_iam_policy.retry_policy
854
- options.apply_defaults metadata: @config.metadata,
1032
+
1033
+ options.apply_defaults timeout: @config.timeout,
1034
+ metadata: @config.metadata,
855
1035
  retry_policy: @config.retry_policy
856
1036
 
857
1037
  @cloud_functions_service_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
@@ -897,6 +1077,21 @@ module Google
897
1077
  #
898
1078
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
899
1079
  #
1080
+ # @example Basic example
1081
+ # require "google/cloud/functions/v1"
1082
+ #
1083
+ # # Create a client object. The client can be reused for multiple calls.
1084
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
1085
+ #
1086
+ # # Create a request. To set request fields, pass in keyword arguments.
1087
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
1088
+ #
1089
+ # # Call the get_iam_policy method.
1090
+ # result = client.get_iam_policy request
1091
+ #
1092
+ # # The returned object is of type Google::Iam::V1::Policy.
1093
+ # p result
1094
+ #
900
1095
  def get_iam_policy request, options = nil
901
1096
  raise ::ArgumentError, "request must be provided" if request.nil?
902
1097
 
@@ -914,16 +1109,20 @@ module Google
914
1109
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
915
1110
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
916
1111
 
917
- header_params = {
918
- "resource" => request.resource
919
- }
1112
+ header_params = {}
1113
+ if request.resource
1114
+ header_params["resource"] = request.resource
1115
+ end
1116
+
920
1117
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
921
1118
  metadata[:"x-goog-request-params"] ||= request_params_header
922
1119
 
923
1120
  options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
924
1121
  metadata: metadata,
925
1122
  retry_policy: @config.rpcs.get_iam_policy.retry_policy
926
- options.apply_defaults metadata: @config.metadata,
1123
+
1124
+ options.apply_defaults timeout: @config.timeout,
1125
+ metadata: @config.metadata,
927
1126
  retry_policy: @config.retry_policy
928
1127
 
929
1128
  @cloud_functions_service_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
@@ -972,6 +1171,21 @@ module Google
972
1171
  #
973
1172
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
974
1173
  #
1174
+ # @example Basic example
1175
+ # require "google/cloud/functions/v1"
1176
+ #
1177
+ # # Create a client object. The client can be reused for multiple calls.
1178
+ # client = Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
1179
+ #
1180
+ # # Create a request. To set request fields, pass in keyword arguments.
1181
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
1182
+ #
1183
+ # # Call the test_iam_permissions method.
1184
+ # result = client.test_iam_permissions request
1185
+ #
1186
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
1187
+ # p result
1188
+ #
975
1189
  def test_iam_permissions request, options = nil
976
1190
  raise ::ArgumentError, "request must be provided" if request.nil?
977
1191
 
@@ -989,16 +1203,20 @@ module Google
989
1203
  gapic_version: ::Google::Cloud::Functions::V1::VERSION
990
1204
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
991
1205
 
992
- header_params = {
993
- "resource" => request.resource
994
- }
1206
+ header_params = {}
1207
+ if request.resource
1208
+ header_params["resource"] = request.resource
1209
+ end
1210
+
995
1211
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
996
1212
  metadata[:"x-goog-request-params"] ||= request_params_header
997
1213
 
998
1214
  options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
999
1215
  metadata: metadata,
1000
1216
  retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1001
- options.apply_defaults metadata: @config.metadata,
1217
+
1218
+ options.apply_defaults timeout: @config.timeout,
1219
+ metadata: @config.metadata,
1002
1220
  retry_policy: @config.retry_policy
1003
1221
 
1004
1222
  @cloud_functions_service_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
@@ -1022,22 +1240,21 @@ module Google
1022
1240
  # Configuration can be applied globally to all clients, or to a single client
1023
1241
  # on construction.
1024
1242
  #
1025
- # # Examples
1026
- #
1027
- # To modify the global config, setting the timeout for list_functions
1028
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1029
- #
1030
- # ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.configure do |config|
1031
- # config.timeout = 10.0
1032
- # config.rpcs.list_functions.timeout = 20.0
1033
- # end
1034
- #
1035
- # To apply the above configuration only to a new client:
1036
- #
1037
- # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config|
1038
- # config.timeout = 10.0
1039
- # config.rpcs.list_functions.timeout = 20.0
1040
- # end
1243
+ # @example
1244
+ #
1245
+ # # Modify the global config, setting the timeout for
1246
+ # # list_functions to 20 seconds,
1247
+ # # and all remaining timeouts to 10 seconds.
1248
+ # ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.configure do |config|
1249
+ # config.timeout = 10.0
1250
+ # config.rpcs.list_functions.timeout = 20.0
1251
+ # end
1252
+ #
1253
+ # # Apply the above configuration only to a new client.
1254
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config|
1255
+ # config.timeout = 10.0
1256
+ # config.rpcs.list_functions.timeout = 20.0
1257
+ # end
1041
1258
  #
1042
1259
  # @!attribute [rw] endpoint
1043
1260
  # The hostname or hostname:port of the service endpoint.