google-cloud-retail-v2 1.1.0 → 1.3.0
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/README.md +31 -21
- data/lib/google/cloud/retail/v2/analytics_service/client.rb +36 -2
- data/lib/google/cloud/retail/v2/analytics_service/operations.rb +19 -15
- data/lib/google/cloud/retail/v2/analytics_service/rest/client.rb +36 -2
- data/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb +50 -38
- data/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/retail/v2/catalog_service/client.rb +36 -12
- data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +36 -12
- data/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +102 -68
- data/lib/google/cloud/retail/v2/completion_service/client.rb +36 -3
- data/lib/google/cloud/retail/v2/completion_service/operations.rb +19 -15
- data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +36 -3
- data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +50 -38
- data/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/retail/v2/control_service/client.rb +36 -6
- data/lib/google/cloud/retail/v2/control_service/rest/client.rb +36 -6
- data/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/retail/v2/generative_question_service/client.rb +35 -6
- data/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb +35 -6
- data/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/retail/v2/model_service/client.rb +38 -9
- data/lib/google/cloud/retail/v2/model_service/operations.rb +19 -15
- data/lib/google/cloud/retail/v2/model_service/rest/client.rb +38 -9
- data/lib/google/cloud/retail/v2/model_service/rest/operations.rb +50 -38
- data/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb +78 -50
- data/lib/google/cloud/retail/v2/prediction_service/client.rb +35 -2
- data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +35 -2
- data/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/retail/v2/product_service/client.rb +43 -13
- data/lib/google/cloud/retail/v2/product_service/operations.rb +19 -15
- data/lib/google/cloud/retail/v2/product_service/rest/client.rb +43 -13
- data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +50 -38
- data/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +110 -74
- data/lib/google/cloud/retail/v2/search_service/client.rb +36 -2
- data/lib/google/cloud/retail/v2/search_service/rest/client.rb +35 -2
- data/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/retail/v2/serving_config_service/client.rb +36 -8
- data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +36 -8
- data/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +70 -44
- data/lib/google/cloud/retail/v2/user_event_service/client.rb +38 -6
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +19 -15
- data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +38 -6
- data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +50 -38
- data/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/proto_docs/google/api/client.rb +39 -0
- data/proto_docs/google/cloud/retail/v2/common.rb +28 -0
- data/proto_docs/google/cloud/retail/v2/export_config.rb +4 -0
- data/proto_docs/google/cloud/retail/v2/import_config.rb +12 -0
- data/proto_docs/google/cloud/retail/v2/product.rb +4 -0
- data/proto_docs/google/cloud/retail/v2/search_service.rb +12 -0
- data/proto_docs/google/longrunning/operations.rb +23 -14
- data/proto_docs/google/protobuf/struct.rb +12 -0
- metadata +6 -9
@@ -158,14 +158,26 @@ module Google
|
|
158
158
|
universe_domain: @config.universe_domain,
|
159
159
|
channel_args: @config.channel_args,
|
160
160
|
interceptors: @config.interceptors,
|
161
|
-
channel_pool_config: @config.channel_pool
|
161
|
+
channel_pool_config: @config.channel_pool,
|
162
|
+
logger: @config.logger
|
162
163
|
)
|
163
164
|
|
165
|
+
@serving_config_service_stub.stub_logger&.info do |entry|
|
166
|
+
entry.set_system_name
|
167
|
+
entry.set_service
|
168
|
+
entry.message = "Created client for #{entry.service}"
|
169
|
+
entry.set_credentials_fields credentials
|
170
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
171
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
172
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
173
|
+
end
|
174
|
+
|
164
175
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
165
176
|
config.credentials = credentials
|
166
177
|
config.quota_project = @quota_project_id
|
167
178
|
config.endpoint = @serving_config_service_stub.endpoint
|
168
179
|
config.universe_domain = @serving_config_service_stub.universe_domain
|
180
|
+
config.logger = @serving_config_service_stub.logger if config.respond_to? :logger=
|
169
181
|
end
|
170
182
|
end
|
171
183
|
|
@@ -176,6 +188,15 @@ module Google
|
|
176
188
|
#
|
177
189
|
attr_reader :location_client
|
178
190
|
|
191
|
+
##
|
192
|
+
# The logger used for request/response debug logging.
|
193
|
+
#
|
194
|
+
# @return [Logger]
|
195
|
+
#
|
196
|
+
def logger
|
197
|
+
@serving_config_service_stub.logger
|
198
|
+
end
|
199
|
+
|
179
200
|
# Service calls
|
180
201
|
|
181
202
|
##
|
@@ -271,7 +292,6 @@ module Google
|
|
271
292
|
|
272
293
|
@serving_config_service_stub.call_rpc :create_serving_config, request, options: options do |response, operation|
|
273
294
|
yield response, operation if block_given?
|
274
|
-
return response
|
275
295
|
end
|
276
296
|
rescue ::GRPC::BadStatus => e
|
277
297
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -360,7 +380,6 @@ module Google
|
|
360
380
|
|
361
381
|
@serving_config_service_stub.call_rpc :delete_serving_config, request, options: options do |response, operation|
|
362
382
|
yield response, operation if block_given?
|
363
|
-
return response
|
364
383
|
end
|
365
384
|
rescue ::GRPC::BadStatus => e
|
366
385
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -454,7 +473,6 @@ module Google
|
|
454
473
|
|
455
474
|
@serving_config_service_stub.call_rpc :update_serving_config, request, options: options do |response, operation|
|
456
475
|
yield response, operation if block_given?
|
457
|
-
return response
|
458
476
|
end
|
459
477
|
rescue ::GRPC::BadStatus => e
|
460
478
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -543,7 +561,6 @@ module Google
|
|
543
561
|
|
544
562
|
@serving_config_service_stub.call_rpc :get_serving_config, request, options: options do |response, operation|
|
545
563
|
yield response, operation if block_given?
|
546
|
-
return response
|
547
564
|
end
|
548
565
|
rescue ::GRPC::BadStatus => e
|
549
566
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -642,7 +659,7 @@ module Google
|
|
642
659
|
@serving_config_service_stub.call_rpc :list_serving_configs, request, options: options do |response, operation|
|
643
660
|
response = ::Gapic::PagedEnumerable.new @serving_config_service_stub, :list_serving_configs, request, response, operation, options
|
644
661
|
yield response, operation if block_given?
|
645
|
-
|
662
|
+
throw :response, response
|
646
663
|
end
|
647
664
|
rescue ::GRPC::BadStatus => e
|
648
665
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -738,7 +755,6 @@ module Google
|
|
738
755
|
|
739
756
|
@serving_config_service_stub.call_rpc :add_control, request, options: options do |response, operation|
|
740
757
|
yield response, operation if block_given?
|
741
|
-
return response
|
742
758
|
end
|
743
759
|
rescue ::GRPC::BadStatus => e
|
744
760
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -831,7 +847,6 @@ module Google
|
|
831
847
|
|
832
848
|
@serving_config_service_stub.call_rpc :remove_control, request, options: options do |response, operation|
|
833
849
|
yield response, operation if block_given?
|
834
|
-
return response
|
835
850
|
end
|
836
851
|
rescue ::GRPC::BadStatus => e
|
837
852
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -881,6 +896,13 @@ module Google
|
|
881
896
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
882
897
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
883
898
|
# * (`nil`) indicating no credentials
|
899
|
+
#
|
900
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
901
|
+
# external source for authentication to Google Cloud, you must validate it before
|
902
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
903
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
904
|
+
# For more information, refer to [Validate credential configurations from external
|
905
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
884
906
|
# @return [::Object]
|
885
907
|
# @!attribute [rw] scope
|
886
908
|
# The OAuth scopes
|
@@ -920,6 +942,11 @@ module Google
|
|
920
942
|
# default endpoint URL. The default value of nil uses the environment
|
921
943
|
# universe (usually the default "googleapis.com" universe).
|
922
944
|
# @return [::String,nil]
|
945
|
+
# @!attribute [rw] logger
|
946
|
+
# A custom logger to use for request/response debug logging, or the value
|
947
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
948
|
+
# explicitly disable logging.
|
949
|
+
# @return [::Logger,:default,nil]
|
923
950
|
#
|
924
951
|
class Configuration
|
925
952
|
extend ::Gapic::Config
|
@@ -944,6 +971,7 @@ module Google
|
|
944
971
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
945
972
|
config_attr :quota_project, nil, ::String, nil
|
946
973
|
config_attr :universe_domain, nil, ::String, nil
|
974
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
947
975
|
|
948
976
|
# @private
|
949
977
|
def initialize parent_config = nil
|
@@ -151,14 +151,26 @@ module Google
|
|
151
151
|
endpoint: @config.endpoint,
|
152
152
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
153
153
|
universe_domain: @config.universe_domain,
|
154
|
-
credentials: credentials
|
154
|
+
credentials: credentials,
|
155
|
+
logger: @config.logger
|
155
156
|
)
|
156
157
|
|
158
|
+
@serving_config_service_stub.logger(stub: true)&.info do |entry|
|
159
|
+
entry.set_system_name
|
160
|
+
entry.set_service
|
161
|
+
entry.message = "Created client for #{entry.service}"
|
162
|
+
entry.set_credentials_fields credentials
|
163
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
164
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
165
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
166
|
+
end
|
167
|
+
|
157
168
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
158
169
|
config.credentials = credentials
|
159
170
|
config.quota_project = @quota_project_id
|
160
171
|
config.endpoint = @serving_config_service_stub.endpoint
|
161
172
|
config.universe_domain = @serving_config_service_stub.universe_domain
|
173
|
+
config.logger = @serving_config_service_stub.logger if config.respond_to? :logger=
|
162
174
|
end
|
163
175
|
end
|
164
176
|
|
@@ -169,6 +181,15 @@ module Google
|
|
169
181
|
#
|
170
182
|
attr_reader :location_client
|
171
183
|
|
184
|
+
##
|
185
|
+
# The logger used for request/response debug logging.
|
186
|
+
#
|
187
|
+
# @return [Logger]
|
188
|
+
#
|
189
|
+
def logger
|
190
|
+
@serving_config_service_stub.logger
|
191
|
+
end
|
192
|
+
|
172
193
|
# Service calls
|
173
194
|
|
174
195
|
##
|
@@ -257,7 +278,6 @@ module Google
|
|
257
278
|
|
258
279
|
@serving_config_service_stub.create_serving_config request, options do |result, operation|
|
259
280
|
yield result, operation if block_given?
|
260
|
-
return result
|
261
281
|
end
|
262
282
|
rescue ::Gapic::Rest::Error => e
|
263
283
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -339,7 +359,6 @@ module Google
|
|
339
359
|
|
340
360
|
@serving_config_service_stub.delete_serving_config request, options do |result, operation|
|
341
361
|
yield result, operation if block_given?
|
342
|
-
return result
|
343
362
|
end
|
344
363
|
rescue ::Gapic::Rest::Error => e
|
345
364
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -426,7 +445,6 @@ module Google
|
|
426
445
|
|
427
446
|
@serving_config_service_stub.update_serving_config request, options do |result, operation|
|
428
447
|
yield result, operation if block_given?
|
429
|
-
return result
|
430
448
|
end
|
431
449
|
rescue ::Gapic::Rest::Error => e
|
432
450
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -508,7 +526,6 @@ module Google
|
|
508
526
|
|
509
527
|
@serving_config_service_stub.get_serving_config request, options do |result, operation|
|
510
528
|
yield result, operation if block_given?
|
511
|
-
return result
|
512
529
|
end
|
513
530
|
rescue ::Gapic::Rest::Error => e
|
514
531
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -600,7 +617,7 @@ module Google
|
|
600
617
|
@serving_config_service_stub.list_serving_configs request, options do |result, operation|
|
601
618
|
result = ::Gapic::Rest::PagedEnumerable.new @serving_config_service_stub, :list_serving_configs, "serving_configs", request, result, options
|
602
619
|
yield result, operation if block_given?
|
603
|
-
|
620
|
+
throw :response, result
|
604
621
|
end
|
605
622
|
rescue ::Gapic::Rest::Error => e
|
606
623
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -689,7 +706,6 @@ module Google
|
|
689
706
|
|
690
707
|
@serving_config_service_stub.add_control request, options do |result, operation|
|
691
708
|
yield result, operation if block_given?
|
692
|
-
return result
|
693
709
|
end
|
694
710
|
rescue ::Gapic::Rest::Error => e
|
695
711
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -775,7 +791,6 @@ module Google
|
|
775
791
|
|
776
792
|
@serving_config_service_stub.remove_control request, options do |result, operation|
|
777
793
|
yield result, operation if block_given?
|
778
|
-
return result
|
779
794
|
end
|
780
795
|
rescue ::Gapic::Rest::Error => e
|
781
796
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -823,6 +838,13 @@ module Google
|
|
823
838
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
824
839
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
825
840
|
# * (`nil`) indicating no credentials
|
841
|
+
#
|
842
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
843
|
+
# external source for authentication to Google Cloud, you must validate it before
|
844
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
845
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
846
|
+
# For more information, refer to [Validate credential configurations from external
|
847
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
826
848
|
# @return [::Object]
|
827
849
|
# @!attribute [rw] scope
|
828
850
|
# The OAuth scopes
|
@@ -855,6 +877,11 @@ module Google
|
|
855
877
|
# default endpoint URL. The default value of nil uses the environment
|
856
878
|
# universe (usually the default "googleapis.com" universe).
|
857
879
|
# @return [::String,nil]
|
880
|
+
# @!attribute [rw] logger
|
881
|
+
# A custom logger to use for request/response debug logging, or the value
|
882
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
883
|
+
# explicitly disable logging.
|
884
|
+
# @return [::Logger,:default,nil]
|
858
885
|
#
|
859
886
|
class Configuration
|
860
887
|
extend ::Gapic::Config
|
@@ -876,6 +903,7 @@ module Google
|
|
876
903
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
877
904
|
config_attr :quota_project, nil, ::String, nil
|
878
905
|
config_attr :universe_domain, nil, ::String, nil
|
906
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
879
907
|
|
880
908
|
# @private
|
881
909
|
def initialize parent_config = nil
|
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the create_serving_config REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "create_serving_config",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "delete_serving_config",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|
@@ -163,16 +179,18 @@ module Google
|
|
163
179
|
|
164
180
|
response = @client_stub.make_http_request(
|
165
181
|
verb,
|
166
|
-
uri:
|
167
|
-
body:
|
168
|
-
params:
|
182
|
+
uri: uri,
|
183
|
+
body: body || "",
|
184
|
+
params: query_string_params,
|
185
|
+
method_name: "update_serving_config",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true
|
173
|
-
|
174
|
-
|
175
|
-
|
190
|
+
catch :response do
|
191
|
+
yield result, operation if block_given?
|
192
|
+
result
|
193
|
+
end
|
176
194
|
end
|
177
195
|
|
178
196
|
##
|
@@ -201,16 +219,18 @@ module Google
|
|
201
219
|
|
202
220
|
response = @client_stub.make_http_request(
|
203
221
|
verb,
|
204
|
-
uri:
|
205
|
-
body:
|
206
|
-
params:
|
222
|
+
uri: uri,
|
223
|
+
body: body || "",
|
224
|
+
params: query_string_params,
|
225
|
+
method_name: "get_serving_config",
|
207
226
|
options: options
|
208
227
|
)
|
209
228
|
operation = ::Gapic::Rest::TransportOperation.new response
|
210
229
|
result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true
|
211
|
-
|
212
|
-
|
213
|
-
|
230
|
+
catch :response do
|
231
|
+
yield result, operation if block_given?
|
232
|
+
result
|
233
|
+
end
|
214
234
|
end
|
215
235
|
|
216
236
|
##
|
@@ -239,16 +259,18 @@ module Google
|
|
239
259
|
|
240
260
|
response = @client_stub.make_http_request(
|
241
261
|
verb,
|
242
|
-
uri:
|
243
|
-
body:
|
244
|
-
params:
|
262
|
+
uri: uri,
|
263
|
+
body: body || "",
|
264
|
+
params: query_string_params,
|
265
|
+
method_name: "list_serving_configs",
|
245
266
|
options: options
|
246
267
|
)
|
247
268
|
operation = ::Gapic::Rest::TransportOperation.new response
|
248
269
|
result = ::Google::Cloud::Retail::V2::ListServingConfigsResponse.decode_json response.body, ignore_unknown_fields: true
|
249
|
-
|
250
|
-
|
251
|
-
|
270
|
+
catch :response do
|
271
|
+
yield result, operation if block_given?
|
272
|
+
result
|
273
|
+
end
|
252
274
|
end
|
253
275
|
|
254
276
|
##
|
@@ -277,16 +299,18 @@ module Google
|
|
277
299
|
|
278
300
|
response = @client_stub.make_http_request(
|
279
301
|
verb,
|
280
|
-
uri:
|
281
|
-
body:
|
282
|
-
params:
|
302
|
+
uri: uri,
|
303
|
+
body: body || "",
|
304
|
+
params: query_string_params,
|
305
|
+
method_name: "add_control",
|
283
306
|
options: options
|
284
307
|
)
|
285
308
|
operation = ::Gapic::Rest::TransportOperation.new response
|
286
309
|
result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true
|
287
|
-
|
288
|
-
|
289
|
-
|
310
|
+
catch :response do
|
311
|
+
yield result, operation if block_given?
|
312
|
+
result
|
313
|
+
end
|
290
314
|
end
|
291
315
|
|
292
316
|
##
|
@@ -315,16 +339,18 @@ module Google
|
|
315
339
|
|
316
340
|
response = @client_stub.make_http_request(
|
317
341
|
verb,
|
318
|
-
uri:
|
319
|
-
body:
|
320
|
-
params:
|
342
|
+
uri: uri,
|
343
|
+
body: body || "",
|
344
|
+
params: query_string_params,
|
345
|
+
method_name: "remove_control",
|
321
346
|
options: options
|
322
347
|
)
|
323
348
|
operation = ::Gapic::Rest::TransportOperation.new response
|
324
349
|
result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true
|
325
|
-
|
326
|
-
|
327
|
-
|
350
|
+
catch :response do
|
351
|
+
yield result, operation if block_given?
|
352
|
+
result
|
353
|
+
end
|
328
354
|
end
|
329
355
|
|
330
356
|
##
|
@@ -180,14 +180,26 @@ module Google
|
|
180
180
|
universe_domain: @config.universe_domain,
|
181
181
|
channel_args: @config.channel_args,
|
182
182
|
interceptors: @config.interceptors,
|
183
|
-
channel_pool_config: @config.channel_pool
|
183
|
+
channel_pool_config: @config.channel_pool,
|
184
|
+
logger: @config.logger
|
184
185
|
)
|
185
186
|
|
187
|
+
@user_event_service_stub.stub_logger&.info do |entry|
|
188
|
+
entry.set_system_name
|
189
|
+
entry.set_service
|
190
|
+
entry.message = "Created client for #{entry.service}"
|
191
|
+
entry.set_credentials_fields credentials
|
192
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
193
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
194
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
195
|
+
end
|
196
|
+
|
186
197
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
187
198
|
config.credentials = credentials
|
188
199
|
config.quota_project = @quota_project_id
|
189
200
|
config.endpoint = @user_event_service_stub.endpoint
|
190
201
|
config.universe_domain = @user_event_service_stub.universe_domain
|
202
|
+
config.logger = @user_event_service_stub.logger if config.respond_to? :logger=
|
191
203
|
end
|
192
204
|
end
|
193
205
|
|
@@ -205,6 +217,15 @@ module Google
|
|
205
217
|
#
|
206
218
|
attr_reader :location_client
|
207
219
|
|
220
|
+
##
|
221
|
+
# The logger used for request/response debug logging.
|
222
|
+
#
|
223
|
+
# @return [Logger]
|
224
|
+
#
|
225
|
+
def logger
|
226
|
+
@user_event_service_stub.logger
|
227
|
+
end
|
228
|
+
|
208
229
|
# Service calls
|
209
230
|
|
210
231
|
##
|
@@ -295,7 +316,6 @@ module Google
|
|
295
316
|
|
296
317
|
@user_event_service_stub.call_rpc :write_user_event, request, options: options do |response, operation|
|
297
318
|
yield response, operation if block_given?
|
298
|
-
return response
|
299
319
|
end
|
300
320
|
rescue ::GRPC::BadStatus => e
|
301
321
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -406,7 +426,6 @@ module Google
|
|
406
426
|
|
407
427
|
@user_event_service_stub.call_rpc :collect_user_event, request, options: options do |response, operation|
|
408
428
|
yield response, operation if block_given?
|
409
|
-
return response
|
410
429
|
end
|
411
430
|
rescue ::GRPC::BadStatus => e
|
412
431
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -533,7 +552,7 @@ module Google
|
|
533
552
|
@user_event_service_stub.call_rpc :purge_user_events, request, options: options do |response, operation|
|
534
553
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
535
554
|
yield response, operation if block_given?
|
536
|
-
|
555
|
+
throw :response, response
|
537
556
|
end
|
538
557
|
rescue ::GRPC::BadStatus => e
|
539
558
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -638,7 +657,7 @@ module Google
|
|
638
657
|
@user_event_service_stub.call_rpc :import_user_events, request, options: options do |response, operation|
|
639
658
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
640
659
|
yield response, operation if block_given?
|
641
|
-
|
660
|
+
throw :response, response
|
642
661
|
end
|
643
662
|
rescue ::GRPC::BadStatus => e
|
644
663
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -745,7 +764,7 @@ module Google
|
|
745
764
|
@user_event_service_stub.call_rpc :rejoin_user_events, request, options: options do |response, operation|
|
746
765
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
747
766
|
yield response, operation if block_given?
|
748
|
-
|
767
|
+
throw :response, response
|
749
768
|
end
|
750
769
|
rescue ::GRPC::BadStatus => e
|
751
770
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -795,6 +814,13 @@ module Google
|
|
795
814
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
796
815
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
797
816
|
# * (`nil`) indicating no credentials
|
817
|
+
#
|
818
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
819
|
+
# external source for authentication to Google Cloud, you must validate it before
|
820
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
821
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
822
|
+
# For more information, refer to [Validate credential configurations from external
|
823
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
798
824
|
# @return [::Object]
|
799
825
|
# @!attribute [rw] scope
|
800
826
|
# The OAuth scopes
|
@@ -834,6 +860,11 @@ module Google
|
|
834
860
|
# default endpoint URL. The default value of nil uses the environment
|
835
861
|
# universe (usually the default "googleapis.com" universe).
|
836
862
|
# @return [::String,nil]
|
863
|
+
# @!attribute [rw] logger
|
864
|
+
# A custom logger to use for request/response debug logging, or the value
|
865
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
866
|
+
# explicitly disable logging.
|
867
|
+
# @return [::Logger,:default,nil]
|
837
868
|
#
|
838
869
|
class Configuration
|
839
870
|
extend ::Gapic::Config
|
@@ -858,6 +889,7 @@ module Google
|
|
858
889
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
859
890
|
config_attr :quota_project, nil, ::String, nil
|
860
891
|
config_attr :universe_domain, nil, ::String, nil
|
892
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
861
893
|
|
862
894
|
# @private
|
863
895
|
def initialize parent_config = nil
|