google-cloud-vision_ai-v1 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -21
  3. data/lib/google/cloud/vision_ai/v1/app_platform/client.rb +57 -27
  4. data/lib/google/cloud/vision_ai/v1/app_platform/operations.rb +19 -15
  5. data/lib/google/cloud/vision_ai/v1/app_platform/rest/client.rb +53 -27
  6. data/lib/google/cloud/vision_ai/v1/app_platform/rest/operations.rb +50 -38
  7. data/lib/google/cloud/vision_ai/v1/app_platform/rest/service_stub.rb +222 -158
  8. data/lib/google/cloud/vision_ai/v1/health_check_service/client.rb +36 -2
  9. data/lib/google/cloud/vision_ai/v1/health_check_service/rest/client.rb +36 -2
  10. data/lib/google/cloud/vision_ai/v1/health_check_service/rest/service_stub.rb +22 -8
  11. data/lib/google/cloud/vision_ai/v1/live_video_analytics/client.rb +50 -19
  12. data/lib/google/cloud/vision_ai/v1/live_video_analytics/operations.rb +19 -15
  13. data/lib/google/cloud/vision_ai/v1/live_video_analytics/rest/client.rb +47 -19
  14. data/lib/google/cloud/vision_ai/v1/live_video_analytics/rest/operations.rb +50 -38
  15. data/lib/google/cloud/vision_ai/v1/live_video_analytics/rest/service_stub.rb +158 -110
  16. data/lib/google/cloud/vision_ai/v1/streaming_service/client.rb +36 -7
  17. data/lib/google/cloud/vision_ai/v1/streaming_service/rest/client.rb +36 -4
  18. data/lib/google/cloud/vision_ai/v1/streaming_service/rest/service_stub.rb +38 -20
  19. data/lib/google/cloud/vision_ai/v1/streams_service/client.rb +54 -24
  20. data/lib/google/cloud/vision_ai/v1/streams_service/operations.rb +19 -15
  21. data/lib/google/cloud/vision_ai/v1/streams_service/rest/client.rb +50 -24
  22. data/lib/google/cloud/vision_ai/v1/streams_service/rest/operations.rb +50 -38
  23. data/lib/google/cloud/vision_ai/v1/streams_service/rest/service_stub.rb +198 -140
  24. data/lib/google/cloud/vision_ai/v1/version.rb +1 -1
  25. data/lib/google/cloud/vision_ai/v1/warehouse/client.rb +71 -64
  26. data/lib/google/cloud/vision_ai/v1/warehouse/operations.rb +19 -15
  27. data/lib/google/cloud/vision_ai/v1/warehouse/rest/client.rb +70 -63
  28. data/lib/google/cloud/vision_ai/v1/warehouse/rest/operations.rb +50 -38
  29. data/lib/google/cloud/vision_ai/v1/warehouse/rest/service_stub.rb +510 -374
  30. data/proto_docs/google/api/client.rb +39 -0
  31. data/proto_docs/google/cloud/visionai/v1/annotations.rb +4 -0
  32. data/proto_docs/google/cloud/visionai/v1/lva.rb +8 -0
  33. data/proto_docs/google/cloud/visionai/v1/platform.rb +44 -0
  34. data/proto_docs/google/cloud/visionai/v1/streaming_resources.rb +4 -0
  35. data/proto_docs/google/cloud/visionai/v1/streaming_service.rb +32 -0
  36. data/proto_docs/google/cloud/visionai/v1/warehouse.rb +64 -0
  37. data/proto_docs/google/longrunning/operations.rb +23 -14
  38. data/proto_docs/google/protobuf/struct.rb +12 -0
  39. data/proto_docs/google/type/datetime.rb +4 -0
  40. metadata +6 -9
@@ -185,14 +185,26 @@ module Google
185
185
  endpoint: @config.endpoint,
186
186
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
187
187
  universe_domain: @config.universe_domain,
188
- credentials: credentials
188
+ credentials: credentials,
189
+ logger: @config.logger
189
190
  )
190
191
 
192
+ @live_video_analytics_stub.logger(stub: true)&.info do |entry|
193
+ entry.set_system_name
194
+ entry.set_service
195
+ entry.message = "Created client for #{entry.service}"
196
+ entry.set_credentials_fields credentials
197
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
198
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
199
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
200
+ end
201
+
191
202
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
192
203
  config.credentials = credentials
193
204
  config.quota_project = @quota_project_id
194
205
  config.endpoint = @live_video_analytics_stub.endpoint
195
206
  config.universe_domain = @live_video_analytics_stub.universe_domain
207
+ config.logger = @live_video_analytics_stub.logger if config.respond_to? :logger=
196
208
  end
197
209
 
198
210
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -200,6 +212,7 @@ module Google
200
212
  config.quota_project = @quota_project_id
201
213
  config.endpoint = @live_video_analytics_stub.endpoint
202
214
  config.universe_domain = @live_video_analytics_stub.universe_domain
215
+ config.logger = @live_video_analytics_stub.logger if config.respond_to? :logger=
203
216
  end
204
217
  end
205
218
 
@@ -224,6 +237,15 @@ module Google
224
237
  #
225
238
  attr_reader :iam_policy_client
226
239
 
240
+ ##
241
+ # The logger used for request/response debug logging.
242
+ #
243
+ # @return [Logger]
244
+ #
245
+ def logger
246
+ @live_video_analytics_stub.logger
247
+ end
248
+
227
249
  # Service calls
228
250
 
229
251
  ##
@@ -313,7 +335,7 @@ module Google
313
335
  @live_video_analytics_stub.list_public_operators request, options do |result, operation|
314
336
  result = ::Gapic::Rest::PagedEnumerable.new @live_video_analytics_stub, :list_public_operators, "operators", request, result, options
315
337
  yield result, operation if block_given?
316
- return result
338
+ throw :response, result
317
339
  end
318
340
  rescue ::Gapic::Rest::Error => e
319
341
  raise ::Google::Cloud::Error.from_error(e)
@@ -394,7 +416,6 @@ module Google
394
416
 
395
417
  @live_video_analytics_stub.resolve_operator_info request, options do |result, operation|
396
418
  yield result, operation if block_given?
397
- return result
398
419
  end
399
420
  rescue ::Gapic::Rest::Error => e
400
421
  raise ::Google::Cloud::Error.from_error(e)
@@ -486,7 +507,6 @@ module Google
486
507
 
487
508
  @live_video_analytics_stub.list_operators request, options do |result, operation|
488
509
  yield result, operation if block_given?
489
- return result
490
510
  end
491
511
  rescue ::Gapic::Rest::Error => e
492
512
  raise ::Google::Cloud::Error.from_error(e)
@@ -565,7 +585,6 @@ module Google
565
585
 
566
586
  @live_video_analytics_stub.get_operator request, options do |result, operation|
567
587
  yield result, operation if block_given?
568
- return result
569
588
  end
570
589
  rescue ::Gapic::Rest::Error => e
571
590
  raise ::Google::Cloud::Error.from_error(e)
@@ -670,7 +689,7 @@ module Google
670
689
  @live_video_analytics_stub.create_operator request, options do |result, operation|
671
690
  result = ::Gapic::Operation.new result, @operations_client, options: options
672
691
  yield result, operation if block_given?
673
- return result
692
+ throw :response, result
674
693
  end
675
694
  rescue ::Gapic::Rest::Error => e
676
695
  raise ::Google::Cloud::Error.from_error(e)
@@ -777,7 +796,7 @@ module Google
777
796
  @live_video_analytics_stub.update_operator request, options do |result, operation|
778
797
  result = ::Gapic::Operation.new result, @operations_client, options: options
779
798
  yield result, operation if block_given?
780
- return result
799
+ throw :response, result
781
800
  end
782
801
  rescue ::Gapic::Rest::Error => e
783
802
  raise ::Google::Cloud::Error.from_error(e)
@@ -878,7 +897,7 @@ module Google
878
897
  @live_video_analytics_stub.delete_operator request, options do |result, operation|
879
898
  result = ::Gapic::Operation.new result, @operations_client, options: options
880
899
  yield result, operation if block_given?
881
- return result
900
+ throw :response, result
882
901
  end
883
902
  rescue ::Gapic::Rest::Error => e
884
903
  raise ::Google::Cloud::Error.from_error(e)
@@ -970,7 +989,6 @@ module Google
970
989
 
971
990
  @live_video_analytics_stub.list_analyses request, options do |result, operation|
972
991
  yield result, operation if block_given?
973
- return result
974
992
  end
975
993
  rescue ::Gapic::Rest::Error => e
976
994
  raise ::Google::Cloud::Error.from_error(e)
@@ -1049,7 +1067,6 @@ module Google
1049
1067
 
1050
1068
  @live_video_analytics_stub.get_analysis request, options do |result, operation|
1051
1069
  yield result, operation if block_given?
1052
- return result
1053
1070
  end
1054
1071
  rescue ::Gapic::Rest::Error => e
1055
1072
  raise ::Google::Cloud::Error.from_error(e)
@@ -1154,7 +1171,7 @@ module Google
1154
1171
  @live_video_analytics_stub.create_analysis request, options do |result, operation|
1155
1172
  result = ::Gapic::Operation.new result, @operations_client, options: options
1156
1173
  yield result, operation if block_given?
1157
- return result
1174
+ throw :response, result
1158
1175
  end
1159
1176
  rescue ::Gapic::Rest::Error => e
1160
1177
  raise ::Google::Cloud::Error.from_error(e)
@@ -1261,7 +1278,7 @@ module Google
1261
1278
  @live_video_analytics_stub.update_analysis request, options do |result, operation|
1262
1279
  result = ::Gapic::Operation.new result, @operations_client, options: options
1263
1280
  yield result, operation if block_given?
1264
- return result
1281
+ throw :response, result
1265
1282
  end
1266
1283
  rescue ::Gapic::Rest::Error => e
1267
1284
  raise ::Google::Cloud::Error.from_error(e)
@@ -1362,7 +1379,7 @@ module Google
1362
1379
  @live_video_analytics_stub.delete_analysis request, options do |result, operation|
1363
1380
  result = ::Gapic::Operation.new result, @operations_client, options: options
1364
1381
  yield result, operation if block_given?
1365
- return result
1382
+ throw :response, result
1366
1383
  end
1367
1384
  rescue ::Gapic::Rest::Error => e
1368
1385
  raise ::Google::Cloud::Error.from_error(e)
@@ -1454,7 +1471,6 @@ module Google
1454
1471
 
1455
1472
  @live_video_analytics_stub.list_processes request, options do |result, operation|
1456
1473
  yield result, operation if block_given?
1457
- return result
1458
1474
  end
1459
1475
  rescue ::Gapic::Rest::Error => e
1460
1476
  raise ::Google::Cloud::Error.from_error(e)
@@ -1533,7 +1549,6 @@ module Google
1533
1549
 
1534
1550
  @live_video_analytics_stub.get_process request, options do |result, operation|
1535
1551
  yield result, operation if block_given?
1536
- return result
1537
1552
  end
1538
1553
  rescue ::Gapic::Rest::Error => e
1539
1554
  raise ::Google::Cloud::Error.from_error(e)
@@ -1638,7 +1653,7 @@ module Google
1638
1653
  @live_video_analytics_stub.create_process request, options do |result, operation|
1639
1654
  result = ::Gapic::Operation.new result, @operations_client, options: options
1640
1655
  yield result, operation if block_given?
1641
- return result
1656
+ throw :response, result
1642
1657
  end
1643
1658
  rescue ::Gapic::Rest::Error => e
1644
1659
  raise ::Google::Cloud::Error.from_error(e)
@@ -1745,7 +1760,7 @@ module Google
1745
1760
  @live_video_analytics_stub.update_process request, options do |result, operation|
1746
1761
  result = ::Gapic::Operation.new result, @operations_client, options: options
1747
1762
  yield result, operation if block_given?
1748
- return result
1763
+ throw :response, result
1749
1764
  end
1750
1765
  rescue ::Gapic::Rest::Error => e
1751
1766
  raise ::Google::Cloud::Error.from_error(e)
@@ -1846,7 +1861,7 @@ module Google
1846
1861
  @live_video_analytics_stub.delete_process request, options do |result, operation|
1847
1862
  result = ::Gapic::Operation.new result, @operations_client, options: options
1848
1863
  yield result, operation if block_given?
1849
- return result
1864
+ throw :response, result
1850
1865
  end
1851
1866
  rescue ::Gapic::Rest::Error => e
1852
1867
  raise ::Google::Cloud::Error.from_error(e)
@@ -1938,7 +1953,7 @@ module Google
1938
1953
  @live_video_analytics_stub.batch_run_process request, options do |result, operation|
1939
1954
  result = ::Gapic::Operation.new result, @operations_client, options: options
1940
1955
  yield result, operation if block_given?
1941
- return result
1956
+ throw :response, result
1942
1957
  end
1943
1958
  rescue ::Gapic::Rest::Error => e
1944
1959
  raise ::Google::Cloud::Error.from_error(e)
@@ -1986,6 +2001,13 @@ module Google
1986
2001
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1987
2002
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1988
2003
  # * (`nil`) indicating no credentials
2004
+ #
2005
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2006
+ # external source for authentication to Google Cloud, you must validate it before
2007
+ # providing it to a Google API client library. Providing an unvalidated credential
2008
+ # configuration to Google APIs can compromise the security of your systems and data.
2009
+ # For more information, refer to [Validate credential configurations from external
2010
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1989
2011
  # @return [::Object]
1990
2012
  # @!attribute [rw] scope
1991
2013
  # The OAuth scopes
@@ -2018,6 +2040,11 @@ module Google
2018
2040
  # default endpoint URL. The default value of nil uses the environment
2019
2041
  # universe (usually the default "googleapis.com" universe).
2020
2042
  # @return [::String,nil]
2043
+ # @!attribute [rw] logger
2044
+ # A custom logger to use for request/response debug logging, or the value
2045
+ # `:default` (the default) to construct a default logger, or `nil` to
2046
+ # explicitly disable logging.
2047
+ # @return [::Logger,:default,nil]
2021
2048
  #
2022
2049
  class Configuration
2023
2050
  extend ::Gapic::Config
@@ -2039,6 +2066,7 @@ module Google
2039
2066
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2040
2067
  config_attr :quota_project, nil, ::String, nil
2041
2068
  config_attr :universe_domain, nil, ::String, nil
2069
+ config_attr :logger, :default, ::Logger, nil, :default
2042
2070
 
2043
2071
  # @private
2044
2072
  def initialize parent_config = nil
@@ -115,14 +115,6 @@ module Google
115
115
  # Lists operations that match the specified filter in the request. If the
116
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
117
  #
118
- # NOTE: the `name` binding allows API services to override the binding
119
- # to use different resource name schemes, such as `users/*/operations`. To
120
- # override the binding, API services can add a binding such as
121
- # `"/v1/{name=users/*}/operations"` to their service configuration.
122
- # For backwards compatibility, the default name includes the operations
123
- # collection id, however overriding users must ensure the name binding
124
- # is the parent resource, without the operations collection id.
125
- #
126
118
  # @overload list_operations(request, options = nil)
127
119
  # Pass arguments to `list_operations` via a request object, either of type
128
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -204,7 +196,7 @@ module Google
204
196
  @operations_stub.list_operations request, options do |result, operation|
205
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
206
198
  yield result, operation if block_given?
207
- return result
199
+ throw :response, result
208
200
  end
209
201
  rescue ::Gapic::Rest::Error => e
210
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -293,7 +285,7 @@ module Google
293
285
  @operations_stub.get_operation request, options do |result, operation|
294
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
295
287
  yield result, operation if block_given?
296
- return result
288
+ throw :response, result
297
289
  end
298
290
  rescue ::Gapic::Rest::Error => e
299
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -375,7 +367,6 @@ module Google
375
367
 
376
368
  @operations_stub.delete_operation request, options do |result, operation|
377
369
  yield result, operation if block_given?
378
- return result
379
370
  end
380
371
  rescue ::Gapic::Rest::Error => e
381
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -390,8 +381,9 @@ module Google
390
381
  # other methods to check whether the cancellation succeeded or whether the
391
382
  # operation completed despite cancellation. On successful cancellation,
392
383
  # the operation is not deleted; instead, it becomes an operation with
393
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
394
- # corresponding to `Code.CANCELLED`.
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
395
387
  #
396
388
  # @overload cancel_operation(request, options = nil)
397
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -463,7 +455,6 @@ module Google
463
455
 
464
456
  @operations_stub.cancel_operation request, options do |result, operation|
465
457
  yield result, operation if block_given?
466
- return result
467
458
  end
468
459
  rescue ::Gapic::Rest::Error => e
469
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -511,6 +502,13 @@ module Google
511
502
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
512
503
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
513
504
  # * (`nil`) indicating no credentials
505
+ #
506
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
507
+ # external source for authentication to Google Cloud, you must validate it before
508
+ # providing it to a Google API client library. Providing an unvalidated credential
509
+ # configuration to Google APIs can compromise the security of your systems and data.
510
+ # For more information, refer to [Validate credential configurations from external
511
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
514
512
  # @return [::Object]
515
513
  # @!attribute [rw] scope
516
514
  # The OAuth scopes
@@ -543,6 +541,11 @@ module Google
543
541
  # default endpoint URL. The default value of nil uses the environment
544
542
  # universe (usually the default "googleapis.com" universe).
545
543
  # @return [::String,nil]
544
+ # @!attribute [rw] logger
545
+ # A custom logger to use for request/response debug logging, or the value
546
+ # `:default` (the default) to construct a default logger, or `nil` to
547
+ # explicitly disable logging.
548
+ # @return [::Logger,:default,nil]
546
549
  #
547
550
  class Configuration
548
551
  extend ::Gapic::Config
@@ -564,6 +567,7 @@ module Google
564
567
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
568
  config_attr :quota_project, nil, ::String, nil
566
569
  config_attr :universe_domain, nil, ::String, nil
570
+ config_attr :logger, :default, ::Logger, nil, :default
567
571
 
568
572
  # @private
569
573
  def initialize parent_config = nil
@@ -683,16 +687,18 @@ module Google
683
687
 
684
688
  response = @client_stub.make_http_request(
685
689
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
690
+ uri: uri,
691
+ body: body || "",
692
+ params: query_string_params,
693
+ method_name: "list_operations",
689
694
  options: options
690
695
  )
691
696
  operation = ::Gapic::Rest::TransportOperation.new response
692
697
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
698
+ catch :response do
699
+ yield result, operation if block_given?
700
+ result
701
+ end
696
702
  end
697
703
 
698
704
  ##
@@ -721,16 +727,18 @@ module Google
721
727
 
722
728
  response = @client_stub.make_http_request(
723
729
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
730
+ uri: uri,
731
+ body: body || "",
732
+ params: query_string_params,
733
+ method_name: "get_operation",
727
734
  options: options
728
735
  )
729
736
  operation = ::Gapic::Rest::TransportOperation.new response
730
737
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
738
+ catch :response do
739
+ yield result, operation if block_given?
740
+ result
741
+ end
734
742
  end
735
743
 
736
744
  ##
@@ -759,16 +767,18 @@ module Google
759
767
 
760
768
  response = @client_stub.make_http_request(
761
769
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
770
+ uri: uri,
771
+ body: body || "",
772
+ params: query_string_params,
773
+ method_name: "delete_operation",
765
774
  options: options
766
775
  )
767
776
  operation = ::Gapic::Rest::TransportOperation.new response
768
777
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
778
+ catch :response do
779
+ yield result, operation if block_given?
780
+ result
781
+ end
772
782
  end
773
783
 
774
784
  ##
@@ -797,16 +807,18 @@ module Google
797
807
 
798
808
  response = @client_stub.make_http_request(
799
809
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
810
+ uri: uri,
811
+ body: body || "",
812
+ params: query_string_params,
813
+ method_name: "cancel_operation",
803
814
  options: options
804
815
  )
805
816
  operation = ::Gapic::Rest::TransportOperation.new response
806
817
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
818
+ catch :response do
819
+ yield result, operation if block_given?
820
+ result
821
+ end
810
822
  end
811
823
 
812
824
  ##