google-cloud-automl-v1 0.2.7 → 0.4.2
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/automl/v1/automl/client.rb +39 -60
- data/lib/google/cloud/automl/v1/automl/operations.rb +96 -11
- data/lib/google/cloud/automl/v1/prediction_service/client.rb +14 -8
- data/lib/google/cloud/automl/v1/prediction_service/operations.rb +96 -11
- data/lib/google/cloud/automl/v1/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +12 -0
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- metadata +19 -11
@@ -73,7 +73,7 @@ module Google
|
|
73
73
|
parent_config = while namespace.any?
|
74
74
|
parent_name = namespace.join "::"
|
75
75
|
parent_const = const_get parent_name
|
76
|
-
break parent_const.configure if parent_const
|
76
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
77
77
|
namespace.pop
|
78
78
|
end
|
79
79
|
default_config = Client::Configuration.new parent_config
|
@@ -82,28 +82,19 @@ module Google
|
|
82
82
|
|
83
83
|
default_config.rpcs.get_dataset.timeout = 5.0
|
84
84
|
default_config.rpcs.get_dataset.retry_policy = {
|
85
|
-
initial_delay: 0.1,
|
86
|
-
max_delay: 60.0,
|
87
|
-
multiplier: 1.3,
|
88
|
-
retry_codes: [4, 14]
|
85
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
89
86
|
}
|
90
87
|
|
91
88
|
default_config.rpcs.list_datasets.timeout = 5.0
|
92
89
|
default_config.rpcs.list_datasets.retry_policy = {
|
93
|
-
initial_delay: 0.1,
|
94
|
-
max_delay: 60.0,
|
95
|
-
multiplier: 1.3,
|
96
|
-
retry_codes: [4, 14]
|
90
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
97
91
|
}
|
98
92
|
|
99
93
|
default_config.rpcs.update_dataset.timeout = 5.0
|
100
94
|
|
101
95
|
default_config.rpcs.delete_dataset.timeout = 5.0
|
102
96
|
default_config.rpcs.delete_dataset.retry_policy = {
|
103
|
-
initial_delay: 0.1,
|
104
|
-
max_delay: 60.0,
|
105
|
-
multiplier: 1.3,
|
106
|
-
retry_codes: [4, 14]
|
97
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
107
98
|
}
|
108
99
|
|
109
100
|
default_config.rpcs.import_data.timeout = 5.0
|
@@ -112,36 +103,24 @@ module Google
|
|
112
103
|
|
113
104
|
default_config.rpcs.get_annotation_spec.timeout = 5.0
|
114
105
|
default_config.rpcs.get_annotation_spec.retry_policy = {
|
115
|
-
initial_delay: 0.1,
|
116
|
-
max_delay: 60.0,
|
117
|
-
multiplier: 1.3,
|
118
|
-
retry_codes: [4, 14]
|
106
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
119
107
|
}
|
120
108
|
|
121
109
|
default_config.rpcs.create_model.timeout = 5.0
|
122
110
|
|
123
111
|
default_config.rpcs.get_model.timeout = 5.0
|
124
112
|
default_config.rpcs.get_model.retry_policy = {
|
125
|
-
initial_delay: 0.1,
|
126
|
-
max_delay: 60.0,
|
127
|
-
multiplier: 1.3,
|
128
|
-
retry_codes: [4, 14]
|
113
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
129
114
|
}
|
130
115
|
|
131
116
|
default_config.rpcs.list_models.timeout = 5.0
|
132
117
|
default_config.rpcs.list_models.retry_policy = {
|
133
|
-
initial_delay: 0.1,
|
134
|
-
max_delay: 60.0,
|
135
|
-
multiplier: 1.3,
|
136
|
-
retry_codes: [4, 14]
|
118
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
137
119
|
}
|
138
120
|
|
139
121
|
default_config.rpcs.delete_model.timeout = 5.0
|
140
122
|
default_config.rpcs.delete_model.retry_policy = {
|
141
|
-
initial_delay: 0.1,
|
142
|
-
max_delay: 60.0,
|
143
|
-
multiplier: 1.3,
|
144
|
-
retry_codes: [4, 14]
|
123
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
145
124
|
}
|
146
125
|
|
147
126
|
default_config.rpcs.update_model.timeout = 5.0
|
@@ -154,18 +133,12 @@ module Google
|
|
154
133
|
|
155
134
|
default_config.rpcs.get_model_evaluation.timeout = 5.0
|
156
135
|
default_config.rpcs.get_model_evaluation.retry_policy = {
|
157
|
-
initial_delay: 0.1,
|
158
|
-
max_delay: 60.0,
|
159
|
-
multiplier: 1.3,
|
160
|
-
retry_codes: [4, 14]
|
136
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
161
137
|
}
|
162
138
|
|
163
139
|
default_config.rpcs.list_model_evaluations.timeout = 5.0
|
164
140
|
default_config.rpcs.list_model_evaluations.retry_policy = {
|
165
|
-
initial_delay: 0.1,
|
166
|
-
max_delay: 60.0,
|
167
|
-
multiplier: 1.3,
|
168
|
-
retry_codes: [4, 14]
|
141
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
169
142
|
}
|
170
143
|
|
171
144
|
default_config
|
@@ -229,8 +202,14 @@ module Google
|
|
229
202
|
|
230
203
|
# Create credentials
|
231
204
|
credentials = @config.credentials
|
232
|
-
|
233
|
-
if
|
205
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
206
|
+
# but only if the default endpoint does not have a region prefix.
|
207
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
208
|
+
@config.endpoint == Client.configure.endpoint &&
|
209
|
+
!@config.endpoint.split(".").first.include?("-")
|
210
|
+
credentials ||= Credentials.default scope: @config.scope,
|
211
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
212
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
234
213
|
credentials = Credentials.new credentials, scope: @config.scope
|
235
214
|
end
|
236
215
|
@quota_project_id = @config.quota_project
|
@@ -1670,7 +1649,7 @@ module Google
|
|
1670
1649
|
config_attr :scope, nil, ::String, ::Array, nil
|
1671
1650
|
config_attr :lib_name, nil, ::String, nil
|
1672
1651
|
config_attr :lib_version, nil, ::String, nil
|
1673
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
1652
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1674
1653
|
config_attr :interceptors, nil, ::Array, nil
|
1675
1654
|
config_attr :timeout, nil, ::Numeric, nil
|
1676
1655
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -1691,7 +1670,7 @@ module Google
|
|
1691
1670
|
def rpcs
|
1692
1671
|
@rpcs ||= begin
|
1693
1672
|
parent_rpcs = nil
|
1694
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
1673
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1695
1674
|
Rpcs.new parent_rpcs
|
1696
1675
|
end
|
1697
1676
|
end
|
@@ -1703,7 +1682,7 @@ module Google
|
|
1703
1682
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1704
1683
|
# the following configuration fields:
|
1705
1684
|
#
|
1706
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
1685
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1707
1686
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1708
1687
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1709
1688
|
# include the following keys:
|
@@ -1807,41 +1786,41 @@ module Google
|
|
1807
1786
|
|
1808
1787
|
# @private
|
1809
1788
|
def initialize parent_rpcs = nil
|
1810
|
-
create_dataset_config = parent_rpcs
|
1789
|
+
create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset
|
1811
1790
|
@create_dataset = ::Gapic::Config::Method.new create_dataset_config
|
1812
|
-
get_dataset_config = parent_rpcs
|
1791
|
+
get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset
|
1813
1792
|
@get_dataset = ::Gapic::Config::Method.new get_dataset_config
|
1814
|
-
list_datasets_config = parent_rpcs
|
1793
|
+
list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets
|
1815
1794
|
@list_datasets = ::Gapic::Config::Method.new list_datasets_config
|
1816
|
-
update_dataset_config = parent_rpcs
|
1795
|
+
update_dataset_config = parent_rpcs.update_dataset if parent_rpcs.respond_to? :update_dataset
|
1817
1796
|
@update_dataset = ::Gapic::Config::Method.new update_dataset_config
|
1818
|
-
delete_dataset_config = parent_rpcs
|
1797
|
+
delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset
|
1819
1798
|
@delete_dataset = ::Gapic::Config::Method.new delete_dataset_config
|
1820
|
-
import_data_config = parent_rpcs
|
1799
|
+
import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data
|
1821
1800
|
@import_data = ::Gapic::Config::Method.new import_data_config
|
1822
|
-
export_data_config = parent_rpcs
|
1801
|
+
export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data
|
1823
1802
|
@export_data = ::Gapic::Config::Method.new export_data_config
|
1824
|
-
get_annotation_spec_config = parent_rpcs
|
1803
|
+
get_annotation_spec_config = parent_rpcs.get_annotation_spec if parent_rpcs.respond_to? :get_annotation_spec
|
1825
1804
|
@get_annotation_spec = ::Gapic::Config::Method.new get_annotation_spec_config
|
1826
|
-
create_model_config = parent_rpcs
|
1805
|
+
create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model
|
1827
1806
|
@create_model = ::Gapic::Config::Method.new create_model_config
|
1828
|
-
get_model_config = parent_rpcs
|
1807
|
+
get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model
|
1829
1808
|
@get_model = ::Gapic::Config::Method.new get_model_config
|
1830
|
-
list_models_config = parent_rpcs
|
1809
|
+
list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models
|
1831
1810
|
@list_models = ::Gapic::Config::Method.new list_models_config
|
1832
|
-
delete_model_config = parent_rpcs
|
1811
|
+
delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model
|
1833
1812
|
@delete_model = ::Gapic::Config::Method.new delete_model_config
|
1834
|
-
update_model_config = parent_rpcs
|
1813
|
+
update_model_config = parent_rpcs.update_model if parent_rpcs.respond_to? :update_model
|
1835
1814
|
@update_model = ::Gapic::Config::Method.new update_model_config
|
1836
|
-
deploy_model_config = parent_rpcs
|
1815
|
+
deploy_model_config = parent_rpcs.deploy_model if parent_rpcs.respond_to? :deploy_model
|
1837
1816
|
@deploy_model = ::Gapic::Config::Method.new deploy_model_config
|
1838
|
-
undeploy_model_config = parent_rpcs
|
1817
|
+
undeploy_model_config = parent_rpcs.undeploy_model if parent_rpcs.respond_to? :undeploy_model
|
1839
1818
|
@undeploy_model = ::Gapic::Config::Method.new undeploy_model_config
|
1840
|
-
export_model_config = parent_rpcs
|
1819
|
+
export_model_config = parent_rpcs.export_model if parent_rpcs.respond_to? :export_model
|
1841
1820
|
@export_model = ::Gapic::Config::Method.new export_model_config
|
1842
|
-
get_model_evaluation_config = parent_rpcs
|
1821
|
+
get_model_evaluation_config = parent_rpcs.get_model_evaluation if parent_rpcs.respond_to? :get_model_evaluation
|
1843
1822
|
@get_model_evaluation = ::Gapic::Config::Method.new get_model_evaluation_config
|
1844
|
-
list_model_evaluations_config = parent_rpcs
|
1823
|
+
list_model_evaluations_config = parent_rpcs.list_model_evaluations if parent_rpcs.respond_to? :list_model_evaluations
|
1845
1824
|
@list_model_evaluations = ::Gapic::Config::Method.new list_model_evaluations_config
|
1846
1825
|
|
1847
1826
|
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::AutoML::V1::VERSION
|
454
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
|
+
metadata: metadata,
|
458
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
+
options.apply_defaults metadata: @config.metadata,
|
460
|
+
retry_policy: @config.retry_policy
|
461
|
+
|
462
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
463
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
464
|
+
yield response, operation if block_given?
|
465
|
+
return response
|
466
|
+
end
|
467
|
+
rescue ::GRPC::BadStatus => e
|
468
|
+
raise ::Google::Cloud::Error.from_error(e)
|
469
|
+
end
|
470
|
+
|
393
471
|
##
|
394
472
|
# Configuration class for the Operations API.
|
395
473
|
#
|
@@ -482,7 +560,7 @@ module Google
|
|
482
560
|
config_attr :scope, nil, ::String, ::Array, nil
|
483
561
|
config_attr :lib_name, nil, ::String, nil
|
484
562
|
config_attr :lib_version, nil, ::String, nil
|
485
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
563
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
486
564
|
config_attr :interceptors, nil, ::Array, nil
|
487
565
|
config_attr :timeout, nil, ::Numeric, nil
|
488
566
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -503,7 +581,7 @@ module Google
|
|
503
581
|
def rpcs
|
504
582
|
@rpcs ||= begin
|
505
583
|
parent_rpcs = nil
|
506
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
584
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
507
585
|
Rpcs.new parent_rpcs
|
508
586
|
end
|
509
587
|
end
|
@@ -515,7 +593,7 @@ module Google
|
|
515
593
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
516
594
|
# the following configuration fields:
|
517
595
|
#
|
518
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
596
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
519
597
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
520
598
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
521
599
|
# include the following keys:
|
@@ -546,17 +624,24 @@ module Google
|
|
546
624
|
# @return [::Gapic::Config::Method]
|
547
625
|
#
|
548
626
|
attr_reader :cancel_operation
|
627
|
+
##
|
628
|
+
# RPC-specific configuration for `wait_operation`
|
629
|
+
# @return [::Gapic::Config::Method]
|
630
|
+
#
|
631
|
+
attr_reader :wait_operation
|
549
632
|
|
550
633
|
# @private
|
551
634
|
def initialize parent_rpcs = nil
|
552
|
-
list_operations_config = parent_rpcs
|
635
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
553
636
|
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
554
|
-
get_operation_config = parent_rpcs
|
637
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
555
638
|
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
556
|
-
delete_operation_config = parent_rpcs
|
639
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
557
640
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
558
|
-
cancel_operation_config = parent_rpcs
|
641
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
559
642
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
643
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
644
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
560
645
|
|
561
646
|
yield self if block_given?
|
562
647
|
end
|
@@ -63,7 +63,7 @@ module Google
|
|
63
63
|
parent_config = while namespace.any?
|
64
64
|
parent_name = namespace.join "::"
|
65
65
|
parent_const = const_get parent_name
|
66
|
-
break parent_const.configure if parent_const
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
67
|
namespace.pop
|
68
68
|
end
|
69
69
|
default_config = Client::Configuration.new parent_config
|
@@ -133,8 +133,14 @@ module Google
|
|
133
133
|
|
134
134
|
# Create credentials
|
135
135
|
credentials = @config.credentials
|
136
|
-
|
137
|
-
if
|
136
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
137
|
+
# but only if the default endpoint does not have a region prefix.
|
138
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
139
|
+
@config.endpoint == Client.configure.endpoint &&
|
140
|
+
!@config.endpoint.split(".").first.include?("-")
|
141
|
+
credentials ||= Credentials.default scope: @config.scope,
|
142
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
143
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
138
144
|
credentials = Credentials.new credentials, scope: @config.scope
|
139
145
|
end
|
140
146
|
@quota_project_id = @config.quota_project
|
@@ -561,7 +567,7 @@ module Google
|
|
561
567
|
config_attr :scope, nil, ::String, ::Array, nil
|
562
568
|
config_attr :lib_name, nil, ::String, nil
|
563
569
|
config_attr :lib_version, nil, ::String, nil
|
564
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
570
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
565
571
|
config_attr :interceptors, nil, ::Array, nil
|
566
572
|
config_attr :timeout, nil, ::Numeric, nil
|
567
573
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -582,7 +588,7 @@ module Google
|
|
582
588
|
def rpcs
|
583
589
|
@rpcs ||= begin
|
584
590
|
parent_rpcs = nil
|
585
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
591
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
586
592
|
Rpcs.new parent_rpcs
|
587
593
|
end
|
588
594
|
end
|
@@ -594,7 +600,7 @@ module Google
|
|
594
600
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
595
601
|
# the following configuration fields:
|
596
602
|
#
|
597
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
603
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
598
604
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
599
605
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
600
606
|
# include the following keys:
|
@@ -618,9 +624,9 @@ module Google
|
|
618
624
|
|
619
625
|
# @private
|
620
626
|
def initialize parent_rpcs = nil
|
621
|
-
predict_config = parent_rpcs
|
627
|
+
predict_config = parent_rpcs.predict if parent_rpcs.respond_to? :predict
|
622
628
|
@predict = ::Gapic::Config::Method.new predict_config
|
623
|
-
batch_predict_config = parent_rpcs
|
629
|
+
batch_predict_config = parent_rpcs.batch_predict if parent_rpcs.respond_to? :batch_predict
|
624
630
|
@batch_predict = ::Gapic::Config::Method.new batch_predict_config
|
625
631
|
|
626
632
|
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::AutoML::V1::VERSION
|
454
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
|
+
metadata: metadata,
|
458
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
+
options.apply_defaults metadata: @config.metadata,
|
460
|
+
retry_policy: @config.retry_policy
|
461
|
+
|
462
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
463
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
464
|
+
yield response, operation if block_given?
|
465
|
+
return response
|
466
|
+
end
|
467
|
+
rescue ::GRPC::BadStatus => e
|
468
|
+
raise ::Google::Cloud::Error.from_error(e)
|
469
|
+
end
|
470
|
+
|
393
471
|
##
|
394
472
|
# Configuration class for the Operations API.
|
395
473
|
#
|
@@ -482,7 +560,7 @@ module Google
|
|
482
560
|
config_attr :scope, nil, ::String, ::Array, nil
|
483
561
|
config_attr :lib_name, nil, ::String, nil
|
484
562
|
config_attr :lib_version, nil, ::String, nil
|
485
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
563
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
486
564
|
config_attr :interceptors, nil, ::Array, nil
|
487
565
|
config_attr :timeout, nil, ::Numeric, nil
|
488
566
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -503,7 +581,7 @@ module Google
|
|
503
581
|
def rpcs
|
504
582
|
@rpcs ||= begin
|
505
583
|
parent_rpcs = nil
|
506
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
584
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
507
585
|
Rpcs.new parent_rpcs
|
508
586
|
end
|
509
587
|
end
|
@@ -515,7 +593,7 @@ module Google
|
|
515
593
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
516
594
|
# the following configuration fields:
|
517
595
|
#
|
518
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
596
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
519
597
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
520
598
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
521
599
|
# include the following keys:
|
@@ -546,17 +624,24 @@ module Google
|
|
546
624
|
# @return [::Gapic::Config::Method]
|
547
625
|
#
|
548
626
|
attr_reader :cancel_operation
|
627
|
+
##
|
628
|
+
# RPC-specific configuration for `wait_operation`
|
629
|
+
# @return [::Gapic::Config::Method]
|
630
|
+
#
|
631
|
+
attr_reader :wait_operation
|
549
632
|
|
550
633
|
# @private
|
551
634
|
def initialize parent_rpcs = nil
|
552
|
-
list_operations_config = parent_rpcs
|
635
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
553
636
|
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
554
|
-
get_operation_config = parent_rpcs
|
637
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
555
638
|
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
556
|
-
delete_operation_config = parent_rpcs
|
639
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
557
640
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
558
|
-
cancel_operation_config = parent_rpcs
|
641
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
559
642
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
643
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
644
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
560
645
|
|
561
646
|
yield self if block_given?
|
562
647
|
end
|