google-cloud-video-live_stream-v1 1.1.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -213,15 +213,27 @@ module Google
213
213
  endpoint: @config.endpoint,
214
214
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
215
215
  universe_domain: @config.universe_domain,
216
- credentials: credentials
216
+ credentials: credentials,
217
+ logger: @config.logger
217
218
  )
218
219
 
220
+ @livestream_service_stub.logger(stub: true)&.info do |entry|
221
+ entry.set_system_name
222
+ entry.set_service
223
+ entry.message = "Created client for #{entry.service}"
224
+ entry.set_credentials_fields credentials
225
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
226
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
227
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
228
+ end
229
+
219
230
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
220
231
  config.credentials = credentials
221
232
  config.quota_project = @quota_project_id
222
233
  config.endpoint = @livestream_service_stub.endpoint
223
234
  config.universe_domain = @livestream_service_stub.universe_domain
224
235
  config.bindings_override = @config.bindings_override
236
+ config.logger = @livestream_service_stub.logger if config.respond_to? :logger=
225
237
  end
226
238
  end
227
239
 
@@ -239,6 +251,15 @@ module Google
239
251
  #
240
252
  attr_reader :location_client
241
253
 
254
+ ##
255
+ # The logger used for request/response debug logging.
256
+ #
257
+ # @return [Logger]
258
+ #
259
+ def logger
260
+ @livestream_service_stub.logger
261
+ end
262
+
242
263
  # Service calls
243
264
 
244
265
  ##
@@ -344,7 +365,7 @@ module Google
344
365
  @livestream_service_stub.create_channel request, options do |result, operation|
345
366
  result = ::Gapic::Operation.new result, @operations_client, options: options
346
367
  yield result, operation if block_given?
347
- return result
368
+ throw :response, result
348
369
  end
349
370
  rescue ::Gapic::Rest::Error => e
350
371
  raise ::Google::Cloud::Error.from_error(e)
@@ -441,7 +462,6 @@ module Google
441
462
 
442
463
  @livestream_service_stub.list_channels request, options do |result, operation|
443
464
  yield result, operation if block_given?
444
- return result
445
465
  end
446
466
  rescue ::Gapic::Rest::Error => e
447
467
  raise ::Google::Cloud::Error.from_error(e)
@@ -521,7 +541,6 @@ module Google
521
541
 
522
542
  @livestream_service_stub.get_channel request, options do |result, operation|
523
543
  yield result, operation if block_given?
524
- return result
525
544
  end
526
545
  rescue ::Gapic::Rest::Error => e
527
546
  raise ::Google::Cloud::Error.from_error(e)
@@ -628,7 +647,7 @@ module Google
628
647
  @livestream_service_stub.delete_channel request, options do |result, operation|
629
648
  result = ::Gapic::Operation.new result, @operations_client, options: options
630
649
  yield result, operation if block_given?
631
- return result
650
+ throw :response, result
632
651
  end
633
652
  rescue ::Gapic::Rest::Error => e
634
653
  raise ::Google::Cloud::Error.from_error(e)
@@ -750,7 +769,7 @@ module Google
750
769
  @livestream_service_stub.update_channel request, options do |result, operation|
751
770
  result = ::Gapic::Operation.new result, @operations_client, options: options
752
771
  yield result, operation if block_given?
753
- return result
772
+ throw :response, result
754
773
  end
755
774
  rescue ::Gapic::Rest::Error => e
756
775
  raise ::Google::Cloud::Error.from_error(e)
@@ -853,7 +872,7 @@ module Google
853
872
  @livestream_service_stub.start_channel request, options do |result, operation|
854
873
  result = ::Gapic::Operation.new result, @operations_client, options: options
855
874
  yield result, operation if block_given?
856
- return result
875
+ throw :response, result
857
876
  end
858
877
  rescue ::Gapic::Rest::Error => e
859
878
  raise ::Google::Cloud::Error.from_error(e)
@@ -956,7 +975,7 @@ module Google
956
975
  @livestream_service_stub.stop_channel request, options do |result, operation|
957
976
  result = ::Gapic::Operation.new result, @operations_client, options: options
958
977
  yield result, operation if block_given?
959
- return result
978
+ throw :response, result
960
979
  end
961
980
  rescue ::Gapic::Rest::Error => e
962
981
  raise ::Google::Cloud::Error.from_error(e)
@@ -1064,7 +1083,7 @@ module Google
1064
1083
  @livestream_service_stub.create_input request, options do |result, operation|
1065
1084
  result = ::Gapic::Operation.new result, @operations_client, options: options
1066
1085
  yield result, operation if block_given?
1067
- return result
1086
+ throw :response, result
1068
1087
  end
1069
1088
  rescue ::Gapic::Rest::Error => e
1070
1089
  raise ::Google::Cloud::Error.from_error(e)
@@ -1161,7 +1180,6 @@ module Google
1161
1180
 
1162
1181
  @livestream_service_stub.list_inputs request, options do |result, operation|
1163
1182
  yield result, operation if block_given?
1164
- return result
1165
1183
  end
1166
1184
  rescue ::Gapic::Rest::Error => e
1167
1185
  raise ::Google::Cloud::Error.from_error(e)
@@ -1241,7 +1259,6 @@ module Google
1241
1259
 
1242
1260
  @livestream_service_stub.get_input request, options do |result, operation|
1243
1261
  yield result, operation if block_given?
1244
- return result
1245
1262
  end
1246
1263
  rescue ::Gapic::Rest::Error => e
1247
1264
  raise ::Google::Cloud::Error.from_error(e)
@@ -1343,7 +1360,7 @@ module Google
1343
1360
  @livestream_service_stub.delete_input request, options do |result, operation|
1344
1361
  result = ::Gapic::Operation.new result, @operations_client, options: options
1345
1362
  yield result, operation if block_given?
1346
- return result
1363
+ throw :response, result
1347
1364
  end
1348
1365
  rescue ::Gapic::Rest::Error => e
1349
1366
  raise ::Google::Cloud::Error.from_error(e)
@@ -1457,7 +1474,7 @@ module Google
1457
1474
  @livestream_service_stub.update_input request, options do |result, operation|
1458
1475
  result = ::Gapic::Operation.new result, @operations_client, options: options
1459
1476
  yield result, operation if block_given?
1460
- return result
1477
+ throw :response, result
1461
1478
  end
1462
1479
  rescue ::Gapic::Rest::Error => e
1463
1480
  raise ::Google::Cloud::Error.from_error(e)
@@ -1557,7 +1574,6 @@ module Google
1557
1574
 
1558
1575
  @livestream_service_stub.create_event request, options do |result, operation|
1559
1576
  yield result, operation if block_given?
1560
- return result
1561
1577
  end
1562
1578
  rescue ::Gapic::Rest::Error => e
1563
1579
  raise ::Google::Cloud::Error.from_error(e)
@@ -1654,7 +1670,6 @@ module Google
1654
1670
 
1655
1671
  @livestream_service_stub.list_events request, options do |result, operation|
1656
1672
  yield result, operation if block_given?
1657
- return result
1658
1673
  end
1659
1674
  rescue ::Gapic::Rest::Error => e
1660
1675
  raise ::Google::Cloud::Error.from_error(e)
@@ -1734,7 +1749,6 @@ module Google
1734
1749
 
1735
1750
  @livestream_service_stub.get_event request, options do |result, operation|
1736
1751
  yield result, operation if block_given?
1737
- return result
1738
1752
  end
1739
1753
  rescue ::Gapic::Rest::Error => e
1740
1754
  raise ::Google::Cloud::Error.from_error(e)
@@ -1828,7 +1842,6 @@ module Google
1828
1842
 
1829
1843
  @livestream_service_stub.delete_event request, options do |result, operation|
1830
1844
  yield result, operation if block_given?
1831
- return result
1832
1845
  end
1833
1846
  rescue ::Gapic::Rest::Error => e
1834
1847
  raise ::Google::Cloud::Error.from_error(e)
@@ -1920,7 +1933,6 @@ module Google
1920
1933
 
1921
1934
  @livestream_service_stub.list_clips request, options do |result, operation|
1922
1935
  yield result, operation if block_given?
1923
- return result
1924
1936
  end
1925
1937
  rescue ::Gapic::Rest::Error => e
1926
1938
  raise ::Google::Cloud::Error.from_error(e)
@@ -2000,7 +2012,6 @@ module Google
2000
2012
 
2001
2013
  @livestream_service_stub.get_clip request, options do |result, operation|
2002
2014
  yield result, operation if block_given?
2003
- return result
2004
2015
  end
2005
2016
  rescue ::Gapic::Rest::Error => e
2006
2017
  raise ::Google::Cloud::Error.from_error(e)
@@ -2109,7 +2120,7 @@ module Google
2109
2120
  @livestream_service_stub.create_clip request, options do |result, operation|
2110
2121
  result = ::Gapic::Operation.new result, @operations_client, options: options
2111
2122
  yield result, operation if block_given?
2112
- return result
2123
+ throw :response, result
2113
2124
  end
2114
2125
  rescue ::Gapic::Rest::Error => e
2115
2126
  raise ::Google::Cloud::Error.from_error(e)
@@ -2212,7 +2223,7 @@ module Google
2212
2223
  @livestream_service_stub.delete_clip request, options do |result, operation|
2213
2224
  result = ::Gapic::Operation.new result, @operations_client, options: options
2214
2225
  yield result, operation if block_given?
2215
- return result
2226
+ throw :response, result
2216
2227
  end
2217
2228
  rescue ::Gapic::Rest::Error => e
2218
2229
  raise ::Google::Cloud::Error.from_error(e)
@@ -2321,7 +2332,7 @@ module Google
2321
2332
  @livestream_service_stub.create_asset request, options do |result, operation|
2322
2333
  result = ::Gapic::Operation.new result, @operations_client, options: options
2323
2334
  yield result, operation if block_given?
2324
- return result
2335
+ throw :response, result
2325
2336
  end
2326
2337
  rescue ::Gapic::Rest::Error => e
2327
2338
  raise ::Google::Cloud::Error.from_error(e)
@@ -2423,7 +2434,7 @@ module Google
2423
2434
  @livestream_service_stub.delete_asset request, options do |result, operation|
2424
2435
  result = ::Gapic::Operation.new result, @operations_client, options: options
2425
2436
  yield result, operation if block_given?
2426
- return result
2437
+ throw :response, result
2427
2438
  end
2428
2439
  rescue ::Gapic::Rest::Error => e
2429
2440
  raise ::Google::Cloud::Error.from_error(e)
@@ -2503,7 +2514,6 @@ module Google
2503
2514
 
2504
2515
  @livestream_service_stub.get_asset request, options do |result, operation|
2505
2516
  yield result, operation if block_given?
2506
- return result
2507
2517
  end
2508
2518
  rescue ::Gapic::Rest::Error => e
2509
2519
  raise ::Google::Cloud::Error.from_error(e)
@@ -2596,7 +2606,6 @@ module Google
2596
2606
 
2597
2607
  @livestream_service_stub.list_assets request, options do |result, operation|
2598
2608
  yield result, operation if block_given?
2599
- return result
2600
2609
  end
2601
2610
  rescue ::Gapic::Rest::Error => e
2602
2611
  raise ::Google::Cloud::Error.from_error(e)
@@ -2676,7 +2685,6 @@ module Google
2676
2685
 
2677
2686
  @livestream_service_stub.get_pool request, options do |result, operation|
2678
2687
  yield result, operation if block_given?
2679
- return result
2680
2688
  end
2681
2689
  rescue ::Gapic::Rest::Error => e
2682
2690
  raise ::Google::Cloud::Error.from_error(e)
@@ -2785,7 +2793,7 @@ module Google
2785
2793
  @livestream_service_stub.update_pool request, options do |result, operation|
2786
2794
  result = ::Gapic::Operation.new result, @operations_client, options: options
2787
2795
  yield result, operation if block_given?
2788
- return result
2796
+ throw :response, result
2789
2797
  end
2790
2798
  rescue ::Gapic::Rest::Error => e
2791
2799
  raise ::Google::Cloud::Error.from_error(e)
@@ -2833,6 +2841,13 @@ module Google
2833
2841
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2834
2842
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2835
2843
  # * (`nil`) indicating no credentials
2844
+ #
2845
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2846
+ # external source for authentication to Google Cloud, you must validate it before
2847
+ # providing it to a Google API client library. Providing an unvalidated credential
2848
+ # configuration to Google APIs can compromise the security of your systems and data.
2849
+ # For more information, refer to [Validate credential configurations from external
2850
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2836
2851
  # @return [::Object]
2837
2852
  # @!attribute [rw] scope
2838
2853
  # The OAuth scopes
@@ -2865,6 +2880,11 @@ module Google
2865
2880
  # default endpoint URL. The default value of nil uses the environment
2866
2881
  # universe (usually the default "googleapis.com" universe).
2867
2882
  # @return [::String,nil]
2883
+ # @!attribute [rw] logger
2884
+ # A custom logger to use for request/response debug logging, or the value
2885
+ # `:default` (the default) to construct a default logger, or `nil` to
2886
+ # explicitly disable logging.
2887
+ # @return [::Logger,:default,nil]
2868
2888
  #
2869
2889
  class Configuration
2870
2890
  extend ::Gapic::Config
@@ -2893,6 +2913,7 @@ module Google
2893
2913
  # by the host service.
2894
2914
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
2895
2915
  config_attr :bindings_override, {}, ::Hash, nil
2916
+ config_attr :logger, :default, ::Logger, nil, :default
2896
2917
 
2897
2918
  # @private
2898
2919
  def initialize parent_config = nil
@@ -116,14 +116,6 @@ module Google
116
116
  # Lists operations that match the specified filter in the request. If the
117
117
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
118
118
  #
119
- # NOTE: the `name` binding allows API services to override the binding
120
- # to use different resource name schemes, such as `users/*/operations`. To
121
- # override the binding, API services can add a binding such as
122
- # `"/v1/{name=users/*}/operations"` to their service configuration.
123
- # For backwards compatibility, the default name includes the operations
124
- # collection id, however overriding users must ensure the name binding
125
- # is the parent resource, without the operations collection id.
126
- #
127
119
  # @overload list_operations(request, options = nil)
128
120
  # Pass arguments to `list_operations` via a request object, either of type
129
121
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -205,7 +197,7 @@ module Google
205
197
  @operations_stub.list_operations request, options do |result, operation|
206
198
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
207
199
  yield result, operation if block_given?
208
- return result
200
+ throw :response, result
209
201
  end
210
202
  rescue ::Gapic::Rest::Error => e
211
203
  raise ::Google::Cloud::Error.from_error(e)
@@ -294,7 +286,7 @@ module Google
294
286
  @operations_stub.get_operation request, options do |result, operation|
295
287
  result = ::Gapic::Operation.new result, @operations_client, options: options
296
288
  yield result, operation if block_given?
297
- return result
289
+ throw :response, result
298
290
  end
299
291
  rescue ::Gapic::Rest::Error => e
300
292
  raise ::Google::Cloud::Error.from_error(e)
@@ -376,7 +368,6 @@ module Google
376
368
 
377
369
  @operations_stub.delete_operation request, options do |result, operation|
378
370
  yield result, operation if block_given?
379
- return result
380
371
  end
381
372
  rescue ::Gapic::Rest::Error => e
382
373
  raise ::Google::Cloud::Error.from_error(e)
@@ -391,8 +382,9 @@ module Google
391
382
  # other methods to check whether the cancellation succeeded or whether the
392
383
  # operation completed despite cancellation. On successful cancellation,
393
384
  # the operation is not deleted; instead, it becomes an operation with
394
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
395
- # corresponding to `Code.CANCELLED`.
385
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
386
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
387
+ # `Code.CANCELLED`.
396
388
  #
397
389
  # @overload cancel_operation(request, options = nil)
398
390
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -464,7 +456,6 @@ module Google
464
456
 
465
457
  @operations_stub.cancel_operation request, options do |result, operation|
466
458
  yield result, operation if block_given?
467
- return result
468
459
  end
469
460
  rescue ::Gapic::Rest::Error => e
470
461
  raise ::Google::Cloud::Error.from_error(e)
@@ -512,6 +503,13 @@ module Google
512
503
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
513
504
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
514
505
  # * (`nil`) indicating no credentials
506
+ #
507
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
508
+ # external source for authentication to Google Cloud, you must validate it before
509
+ # providing it to a Google API client library. Providing an unvalidated credential
510
+ # configuration to Google APIs can compromise the security of your systems and data.
511
+ # For more information, refer to [Validate credential configurations from external
512
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
515
513
  # @return [::Object]
516
514
  # @!attribute [rw] scope
517
515
  # The OAuth scopes
@@ -544,6 +542,11 @@ module Google
544
542
  # default endpoint URL. The default value of nil uses the environment
545
543
  # universe (usually the default "googleapis.com" universe).
546
544
  # @return [::String,nil]
545
+ # @!attribute [rw] logger
546
+ # A custom logger to use for request/response debug logging, or the value
547
+ # `:default` (the default) to construct a default logger, or `nil` to
548
+ # explicitly disable logging.
549
+ # @return [::Logger,:default,nil]
547
550
  #
548
551
  class Configuration
549
552
  extend ::Gapic::Config
@@ -565,6 +568,7 @@ module Google
565
568
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
566
569
  config_attr :quota_project, nil, ::String, nil
567
570
  config_attr :universe_domain, nil, ::String, nil
571
+ config_attr :logger, :default, ::Logger, nil, :default
568
572
 
569
573
  # @private
570
574
  def initialize parent_config = nil
@@ -684,16 +688,18 @@ module Google
684
688
 
685
689
  response = @client_stub.make_http_request(
686
690
  verb,
687
- uri: uri,
688
- body: body || "",
689
- params: query_string_params,
691
+ uri: uri,
692
+ body: body || "",
693
+ params: query_string_params,
694
+ method_name: "list_operations",
690
695
  options: options
691
696
  )
692
697
  operation = ::Gapic::Rest::TransportOperation.new response
693
698
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
694
-
695
- yield result, operation if block_given?
696
- result
699
+ catch :response do
700
+ yield result, operation if block_given?
701
+ result
702
+ end
697
703
  end
698
704
 
699
705
  ##
@@ -722,16 +728,18 @@ module Google
722
728
 
723
729
  response = @client_stub.make_http_request(
724
730
  verb,
725
- uri: uri,
726
- body: body || "",
727
- params: query_string_params,
731
+ uri: uri,
732
+ body: body || "",
733
+ params: query_string_params,
734
+ method_name: "get_operation",
728
735
  options: options
729
736
  )
730
737
  operation = ::Gapic::Rest::TransportOperation.new response
731
738
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
732
-
733
- yield result, operation if block_given?
734
- result
739
+ catch :response do
740
+ yield result, operation if block_given?
741
+ result
742
+ end
735
743
  end
736
744
 
737
745
  ##
@@ -760,16 +768,18 @@ module Google
760
768
 
761
769
  response = @client_stub.make_http_request(
762
770
  verb,
763
- uri: uri,
764
- body: body || "",
765
- params: query_string_params,
771
+ uri: uri,
772
+ body: body || "",
773
+ params: query_string_params,
774
+ method_name: "delete_operation",
766
775
  options: options
767
776
  )
768
777
  operation = ::Gapic::Rest::TransportOperation.new response
769
778
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
770
-
771
- yield result, operation if block_given?
772
- result
779
+ catch :response do
780
+ yield result, operation if block_given?
781
+ result
782
+ end
773
783
  end
774
784
 
775
785
  ##
@@ -798,16 +808,18 @@ module Google
798
808
 
799
809
  response = @client_stub.make_http_request(
800
810
  verb,
801
- uri: uri,
802
- body: body || "",
803
- params: query_string_params,
811
+ uri: uri,
812
+ body: body || "",
813
+ params: query_string_params,
814
+ method_name: "cancel_operation",
804
815
  options: options
805
816
  )
806
817
  operation = ::Gapic::Rest::TransportOperation.new response
807
818
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
808
-
809
- yield result, operation if block_given?
810
- result
819
+ catch :response do
820
+ yield result, operation if block_given?
821
+ result
822
+ end
811
823
  end
812
824
 
813
825
  ##