google-cloud-retail-v2 0.1.1 → 0.3.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/retail/v2/catalog_service/client.rb +14 -11
- data/lib/google/cloud/retail/v2/prediction_service/client.rb +13 -10
- data/lib/google/cloud/retail/v2/product_service/client.rb +21 -18
- data/lib/google/cloud/retail/v2/product_service/operations.rb +95 -10
- data/lib/google/cloud/retail/v2/user_event_service/client.rb +21 -18
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +95 -10
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +12 -0
- data/proto_docs/google/api/httpbody.rb +4 -3
- data/proto_docs/google/cloud/retail/v2/import_config.rb +8 -7
- data/proto_docs/google/cloud/retail/v2/product.rb +2 -2
- data/proto_docs/google/cloud/retail/v2/product_service.rb +3 -3
- data/proto_docs/google/cloud/retail/v2/user_event_service.rb +3 -3
- 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
- metadata +20 -11
@@ -60,17 +60,14 @@ module Google
|
|
60
60
|
parent_config = while namespace.any?
|
61
61
|
parent_name = namespace.join "::"
|
62
62
|
parent_const = const_get parent_name
|
63
|
-
break parent_const.configure if parent_const
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
64
|
namespace.pop
|
65
65
|
end
|
66
66
|
default_config = Client::Configuration.new parent_config
|
67
67
|
|
68
68
|
default_config.timeout = 60.0
|
69
69
|
default_config.retry_policy = {
|
70
|
-
initial_delay: 0.1,
|
71
|
-
max_delay: 60.0,
|
72
|
-
multiplier: 1.3,
|
73
|
-
retry_codes: [14, 4]
|
70
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
74
71
|
}
|
75
72
|
|
76
73
|
default_config
|
@@ -134,8 +131,14 @@ module Google
|
|
134
131
|
|
135
132
|
# Create credentials
|
136
133
|
credentials = @config.credentials
|
137
|
-
|
138
|
-
if
|
134
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
135
|
+
# but only if the default endpoint does not have a region prefix.
|
136
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
137
|
+
@config.endpoint == Client.configure.endpoint &&
|
138
|
+
!@config.endpoint.split(".").first.include?("-")
|
139
|
+
credentials ||= Credentials.default scope: @config.scope,
|
140
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
141
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
139
142
|
credentials = Credentials.new credentials, scope: @config.scope
|
140
143
|
end
|
141
144
|
@quota_project_id = @config.quota_project
|
@@ -416,7 +419,7 @@ module Google
|
|
416
419
|
config_attr :scope, nil, ::String, ::Array, nil
|
417
420
|
config_attr :lib_name, nil, ::String, nil
|
418
421
|
config_attr :lib_version, nil, ::String, nil
|
419
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
422
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
420
423
|
config_attr :interceptors, nil, ::Array, nil
|
421
424
|
config_attr :timeout, nil, ::Numeric, nil
|
422
425
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -437,7 +440,7 @@ module Google
|
|
437
440
|
def rpcs
|
438
441
|
@rpcs ||= begin
|
439
442
|
parent_rpcs = nil
|
440
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
443
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
441
444
|
Rpcs.new parent_rpcs
|
442
445
|
end
|
443
446
|
end
|
@@ -473,9 +476,9 @@ module Google
|
|
473
476
|
|
474
477
|
# @private
|
475
478
|
def initialize parent_rpcs = nil
|
476
|
-
list_catalogs_config = parent_rpcs
|
479
|
+
list_catalogs_config = parent_rpcs.list_catalogs if parent_rpcs.respond_to? :list_catalogs
|
477
480
|
@list_catalogs = ::Gapic::Config::Method.new list_catalogs_config
|
478
|
-
update_catalog_config = parent_rpcs
|
481
|
+
update_catalog_config = parent_rpcs.update_catalog if parent_rpcs.respond_to? :update_catalog
|
479
482
|
@update_catalog = ::Gapic::Config::Method.new update_catalog_config
|
480
483
|
|
481
484
|
yield self if block_given?
|
@@ -60,17 +60,14 @@ module Google
|
|
60
60
|
parent_config = while namespace.any?
|
61
61
|
parent_name = namespace.join "::"
|
62
62
|
parent_const = const_get parent_name
|
63
|
-
break parent_const.configure if parent_const
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
64
|
namespace.pop
|
65
65
|
end
|
66
66
|
default_config = Client::Configuration.new parent_config
|
67
67
|
|
68
68
|
default_config.timeout = 60.0
|
69
69
|
default_config.retry_policy = {
|
70
|
-
initial_delay: 0.1,
|
71
|
-
max_delay: 60.0,
|
72
|
-
multiplier: 1.3,
|
73
|
-
retry_codes: [14, 4]
|
70
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
74
71
|
}
|
75
72
|
|
76
73
|
default_config
|
@@ -134,8 +131,14 @@ module Google
|
|
134
131
|
|
135
132
|
# Create credentials
|
136
133
|
credentials = @config.credentials
|
137
|
-
|
138
|
-
if
|
134
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
135
|
+
# but only if the default endpoint does not have a region prefix.
|
136
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
137
|
+
@config.endpoint == Client.configure.endpoint &&
|
138
|
+
!@config.endpoint.split(".").first.include?("-")
|
139
|
+
credentials ||= Credentials.default scope: @config.scope,
|
140
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
141
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
139
142
|
credentials = Credentials.new credentials, scope: @config.scope
|
140
143
|
end
|
141
144
|
@quota_project_id = @config.quota_project
|
@@ -405,7 +408,7 @@ module Google
|
|
405
408
|
config_attr :scope, nil, ::String, ::Array, nil
|
406
409
|
config_attr :lib_name, nil, ::String, nil
|
407
410
|
config_attr :lib_version, nil, ::String, nil
|
408
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
411
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
409
412
|
config_attr :interceptors, nil, ::Array, nil
|
410
413
|
config_attr :timeout, nil, ::Numeric, nil
|
411
414
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -426,7 +429,7 @@ module Google
|
|
426
429
|
def rpcs
|
427
430
|
@rpcs ||= begin
|
428
431
|
parent_rpcs = nil
|
429
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
432
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
430
433
|
Rpcs.new parent_rpcs
|
431
434
|
end
|
432
435
|
end
|
@@ -457,7 +460,7 @@ module Google
|
|
457
460
|
|
458
461
|
# @private
|
459
462
|
def initialize parent_rpcs = nil
|
460
|
-
predict_config = parent_rpcs
|
463
|
+
predict_config = parent_rpcs.predict if parent_rpcs.respond_to? :predict
|
461
464
|
@predict = ::Gapic::Config::Method.new predict_config
|
462
465
|
|
463
466
|
yield self if block_given?
|
@@ -61,17 +61,14 @@ module Google
|
|
61
61
|
parent_config = while namespace.any?
|
62
62
|
parent_name = namespace.join "::"
|
63
63
|
parent_const = const_get parent_name
|
64
|
-
break parent_const.configure if parent_const
|
64
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
65
65
|
namespace.pop
|
66
66
|
end
|
67
67
|
default_config = Client::Configuration.new parent_config
|
68
68
|
|
69
69
|
default_config.timeout = 60.0
|
70
70
|
default_config.retry_policy = {
|
71
|
-
initial_delay: 0.1,
|
72
|
-
max_delay: 60.0,
|
73
|
-
multiplier: 1.3,
|
74
|
-
retry_codes: [14, 4]
|
71
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
75
72
|
}
|
76
73
|
|
77
74
|
default_config
|
@@ -135,8 +132,14 @@ module Google
|
|
135
132
|
|
136
133
|
# Create credentials
|
137
134
|
credentials = @config.credentials
|
138
|
-
|
139
|
-
if
|
135
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
136
|
+
# but only if the default endpoint does not have a region prefix.
|
137
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
138
|
+
@config.endpoint == Client.configure.endpoint &&
|
139
|
+
!@config.endpoint.split(".").first.include?("-")
|
140
|
+
credentials ||= Credentials.default scope: @config.scope,
|
141
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
142
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
140
143
|
credentials = Credentials.new credentials, scope: @config.scope
|
141
144
|
end
|
142
145
|
@quota_project_id = @config.quota_project
|
@@ -185,7 +188,7 @@ module Google
|
|
185
188
|
#
|
186
189
|
# @param parent [::String]
|
187
190
|
# Required. The parent catalog resource name, such as
|
188
|
-
#
|
191
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.
|
189
192
|
# @param product [::Google::Cloud::Retail::V2::Product, ::Hash]
|
190
193
|
# Required. The {::Google::Cloud::Retail::V2::Product Product} to create.
|
191
194
|
# @param product_id [::String]
|
@@ -271,7 +274,7 @@ module Google
|
|
271
274
|
# @param name [::String]
|
272
275
|
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
273
276
|
# such as
|
274
|
-
#
|
277
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
275
278
|
#
|
276
279
|
# If the caller does not have permission to access the
|
277
280
|
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
@@ -427,7 +430,7 @@ module Google
|
|
427
430
|
# @param name [::String]
|
428
431
|
# Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
|
429
432
|
# such as
|
430
|
-
#
|
433
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
|
431
434
|
#
|
432
435
|
# If the caller does not have permission to delete the
|
433
436
|
# {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
|
@@ -507,7 +510,7 @@ module Google
|
|
507
510
|
#
|
508
511
|
# @param parent [::String]
|
509
512
|
# Required.
|
510
|
-
#
|
513
|
+
# `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
|
511
514
|
#
|
512
515
|
# If no updateMask is specified, requires products.create permission.
|
513
516
|
# If updateMask is specified, requires products.update permission.
|
@@ -657,7 +660,7 @@ module Google
|
|
657
660
|
config_attr :scope, nil, ::String, ::Array, nil
|
658
661
|
config_attr :lib_name, nil, ::String, nil
|
659
662
|
config_attr :lib_version, nil, ::String, nil
|
660
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
663
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
661
664
|
config_attr :interceptors, nil, ::Array, nil
|
662
665
|
config_attr :timeout, nil, ::Numeric, nil
|
663
666
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -678,7 +681,7 @@ module Google
|
|
678
681
|
def rpcs
|
679
682
|
@rpcs ||= begin
|
680
683
|
parent_rpcs = nil
|
681
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
684
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
682
685
|
Rpcs.new parent_rpcs
|
683
686
|
end
|
684
687
|
end
|
@@ -729,15 +732,15 @@ module Google
|
|
729
732
|
|
730
733
|
# @private
|
731
734
|
def initialize parent_rpcs = nil
|
732
|
-
create_product_config = parent_rpcs
|
735
|
+
create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product
|
733
736
|
@create_product = ::Gapic::Config::Method.new create_product_config
|
734
|
-
get_product_config = parent_rpcs
|
737
|
+
get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
|
735
738
|
@get_product = ::Gapic::Config::Method.new get_product_config
|
736
|
-
update_product_config = parent_rpcs
|
739
|
+
update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product
|
737
740
|
@update_product = ::Gapic::Config::Method.new update_product_config
|
738
|
-
delete_product_config = parent_rpcs
|
741
|
+
delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product
|
739
742
|
@delete_product = ::Gapic::Config::Method.new delete_product_config
|
740
|
-
import_products_config = parent_rpcs
|
743
|
+
import_products_config = parent_rpcs.import_products if parent_rpcs.respond_to? :import_products
|
741
744
|
@import_products = ::Gapic::Config::Method.new import_products_config
|
742
745
|
|
743
746
|
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::Retail::V2::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
|
@@ -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
|
@@ -60,17 +60,14 @@ module Google
|
|
60
60
|
parent_config = while namespace.any?
|
61
61
|
parent_name = namespace.join "::"
|
62
62
|
parent_const = const_get parent_name
|
63
|
-
break parent_const.configure if parent_const
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
64
|
namespace.pop
|
65
65
|
end
|
66
66
|
default_config = Client::Configuration.new parent_config
|
67
67
|
|
68
68
|
default_config.timeout = 60.0
|
69
69
|
default_config.retry_policy = {
|
70
|
-
initial_delay: 0.1,
|
71
|
-
max_delay: 60.0,
|
72
|
-
multiplier: 1.3,
|
73
|
-
retry_codes: [14, 4]
|
70
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
74
71
|
}
|
75
72
|
|
76
73
|
default_config
|
@@ -134,8 +131,14 @@ module Google
|
|
134
131
|
|
135
132
|
# Create credentials
|
136
133
|
credentials = @config.credentials
|
137
|
-
|
138
|
-
if
|
134
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
135
|
+
# but only if the default endpoint does not have a region prefix.
|
136
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
137
|
+
@config.endpoint == Client.configure.endpoint &&
|
138
|
+
!@config.endpoint.split(".").first.include?("-")
|
139
|
+
credentials ||= Credentials.default scope: @config.scope,
|
140
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
141
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
139
142
|
credentials = Credentials.new credentials, scope: @config.scope
|
140
143
|
end
|
141
144
|
@quota_project_id = @config.quota_project
|
@@ -184,7 +187,7 @@ module Google
|
|
184
187
|
#
|
185
188
|
# @param parent [::String]
|
186
189
|
# Required. The parent catalog resource name, such as
|
187
|
-
#
|
190
|
+
# `projects/1234/locations/global/catalogs/default_catalog`.
|
188
191
|
# @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash]
|
189
192
|
# Required. User event to write.
|
190
193
|
#
|
@@ -257,7 +260,7 @@ module Google
|
|
257
260
|
#
|
258
261
|
# @param parent [::String]
|
259
262
|
# Required. The parent catalog name, such as
|
260
|
-
#
|
263
|
+
# `projects/1234/locations/global/catalogs/default_catalog`.
|
261
264
|
# @param user_event [::String]
|
262
265
|
# Required. URL encoded UserEvent proto with a length limit of 2,000,000
|
263
266
|
# characters.
|
@@ -441,7 +444,7 @@ module Google
|
|
441
444
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
442
445
|
#
|
443
446
|
# @param parent [::String]
|
444
|
-
# Required.
|
447
|
+
# Required. `projects/1234/locations/global/catalogs/default_catalog`
|
445
448
|
# @param input_config [::Google::Cloud::Retail::V2::UserEventInputConfig, ::Hash]
|
446
449
|
# Required. The desired input location of the data.
|
447
450
|
# @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash]
|
@@ -520,7 +523,7 @@ module Google
|
|
520
523
|
#
|
521
524
|
# @param parent [::String]
|
522
525
|
# Required. The parent catalog resource name, such as
|
523
|
-
#
|
526
|
+
# `projects/1234/locations/global/catalogs/default_catalog`.
|
524
527
|
# @param user_event_rejoin_scope [::Google::Cloud::Retail::V2::RejoinUserEventsRequest::UserEventRejoinScope]
|
525
528
|
# The type of the user event rejoin to define the scope and range of the user
|
526
529
|
# events to be rejoined with the latest product catalog. Defaults to
|
@@ -665,7 +668,7 @@ module Google
|
|
665
668
|
config_attr :scope, nil, ::String, ::Array, nil
|
666
669
|
config_attr :lib_name, nil, ::String, nil
|
667
670
|
config_attr :lib_version, nil, ::String, nil
|
668
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
671
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
669
672
|
config_attr :interceptors, nil, ::Array, nil
|
670
673
|
config_attr :timeout, nil, ::Numeric, nil
|
671
674
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -686,7 +689,7 @@ module Google
|
|
686
689
|
def rpcs
|
687
690
|
@rpcs ||= begin
|
688
691
|
parent_rpcs = nil
|
689
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
692
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
690
693
|
Rpcs.new parent_rpcs
|
691
694
|
end
|
692
695
|
end
|
@@ -737,15 +740,15 @@ module Google
|
|
737
740
|
|
738
741
|
# @private
|
739
742
|
def initialize parent_rpcs = nil
|
740
|
-
write_user_event_config = parent_rpcs
|
743
|
+
write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event
|
741
744
|
@write_user_event = ::Gapic::Config::Method.new write_user_event_config
|
742
|
-
collect_user_event_config = parent_rpcs
|
745
|
+
collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event
|
743
746
|
@collect_user_event = ::Gapic::Config::Method.new collect_user_event_config
|
744
|
-
purge_user_events_config = parent_rpcs
|
747
|
+
purge_user_events_config = parent_rpcs.purge_user_events if parent_rpcs.respond_to? :purge_user_events
|
745
748
|
@purge_user_events = ::Gapic::Config::Method.new purge_user_events_config
|
746
|
-
import_user_events_config = parent_rpcs
|
749
|
+
import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events
|
747
750
|
@import_user_events = ::Gapic::Config::Method.new import_user_events_config
|
748
|
-
rejoin_user_events_config = parent_rpcs
|
751
|
+
rejoin_user_events_config = parent_rpcs.rejoin_user_events if parent_rpcs.respond_to? :rejoin_user_events
|
749
752
|
@rejoin_user_events = ::Gapic::Config::Method.new rejoin_user_events_config
|
750
753
|
|
751
754
|
yield self if block_given?
|