google-cloud-vision-v1p3beta1 0.2.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +188 -190
- data/README.md +66 -2
- data/lib/google/cloud/vision/v1p3beta1.rb +3 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator/client.rb +20 -14
- data/lib/google/cloud/vision/v1p3beta1/image_annotator/operations.rb +96 -11
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +5 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +2 -2
- data/lib/google/cloud/vision/v1p3beta1/product_search/client.rb +84 -78
- data/lib/google/cloud/vision/v1p3beta1/product_search/operations.rb +96 -11
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +18 -18
- data/lib/google/cloud/vision/v1p3beta1/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/cloud/vision/v1p3beta1/image_annotator.rb +15 -0
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- data/proto_docs/google/type/latlng.rb +2 -2
- metadata +11 -7
@@ -62,7 +62,7 @@ module Google
|
|
62
62
|
parent_config = while namespace.any?
|
63
63
|
parent_name = namespace.join "::"
|
64
64
|
parent_const = const_get parent_name
|
65
|
-
break parent_const.configure if parent_const
|
65
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
66
|
namespace.pop
|
67
67
|
end
|
68
68
|
default_config = Client::Configuration.new parent_config
|
@@ -70,17 +70,17 @@ module Google
|
|
70
70
|
default_config.rpcs.batch_annotate_images.timeout = 600.0
|
71
71
|
default_config.rpcs.batch_annotate_images.retry_policy = {
|
72
72
|
initial_delay: 0.1,
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
max_delay: 60.0,
|
74
|
+
multiplier: 1.3,
|
75
|
+
retry_codes: [14, 4]
|
76
76
|
}
|
77
77
|
|
78
78
|
default_config.rpcs.async_batch_annotate_files.timeout = 600.0
|
79
79
|
default_config.rpcs.async_batch_annotate_files.retry_policy = {
|
80
80
|
initial_delay: 0.1,
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
max_delay: 60.0,
|
82
|
+
multiplier: 1.3,
|
83
|
+
retry_codes: []
|
84
84
|
}
|
85
85
|
|
86
86
|
default_config
|
@@ -144,7 +144,13 @@ module Google
|
|
144
144
|
|
145
145
|
# Create credentials
|
146
146
|
credentials = @config.credentials
|
147
|
-
|
147
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
148
|
+
# but only if the default endpoint does not have a region prefix.
|
149
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
150
|
+
@config.endpoint == Client.configure.endpoint &&
|
151
|
+
!@config.endpoint.split(".").first.include?("-")
|
152
|
+
credentials ||= Credentials.default scope: @config.scope,
|
153
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
148
154
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
149
155
|
credentials = Credentials.new credentials, scope: @config.scope
|
150
156
|
end
|
@@ -385,14 +391,14 @@ module Google
|
|
385
391
|
|
386
392
|
config_attr :endpoint, "vision.googleapis.com", ::String
|
387
393
|
config_attr :credentials, nil do |value|
|
388
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
394
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
389
395
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
390
396
|
allowed.any? { |klass| klass === value }
|
391
397
|
end
|
392
398
|
config_attr :scope, nil, ::String, ::Array, nil
|
393
399
|
config_attr :lib_name, nil, ::String, nil
|
394
400
|
config_attr :lib_version, nil, ::String, nil
|
395
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
401
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
396
402
|
config_attr :interceptors, nil, ::Array, nil
|
397
403
|
config_attr :timeout, nil, ::Numeric, nil
|
398
404
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -413,7 +419,7 @@ module Google
|
|
413
419
|
def rpcs
|
414
420
|
@rpcs ||= begin
|
415
421
|
parent_rpcs = nil
|
416
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
422
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
417
423
|
Rpcs.new parent_rpcs
|
418
424
|
end
|
419
425
|
end
|
@@ -425,7 +431,7 @@ module Google
|
|
425
431
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
426
432
|
# the following configuration fields:
|
427
433
|
#
|
428
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
434
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
429
435
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
430
436
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
431
437
|
# include the following keys:
|
@@ -449,9 +455,9 @@ module Google
|
|
449
455
|
|
450
456
|
# @private
|
451
457
|
def initialize parent_rpcs = nil
|
452
|
-
batch_annotate_images_config = parent_rpcs
|
458
|
+
batch_annotate_images_config = parent_rpcs.batch_annotate_images if parent_rpcs.respond_to? :batch_annotate_images
|
453
459
|
@batch_annotate_images = ::Gapic::Config::Method.new batch_annotate_images_config
|
454
|
-
async_batch_annotate_files_config = parent_rpcs
|
460
|
+
async_batch_annotate_files_config = parent_rpcs.async_batch_annotate_files if parent_rpcs.respond_to? :async_batch_annotate_files
|
455
461
|
@async_batch_annotate_files = ::Gapic::Config::Method.new async_batch_annotate_files_config
|
456
462
|
|
457
463
|
yield self if block_given?
|
@@ -103,8 +103,13 @@ module Google
|
|
103
103
|
# Lists operations that match the specified filter in the request. If the
|
104
104
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
105
105
|
#
|
106
|
-
# NOTE: the `name` binding
|
107
|
-
# to use different resource name schemes, such as `users/*/operations`.
|
106
|
+
# NOTE: the `name` binding allows API services to override the binding
|
107
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
108
|
+
# override the binding, API services can add a binding such as
|
109
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
110
|
+
# For backwards compatibility, the default name includes the operations
|
111
|
+
# collection id, however overriding users must ensure the name binding
|
112
|
+
# is the parent resource, without the operations collection id.
|
108
113
|
#
|
109
114
|
# @overload list_operations(request, options = nil)
|
110
115
|
# Pass arguments to `list_operations` via a request object, either of type
|
@@ -122,7 +127,7 @@ module Google
|
|
122
127
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
123
128
|
#
|
124
129
|
# @param name [::String]
|
125
|
-
# The name of the operation
|
130
|
+
# The name of the operation's parent resource.
|
126
131
|
# @param filter [::String]
|
127
132
|
# The standard list filter.
|
128
133
|
# @param page_size [::Integer]
|
@@ -390,6 +395,79 @@ module Google
|
|
390
395
|
raise ::Google::Cloud::Error.from_error(e)
|
391
396
|
end
|
392
397
|
|
398
|
+
##
|
399
|
+
# Waits for the specified long-running operation until it is done or reaches
|
400
|
+
# at most a specified timeout, returning the latest state. If the operation
|
401
|
+
# is already done, the latest state is immediately returned. If the timeout
|
402
|
+
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
403
|
+
# timeout is used. If the server does not support this method, it returns
|
404
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
405
|
+
# Note that this method is on a best-effort basis. It may return the latest
|
406
|
+
# state before the specified timeout (including immediately), meaning even an
|
407
|
+
# immediate response is no guarantee that the operation is done.
|
408
|
+
#
|
409
|
+
# @overload wait_operation(request, options = nil)
|
410
|
+
# Pass arguments to `wait_operation` via a request object, either of type
|
411
|
+
# {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
|
412
|
+
#
|
413
|
+
# @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
|
414
|
+
# A request object representing the call parameters. Required. To specify no
|
415
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
416
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
417
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
418
|
+
#
|
419
|
+
# @overload wait_operation(name: nil, timeout: nil)
|
420
|
+
# Pass arguments to `wait_operation` via keyword arguments. Note that at
|
421
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
422
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
423
|
+
#
|
424
|
+
# @param name [::String]
|
425
|
+
# The name of the operation resource to wait on.
|
426
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
427
|
+
# The maximum duration to wait before timing out. If left blank, the wait
|
428
|
+
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
429
|
+
# If RPC context deadline is also specified, the shorter one will be used.
|
430
|
+
#
|
431
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
432
|
+
# @yieldparam response [::Gapic::Operation]
|
433
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
434
|
+
#
|
435
|
+
# @return [::Gapic::Operation]
|
436
|
+
#
|
437
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
438
|
+
#
|
439
|
+
def wait_operation request, options = nil
|
440
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
441
|
+
|
442
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
|
443
|
+
|
444
|
+
# Converts hash and nil to an options object
|
445
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
446
|
+
|
447
|
+
# Customize the options with defaults
|
448
|
+
metadata = @config.rpcs.wait_operation.metadata.to_h
|
449
|
+
|
450
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
451
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
452
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
453
|
+
gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
|
454
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
|
+
metadata: metadata,
|
458
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
+
options.apply_defaults metadata: @config.metadata,
|
460
|
+
retry_policy: @config.retry_policy
|
461
|
+
|
462
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
463
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
464
|
+
yield response, operation if block_given?
|
465
|
+
return response
|
466
|
+
end
|
467
|
+
rescue ::GRPC::BadStatus => e
|
468
|
+
raise ::Google::Cloud::Error.from_error(e)
|
469
|
+
end
|
470
|
+
|
393
471
|
##
|
394
472
|
# Configuration class for the Operations API.
|
395
473
|
#
|
@@ -475,14 +553,14 @@ module Google
|
|
475
553
|
|
476
554
|
config_attr :endpoint, "vision.googleapis.com", ::String
|
477
555
|
config_attr :credentials, nil do |value|
|
478
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
556
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
479
557
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
480
558
|
allowed.any? { |klass| klass === value }
|
481
559
|
end
|
482
560
|
config_attr :scope, nil, ::String, ::Array, nil
|
483
561
|
config_attr :lib_name, nil, ::String, nil
|
484
562
|
config_attr :lib_version, nil, ::String, nil
|
485
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
563
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
486
564
|
config_attr :interceptors, nil, ::Array, nil
|
487
565
|
config_attr :timeout, nil, ::Numeric, nil
|
488
566
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -503,7 +581,7 @@ module Google
|
|
503
581
|
def rpcs
|
504
582
|
@rpcs ||= begin
|
505
583
|
parent_rpcs = nil
|
506
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
584
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
507
585
|
Rpcs.new parent_rpcs
|
508
586
|
end
|
509
587
|
end
|
@@ -515,7 +593,7 @@ module Google
|
|
515
593
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
516
594
|
# the following configuration fields:
|
517
595
|
#
|
518
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
596
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
519
597
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
520
598
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
521
599
|
# include the following keys:
|
@@ -546,17 +624,24 @@ module Google
|
|
546
624
|
# @return [::Gapic::Config::Method]
|
547
625
|
#
|
548
626
|
attr_reader :cancel_operation
|
627
|
+
##
|
628
|
+
# RPC-specific configuration for `wait_operation`
|
629
|
+
# @return [::Gapic::Config::Method]
|
630
|
+
#
|
631
|
+
attr_reader :wait_operation
|
549
632
|
|
550
633
|
# @private
|
551
634
|
def initialize parent_rpcs = nil
|
552
|
-
list_operations_config = parent_rpcs
|
635
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
553
636
|
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
554
|
-
get_operation_config = parent_rpcs
|
637
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
555
638
|
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
556
|
-
delete_operation_config = parent_rpcs
|
639
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
557
640
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
558
|
-
cancel_operation_config = parent_rpcs
|
641
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
559
642
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
643
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
644
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
560
645
|
|
561
646
|
yield self if block_given?
|
562
647
|
end
|
@@ -165,12 +165,16 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
165
165
|
add_message "google.cloud.vision.v1p3beta1.WebDetectionParams" do
|
166
166
|
optional :include_geo_results, :bool, 2
|
167
167
|
end
|
168
|
+
add_message "google.cloud.vision.v1p3beta1.TextDetectionParams" do
|
169
|
+
optional :enable_text_detection_confidence_score, :bool, 9
|
170
|
+
end
|
168
171
|
add_message "google.cloud.vision.v1p3beta1.ImageContext" do
|
169
172
|
optional :lat_long_rect, :message, 1, "google.cloud.vision.v1p3beta1.LatLongRect"
|
170
173
|
repeated :language_hints, :string, 2
|
171
174
|
optional :crop_hints_params, :message, 4, "google.cloud.vision.v1p3beta1.CropHintsParams"
|
172
175
|
optional :product_search_params, :message, 5, "google.cloud.vision.v1p3beta1.ProductSearchParams"
|
173
176
|
optional :web_detection_params, :message, 6, "google.cloud.vision.v1p3beta1.WebDetectionParams"
|
177
|
+
optional :text_detection_params, :message, 12, "google.cloud.vision.v1p3beta1.TextDetectionParams"
|
174
178
|
end
|
175
179
|
add_message "google.cloud.vision.v1p3beta1.AnnotateImageRequest" do
|
176
180
|
optional :image, :message, 1, "google.cloud.vision.v1p3beta1.Image"
|
@@ -283,6 +287,7 @@ module Google
|
|
283
287
|
CropHintsAnnotation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1p3beta1.CropHintsAnnotation").msgclass
|
284
288
|
CropHintsParams = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1p3beta1.CropHintsParams").msgclass
|
285
289
|
WebDetectionParams = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1p3beta1.WebDetectionParams").msgclass
|
290
|
+
TextDetectionParams = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1p3beta1.TextDetectionParams").msgclass
|
286
291
|
ImageContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1p3beta1.ImageContext").msgclass
|
287
292
|
AnnotateImageRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1p3beta1.AnnotateImageRequest").msgclass
|
288
293
|
ImageAnnotationContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1p3beta1.ImageAnnotationContext").msgclass
|
@@ -37,14 +37,14 @@ module Google
|
|
37
37
|
self.service_name = 'google.cloud.vision.v1p3beta1.ImageAnnotator'
|
38
38
|
|
39
39
|
# Run image detection and annotation for a batch of images.
|
40
|
-
rpc :BatchAnnotateImages, Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesRequest, Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse
|
40
|
+
rpc :BatchAnnotateImages, ::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesRequest, ::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse
|
41
41
|
# Run asynchronous image detection and annotation for a list of generic
|
42
42
|
# files, such as PDF files, which may contain multiple pages and multiple
|
43
43
|
# images per page. Progress and results can be retrieved through the
|
44
44
|
# `google.longrunning.Operations` interface.
|
45
45
|
# `Operation.metadata` contains `OperationMetadata` (metadata).
|
46
46
|
# `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
|
47
|
-
rpc :AsyncBatchAnnotateFiles, Google::Cloud::Vision::V1p3beta1::AsyncBatchAnnotateFilesRequest, Google::Longrunning::Operation
|
47
|
+
rpc :AsyncBatchAnnotateFiles, ::Google::Cloud::Vision::V1p3beta1::AsyncBatchAnnotateFilesRequest, ::Google::Longrunning::Operation
|
48
48
|
end
|
49
49
|
|
50
50
|
Stub = Service.rpc_stub_class
|
@@ -73,7 +73,7 @@ module Google
|
|
73
73
|
parent_config = while namespace.any?
|
74
74
|
parent_name = namespace.join "::"
|
75
75
|
parent_const = const_get parent_name
|
76
|
-
break parent_const.configure if parent_const
|
76
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
77
77
|
namespace.pop
|
78
78
|
end
|
79
79
|
default_config = Client::Configuration.new parent_config
|
@@ -81,145 +81,145 @@ module Google
|
|
81
81
|
default_config.rpcs.create_product_set.timeout = 600.0
|
82
82
|
default_config.rpcs.create_product_set.retry_policy = {
|
83
83
|
initial_delay: 0.1,
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
max_delay: 60.0,
|
85
|
+
multiplier: 1.3,
|
86
|
+
retry_codes: []
|
87
87
|
}
|
88
88
|
|
89
89
|
default_config.rpcs.list_product_sets.timeout = 600.0
|
90
90
|
default_config.rpcs.list_product_sets.retry_policy = {
|
91
91
|
initial_delay: 0.1,
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
max_delay: 60.0,
|
93
|
+
multiplier: 1.3,
|
94
|
+
retry_codes: [14, 4]
|
95
95
|
}
|
96
96
|
|
97
97
|
default_config.rpcs.get_product_set.timeout = 600.0
|
98
98
|
default_config.rpcs.get_product_set.retry_policy = {
|
99
99
|
initial_delay: 0.1,
|
100
|
-
|
101
|
-
|
102
|
-
|
100
|
+
max_delay: 60.0,
|
101
|
+
multiplier: 1.3,
|
102
|
+
retry_codes: [14, 4]
|
103
103
|
}
|
104
104
|
|
105
105
|
default_config.rpcs.update_product_set.timeout = 600.0
|
106
106
|
default_config.rpcs.update_product_set.retry_policy = {
|
107
107
|
initial_delay: 0.1,
|
108
|
-
|
109
|
-
|
110
|
-
|
108
|
+
max_delay: 60.0,
|
109
|
+
multiplier: 1.3,
|
110
|
+
retry_codes: []
|
111
111
|
}
|
112
112
|
|
113
113
|
default_config.rpcs.delete_product_set.timeout = 600.0
|
114
114
|
default_config.rpcs.delete_product_set.retry_policy = {
|
115
115
|
initial_delay: 0.1,
|
116
|
-
|
117
|
-
|
118
|
-
|
116
|
+
max_delay: 60.0,
|
117
|
+
multiplier: 1.3,
|
118
|
+
retry_codes: [14, 4]
|
119
119
|
}
|
120
120
|
|
121
121
|
default_config.rpcs.create_product.timeout = 600.0
|
122
122
|
default_config.rpcs.create_product.retry_policy = {
|
123
123
|
initial_delay: 0.1,
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
max_delay: 60.0,
|
125
|
+
multiplier: 1.3,
|
126
|
+
retry_codes: []
|
127
127
|
}
|
128
128
|
|
129
129
|
default_config.rpcs.list_products.timeout = 600.0
|
130
130
|
default_config.rpcs.list_products.retry_policy = {
|
131
131
|
initial_delay: 0.1,
|
132
|
-
|
133
|
-
|
134
|
-
|
132
|
+
max_delay: 60.0,
|
133
|
+
multiplier: 1.3,
|
134
|
+
retry_codes: [14, 4]
|
135
135
|
}
|
136
136
|
|
137
137
|
default_config.rpcs.get_product.timeout = 600.0
|
138
138
|
default_config.rpcs.get_product.retry_policy = {
|
139
139
|
initial_delay: 0.1,
|
140
|
-
|
141
|
-
|
142
|
-
|
140
|
+
max_delay: 60.0,
|
141
|
+
multiplier: 1.3,
|
142
|
+
retry_codes: [14, 4]
|
143
143
|
}
|
144
144
|
|
145
145
|
default_config.rpcs.update_product.timeout = 600.0
|
146
146
|
default_config.rpcs.update_product.retry_policy = {
|
147
147
|
initial_delay: 0.1,
|
148
|
-
|
149
|
-
|
150
|
-
|
148
|
+
max_delay: 60.0,
|
149
|
+
multiplier: 1.3,
|
150
|
+
retry_codes: []
|
151
151
|
}
|
152
152
|
|
153
153
|
default_config.rpcs.delete_product.timeout = 600.0
|
154
154
|
default_config.rpcs.delete_product.retry_policy = {
|
155
155
|
initial_delay: 0.1,
|
156
|
-
|
157
|
-
|
158
|
-
|
156
|
+
max_delay: 60.0,
|
157
|
+
multiplier: 1.3,
|
158
|
+
retry_codes: [14, 4]
|
159
159
|
}
|
160
160
|
|
161
161
|
default_config.rpcs.create_reference_image.timeout = 600.0
|
162
162
|
default_config.rpcs.create_reference_image.retry_policy = {
|
163
163
|
initial_delay: 0.1,
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
max_delay: 60.0,
|
165
|
+
multiplier: 1.3,
|
166
|
+
retry_codes: []
|
167
167
|
}
|
168
168
|
|
169
169
|
default_config.rpcs.delete_reference_image.timeout = 600.0
|
170
170
|
default_config.rpcs.delete_reference_image.retry_policy = {
|
171
171
|
initial_delay: 0.1,
|
172
|
-
|
173
|
-
|
174
|
-
|
172
|
+
max_delay: 60.0,
|
173
|
+
multiplier: 1.3,
|
174
|
+
retry_codes: [14, 4]
|
175
175
|
}
|
176
176
|
|
177
177
|
default_config.rpcs.list_reference_images.timeout = 600.0
|
178
178
|
default_config.rpcs.list_reference_images.retry_policy = {
|
179
179
|
initial_delay: 0.1,
|
180
|
-
|
181
|
-
|
182
|
-
|
180
|
+
max_delay: 60.0,
|
181
|
+
multiplier: 1.3,
|
182
|
+
retry_codes: [14, 4]
|
183
183
|
}
|
184
184
|
|
185
185
|
default_config.rpcs.get_reference_image.timeout = 600.0
|
186
186
|
default_config.rpcs.get_reference_image.retry_policy = {
|
187
187
|
initial_delay: 0.1,
|
188
|
-
|
189
|
-
|
190
|
-
|
188
|
+
max_delay: 60.0,
|
189
|
+
multiplier: 1.3,
|
190
|
+
retry_codes: [14, 4]
|
191
191
|
}
|
192
192
|
|
193
193
|
default_config.rpcs.add_product_to_product_set.timeout = 600.0
|
194
194
|
default_config.rpcs.add_product_to_product_set.retry_policy = {
|
195
195
|
initial_delay: 0.1,
|
196
|
-
|
197
|
-
|
198
|
-
|
196
|
+
max_delay: 60.0,
|
197
|
+
multiplier: 1.3,
|
198
|
+
retry_codes: []
|
199
199
|
}
|
200
200
|
|
201
201
|
default_config.rpcs.remove_product_from_product_set.timeout = 600.0
|
202
202
|
default_config.rpcs.remove_product_from_product_set.retry_policy = {
|
203
203
|
initial_delay: 0.1,
|
204
|
-
|
205
|
-
|
206
|
-
|
204
|
+
max_delay: 60.0,
|
205
|
+
multiplier: 1.3,
|
206
|
+
retry_codes: []
|
207
207
|
}
|
208
208
|
|
209
209
|
default_config.rpcs.list_products_in_product_set.timeout = 600.0
|
210
210
|
default_config.rpcs.list_products_in_product_set.retry_policy = {
|
211
211
|
initial_delay: 0.1,
|
212
|
-
|
213
|
-
|
214
|
-
|
212
|
+
max_delay: 60.0,
|
213
|
+
multiplier: 1.3,
|
214
|
+
retry_codes: [14, 4]
|
215
215
|
}
|
216
216
|
|
217
217
|
default_config.rpcs.import_product_sets.timeout = 600.0
|
218
218
|
default_config.rpcs.import_product_sets.retry_policy = {
|
219
219
|
initial_delay: 0.1,
|
220
|
-
|
221
|
-
|
222
|
-
|
220
|
+
max_delay: 60.0,
|
221
|
+
multiplier: 1.3,
|
222
|
+
retry_codes: []
|
223
223
|
}
|
224
224
|
|
225
225
|
default_config
|
@@ -283,7 +283,13 @@ module Google
|
|
283
283
|
|
284
284
|
# Create credentials
|
285
285
|
credentials = @config.credentials
|
286
|
-
|
286
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
287
|
+
# but only if the default endpoint does not have a region prefix.
|
288
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
289
|
+
@config.endpoint == Client.configure.endpoint &&
|
290
|
+
!@config.endpoint.split(".").first.include?("-")
|
291
|
+
credentials ||= Credentials.default scope: @config.scope,
|
292
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
287
293
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
288
294
|
credentials = Credentials.new credentials, scope: @config.scope
|
289
295
|
end
|
@@ -1832,14 +1838,14 @@ module Google
|
|
1832
1838
|
|
1833
1839
|
config_attr :endpoint, "vision.googleapis.com", ::String
|
1834
1840
|
config_attr :credentials, nil do |value|
|
1835
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1841
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1836
1842
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
1837
1843
|
allowed.any? { |klass| klass === value }
|
1838
1844
|
end
|
1839
1845
|
config_attr :scope, nil, ::String, ::Array, nil
|
1840
1846
|
config_attr :lib_name, nil, ::String, nil
|
1841
1847
|
config_attr :lib_version, nil, ::String, nil
|
1842
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
1848
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1843
1849
|
config_attr :interceptors, nil, ::Array, nil
|
1844
1850
|
config_attr :timeout, nil, ::Numeric, nil
|
1845
1851
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -1860,7 +1866,7 @@ module Google
|
|
1860
1866
|
def rpcs
|
1861
1867
|
@rpcs ||= begin
|
1862
1868
|
parent_rpcs = nil
|
1863
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
1869
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1864
1870
|
Rpcs.new parent_rpcs
|
1865
1871
|
end
|
1866
1872
|
end
|
@@ -1872,7 +1878,7 @@ module Google
|
|
1872
1878
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1873
1879
|
# the following configuration fields:
|
1874
1880
|
#
|
1875
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
1881
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1876
1882
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1877
1883
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1878
1884
|
# include the following keys:
|
@@ -1976,41 +1982,41 @@ module Google
|
|
1976
1982
|
|
1977
1983
|
# @private
|
1978
1984
|
def initialize parent_rpcs = nil
|
1979
|
-
create_product_set_config = parent_rpcs
|
1985
|
+
create_product_set_config = parent_rpcs.create_product_set if parent_rpcs.respond_to? :create_product_set
|
1980
1986
|
@create_product_set = ::Gapic::Config::Method.new create_product_set_config
|
1981
|
-
list_product_sets_config = parent_rpcs
|
1987
|
+
list_product_sets_config = parent_rpcs.list_product_sets if parent_rpcs.respond_to? :list_product_sets
|
1982
1988
|
@list_product_sets = ::Gapic::Config::Method.new list_product_sets_config
|
1983
|
-
get_product_set_config = parent_rpcs
|
1989
|
+
get_product_set_config = parent_rpcs.get_product_set if parent_rpcs.respond_to? :get_product_set
|
1984
1990
|
@get_product_set = ::Gapic::Config::Method.new get_product_set_config
|
1985
|
-
update_product_set_config = parent_rpcs
|
1991
|
+
update_product_set_config = parent_rpcs.update_product_set if parent_rpcs.respond_to? :update_product_set
|
1986
1992
|
@update_product_set = ::Gapic::Config::Method.new update_product_set_config
|
1987
|
-
delete_product_set_config = parent_rpcs
|
1993
|
+
delete_product_set_config = parent_rpcs.delete_product_set if parent_rpcs.respond_to? :delete_product_set
|
1988
1994
|
@delete_product_set = ::Gapic::Config::Method.new delete_product_set_config
|
1989
|
-
create_product_config = parent_rpcs
|
1995
|
+
create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product
|
1990
1996
|
@create_product = ::Gapic::Config::Method.new create_product_config
|
1991
|
-
list_products_config = parent_rpcs
|
1997
|
+
list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
|
1992
1998
|
@list_products = ::Gapic::Config::Method.new list_products_config
|
1993
|
-
get_product_config = parent_rpcs
|
1999
|
+
get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
|
1994
2000
|
@get_product = ::Gapic::Config::Method.new get_product_config
|
1995
|
-
update_product_config = parent_rpcs
|
2001
|
+
update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product
|
1996
2002
|
@update_product = ::Gapic::Config::Method.new update_product_config
|
1997
|
-
delete_product_config = parent_rpcs
|
2003
|
+
delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product
|
1998
2004
|
@delete_product = ::Gapic::Config::Method.new delete_product_config
|
1999
|
-
create_reference_image_config = parent_rpcs
|
2005
|
+
create_reference_image_config = parent_rpcs.create_reference_image if parent_rpcs.respond_to? :create_reference_image
|
2000
2006
|
@create_reference_image = ::Gapic::Config::Method.new create_reference_image_config
|
2001
|
-
delete_reference_image_config = parent_rpcs
|
2007
|
+
delete_reference_image_config = parent_rpcs.delete_reference_image if parent_rpcs.respond_to? :delete_reference_image
|
2002
2008
|
@delete_reference_image = ::Gapic::Config::Method.new delete_reference_image_config
|
2003
|
-
list_reference_images_config = parent_rpcs
|
2009
|
+
list_reference_images_config = parent_rpcs.list_reference_images if parent_rpcs.respond_to? :list_reference_images
|
2004
2010
|
@list_reference_images = ::Gapic::Config::Method.new list_reference_images_config
|
2005
|
-
get_reference_image_config = parent_rpcs
|
2011
|
+
get_reference_image_config = parent_rpcs.get_reference_image if parent_rpcs.respond_to? :get_reference_image
|
2006
2012
|
@get_reference_image = ::Gapic::Config::Method.new get_reference_image_config
|
2007
|
-
add_product_to_product_set_config = parent_rpcs
|
2013
|
+
add_product_to_product_set_config = parent_rpcs.add_product_to_product_set if parent_rpcs.respond_to? :add_product_to_product_set
|
2008
2014
|
@add_product_to_product_set = ::Gapic::Config::Method.new add_product_to_product_set_config
|
2009
|
-
remove_product_from_product_set_config = parent_rpcs
|
2015
|
+
remove_product_from_product_set_config = parent_rpcs.remove_product_from_product_set if parent_rpcs.respond_to? :remove_product_from_product_set
|
2010
2016
|
@remove_product_from_product_set = ::Gapic::Config::Method.new remove_product_from_product_set_config
|
2011
|
-
list_products_in_product_set_config = parent_rpcs
|
2017
|
+
list_products_in_product_set_config = parent_rpcs.list_products_in_product_set if parent_rpcs.respond_to? :list_products_in_product_set
|
2012
2018
|
@list_products_in_product_set = ::Gapic::Config::Method.new list_products_in_product_set_config
|
2013
|
-
import_product_sets_config = parent_rpcs
|
2019
|
+
import_product_sets_config = parent_rpcs.import_product_sets if parent_rpcs.respond_to? :import_product_sets
|
2014
2020
|
@import_product_sets = ::Gapic::Config::Method.new import_product_sets_config
|
2015
2021
|
|
2016
2022
|
yield self if block_given?
|