google-cloud-vision_ai-v1 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/vision_ai/v1/app_platform/client.rb +50 -27
  4. data/lib/google/cloud/vision_ai/v1/app_platform/operations.rb +12 -15
  5. data/lib/google/cloud/vision_ai/v1/app_platform/rest/client.rb +46 -27
  6. data/lib/google/cloud/vision_ai/v1/app_platform/rest/operations.rb +43 -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 +29 -2
  9. data/lib/google/cloud/vision_ai/v1/health_check_service/rest/client.rb +29 -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 +43 -19
  12. data/lib/google/cloud/vision_ai/v1/live_video_analytics/operations.rb +12 -15
  13. data/lib/google/cloud/vision_ai/v1/live_video_analytics/rest/client.rb +40 -19
  14. data/lib/google/cloud/vision_ai/v1/live_video_analytics/rest/operations.rb +43 -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 +29 -7
  17. data/lib/google/cloud/vision_ai/v1/streaming_service/rest/client.rb +29 -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 +47 -24
  20. data/lib/google/cloud/vision_ai/v1/streams_service/operations.rb +12 -15
  21. data/lib/google/cloud/vision_ai/v1/streams_service/rest/client.rb +43 -24
  22. data/lib/google/cloud/vision_ai/v1/streams_service/rest/operations.rb +43 -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 +61 -64
  26. data/lib/google/cloud/vision_ai/v1/warehouse/operations.rb +12 -15
  27. data/lib/google/cloud/vision_ai/v1/warehouse/rest/client.rb +60 -63
  28. data/lib/google/cloud/vision_ai/v1/warehouse/rest/operations.rb +43 -38
  29. data/lib/google/cloud/vision_ai/v1/warehouse/rest/service_stub.rb +510 -374
  30. data/lib/google/cloud/visionai/v1/warehouse_pb.rb +2 -1
  31. data/lib/google/cloud/visionai/v1/warehouse_services_pb.rb +1 -0
  32. data/proto_docs/google/api/client.rb +56 -0
  33. data/proto_docs/google/cloud/visionai/v1/warehouse.rb +60 -7
  34. data/proto_docs/google/longrunning/operations.rb +19 -14
  35. metadata +5 -5
@@ -159,14 +159,26 @@ module Google
159
159
  endpoint: @config.endpoint,
160
160
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
161
161
  universe_domain: @config.universe_domain,
162
- credentials: credentials
162
+ credentials: credentials,
163
+ logger: @config.logger
163
164
  )
164
165
 
166
+ @app_platform_stub.logger(stub: true)&.info do |entry|
167
+ entry.set_system_name
168
+ entry.set_service
169
+ entry.message = "Created client for #{entry.service}"
170
+ entry.set_credentials_fields credentials
171
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
172
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
173
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
174
+ end
175
+
165
176
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
166
177
  config.credentials = credentials
167
178
  config.quota_project = @quota_project_id
168
179
  config.endpoint = @app_platform_stub.endpoint
169
180
  config.universe_domain = @app_platform_stub.universe_domain
181
+ config.logger = @app_platform_stub.logger if config.respond_to? :logger=
170
182
  end
171
183
 
172
184
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -174,6 +186,7 @@ module Google
174
186
  config.quota_project = @quota_project_id
175
187
  config.endpoint = @app_platform_stub.endpoint
176
188
  config.universe_domain = @app_platform_stub.universe_domain
189
+ config.logger = @app_platform_stub.logger if config.respond_to? :logger=
177
190
  end
178
191
  end
179
192
 
@@ -198,6 +211,15 @@ module Google
198
211
  #
199
212
  attr_reader :iam_policy_client
200
213
 
214
+ ##
215
+ # The logger used for request/response debug logging.
216
+ #
217
+ # @return [Logger]
218
+ #
219
+ def logger
220
+ @app_platform_stub.logger
221
+ end
222
+
201
223
  # Service calls
202
224
 
203
225
  ##
@@ -286,7 +308,6 @@ module Google
286
308
 
287
309
  @app_platform_stub.list_applications request, options do |result, operation|
288
310
  yield result, operation if block_given?
289
- return result
290
311
  end
291
312
  rescue ::Gapic::Rest::Error => e
292
313
  raise ::Google::Cloud::Error.from_error(e)
@@ -365,7 +386,6 @@ module Google
365
386
 
366
387
  @app_platform_stub.get_application request, options do |result, operation|
367
388
  yield result, operation if block_given?
368
- return result
369
389
  end
370
390
  rescue ::Gapic::Rest::Error => e
371
391
  raise ::Google::Cloud::Error.from_error(e)
@@ -470,7 +490,7 @@ module Google
470
490
  @app_platform_stub.create_application request, options do |result, operation|
471
491
  result = ::Gapic::Operation.new result, @operations_client, options: options
472
492
  yield result, operation if block_given?
473
- return result
493
+ throw :response, result
474
494
  end
475
495
  rescue ::Gapic::Rest::Error => e
476
496
  raise ::Google::Cloud::Error.from_error(e)
@@ -577,7 +597,7 @@ module Google
577
597
  @app_platform_stub.update_application request, options do |result, operation|
578
598
  result = ::Gapic::Operation.new result, @operations_client, options: options
579
599
  yield result, operation if block_given?
580
- return result
600
+ throw :response, result
581
601
  end
582
602
  rescue ::Gapic::Rest::Error => e
583
603
  raise ::Google::Cloud::Error.from_error(e)
@@ -682,7 +702,7 @@ module Google
682
702
  @app_platform_stub.delete_application request, options do |result, operation|
683
703
  result = ::Gapic::Operation.new result, @operations_client, options: options
684
704
  yield result, operation if block_given?
685
- return result
705
+ throw :response, result
686
706
  end
687
707
  rescue ::Gapic::Rest::Error => e
688
708
  raise ::Google::Cloud::Error.from_error(e)
@@ -791,7 +811,7 @@ module Google
791
811
  @app_platform_stub.deploy_application request, options do |result, operation|
792
812
  result = ::Gapic::Operation.new result, @operations_client, options: options
793
813
  yield result, operation if block_given?
794
- return result
814
+ throw :response, result
795
815
  end
796
816
  rescue ::Gapic::Rest::Error => e
797
817
  raise ::Google::Cloud::Error.from_error(e)
@@ -894,7 +914,7 @@ module Google
894
914
  @app_platform_stub.undeploy_application request, options do |result, operation|
895
915
  result = ::Gapic::Operation.new result, @operations_client, options: options
896
916
  yield result, operation if block_given?
897
- return result
917
+ throw :response, result
898
918
  end
899
919
  rescue ::Gapic::Rest::Error => e
900
920
  raise ::Google::Cloud::Error.from_error(e)
@@ -1003,7 +1023,7 @@ module Google
1003
1023
  @app_platform_stub.add_application_stream_input request, options do |result, operation|
1004
1024
  result = ::Gapic::Operation.new result, @operations_client, options: options
1005
1025
  yield result, operation if block_given?
1006
- return result
1026
+ throw :response, result
1007
1027
  end
1008
1028
  rescue ::Gapic::Rest::Error => e
1009
1029
  raise ::Google::Cloud::Error.from_error(e)
@@ -1110,7 +1130,7 @@ module Google
1110
1130
  @app_platform_stub.remove_application_stream_input request, options do |result, operation|
1111
1131
  result = ::Gapic::Operation.new result, @operations_client, options: options
1112
1132
  yield result, operation if block_given?
1113
- return result
1133
+ throw :response, result
1114
1134
  end
1115
1135
  rescue ::Gapic::Rest::Error => e
1116
1136
  raise ::Google::Cloud::Error.from_error(e)
@@ -1221,7 +1241,7 @@ module Google
1221
1241
  @app_platform_stub.update_application_stream_input request, options do |result, operation|
1222
1242
  result = ::Gapic::Operation.new result, @operations_client, options: options
1223
1243
  yield result, operation if block_given?
1224
- return result
1244
+ throw :response, result
1225
1245
  end
1226
1246
  rescue ::Gapic::Rest::Error => e
1227
1247
  raise ::Google::Cloud::Error.from_error(e)
@@ -1313,7 +1333,6 @@ module Google
1313
1333
 
1314
1334
  @app_platform_stub.list_instances request, options do |result, operation|
1315
1335
  yield result, operation if block_given?
1316
- return result
1317
1336
  end
1318
1337
  rescue ::Gapic::Rest::Error => e
1319
1338
  raise ::Google::Cloud::Error.from_error(e)
@@ -1392,7 +1411,6 @@ module Google
1392
1411
 
1393
1412
  @app_platform_stub.get_instance request, options do |result, operation|
1394
1413
  yield result, operation if block_given?
1395
- return result
1396
1414
  end
1397
1415
  rescue ::Gapic::Rest::Error => e
1398
1416
  raise ::Google::Cloud::Error.from_error(e)
@@ -1500,7 +1518,7 @@ module Google
1500
1518
  @app_platform_stub.create_application_instances request, options do |result, operation|
1501
1519
  result = ::Gapic::Operation.new result, @operations_client, options: options
1502
1520
  yield result, operation if block_given?
1503
- return result
1521
+ throw :response, result
1504
1522
  end
1505
1523
  rescue ::Gapic::Rest::Error => e
1506
1524
  raise ::Google::Cloud::Error.from_error(e)
@@ -1607,7 +1625,7 @@ module Google
1607
1625
  @app_platform_stub.delete_application_instances request, options do |result, operation|
1608
1626
  result = ::Gapic::Operation.new result, @operations_client, options: options
1609
1627
  yield result, operation if block_given?
1610
- return result
1628
+ throw :response, result
1611
1629
  end
1612
1630
  rescue ::Gapic::Rest::Error => e
1613
1631
  raise ::Google::Cloud::Error.from_error(e)
@@ -1717,7 +1735,7 @@ module Google
1717
1735
  @app_platform_stub.update_application_instances request, options do |result, operation|
1718
1736
  result = ::Gapic::Operation.new result, @operations_client, options: options
1719
1737
  yield result, operation if block_given?
1720
- return result
1738
+ throw :response, result
1721
1739
  end
1722
1740
  rescue ::Gapic::Rest::Error => e
1723
1741
  raise ::Google::Cloud::Error.from_error(e)
@@ -1809,7 +1827,6 @@ module Google
1809
1827
 
1810
1828
  @app_platform_stub.list_drafts request, options do |result, operation|
1811
1829
  yield result, operation if block_given?
1812
- return result
1813
1830
  end
1814
1831
  rescue ::Gapic::Rest::Error => e
1815
1832
  raise ::Google::Cloud::Error.from_error(e)
@@ -1888,7 +1905,6 @@ module Google
1888
1905
 
1889
1906
  @app_platform_stub.get_draft request, options do |result, operation|
1890
1907
  yield result, operation if block_given?
1891
- return result
1892
1908
  end
1893
1909
  rescue ::Gapic::Rest::Error => e
1894
1910
  raise ::Google::Cloud::Error.from_error(e)
@@ -1993,7 +2009,7 @@ module Google
1993
2009
  @app_platform_stub.create_draft request, options do |result, operation|
1994
2010
  result = ::Gapic::Operation.new result, @operations_client, options: options
1995
2011
  yield result, operation if block_given?
1996
- return result
2012
+ throw :response, result
1997
2013
  end
1998
2014
  rescue ::Gapic::Rest::Error => e
1999
2015
  raise ::Google::Cloud::Error.from_error(e)
@@ -2103,7 +2119,7 @@ module Google
2103
2119
  @app_platform_stub.update_draft request, options do |result, operation|
2104
2120
  result = ::Gapic::Operation.new result, @operations_client, options: options
2105
2121
  yield result, operation if block_given?
2106
- return result
2122
+ throw :response, result
2107
2123
  end
2108
2124
  rescue ::Gapic::Rest::Error => e
2109
2125
  raise ::Google::Cloud::Error.from_error(e)
@@ -2204,7 +2220,7 @@ module Google
2204
2220
  @app_platform_stub.delete_draft request, options do |result, operation|
2205
2221
  result = ::Gapic::Operation.new result, @operations_client, options: options
2206
2222
  yield result, operation if block_given?
2207
- return result
2223
+ throw :response, result
2208
2224
  end
2209
2225
  rescue ::Gapic::Rest::Error => e
2210
2226
  raise ::Google::Cloud::Error.from_error(e)
@@ -2296,7 +2312,6 @@ module Google
2296
2312
 
2297
2313
  @app_platform_stub.list_processors request, options do |result, operation|
2298
2314
  yield result, operation if block_given?
2299
- return result
2300
2315
  end
2301
2316
  rescue ::Gapic::Rest::Error => e
2302
2317
  raise ::Google::Cloud::Error.from_error(e)
@@ -2376,7 +2391,6 @@ module Google
2376
2391
 
2377
2392
  @app_platform_stub.list_prebuilt_processors request, options do |result, operation|
2378
2393
  yield result, operation if block_given?
2379
- return result
2380
2394
  end
2381
2395
  rescue ::Gapic::Rest::Error => e
2382
2396
  raise ::Google::Cloud::Error.from_error(e)
@@ -2455,7 +2469,6 @@ module Google
2455
2469
 
2456
2470
  @app_platform_stub.get_processor request, options do |result, operation|
2457
2471
  yield result, operation if block_given?
2458
- return result
2459
2472
  end
2460
2473
  rescue ::Gapic::Rest::Error => e
2461
2474
  raise ::Google::Cloud::Error.from_error(e)
@@ -2560,7 +2573,7 @@ module Google
2560
2573
  @app_platform_stub.create_processor request, options do |result, operation|
2561
2574
  result = ::Gapic::Operation.new result, @operations_client, options: options
2562
2575
  yield result, operation if block_given?
2563
- return result
2576
+ throw :response, result
2564
2577
  end
2565
2578
  rescue ::Gapic::Rest::Error => e
2566
2579
  raise ::Google::Cloud::Error.from_error(e)
@@ -2667,7 +2680,7 @@ module Google
2667
2680
  @app_platform_stub.update_processor request, options do |result, operation|
2668
2681
  result = ::Gapic::Operation.new result, @operations_client, options: options
2669
2682
  yield result, operation if block_given?
2670
- return result
2683
+ throw :response, result
2671
2684
  end
2672
2685
  rescue ::Gapic::Rest::Error => e
2673
2686
  raise ::Google::Cloud::Error.from_error(e)
@@ -2768,7 +2781,7 @@ module Google
2768
2781
  @app_platform_stub.delete_processor request, options do |result, operation|
2769
2782
  result = ::Gapic::Operation.new result, @operations_client, options: options
2770
2783
  yield result, operation if block_given?
2771
- return result
2784
+ throw :response, result
2772
2785
  end
2773
2786
  rescue ::Gapic::Rest::Error => e
2774
2787
  raise ::Google::Cloud::Error.from_error(e)
@@ -2848,6 +2861,11 @@ module Google
2848
2861
  # default endpoint URL. The default value of nil uses the environment
2849
2862
  # universe (usually the default "googleapis.com" universe).
2850
2863
  # @return [::String,nil]
2864
+ # @!attribute [rw] logger
2865
+ # A custom logger to use for request/response debug logging, or the value
2866
+ # `:default` (the default) to construct a default logger, or `nil` to
2867
+ # explicitly disable logging.
2868
+ # @return [::Logger,:default,nil]
2851
2869
  #
2852
2870
  class Configuration
2853
2871
  extend ::Gapic::Config
@@ -2869,6 +2887,7 @@ module Google
2869
2887
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2870
2888
  config_attr :quota_project, nil, ::String, nil
2871
2889
  config_attr :universe_domain, nil, ::String, nil
2890
+ config_attr :logger, :default, ::Logger, nil, :default
2872
2891
 
2873
2892
  # @private
2874
2893
  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)
@@ -543,6 +534,11 @@ module Google
543
534
  # default endpoint URL. The default value of nil uses the environment
544
535
  # universe (usually the default "googleapis.com" universe).
545
536
  # @return [::String,nil]
537
+ # @!attribute [rw] logger
538
+ # A custom logger to use for request/response debug logging, or the value
539
+ # `:default` (the default) to construct a default logger, or `nil` to
540
+ # explicitly disable logging.
541
+ # @return [::Logger,:default,nil]
546
542
  #
547
543
  class Configuration
548
544
  extend ::Gapic::Config
@@ -564,6 +560,7 @@ module Google
564
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
561
  config_attr :quota_project, nil, ::String, nil
566
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
567
564
 
568
565
  # @private
569
566
  def initialize parent_config = nil
@@ -683,16 +680,18 @@ module Google
683
680
 
684
681
  response = @client_stub.make_http_request(
685
682
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
689
687
  options: options
690
688
  )
691
689
  operation = ::Gapic::Rest::TransportOperation.new response
692
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
696
695
  end
697
696
 
698
697
  ##
@@ -721,16 +720,18 @@ module Google
721
720
 
722
721
  response = @client_stub.make_http_request(
723
722
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
727
727
  options: options
728
728
  )
729
729
  operation = ::Gapic::Rest::TransportOperation.new response
730
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
734
735
  end
735
736
 
736
737
  ##
@@ -759,16 +760,18 @@ module Google
759
760
 
760
761
  response = @client_stub.make_http_request(
761
762
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
765
767
  options: options
766
768
  )
767
769
  operation = ::Gapic::Rest::TransportOperation.new response
768
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
772
775
  end
773
776
 
774
777
  ##
@@ -797,16 +800,18 @@ module Google
797
800
 
798
801
  response = @client_stub.make_http_request(
799
802
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
803
807
  options: options
804
808
  )
805
809
  operation = ::Gapic::Rest::TransportOperation.new response
806
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
810
815
  end
811
816
 
812
817
  ##