google-cloud-vision-v1p3beta1 0.3.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -8
- data/LICENSE.md +188 -190
- data/README.md +67 -3
- data/lib/google/cloud/vision/v1p3beta1.rb +3 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator/client.rb +16 -16
- data/lib/google/cloud/vision/v1p3beta1/image_annotator/operations.rb +96 -11
- data/lib/google/cloud/vision/v1p3beta1/product_search/client.rb +48 -96
- data/lib/google/cloud/vision/v1p3beta1/product_search/operations.rb +96 -11
- data/lib/google/cloud/vision/v1p3beta1/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +12 -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/color.rb +16 -11
- data/proto_docs/google/type/latlng.rb +2 -2
- metadata +21 -11
@@ -62,25 +62,19 @@ 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
|
69
69
|
|
70
70
|
default_config.rpcs.batch_annotate_images.timeout = 600.0
|
71
71
|
default_config.rpcs.batch_annotate_images.retry_policy = {
|
72
|
-
initial_delay: 0.1,
|
73
|
-
max_delay: 60.0,
|
74
|
-
multiplier: 1.3,
|
75
|
-
retry_codes: [14, 4]
|
72
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
76
73
|
}
|
77
74
|
|
78
75
|
default_config.rpcs.async_batch_annotate_files.timeout = 600.0
|
79
76
|
default_config.rpcs.async_batch_annotate_files.retry_policy = {
|
80
|
-
initial_delay: 0.1,
|
81
|
-
max_delay: 60.0,
|
82
|
-
multiplier: 1.3,
|
83
|
-
retry_codes: []
|
77
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
84
78
|
}
|
85
79
|
|
86
80
|
default_config
|
@@ -144,8 +138,14 @@ module Google
|
|
144
138
|
|
145
139
|
# Create credentials
|
146
140
|
credentials = @config.credentials
|
147
|
-
|
148
|
-
if
|
141
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
142
|
+
# but only if the default endpoint does not have a region prefix.
|
143
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
144
|
+
@config.endpoint == Client.configure.endpoint &&
|
145
|
+
!@config.endpoint.split(".").first.include?("-")
|
146
|
+
credentials ||= Credentials.default scope: @config.scope,
|
147
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
148
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
149
149
|
credentials = Credentials.new credentials, scope: @config.scope
|
150
150
|
end
|
151
151
|
@quota_project_id = @config.quota_project
|
@@ -392,7 +392,7 @@ module Google
|
|
392
392
|
config_attr :scope, nil, ::String, ::Array, nil
|
393
393
|
config_attr :lib_name, nil, ::String, nil
|
394
394
|
config_attr :lib_version, nil, ::String, nil
|
395
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
395
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
396
396
|
config_attr :interceptors, nil, ::Array, nil
|
397
397
|
config_attr :timeout, nil, ::Numeric, nil
|
398
398
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -413,7 +413,7 @@ module Google
|
|
413
413
|
def rpcs
|
414
414
|
@rpcs ||= begin
|
415
415
|
parent_rpcs = nil
|
416
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
416
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
417
417
|
Rpcs.new parent_rpcs
|
418
418
|
end
|
419
419
|
end
|
@@ -425,7 +425,7 @@ module Google
|
|
425
425
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
426
426
|
# the following configuration fields:
|
427
427
|
#
|
428
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
428
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
429
429
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
430
430
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
431
431
|
# include the following keys:
|
@@ -449,9 +449,9 @@ module Google
|
|
449
449
|
|
450
450
|
# @private
|
451
451
|
def initialize parent_rpcs = nil
|
452
|
-
batch_annotate_images_config = parent_rpcs
|
452
|
+
batch_annotate_images_config = parent_rpcs.batch_annotate_images if parent_rpcs.respond_to? :batch_annotate_images
|
453
453
|
@batch_annotate_images = ::Gapic::Config::Method.new batch_annotate_images_config
|
454
|
-
async_batch_annotate_files_config = parent_rpcs
|
454
|
+
async_batch_annotate_files_config = parent_rpcs.async_batch_annotate_files if parent_rpcs.respond_to? :async_batch_annotate_files
|
455
455
|
@async_batch_annotate_files = ::Gapic::Config::Method.new async_batch_annotate_files_config
|
456
456
|
|
457
457
|
yield self if block_given?
|
@@ -82,7 +82,7 @@ module Google
|
|
82
82
|
# Create credentials
|
83
83
|
credentials = @config.credentials
|
84
84
|
credentials ||= Credentials.default scope: @config.scope
|
85
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
85
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
86
86
|
credentials = Credentials.new credentials, scope: @config.scope
|
87
87
|
end
|
88
88
|
@quota_project_id = @config.quota_project
|
@@ -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 until the specified long-running operation is done or reaches at most
|
400
|
+
# a specified timeout, returning the latest state. If the operation is
|
401
|
+
# 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
|
#
|
@@ -482,7 +560,7 @@ module Google
|
|
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
|
@@ -73,153 +73,99 @@ 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
|
80
80
|
|
81
81
|
default_config.rpcs.create_product_set.timeout = 600.0
|
82
82
|
default_config.rpcs.create_product_set.retry_policy = {
|
83
|
-
initial_delay: 0.1,
|
84
|
-
max_delay: 60.0,
|
85
|
-
multiplier: 1.3,
|
86
|
-
retry_codes: []
|
83
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
87
84
|
}
|
88
85
|
|
89
86
|
default_config.rpcs.list_product_sets.timeout = 600.0
|
90
87
|
default_config.rpcs.list_product_sets.retry_policy = {
|
91
|
-
initial_delay: 0.1,
|
92
|
-
max_delay: 60.0,
|
93
|
-
multiplier: 1.3,
|
94
|
-
retry_codes: [14, 4]
|
88
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
95
89
|
}
|
96
90
|
|
97
91
|
default_config.rpcs.get_product_set.timeout = 600.0
|
98
92
|
default_config.rpcs.get_product_set.retry_policy = {
|
99
|
-
initial_delay: 0.1,
|
100
|
-
max_delay: 60.0,
|
101
|
-
multiplier: 1.3,
|
102
|
-
retry_codes: [14, 4]
|
93
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
103
94
|
}
|
104
95
|
|
105
96
|
default_config.rpcs.update_product_set.timeout = 600.0
|
106
97
|
default_config.rpcs.update_product_set.retry_policy = {
|
107
|
-
initial_delay: 0.1,
|
108
|
-
max_delay: 60.0,
|
109
|
-
multiplier: 1.3,
|
110
|
-
retry_codes: []
|
98
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
111
99
|
}
|
112
100
|
|
113
101
|
default_config.rpcs.delete_product_set.timeout = 600.0
|
114
102
|
default_config.rpcs.delete_product_set.retry_policy = {
|
115
|
-
initial_delay: 0.1,
|
116
|
-
max_delay: 60.0,
|
117
|
-
multiplier: 1.3,
|
118
|
-
retry_codes: [14, 4]
|
103
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
119
104
|
}
|
120
105
|
|
121
106
|
default_config.rpcs.create_product.timeout = 600.0
|
122
107
|
default_config.rpcs.create_product.retry_policy = {
|
123
|
-
initial_delay: 0.1,
|
124
|
-
max_delay: 60.0,
|
125
|
-
multiplier: 1.3,
|
126
|
-
retry_codes: []
|
108
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
127
109
|
}
|
128
110
|
|
129
111
|
default_config.rpcs.list_products.timeout = 600.0
|
130
112
|
default_config.rpcs.list_products.retry_policy = {
|
131
|
-
initial_delay: 0.1,
|
132
|
-
max_delay: 60.0,
|
133
|
-
multiplier: 1.3,
|
134
|
-
retry_codes: [14, 4]
|
113
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
135
114
|
}
|
136
115
|
|
137
116
|
default_config.rpcs.get_product.timeout = 600.0
|
138
117
|
default_config.rpcs.get_product.retry_policy = {
|
139
|
-
initial_delay: 0.1,
|
140
|
-
max_delay: 60.0,
|
141
|
-
multiplier: 1.3,
|
142
|
-
retry_codes: [14, 4]
|
118
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
143
119
|
}
|
144
120
|
|
145
121
|
default_config.rpcs.update_product.timeout = 600.0
|
146
122
|
default_config.rpcs.update_product.retry_policy = {
|
147
|
-
initial_delay: 0.1,
|
148
|
-
max_delay: 60.0,
|
149
|
-
multiplier: 1.3,
|
150
|
-
retry_codes: []
|
123
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
151
124
|
}
|
152
125
|
|
153
126
|
default_config.rpcs.delete_product.timeout = 600.0
|
154
127
|
default_config.rpcs.delete_product.retry_policy = {
|
155
|
-
initial_delay: 0.1,
|
156
|
-
max_delay: 60.0,
|
157
|
-
multiplier: 1.3,
|
158
|
-
retry_codes: [14, 4]
|
128
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
159
129
|
}
|
160
130
|
|
161
131
|
default_config.rpcs.create_reference_image.timeout = 600.0
|
162
132
|
default_config.rpcs.create_reference_image.retry_policy = {
|
163
|
-
initial_delay: 0.1,
|
164
|
-
max_delay: 60.0,
|
165
|
-
multiplier: 1.3,
|
166
|
-
retry_codes: []
|
133
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
167
134
|
}
|
168
135
|
|
169
136
|
default_config.rpcs.delete_reference_image.timeout = 600.0
|
170
137
|
default_config.rpcs.delete_reference_image.retry_policy = {
|
171
|
-
initial_delay: 0.1,
|
172
|
-
max_delay: 60.0,
|
173
|
-
multiplier: 1.3,
|
174
|
-
retry_codes: [14, 4]
|
138
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
175
139
|
}
|
176
140
|
|
177
141
|
default_config.rpcs.list_reference_images.timeout = 600.0
|
178
142
|
default_config.rpcs.list_reference_images.retry_policy = {
|
179
|
-
initial_delay: 0.1,
|
180
|
-
max_delay: 60.0,
|
181
|
-
multiplier: 1.3,
|
182
|
-
retry_codes: [14, 4]
|
143
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
183
144
|
}
|
184
145
|
|
185
146
|
default_config.rpcs.get_reference_image.timeout = 600.0
|
186
147
|
default_config.rpcs.get_reference_image.retry_policy = {
|
187
|
-
initial_delay: 0.1,
|
188
|
-
max_delay: 60.0,
|
189
|
-
multiplier: 1.3,
|
190
|
-
retry_codes: [14, 4]
|
148
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
191
149
|
}
|
192
150
|
|
193
151
|
default_config.rpcs.add_product_to_product_set.timeout = 600.0
|
194
152
|
default_config.rpcs.add_product_to_product_set.retry_policy = {
|
195
|
-
initial_delay: 0.1,
|
196
|
-
max_delay: 60.0,
|
197
|
-
multiplier: 1.3,
|
198
|
-
retry_codes: []
|
153
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
199
154
|
}
|
200
155
|
|
201
156
|
default_config.rpcs.remove_product_from_product_set.timeout = 600.0
|
202
157
|
default_config.rpcs.remove_product_from_product_set.retry_policy = {
|
203
|
-
initial_delay: 0.1,
|
204
|
-
max_delay: 60.0,
|
205
|
-
multiplier: 1.3,
|
206
|
-
retry_codes: []
|
158
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
207
159
|
}
|
208
160
|
|
209
161
|
default_config.rpcs.list_products_in_product_set.timeout = 600.0
|
210
162
|
default_config.rpcs.list_products_in_product_set.retry_policy = {
|
211
|
-
initial_delay: 0.1,
|
212
|
-
max_delay: 60.0,
|
213
|
-
multiplier: 1.3,
|
214
|
-
retry_codes: [14, 4]
|
163
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
215
164
|
}
|
216
165
|
|
217
166
|
default_config.rpcs.import_product_sets.timeout = 600.0
|
218
167
|
default_config.rpcs.import_product_sets.retry_policy = {
|
219
|
-
initial_delay: 0.1,
|
220
|
-
max_delay: 60.0,
|
221
|
-
multiplier: 1.3,
|
222
|
-
retry_codes: []
|
168
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
223
169
|
}
|
224
170
|
|
225
171
|
default_config
|
@@ -283,8 +229,14 @@ module Google
|
|
283
229
|
|
284
230
|
# Create credentials
|
285
231
|
credentials = @config.credentials
|
286
|
-
|
287
|
-
if
|
232
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
233
|
+
# but only if the default endpoint does not have a region prefix.
|
234
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
235
|
+
@config.endpoint == Client.configure.endpoint &&
|
236
|
+
!@config.endpoint.split(".").first.include?("-")
|
237
|
+
credentials ||= Credentials.default scope: @config.scope,
|
238
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
239
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
288
240
|
credentials = Credentials.new credentials, scope: @config.scope
|
289
241
|
end
|
290
242
|
@quota_project_id = @config.quota_project
|
@@ -1839,7 +1791,7 @@ module Google
|
|
1839
1791
|
config_attr :scope, nil, ::String, ::Array, nil
|
1840
1792
|
config_attr :lib_name, nil, ::String, nil
|
1841
1793
|
config_attr :lib_version, nil, ::String, nil
|
1842
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
1794
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1843
1795
|
config_attr :interceptors, nil, ::Array, nil
|
1844
1796
|
config_attr :timeout, nil, ::Numeric, nil
|
1845
1797
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -1860,7 +1812,7 @@ module Google
|
|
1860
1812
|
def rpcs
|
1861
1813
|
@rpcs ||= begin
|
1862
1814
|
parent_rpcs = nil
|
1863
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
1815
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1864
1816
|
Rpcs.new parent_rpcs
|
1865
1817
|
end
|
1866
1818
|
end
|
@@ -1872,7 +1824,7 @@ module Google
|
|
1872
1824
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1873
1825
|
# the following configuration fields:
|
1874
1826
|
#
|
1875
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
1827
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1876
1828
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1877
1829
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1878
1830
|
# include the following keys:
|
@@ -1976,41 +1928,41 @@ module Google
|
|
1976
1928
|
|
1977
1929
|
# @private
|
1978
1930
|
def initialize parent_rpcs = nil
|
1979
|
-
create_product_set_config = parent_rpcs
|
1931
|
+
create_product_set_config = parent_rpcs.create_product_set if parent_rpcs.respond_to? :create_product_set
|
1980
1932
|
@create_product_set = ::Gapic::Config::Method.new create_product_set_config
|
1981
|
-
list_product_sets_config = parent_rpcs
|
1933
|
+
list_product_sets_config = parent_rpcs.list_product_sets if parent_rpcs.respond_to? :list_product_sets
|
1982
1934
|
@list_product_sets = ::Gapic::Config::Method.new list_product_sets_config
|
1983
|
-
get_product_set_config = parent_rpcs
|
1935
|
+
get_product_set_config = parent_rpcs.get_product_set if parent_rpcs.respond_to? :get_product_set
|
1984
1936
|
@get_product_set = ::Gapic::Config::Method.new get_product_set_config
|
1985
|
-
update_product_set_config = parent_rpcs
|
1937
|
+
update_product_set_config = parent_rpcs.update_product_set if parent_rpcs.respond_to? :update_product_set
|
1986
1938
|
@update_product_set = ::Gapic::Config::Method.new update_product_set_config
|
1987
|
-
delete_product_set_config = parent_rpcs
|
1939
|
+
delete_product_set_config = parent_rpcs.delete_product_set if parent_rpcs.respond_to? :delete_product_set
|
1988
1940
|
@delete_product_set = ::Gapic::Config::Method.new delete_product_set_config
|
1989
|
-
create_product_config = parent_rpcs
|
1941
|
+
create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product
|
1990
1942
|
@create_product = ::Gapic::Config::Method.new create_product_config
|
1991
|
-
list_products_config = parent_rpcs
|
1943
|
+
list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
|
1992
1944
|
@list_products = ::Gapic::Config::Method.new list_products_config
|
1993
|
-
get_product_config = parent_rpcs
|
1945
|
+
get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
|
1994
1946
|
@get_product = ::Gapic::Config::Method.new get_product_config
|
1995
|
-
update_product_config = parent_rpcs
|
1947
|
+
update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product
|
1996
1948
|
@update_product = ::Gapic::Config::Method.new update_product_config
|
1997
|
-
delete_product_config = parent_rpcs
|
1949
|
+
delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product
|
1998
1950
|
@delete_product = ::Gapic::Config::Method.new delete_product_config
|
1999
|
-
create_reference_image_config = parent_rpcs
|
1951
|
+
create_reference_image_config = parent_rpcs.create_reference_image if parent_rpcs.respond_to? :create_reference_image
|
2000
1952
|
@create_reference_image = ::Gapic::Config::Method.new create_reference_image_config
|
2001
|
-
delete_reference_image_config = parent_rpcs
|
1953
|
+
delete_reference_image_config = parent_rpcs.delete_reference_image if parent_rpcs.respond_to? :delete_reference_image
|
2002
1954
|
@delete_reference_image = ::Gapic::Config::Method.new delete_reference_image_config
|
2003
|
-
list_reference_images_config = parent_rpcs
|
1955
|
+
list_reference_images_config = parent_rpcs.list_reference_images if parent_rpcs.respond_to? :list_reference_images
|
2004
1956
|
@list_reference_images = ::Gapic::Config::Method.new list_reference_images_config
|
2005
|
-
get_reference_image_config = parent_rpcs
|
1957
|
+
get_reference_image_config = parent_rpcs.get_reference_image if parent_rpcs.respond_to? :get_reference_image
|
2006
1958
|
@get_reference_image = ::Gapic::Config::Method.new get_reference_image_config
|
2007
|
-
add_product_to_product_set_config = parent_rpcs
|
1959
|
+
add_product_to_product_set_config = parent_rpcs.add_product_to_product_set if parent_rpcs.respond_to? :add_product_to_product_set
|
2008
1960
|
@add_product_to_product_set = ::Gapic::Config::Method.new add_product_to_product_set_config
|
2009
|
-
remove_product_from_product_set_config = parent_rpcs
|
1961
|
+
remove_product_from_product_set_config = parent_rpcs.remove_product_from_product_set if parent_rpcs.respond_to? :remove_product_from_product_set
|
2010
1962
|
@remove_product_from_product_set = ::Gapic::Config::Method.new remove_product_from_product_set_config
|
2011
|
-
list_products_in_product_set_config = parent_rpcs
|
1963
|
+
list_products_in_product_set_config = parent_rpcs.list_products_in_product_set if parent_rpcs.respond_to? :list_products_in_product_set
|
2012
1964
|
@list_products_in_product_set = ::Gapic::Config::Method.new list_products_in_product_set_config
|
2013
|
-
import_product_sets_config = parent_rpcs
|
1965
|
+
import_product_sets_config = parent_rpcs.import_product_sets if parent_rpcs.respond_to? :import_product_sets
|
2014
1966
|
@import_product_sets = ::Gapic::Config::Method.new import_product_sets_config
|
2015
1967
|
|
2016
1968
|
yield self if block_given?
|