google-cloud-automl-v1beta1 0.11.0 → 0.12.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 +30 -20
- data/lib/google/cloud/automl/v1beta1/automl/client.rb +92 -49
- data/lib/google/cloud/automl/v1beta1/automl/operations.rb +25 -20
- data/lib/google/cloud/automl/v1beta1/automl/rest/client.rb +92 -49
- data/lib/google/cloud/automl/v1beta1/automl/rest/operations.rb +65 -50
- data/lib/google/cloud/automl/v1beta1/automl/rest/service_stub.rb +206 -146
- data/lib/google/cloud/automl/v1beta1/prediction_service/client.rb +35 -5
- data/lib/google/cloud/automl/v1beta1/prediction_service/operations.rb +25 -20
- data/lib/google/cloud/automl/v1beta1/prediction_service/rest/client.rb +35 -5
- data/lib/google/cloud/automl/v1beta1/prediction_service/rest/operations.rb +65 -50
- data/lib/google/cloud/automl/v1beta1/prediction_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/automl/v1beta1/version.rb +1 -1
- data/proto_docs/google/api/client.rb +74 -10
- data/proto_docs/google/api/resource.rb +7 -2
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +5 -5
@@ -33,6 +33,9 @@ module Google
|
|
33
33
|
# snake_case or kebab-case, either of those cases is accepted.
|
34
34
|
#
|
35
35
|
class Client
|
36
|
+
# @private
|
37
|
+
API_VERSION = ""
|
38
|
+
|
36
39
|
# @private
|
37
40
|
DEFAULT_ENDPOINT_TEMPLATE = "automl.$UNIVERSE_DOMAIN$"
|
38
41
|
|
@@ -168,8 +171,19 @@ module Google
|
|
168
171
|
universe_domain: @config.universe_domain,
|
169
172
|
channel_args: @config.channel_args,
|
170
173
|
interceptors: @config.interceptors,
|
171
|
-
channel_pool_config: @config.channel_pool
|
174
|
+
channel_pool_config: @config.channel_pool,
|
175
|
+
logger: @config.logger
|
172
176
|
)
|
177
|
+
|
178
|
+
@prediction_service_stub.stub_logger&.info do |entry|
|
179
|
+
entry.set_system_name
|
180
|
+
entry.set_service
|
181
|
+
entry.message = "Created client for #{entry.service}"
|
182
|
+
entry.set_credentials_fields credentials
|
183
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
184
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
185
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
186
|
+
end
|
173
187
|
end
|
174
188
|
|
175
189
|
##
|
@@ -179,6 +193,15 @@ module Google
|
|
179
193
|
#
|
180
194
|
attr_reader :operations_client
|
181
195
|
|
196
|
+
##
|
197
|
+
# The logger used for request/response debug logging.
|
198
|
+
#
|
199
|
+
# @return [Logger]
|
200
|
+
#
|
201
|
+
def logger
|
202
|
+
@prediction_service_stub.logger
|
203
|
+
end
|
204
|
+
|
182
205
|
# Service calls
|
183
206
|
|
184
207
|
##
|
@@ -278,10 +301,11 @@ module Google
|
|
278
301
|
# Customize the options with defaults
|
279
302
|
metadata = @config.rpcs.predict.metadata.to_h
|
280
303
|
|
281
|
-
# Set x-goog-api-client
|
304
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
282
305
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
283
306
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
284
307
|
gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION
|
308
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
285
309
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
286
310
|
|
287
311
|
header_params = {}
|
@@ -302,7 +326,6 @@ module Google
|
|
302
326
|
|
303
327
|
@prediction_service_stub.call_rpc :predict, request, options: options do |response, operation|
|
304
328
|
yield response, operation if block_given?
|
305
|
-
return response
|
306
329
|
end
|
307
330
|
rescue ::GRPC::BadStatus => e
|
308
331
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -457,10 +480,11 @@ module Google
|
|
457
480
|
# Customize the options with defaults
|
458
481
|
metadata = @config.rpcs.batch_predict.metadata.to_h
|
459
482
|
|
460
|
-
# Set x-goog-api-client
|
483
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
461
484
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
462
485
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
463
486
|
gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION
|
487
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
464
488
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
465
489
|
|
466
490
|
header_params = {}
|
@@ -482,7 +506,7 @@ module Google
|
|
482
506
|
@prediction_service_stub.call_rpc :batch_predict, request, options: options do |response, operation|
|
483
507
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
484
508
|
yield response, operation if block_given?
|
485
|
-
|
509
|
+
throw :response, response
|
486
510
|
end
|
487
511
|
rescue ::GRPC::BadStatus => e
|
488
512
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -571,6 +595,11 @@ module Google
|
|
571
595
|
# default endpoint URL. The default value of nil uses the environment
|
572
596
|
# universe (usually the default "googleapis.com" universe).
|
573
597
|
# @return [::String,nil]
|
598
|
+
# @!attribute [rw] logger
|
599
|
+
# A custom logger to use for request/response debug logging, or the value
|
600
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
601
|
+
# explicitly disable logging.
|
602
|
+
# @return [::Logger,:default,nil]
|
574
603
|
#
|
575
604
|
class Configuration
|
576
605
|
extend ::Gapic::Config
|
@@ -595,6 +624,7 @@ module Google
|
|
595
624
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
596
625
|
config_attr :quota_project, nil, ::String, nil
|
597
626
|
config_attr :universe_domain, nil, ::String, nil
|
627
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
598
628
|
|
599
629
|
# @private
|
600
630
|
def initialize parent_config = nil
|
@@ -26,6 +26,9 @@ module Google
|
|
26
26
|
module PredictionService
|
27
27
|
# Service that implements Longrunning Operations API.
|
28
28
|
class Operations
|
29
|
+
# @private
|
30
|
+
API_VERSION = ""
|
31
|
+
|
29
32
|
# @private
|
30
33
|
DEFAULT_ENDPOINT_TEMPLATE = "automl.$UNIVERSE_DOMAIN$"
|
31
34
|
|
@@ -121,14 +124,6 @@ module Google
|
|
121
124
|
# Lists operations that match the specified filter in the request. If the
|
122
125
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
123
126
|
#
|
124
|
-
# NOTE: the `name` binding allows API services to override the binding
|
125
|
-
# to use different resource name schemes, such as `users/*/operations`. To
|
126
|
-
# override the binding, API services can add a binding such as
|
127
|
-
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
128
|
-
# For backwards compatibility, the default name includes the operations
|
129
|
-
# collection id, however overriding users must ensure the name binding
|
130
|
-
# is the parent resource, without the operations collection id.
|
131
|
-
#
|
132
127
|
# @overload list_operations(request, options = nil)
|
133
128
|
# Pass arguments to `list_operations` via a request object, either of type
|
134
129
|
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
@@ -191,10 +186,11 @@ module Google
|
|
191
186
|
# Customize the options with defaults
|
192
187
|
metadata = @config.rpcs.list_operations.metadata.to_h
|
193
188
|
|
194
|
-
# Set x-goog-api-client
|
189
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
195
190
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
196
191
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
197
192
|
gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION
|
193
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
198
194
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
199
195
|
|
200
196
|
header_params = {}
|
@@ -217,7 +213,7 @@ module Google
|
|
217
213
|
wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
|
218
214
|
response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
|
219
215
|
yield response, operation if block_given?
|
220
|
-
|
216
|
+
throw :response, response
|
221
217
|
end
|
222
218
|
rescue ::GRPC::BadStatus => e
|
223
219
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -287,10 +283,11 @@ module Google
|
|
287
283
|
# Customize the options with defaults
|
288
284
|
metadata = @config.rpcs.get_operation.metadata.to_h
|
289
285
|
|
290
|
-
# Set x-goog-api-client
|
286
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
291
287
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
292
288
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
293
289
|
gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION
|
290
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
294
291
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
295
292
|
|
296
293
|
header_params = {}
|
@@ -312,7 +309,7 @@ module Google
|
|
312
309
|
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
313
310
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
314
311
|
yield response, operation if block_given?
|
315
|
-
|
312
|
+
throw :response, response
|
316
313
|
end
|
317
314
|
rescue ::GRPC::BadStatus => e
|
318
315
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -376,10 +373,11 @@ module Google
|
|
376
373
|
# Customize the options with defaults
|
377
374
|
metadata = @config.rpcs.delete_operation.metadata.to_h
|
378
375
|
|
379
|
-
# Set x-goog-api-client
|
376
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
380
377
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
381
378
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
382
379
|
gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION
|
380
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
383
381
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
384
382
|
|
385
383
|
header_params = {}
|
@@ -400,7 +398,6 @@ module Google
|
|
400
398
|
|
401
399
|
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
402
400
|
yield response, operation if block_given?
|
403
|
-
return response
|
404
401
|
end
|
405
402
|
rescue ::GRPC::BadStatus => e
|
406
403
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -415,8 +412,9 @@ module Google
|
|
415
412
|
# other methods to check whether the cancellation succeeded or whether the
|
416
413
|
# operation completed despite cancellation. On successful cancellation,
|
417
414
|
# the operation is not deleted; instead, it becomes an operation with
|
418
|
-
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
419
|
-
# corresponding to
|
415
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
416
|
+
# {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
|
417
|
+
# `Code.CANCELLED`.
|
420
418
|
#
|
421
419
|
# @overload cancel_operation(request, options = nil)
|
422
420
|
# Pass arguments to `cancel_operation` via a request object, either of type
|
@@ -470,10 +468,11 @@ module Google
|
|
470
468
|
# Customize the options with defaults
|
471
469
|
metadata = @config.rpcs.cancel_operation.metadata.to_h
|
472
470
|
|
473
|
-
# Set x-goog-api-client
|
471
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
474
472
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
475
473
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
476
474
|
gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION
|
475
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
477
476
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
478
477
|
|
479
478
|
header_params = {}
|
@@ -494,7 +493,6 @@ module Google
|
|
494
493
|
|
495
494
|
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
496
495
|
yield response, operation if block_given?
|
497
|
-
return response
|
498
496
|
end
|
499
497
|
rescue ::GRPC::BadStatus => e
|
500
498
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -574,10 +572,11 @@ module Google
|
|
574
572
|
# Customize the options with defaults
|
575
573
|
metadata = @config.rpcs.wait_operation.metadata.to_h
|
576
574
|
|
577
|
-
# Set x-goog-api-client
|
575
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
578
576
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
579
577
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
580
578
|
gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION
|
579
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
581
580
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
582
581
|
|
583
582
|
header_params = {}
|
@@ -599,7 +598,7 @@ module Google
|
|
599
598
|
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
600
599
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
601
600
|
yield response, operation if block_given?
|
602
|
-
|
601
|
+
throw :response, response
|
603
602
|
end
|
604
603
|
rescue ::GRPC::BadStatus => e
|
605
604
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -688,6 +687,11 @@ module Google
|
|
688
687
|
# default endpoint URL. The default value of nil uses the environment
|
689
688
|
# universe (usually the default "googleapis.com" universe).
|
690
689
|
# @return [::String,nil]
|
690
|
+
# @!attribute [rw] logger
|
691
|
+
# A custom logger to use for request/response debug logging, or the value
|
692
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
693
|
+
# explicitly disable logging.
|
694
|
+
# @return [::Logger,:default,nil]
|
691
695
|
#
|
692
696
|
class Configuration
|
693
697
|
extend ::Gapic::Config
|
@@ -712,6 +716,7 @@ module Google
|
|
712
716
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
713
717
|
config_attr :quota_project, nil, ::String, nil
|
714
718
|
config_attr :universe_domain, nil, ::String, nil
|
719
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
715
720
|
|
716
721
|
# @private
|
717
722
|
def initialize parent_config = nil
|
@@ -35,6 +35,9 @@ module Google
|
|
35
35
|
# snake_case or kebab-case, either of those cases is accepted.
|
36
36
|
#
|
37
37
|
class Client
|
38
|
+
# @private
|
39
|
+
API_VERSION = ""
|
40
|
+
|
38
41
|
# @private
|
39
42
|
DEFAULT_ENDPOINT_TEMPLATE = "automl.$UNIVERSE_DOMAIN$"
|
40
43
|
|
@@ -161,8 +164,19 @@ module Google
|
|
161
164
|
endpoint: @config.endpoint,
|
162
165
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
163
166
|
universe_domain: @config.universe_domain,
|
164
|
-
credentials: credentials
|
167
|
+
credentials: credentials,
|
168
|
+
logger: @config.logger
|
165
169
|
)
|
170
|
+
|
171
|
+
@prediction_service_stub.logger(stub: true)&.info do |entry|
|
172
|
+
entry.set_system_name
|
173
|
+
entry.set_service
|
174
|
+
entry.message = "Created client for #{entry.service}"
|
175
|
+
entry.set_credentials_fields credentials
|
176
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
177
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
178
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
179
|
+
end
|
166
180
|
end
|
167
181
|
|
168
182
|
##
|
@@ -172,6 +186,15 @@ module Google
|
|
172
186
|
#
|
173
187
|
attr_reader :operations_client
|
174
188
|
|
189
|
+
##
|
190
|
+
# The logger used for request/response debug logging.
|
191
|
+
#
|
192
|
+
# @return [Logger]
|
193
|
+
#
|
194
|
+
def logger
|
195
|
+
@prediction_service_stub.logger
|
196
|
+
end
|
197
|
+
|
175
198
|
# Service calls
|
176
199
|
|
177
200
|
##
|
@@ -270,12 +293,13 @@ module Google
|
|
270
293
|
# Customize the options with defaults
|
271
294
|
call_metadata = @config.rpcs.predict.metadata.to_h
|
272
295
|
|
273
|
-
# Set x-goog-api-client
|
296
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
274
297
|
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
275
298
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
276
299
|
gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION,
|
277
300
|
transports_version_send: [:rest]
|
278
301
|
|
302
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
279
303
|
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
280
304
|
|
281
305
|
options.apply_defaults timeout: @config.rpcs.predict.timeout,
|
@@ -288,7 +312,6 @@ module Google
|
|
288
312
|
|
289
313
|
@prediction_service_stub.predict request, options do |result, operation|
|
290
314
|
yield result, operation if block_given?
|
291
|
-
return result
|
292
315
|
end
|
293
316
|
rescue ::Gapic::Rest::Error => e
|
294
317
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -442,12 +465,13 @@ module Google
|
|
442
465
|
# Customize the options with defaults
|
443
466
|
call_metadata = @config.rpcs.batch_predict.metadata.to_h
|
444
467
|
|
445
|
-
# Set x-goog-api-client
|
468
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
446
469
|
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
447
470
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
448
471
|
gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION,
|
449
472
|
transports_version_send: [:rest]
|
450
473
|
|
474
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
451
475
|
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
452
476
|
|
453
477
|
options.apply_defaults timeout: @config.rpcs.batch_predict.timeout,
|
@@ -461,7 +485,7 @@ module Google
|
|
461
485
|
@prediction_service_stub.batch_predict request, options do |result, operation|
|
462
486
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
463
487
|
yield result, operation if block_given?
|
464
|
-
|
488
|
+
throw :response, result
|
465
489
|
end
|
466
490
|
rescue ::Gapic::Rest::Error => e
|
467
491
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -541,6 +565,11 @@ module Google
|
|
541
565
|
# default endpoint URL. The default value of nil uses the environment
|
542
566
|
# universe (usually the default "googleapis.com" universe).
|
543
567
|
# @return [::String,nil]
|
568
|
+
# @!attribute [rw] logger
|
569
|
+
# A custom logger to use for request/response debug logging, or the value
|
570
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
571
|
+
# explicitly disable logging.
|
572
|
+
# @return [::Logger,:default,nil]
|
544
573
|
#
|
545
574
|
class Configuration
|
546
575
|
extend ::Gapic::Config
|
@@ -562,6 +591,7 @@ module Google
|
|
562
591
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
563
592
|
config_attr :quota_project, nil, ::String, nil
|
564
593
|
config_attr :universe_domain, nil, ::String, nil
|
594
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
565
595
|
|
566
596
|
# @private
|
567
597
|
def initialize parent_config = nil
|