google-cloud-recommendation_engine-v1beta1 0.1.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -8
- data/LICENSE.md +188 -190
- data/README.md +67 -3
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/client.rb +28 -40
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/operations.rb +95 -10
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/client.rb +20 -23
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/client.rb +14 -11
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/client.rb +26 -35
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/operations.rb +95 -10
- data/lib/google/cloud/recommendation_engine/v1beta1/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/recommendationengine/v1beta1/catalog_service.rb +4 -4
- data/proto_docs/google/cloud/recommendationengine/v1beta1/import.rb +4 -4
- data/proto_docs/google/cloud/recommendationengine/v1beta1/prediction_apikey_registry_service.rb +3 -3
- data/proto_docs/google/cloud/recommendationengine/v1beta1/prediction_service.rb +1 -1
- data/proto_docs/google/cloud/recommendationengine/v1beta1/user_event_service.rb +4 -4
- 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/date.rb +14 -11
- metadata +21 -11
@@ -60,57 +60,39 @@ 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.rpcs.create_catalog_item.timeout = 600.0
|
69
69
|
default_config.rpcs.create_catalog_item.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.rpcs.get_catalog_item.timeout = 600.0
|
77
74
|
default_config.rpcs.get_catalog_item.retry_policy = {
|
78
|
-
initial_delay: 0.1,
|
79
|
-
max_delay: 60.0,
|
80
|
-
multiplier: 1.3,
|
81
|
-
retry_codes: [14, 4]
|
75
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
82
76
|
}
|
83
77
|
|
84
78
|
default_config.rpcs.list_catalog_items.timeout = 600.0
|
85
79
|
default_config.rpcs.list_catalog_items.retry_policy = {
|
86
|
-
initial_delay: 0.1,
|
87
|
-
max_delay: 60.0,
|
88
|
-
multiplier: 1.3,
|
89
|
-
retry_codes: [14, 4]
|
80
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
90
81
|
}
|
91
82
|
|
92
83
|
default_config.rpcs.update_catalog_item.timeout = 600.0
|
93
84
|
default_config.rpcs.update_catalog_item.retry_policy = {
|
94
|
-
initial_delay: 0.1,
|
95
|
-
max_delay: 60.0,
|
96
|
-
multiplier: 1.3,
|
97
|
-
retry_codes: [14, 4]
|
85
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
98
86
|
}
|
99
87
|
|
100
88
|
default_config.rpcs.delete_catalog_item.timeout = 600.0
|
101
89
|
default_config.rpcs.delete_catalog_item.retry_policy = {
|
102
|
-
initial_delay: 0.1,
|
103
|
-
max_delay: 60.0,
|
104
|
-
multiplier: 1.3,
|
105
|
-
retry_codes: [14, 4]
|
90
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
106
91
|
}
|
107
92
|
|
108
93
|
default_config.rpcs.import_catalog_items.timeout = 600.0
|
109
94
|
default_config.rpcs.import_catalog_items.retry_policy = {
|
110
|
-
initial_delay: 0.1,
|
111
|
-
max_delay: 60.0,
|
112
|
-
multiplier: 1.3,
|
113
|
-
retry_codes: [14, 4]
|
95
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
114
96
|
}
|
115
97
|
|
116
98
|
default_config
|
@@ -174,8 +156,14 @@ module Google
|
|
174
156
|
|
175
157
|
# Create credentials
|
176
158
|
credentials = @config.credentials
|
177
|
-
|
178
|
-
if
|
159
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
160
|
+
# but only if the default endpoint does not have a region prefix.
|
161
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
162
|
+
@config.endpoint == Client.configure.endpoint &&
|
163
|
+
!@config.endpoint.split(".").first.include?("-")
|
164
|
+
credentials ||= Credentials.default scope: @config.scope,
|
165
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
166
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
179
167
|
credentials = Credentials.new credentials, scope: @config.scope
|
180
168
|
end
|
181
169
|
@quota_project_id = @config.quota_project
|
@@ -224,7 +212,7 @@ module Google
|
|
224
212
|
#
|
225
213
|
# @param parent [::String]
|
226
214
|
# Required. The parent catalog resource name, such as
|
227
|
-
#
|
215
|
+
# `projects/*/locations/global/catalogs/default_catalog`.
|
228
216
|
# @param catalog_item [::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem, ::Hash]
|
229
217
|
# Required. The catalog item to create.
|
230
218
|
#
|
@@ -293,7 +281,7 @@ module Google
|
|
293
281
|
#
|
294
282
|
# @param name [::String]
|
295
283
|
# Required. Full resource name of catalog item, such as
|
296
|
-
#
|
284
|
+
# `projects/*/locations/global/catalogs/default_catalog/catalogitems/some_catalog_item_id`.
|
297
285
|
#
|
298
286
|
# @yield [response, operation] Access the result along with the RPC operation
|
299
287
|
# @yieldparam response [::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem]
|
@@ -360,7 +348,7 @@ module Google
|
|
360
348
|
#
|
361
349
|
# @param parent [::String]
|
362
350
|
# Required. The parent catalog resource name, such as
|
363
|
-
#
|
351
|
+
# `projects/*/locations/global/catalogs/default_catalog`.
|
364
352
|
# @param page_size [::Integer]
|
365
353
|
# Optional. Maximum number of results to return per page. If zero, the
|
366
354
|
# service will choose a reasonable default.
|
@@ -509,7 +497,7 @@ module Google
|
|
509
497
|
#
|
510
498
|
# @param name [::String]
|
511
499
|
# Required. Full resource name of catalog item, such as
|
512
|
-
#
|
500
|
+
# `projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id`.
|
513
501
|
#
|
514
502
|
# @yield [response, operation] Access the result along with the RPC operation
|
515
503
|
# @yieldparam response [::Google::Protobuf::Empty]
|
@@ -580,7 +568,7 @@ module Google
|
|
580
568
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
581
569
|
#
|
582
570
|
# @param parent [::String]
|
583
|
-
# Required.
|
571
|
+
# Required. `projects/1234/locations/global/catalogs/default_catalog`
|
584
572
|
# @param request_id [::String]
|
585
573
|
# Optional. Unique identifier provided by client, within the ancestor
|
586
574
|
# dataset scope. Ensures idempotency and used for request deduplication.
|
@@ -729,7 +717,7 @@ module Google
|
|
729
717
|
config_attr :scope, nil, ::String, ::Array, nil
|
730
718
|
config_attr :lib_name, nil, ::String, nil
|
731
719
|
config_attr :lib_version, nil, ::String, nil
|
732
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
720
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
733
721
|
config_attr :interceptors, nil, ::Array, nil
|
734
722
|
config_attr :timeout, nil, ::Numeric, nil
|
735
723
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -750,7 +738,7 @@ module Google
|
|
750
738
|
def rpcs
|
751
739
|
@rpcs ||= begin
|
752
740
|
parent_rpcs = nil
|
753
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
741
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
754
742
|
Rpcs.new parent_rpcs
|
755
743
|
end
|
756
744
|
end
|
@@ -806,17 +794,17 @@ module Google
|
|
806
794
|
|
807
795
|
# @private
|
808
796
|
def initialize parent_rpcs = nil
|
809
|
-
create_catalog_item_config = parent_rpcs
|
797
|
+
create_catalog_item_config = parent_rpcs.create_catalog_item if parent_rpcs.respond_to? :create_catalog_item
|
810
798
|
@create_catalog_item = ::Gapic::Config::Method.new create_catalog_item_config
|
811
|
-
get_catalog_item_config = parent_rpcs
|
799
|
+
get_catalog_item_config = parent_rpcs.get_catalog_item if parent_rpcs.respond_to? :get_catalog_item
|
812
800
|
@get_catalog_item = ::Gapic::Config::Method.new get_catalog_item_config
|
813
|
-
list_catalog_items_config = parent_rpcs
|
801
|
+
list_catalog_items_config = parent_rpcs.list_catalog_items if parent_rpcs.respond_to? :list_catalog_items
|
814
802
|
@list_catalog_items = ::Gapic::Config::Method.new list_catalog_items_config
|
815
|
-
update_catalog_item_config = parent_rpcs
|
803
|
+
update_catalog_item_config = parent_rpcs.update_catalog_item if parent_rpcs.respond_to? :update_catalog_item
|
816
804
|
@update_catalog_item = ::Gapic::Config::Method.new update_catalog_item_config
|
817
|
-
delete_catalog_item_config = parent_rpcs
|
805
|
+
delete_catalog_item_config = parent_rpcs.delete_catalog_item if parent_rpcs.respond_to? :delete_catalog_item
|
818
806
|
@delete_catalog_item = ::Gapic::Config::Method.new delete_catalog_item_config
|
819
|
-
import_catalog_items_config = parent_rpcs
|
807
|
+
import_catalog_items_config = parent_rpcs.import_catalog_items if parent_rpcs.respond_to? :import_catalog_items
|
820
808
|
@import_catalog_items = ::Gapic::Config::Method.new import_catalog_items_config
|
821
809
|
|
822
810
|
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::RecommendationEngine::V1beta1::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
|
@@ -64,33 +64,24 @@ module Google
|
|
64
64
|
parent_config = while namespace.any?
|
65
65
|
parent_name = namespace.join "::"
|
66
66
|
parent_const = const_get parent_name
|
67
|
-
break parent_const.configure if parent_const
|
67
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
68
68
|
namespace.pop
|
69
69
|
end
|
70
70
|
default_config = Client::Configuration.new parent_config
|
71
71
|
|
72
72
|
default_config.rpcs.create_prediction_api_key_registration.timeout = 600.0
|
73
73
|
default_config.rpcs.create_prediction_api_key_registration.retry_policy = {
|
74
|
-
initial_delay: 0.1,
|
75
|
-
max_delay: 60.0,
|
76
|
-
multiplier: 1.3,
|
77
|
-
retry_codes: [14, 4]
|
74
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
78
75
|
}
|
79
76
|
|
80
77
|
default_config.rpcs.list_prediction_api_key_registrations.timeout = 600.0
|
81
78
|
default_config.rpcs.list_prediction_api_key_registrations.retry_policy = {
|
82
|
-
initial_delay: 0.1,
|
83
|
-
max_delay: 60.0,
|
84
|
-
multiplier: 1.3,
|
85
|
-
retry_codes: [14, 4]
|
79
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
86
80
|
}
|
87
81
|
|
88
82
|
default_config.rpcs.delete_prediction_api_key_registration.timeout = 600.0
|
89
83
|
default_config.rpcs.delete_prediction_api_key_registration.retry_policy = {
|
90
|
-
initial_delay: 0.1,
|
91
|
-
max_delay: 60.0,
|
92
|
-
multiplier: 1.3,
|
93
|
-
retry_codes: [14, 4]
|
84
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
94
85
|
}
|
95
86
|
|
96
87
|
default_config
|
@@ -154,8 +145,14 @@ module Google
|
|
154
145
|
|
155
146
|
# Create credentials
|
156
147
|
credentials = @config.credentials
|
157
|
-
|
158
|
-
if
|
148
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
149
|
+
# but only if the default endpoint does not have a region prefix.
|
150
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
151
|
+
@config.endpoint == Client.configure.endpoint &&
|
152
|
+
!@config.endpoint.split(".").first.include?("-")
|
153
|
+
credentials ||= Credentials.default scope: @config.scope,
|
154
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
155
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
159
156
|
credentials = Credentials.new credentials, scope: @config.scope
|
160
157
|
end
|
161
158
|
@quota_project_id = @config.quota_project
|
@@ -192,7 +189,7 @@ module Google
|
|
192
189
|
#
|
193
190
|
# @param parent [::String]
|
194
191
|
# Required. The parent resource path.
|
195
|
-
#
|
192
|
+
# `projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store`.
|
196
193
|
# @param prediction_api_key_registration [::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration, ::Hash]
|
197
194
|
# Required. The prediction API key registration.
|
198
195
|
#
|
@@ -261,7 +258,7 @@ module Google
|
|
261
258
|
#
|
262
259
|
# @param parent [::String]
|
263
260
|
# Required. The parent placement resource name such as
|
264
|
-
#
|
261
|
+
# `projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store`
|
265
262
|
# @param page_size [::Integer]
|
266
263
|
# Optional. Maximum number of results to return per page. If unset, the
|
267
264
|
# service will choose a reasonable default.
|
@@ -334,7 +331,7 @@ module Google
|
|
334
331
|
#
|
335
332
|
# @param name [::String]
|
336
333
|
# Required. The API key to unregister including full resource path.
|
337
|
-
#
|
334
|
+
# `projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/predictionApiKeyRegistrations/<YOUR_API_KEY>`
|
338
335
|
#
|
339
336
|
# @yield [response, operation] Access the result along with the RPC operation
|
340
337
|
# @yieldparam response [::Google::Protobuf::Empty]
|
@@ -473,7 +470,7 @@ module Google
|
|
473
470
|
config_attr :scope, nil, ::String, ::Array, nil
|
474
471
|
config_attr :lib_name, nil, ::String, nil
|
475
472
|
config_attr :lib_version, nil, ::String, nil
|
476
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
473
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
477
474
|
config_attr :interceptors, nil, ::Array, nil
|
478
475
|
config_attr :timeout, nil, ::Numeric, nil
|
479
476
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -494,7 +491,7 @@ module Google
|
|
494
491
|
def rpcs
|
495
492
|
@rpcs ||= begin
|
496
493
|
parent_rpcs = nil
|
497
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
494
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
498
495
|
Rpcs.new parent_rpcs
|
499
496
|
end
|
500
497
|
end
|
@@ -535,11 +532,11 @@ module Google
|
|
535
532
|
|
536
533
|
# @private
|
537
534
|
def initialize parent_rpcs = nil
|
538
|
-
create_prediction_api_key_registration_config = parent_rpcs
|
535
|
+
create_prediction_api_key_registration_config = parent_rpcs.create_prediction_api_key_registration if parent_rpcs.respond_to? :create_prediction_api_key_registration
|
539
536
|
@create_prediction_api_key_registration = ::Gapic::Config::Method.new create_prediction_api_key_registration_config
|
540
|
-
list_prediction_api_key_registrations_config = parent_rpcs
|
537
|
+
list_prediction_api_key_registrations_config = parent_rpcs.list_prediction_api_key_registrations if parent_rpcs.respond_to? :list_prediction_api_key_registrations
|
541
538
|
@list_prediction_api_key_registrations = ::Gapic::Config::Method.new list_prediction_api_key_registrations_config
|
542
|
-
delete_prediction_api_key_registration_config = parent_rpcs
|
539
|
+
delete_prediction_api_key_registration_config = parent_rpcs.delete_prediction_api_key_registration if parent_rpcs.respond_to? :delete_prediction_api_key_registration
|
543
540
|
@delete_prediction_api_key_registration = ::Gapic::Config::Method.new delete_prediction_api_key_registration_config
|
544
541
|
|
545
542
|
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.rpcs.predict.timeout = 600.0
|
69
69
|
default_config.rpcs.predict.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
|
@@ -175,7 +178,7 @@ module Google
|
|
175
178
|
#
|
176
179
|
# @param name [::String]
|
177
180
|
# Required. Full resource name of the format:
|
178
|
-
#
|
181
|
+
# `{name=projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/*}`
|
179
182
|
# The id of the recommendation engine placement. This id is used to identify
|
180
183
|
# the set of models that will be used to make the prediction.
|
181
184
|
#
|
@@ -401,7 +404,7 @@ module Google
|
|
401
404
|
config_attr :scope, nil, ::String, ::Array, nil
|
402
405
|
config_attr :lib_name, nil, ::String, nil
|
403
406
|
config_attr :lib_version, nil, ::String, nil
|
404
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
407
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
405
408
|
config_attr :interceptors, nil, ::Array, nil
|
406
409
|
config_attr :timeout, nil, ::Numeric, nil
|
407
410
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -422,7 +425,7 @@ module Google
|
|
422
425
|
def rpcs
|
423
426
|
@rpcs ||= begin
|
424
427
|
parent_rpcs = nil
|
425
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
428
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
426
429
|
Rpcs.new parent_rpcs
|
427
430
|
end
|
428
431
|
end
|
@@ -453,7 +456,7 @@ module Google
|
|
453
456
|
|
454
457
|
# @private
|
455
458
|
def initialize parent_rpcs = nil
|
456
|
-
predict_config = parent_rpcs
|
459
|
+
predict_config = parent_rpcs.predict if parent_rpcs.respond_to? :predict
|
457
460
|
@predict = ::Gapic::Config::Method.new predict_config
|
458
461
|
|
459
462
|
yield self if block_given?
|