google-cloud-automl-v1beta1 0.3.1 → 0.5.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/v1beta1/automl/client.rb +48 -78
- data/lib/google/cloud/automl/v1beta1/automl/operations.rb +96 -11
- data/lib/google/cloud/automl/v1beta1/prediction_service/client.rb +14 -8
- data/lib/google/cloud/automl/v1beta1/prediction_service/operations.rb +96 -11
- data/lib/google/cloud/automl/v1beta1/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: [14, 4]
|
85
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
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: [14, 4]
|
90
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
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: [14, 4]
|
97
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
107
98
|
}
|
108
99
|
|
109
100
|
default_config.rpcs.import_data.timeout = 5.0
|
@@ -112,44 +103,29 @@ 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: [14, 4]
|
106
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
119
107
|
}
|
120
108
|
|
121
109
|
default_config.rpcs.get_table_spec.timeout = 5.0
|
122
110
|
default_config.rpcs.get_table_spec.retry_policy = {
|
123
|
-
initial_delay: 0.1,
|
124
|
-
max_delay: 60.0,
|
125
|
-
multiplier: 1.3,
|
126
|
-
retry_codes: [14, 4]
|
111
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
127
112
|
}
|
128
113
|
|
129
114
|
default_config.rpcs.list_table_specs.timeout = 5.0
|
130
115
|
default_config.rpcs.list_table_specs.retry_policy = {
|
131
|
-
initial_delay: 0.1,
|
132
|
-
max_delay: 60.0,
|
133
|
-
multiplier: 1.3,
|
134
|
-
retry_codes: [14, 4]
|
116
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
135
117
|
}
|
136
118
|
|
137
119
|
default_config.rpcs.update_table_spec.timeout = 5.0
|
138
120
|
|
139
121
|
default_config.rpcs.get_column_spec.timeout = 5.0
|
140
122
|
default_config.rpcs.get_column_spec.retry_policy = {
|
141
|
-
initial_delay: 0.1,
|
142
|
-
max_delay: 60.0,
|
143
|
-
multiplier: 1.3,
|
144
|
-
retry_codes: [14, 4]
|
123
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
145
124
|
}
|
146
125
|
|
147
126
|
default_config.rpcs.list_column_specs.timeout = 5.0
|
148
127
|
default_config.rpcs.list_column_specs.retry_policy = {
|
149
|
-
initial_delay: 0.1,
|
150
|
-
max_delay: 60.0,
|
151
|
-
multiplier: 1.3,
|
152
|
-
retry_codes: [14, 4]
|
128
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
153
129
|
}
|
154
130
|
|
155
131
|
default_config.rpcs.update_column_spec.timeout = 5.0
|
@@ -158,26 +134,17 @@ module Google
|
|
158
134
|
|
159
135
|
default_config.rpcs.get_model.timeout = 5.0
|
160
136
|
default_config.rpcs.get_model.retry_policy = {
|
161
|
-
initial_delay: 0.1,
|
162
|
-
max_delay: 60.0,
|
163
|
-
multiplier: 1.3,
|
164
|
-
retry_codes: [14, 4]
|
137
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
165
138
|
}
|
166
139
|
|
167
140
|
default_config.rpcs.list_models.timeout = 5.0
|
168
141
|
default_config.rpcs.list_models.retry_policy = {
|
169
|
-
initial_delay: 0.1,
|
170
|
-
max_delay: 60.0,
|
171
|
-
multiplier: 1.3,
|
172
|
-
retry_codes: [14, 4]
|
142
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
173
143
|
}
|
174
144
|
|
175
145
|
default_config.rpcs.delete_model.timeout = 5.0
|
176
146
|
default_config.rpcs.delete_model.retry_policy = {
|
177
|
-
initial_delay: 0.1,
|
178
|
-
max_delay: 60.0,
|
179
|
-
multiplier: 1.3,
|
180
|
-
retry_codes: [14, 4]
|
147
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
181
148
|
}
|
182
149
|
|
183
150
|
default_config.rpcs.deploy_model.timeout = 5.0
|
@@ -190,10 +157,7 @@ module Google
|
|
190
157
|
|
191
158
|
default_config.rpcs.get_model_evaluation.timeout = 5.0
|
192
159
|
default_config.rpcs.get_model_evaluation.retry_policy = {
|
193
|
-
initial_delay: 0.1,
|
194
|
-
max_delay: 60.0,
|
195
|
-
multiplier: 1.3,
|
196
|
-
retry_codes: [14, 4]
|
160
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
197
161
|
}
|
198
162
|
|
199
163
|
default_config.rpcs.list_model_evaluations.timeout = 5.0
|
@@ -259,8 +223,14 @@ module Google
|
|
259
223
|
|
260
224
|
# Create credentials
|
261
225
|
credentials = @config.credentials
|
262
|
-
|
263
|
-
if
|
226
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
227
|
+
# but only if the default endpoint does not have a region prefix.
|
228
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
229
|
+
@config.endpoint == Client.configure.endpoint &&
|
230
|
+
!@config.endpoint.split(".").first.include?("-")
|
231
|
+
credentials ||= Credentials.default scope: @config.scope,
|
232
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
233
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
264
234
|
credentials = Credentials.new credentials, scope: @config.scope
|
265
235
|
end
|
266
236
|
@quota_project_id = @config.quota_project
|
@@ -2145,7 +2115,7 @@ module Google
|
|
2145
2115
|
config_attr :scope, nil, ::String, ::Array, nil
|
2146
2116
|
config_attr :lib_name, nil, ::String, nil
|
2147
2117
|
config_attr :lib_version, nil, ::String, nil
|
2148
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
2118
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
2149
2119
|
config_attr :interceptors, nil, ::Array, nil
|
2150
2120
|
config_attr :timeout, nil, ::Numeric, nil
|
2151
2121
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -2166,7 +2136,7 @@ module Google
|
|
2166
2136
|
def rpcs
|
2167
2137
|
@rpcs ||= begin
|
2168
2138
|
parent_rpcs = nil
|
2169
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
2139
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
2170
2140
|
Rpcs.new parent_rpcs
|
2171
2141
|
end
|
2172
2142
|
end
|
@@ -2178,7 +2148,7 @@ module Google
|
|
2178
2148
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
2179
2149
|
# the following configuration fields:
|
2180
2150
|
#
|
2181
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
2151
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
2182
2152
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
2183
2153
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
2184
2154
|
# include the following keys:
|
@@ -2312,53 +2282,53 @@ module Google
|
|
2312
2282
|
|
2313
2283
|
# @private
|
2314
2284
|
def initialize parent_rpcs = nil
|
2315
|
-
create_dataset_config = parent_rpcs
|
2285
|
+
create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset
|
2316
2286
|
@create_dataset = ::Gapic::Config::Method.new create_dataset_config
|
2317
|
-
get_dataset_config = parent_rpcs
|
2287
|
+
get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset
|
2318
2288
|
@get_dataset = ::Gapic::Config::Method.new get_dataset_config
|
2319
|
-
list_datasets_config = parent_rpcs
|
2289
|
+
list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets
|
2320
2290
|
@list_datasets = ::Gapic::Config::Method.new list_datasets_config
|
2321
|
-
update_dataset_config = parent_rpcs
|
2291
|
+
update_dataset_config = parent_rpcs.update_dataset if parent_rpcs.respond_to? :update_dataset
|
2322
2292
|
@update_dataset = ::Gapic::Config::Method.new update_dataset_config
|
2323
|
-
delete_dataset_config = parent_rpcs
|
2293
|
+
delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset
|
2324
2294
|
@delete_dataset = ::Gapic::Config::Method.new delete_dataset_config
|
2325
|
-
import_data_config = parent_rpcs
|
2295
|
+
import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data
|
2326
2296
|
@import_data = ::Gapic::Config::Method.new import_data_config
|
2327
|
-
export_data_config = parent_rpcs
|
2297
|
+
export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data
|
2328
2298
|
@export_data = ::Gapic::Config::Method.new export_data_config
|
2329
|
-
get_annotation_spec_config = parent_rpcs
|
2299
|
+
get_annotation_spec_config = parent_rpcs.get_annotation_spec if parent_rpcs.respond_to? :get_annotation_spec
|
2330
2300
|
@get_annotation_spec = ::Gapic::Config::Method.new get_annotation_spec_config
|
2331
|
-
get_table_spec_config = parent_rpcs
|
2301
|
+
get_table_spec_config = parent_rpcs.get_table_spec if parent_rpcs.respond_to? :get_table_spec
|
2332
2302
|
@get_table_spec = ::Gapic::Config::Method.new get_table_spec_config
|
2333
|
-
list_table_specs_config = parent_rpcs
|
2303
|
+
list_table_specs_config = parent_rpcs.list_table_specs if parent_rpcs.respond_to? :list_table_specs
|
2334
2304
|
@list_table_specs = ::Gapic::Config::Method.new list_table_specs_config
|
2335
|
-
update_table_spec_config = parent_rpcs
|
2305
|
+
update_table_spec_config = parent_rpcs.update_table_spec if parent_rpcs.respond_to? :update_table_spec
|
2336
2306
|
@update_table_spec = ::Gapic::Config::Method.new update_table_spec_config
|
2337
|
-
get_column_spec_config = parent_rpcs
|
2307
|
+
get_column_spec_config = parent_rpcs.get_column_spec if parent_rpcs.respond_to? :get_column_spec
|
2338
2308
|
@get_column_spec = ::Gapic::Config::Method.new get_column_spec_config
|
2339
|
-
list_column_specs_config = parent_rpcs
|
2309
|
+
list_column_specs_config = parent_rpcs.list_column_specs if parent_rpcs.respond_to? :list_column_specs
|
2340
2310
|
@list_column_specs = ::Gapic::Config::Method.new list_column_specs_config
|
2341
|
-
update_column_spec_config = parent_rpcs
|
2311
|
+
update_column_spec_config = parent_rpcs.update_column_spec if parent_rpcs.respond_to? :update_column_spec
|
2342
2312
|
@update_column_spec = ::Gapic::Config::Method.new update_column_spec_config
|
2343
|
-
create_model_config = parent_rpcs
|
2313
|
+
create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model
|
2344
2314
|
@create_model = ::Gapic::Config::Method.new create_model_config
|
2345
|
-
get_model_config = parent_rpcs
|
2315
|
+
get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model
|
2346
2316
|
@get_model = ::Gapic::Config::Method.new get_model_config
|
2347
|
-
list_models_config = parent_rpcs
|
2317
|
+
list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models
|
2348
2318
|
@list_models = ::Gapic::Config::Method.new list_models_config
|
2349
|
-
delete_model_config = parent_rpcs
|
2319
|
+
delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model
|
2350
2320
|
@delete_model = ::Gapic::Config::Method.new delete_model_config
|
2351
|
-
deploy_model_config = parent_rpcs
|
2321
|
+
deploy_model_config = parent_rpcs.deploy_model if parent_rpcs.respond_to? :deploy_model
|
2352
2322
|
@deploy_model = ::Gapic::Config::Method.new deploy_model_config
|
2353
|
-
undeploy_model_config = parent_rpcs
|
2323
|
+
undeploy_model_config = parent_rpcs.undeploy_model if parent_rpcs.respond_to? :undeploy_model
|
2354
2324
|
@undeploy_model = ::Gapic::Config::Method.new undeploy_model_config
|
2355
|
-
export_model_config = parent_rpcs
|
2325
|
+
export_model_config = parent_rpcs.export_model if parent_rpcs.respond_to? :export_model
|
2356
2326
|
@export_model = ::Gapic::Config::Method.new export_model_config
|
2357
|
-
export_evaluated_examples_config = parent_rpcs
|
2327
|
+
export_evaluated_examples_config = parent_rpcs.export_evaluated_examples if parent_rpcs.respond_to? :export_evaluated_examples
|
2358
2328
|
@export_evaluated_examples = ::Gapic::Config::Method.new export_evaluated_examples_config
|
2359
|
-
get_model_evaluation_config = parent_rpcs
|
2329
|
+
get_model_evaluation_config = parent_rpcs.get_model_evaluation if parent_rpcs.respond_to? :get_model_evaluation
|
2360
2330
|
@get_model_evaluation = ::Gapic::Config::Method.new get_model_evaluation_config
|
2361
|
-
list_model_evaluations_config = parent_rpcs
|
2331
|
+
list_model_evaluations_config = parent_rpcs.list_model_evaluations if parent_rpcs.respond_to? :list_model_evaluations
|
2362
2332
|
@list_model_evaluations = ::Gapic::Config::Method.new list_model_evaluations_config
|
2363
2333
|
|
2364
2334
|
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::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
|
@@ -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
|
@@ -517,7 +523,7 @@ module Google
|
|
517
523
|
config_attr :scope, nil, ::String, ::Array, nil
|
518
524
|
config_attr :lib_name, nil, ::String, nil
|
519
525
|
config_attr :lib_version, nil, ::String, nil
|
520
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
526
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
521
527
|
config_attr :interceptors, nil, ::Array, nil
|
522
528
|
config_attr :timeout, nil, ::Numeric, nil
|
523
529
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -538,7 +544,7 @@ module Google
|
|
538
544
|
def rpcs
|
539
545
|
@rpcs ||= begin
|
540
546
|
parent_rpcs = nil
|
541
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
547
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
542
548
|
Rpcs.new parent_rpcs
|
543
549
|
end
|
544
550
|
end
|
@@ -550,7 +556,7 @@ module Google
|
|
550
556
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
551
557
|
# the following configuration fields:
|
552
558
|
#
|
553
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
559
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
554
560
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
555
561
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
556
562
|
# include the following keys:
|
@@ -574,9 +580,9 @@ module Google
|
|
574
580
|
|
575
581
|
# @private
|
576
582
|
def initialize parent_rpcs = nil
|
577
|
-
predict_config = parent_rpcs
|
583
|
+
predict_config = parent_rpcs.predict if parent_rpcs.respond_to? :predict
|
578
584
|
@predict = ::Gapic::Config::Method.new predict_config
|
579
|
-
batch_predict_config = parent_rpcs
|
585
|
+
batch_predict_config = parent_rpcs.batch_predict if parent_rpcs.respond_to? :batch_predict
|
580
586
|
@batch_predict = ::Gapic::Config::Method.new batch_predict_config
|
581
587
|
|
582
588
|
yield self if block_given?
|