google-cloud-automl-v1beta1 0.1.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +1 -1
- data/lib/google/cloud/automl/v1beta1.rb +1 -1
- data/lib/google/cloud/automl/v1beta1/automl.rb +1 -1
- data/lib/google/cloud/automl/v1beta1/automl/client.rb +497 -492
- data/lib/google/cloud/automl/v1beta1/automl/credentials.rb +1 -1
- data/lib/google/cloud/automl/v1beta1/automl/operations.rb +109 -103
- data/lib/google/cloud/automl/v1beta1/automl/paths.rb +25 -25
- data/lib/google/cloud/automl/v1beta1/prediction_service.rb +1 -1
- data/lib/google/cloud/automl/v1beta1/prediction_service/client.rb +87 -82
- data/lib/google/cloud/automl/v1beta1/prediction_service/credentials.rb +1 -1
- data/lib/google/cloud/automl/v1beta1/prediction_service/operations.rb +109 -103
- data/lib/google/cloud/automl/v1beta1/prediction_service/paths.rb +3 -3
- data/lib/google/cloud/automl/v1beta1/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +12 -12
- data/proto_docs/google/cloud/automl/v1beta1/annotation_payload.rb +13 -13
- data/proto_docs/google/cloud/automl/v1beta1/annotation_spec.rb +5 -5
- data/proto_docs/google/cloud/automl/v1beta1/classification.rb +43 -43
- data/proto_docs/google/cloud/automl/v1beta1/column_spec.rb +12 -12
- data/proto_docs/google/cloud/automl/v1beta1/data_items.rb +49 -49
- data/proto_docs/google/cloud/automl/v1beta1/data_stats.rb +65 -65
- data/proto_docs/google/cloud/automl/v1beta1/data_types.rb +23 -23
- data/proto_docs/google/cloud/automl/v1beta1/dataset.rb +17 -17
- data/proto_docs/google/cloud/automl/v1beta1/detection.rb +32 -32
- data/proto_docs/google/cloud/automl/v1beta1/geometry.rb +7 -7
- data/proto_docs/google/cloud/automl/v1beta1/image.rb +38 -38
- data/proto_docs/google/cloud/automl/v1beta1/io.rb +92 -99
- data/proto_docs/google/cloud/automl/v1beta1/model.rb +17 -17
- data/proto_docs/google/cloud/automl/v1beta1/model_evaluation.rb +17 -17
- data/proto_docs/google/cloud/automl/v1beta1/operations.rb +56 -56
- data/proto_docs/google/cloud/automl/v1beta1/prediction_service.rb +41 -41
- data/proto_docs/google/cloud/automl/v1beta1/ranges.rb +4 -4
- data/proto_docs/google/cloud/automl/v1beta1/regression.rb +7 -7
- data/proto_docs/google/cloud/automl/v1beta1/service.rb +167 -167
- data/proto_docs/google/cloud/automl/v1beta1/table_spec.rb +9 -9
- data/proto_docs/google/cloud/automl/v1beta1/tables.rb +47 -47
- data/proto_docs/google/cloud/automl/v1beta1/temporal.rb +4 -4
- data/proto_docs/google/cloud/automl/v1beta1/text.rb +15 -15
- data/proto_docs/google/cloud/automl/v1beta1/text_extraction.rb +14 -14
- data/proto_docs/google/cloud/automl/v1beta1/text_segment.rb +5 -5
- data/proto_docs/google/cloud/automl/v1beta1/text_sentiment.rb +15 -15
- data/proto_docs/google/cloud/automl/v1beta1/translation.rb +16 -16
- data/proto_docs/google/cloud/automl/v1beta1/video.rb +8 -8
- data/proto_docs/google/longrunning/operations.rb +30 -30
- data/proto_docs/google/protobuf/any.rb +4 -4
- data/proto_docs/google/protobuf/duration.rb +4 -4
- data/proto_docs/google/protobuf/empty.rb +2 -2
- data/proto_docs/google/protobuf/field_mask.rb +3 -3
- data/proto_docs/google/protobuf/struct.rb +18 -18
- data/proto_docs/google/protobuf/timestamp.rb +4 -4
- data/proto_docs/google/rpc/status.rb +6 -6
- metadata +33 -6
- data/lib/google/cloud/common_resources_pb.rb +0 -15
@@ -36,11 +36,11 @@ module Google
|
|
36
36
|
# @param dataset [String]
|
37
37
|
# @param annotation_spec [String]
|
38
38
|
#
|
39
|
-
# @return [String]
|
39
|
+
# @return [::String]
|
40
40
|
def annotation_spec_path project:, location:, dataset:, annotation_spec:
|
41
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
42
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
43
|
-
raise ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
|
41
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
42
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
43
|
+
raise ::ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
|
44
44
|
|
45
45
|
"projects/#{project}/locations/#{location}/datasets/#{dataset}/annotationSpecs/#{annotation_spec}"
|
46
46
|
end
|
@@ -58,12 +58,12 @@ module Google
|
|
58
58
|
# @param table_spec [String]
|
59
59
|
# @param column_spec [String]
|
60
60
|
#
|
61
|
-
# @return [String]
|
61
|
+
# @return [::String]
|
62
62
|
def column_spec_path project:, location:, dataset:, table_spec:, column_spec:
|
63
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
64
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
65
|
-
raise ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
|
66
|
-
raise ArgumentError, "table_spec cannot contain /" if table_spec.to_s.include? "/"
|
63
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
64
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
65
|
+
raise ::ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
|
66
|
+
raise ::ArgumentError, "table_spec cannot contain /" if table_spec.to_s.include? "/"
|
67
67
|
|
68
68
|
"projects/#{project}/locations/#{location}/datasets/#{dataset}/tableSpecs/#{table_spec}/columnSpecs/#{column_spec}"
|
69
69
|
end
|
@@ -79,10 +79,10 @@ module Google
|
|
79
79
|
# @param location [String]
|
80
80
|
# @param dataset [String]
|
81
81
|
#
|
82
|
-
# @return [String]
|
82
|
+
# @return [::String]
|
83
83
|
def dataset_path project:, location:, dataset:
|
84
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
85
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
84
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
85
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
86
86
|
|
87
87
|
"projects/#{project}/locations/#{location}/datasets/#{dataset}"
|
88
88
|
end
|
@@ -97,9 +97,9 @@ module Google
|
|
97
97
|
# @param project [String]
|
98
98
|
# @param location [String]
|
99
99
|
#
|
100
|
-
# @return [String]
|
100
|
+
# @return [::String]
|
101
101
|
def location_path project:, location:
|
102
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
102
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
103
103
|
|
104
104
|
"projects/#{project}/locations/#{location}"
|
105
105
|
end
|
@@ -115,10 +115,10 @@ module Google
|
|
115
115
|
# @param location [String]
|
116
116
|
# @param model [String]
|
117
117
|
#
|
118
|
-
# @return [String]
|
118
|
+
# @return [::String]
|
119
119
|
def model_path project:, location:, model:
|
120
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
121
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
120
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
121
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
122
122
|
|
123
123
|
"projects/#{project}/locations/#{location}/models/#{model}"
|
124
124
|
end
|
@@ -135,11 +135,11 @@ module Google
|
|
135
135
|
# @param model [String]
|
136
136
|
# @param model_evaluation [String]
|
137
137
|
#
|
138
|
-
# @return [String]
|
138
|
+
# @return [::String]
|
139
139
|
def model_evaluation_path project:, location:, model:, model_evaluation:
|
140
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
141
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
142
|
-
raise ArgumentError, "model cannot contain /" if model.to_s.include? "/"
|
140
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
141
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
142
|
+
raise ::ArgumentError, "model cannot contain /" if model.to_s.include? "/"
|
143
143
|
|
144
144
|
"projects/#{project}/locations/#{location}/models/#{model}/modelEvaluations/#{model_evaluation}"
|
145
145
|
end
|
@@ -156,11 +156,11 @@ module Google
|
|
156
156
|
# @param dataset [String]
|
157
157
|
# @param table_spec [String]
|
158
158
|
#
|
159
|
-
# @return [String]
|
159
|
+
# @return [::String]
|
160
160
|
def table_spec_path project:, location:, dataset:, table_spec:
|
161
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
162
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
163
|
-
raise ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
|
161
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
162
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
163
|
+
raise ::ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
|
164
164
|
|
165
165
|
"projects/#{project}/locations/#{location}/datasets/#{dataset}/tableSpecs/#{table_spec}"
|
166
166
|
end
|
@@ -40,7 +40,7 @@ module Google
|
|
40
40
|
# To load this service and instantiate a client:
|
41
41
|
#
|
42
42
|
# require "google/cloud/automl/v1beta1/prediction_service"
|
43
|
-
# client = Google::Cloud::AutoML::V1beta1::PredictionService::Client.new
|
43
|
+
# client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new
|
44
44
|
#
|
45
45
|
module PredictionService
|
46
46
|
end
|
@@ -41,15 +41,15 @@ module Google
|
|
41
41
|
##
|
42
42
|
# Configure the PredictionService Client class.
|
43
43
|
#
|
44
|
-
# See {Google::Cloud::AutoML::V1beta1::PredictionService::Client::Configuration}
|
44
|
+
# See {::Google::Cloud::AutoML::V1beta1::PredictionService::Client::Configuration}
|
45
45
|
# for a description of the configuration fields.
|
46
46
|
#
|
47
47
|
# ## Example
|
48
48
|
#
|
49
49
|
# To modify the configuration for all PredictionService clients:
|
50
50
|
#
|
51
|
-
# Google::Cloud::AutoML::V1beta1::PredictionService::Client.configure do |config|
|
52
|
-
# config.timeout =
|
51
|
+
# ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
53
|
# end
|
54
54
|
#
|
55
55
|
# @yield [config] Configure the Client client.
|
@@ -85,7 +85,7 @@ module Google
|
|
85
85
|
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
86
86
|
# should be made on {Client.configure}.
|
87
87
|
#
|
88
|
-
# See {Google::Cloud::AutoML::V1beta1::PredictionService::Client::Configuration}
|
88
|
+
# See {::Google::Cloud::AutoML::V1beta1::PredictionService::Client::Configuration}
|
89
89
|
# for a description of the configuration fields.
|
90
90
|
#
|
91
91
|
# @yield [config] Configure the Client client.
|
@@ -106,13 +106,13 @@ module Google
|
|
106
106
|
# To create a new PredictionService client with the default
|
107
107
|
# configuration:
|
108
108
|
#
|
109
|
-
# client = Google::Cloud::AutoML::V1beta1::PredictionService::Client.new
|
109
|
+
# client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new
|
110
110
|
#
|
111
111
|
# To create a new PredictionService client with a custom
|
112
112
|
# configuration:
|
113
113
|
#
|
114
|
-
# client = Google::Cloud::AutoML::V1beta1::PredictionService::Client.new do |config|
|
115
|
-
# config.timeout =
|
114
|
+
# client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new do |config|
|
115
|
+
# config.timeout = 10.0
|
116
116
|
# end
|
117
117
|
#
|
118
118
|
# @yield [config] Configure the PredictionService client.
|
@@ -137,15 +137,16 @@ module Google
|
|
137
137
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
138
138
|
credentials = Credentials.new credentials, scope: @config.scope
|
139
139
|
end
|
140
|
-
@quota_project_id =
|
140
|
+
@quota_project_id = @config.quota_project
|
141
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
141
142
|
|
142
143
|
@operations_client = Operations.new do |config|
|
143
144
|
config.credentials = credentials
|
144
145
|
config.endpoint = @config.endpoint
|
145
146
|
end
|
146
147
|
|
147
|
-
@prediction_service_stub = Gapic::ServiceStub.new(
|
148
|
-
Google::Cloud::AutoML::V1beta1::PredictionService::Stub,
|
148
|
+
@prediction_service_stub = ::Gapic::ServiceStub.new(
|
149
|
+
::Google::Cloud::AutoML::V1beta1::PredictionService::Stub,
|
149
150
|
credentials: credentials,
|
150
151
|
endpoint: @config.endpoint,
|
151
152
|
channel_args: @config.channel_args,
|
@@ -156,7 +157,7 @@ module Google
|
|
156
157
|
##
|
157
158
|
# Get the associated client for long-running operations.
|
158
159
|
#
|
159
|
-
# @return [Google::Cloud::AutoML::V1beta1::PredictionService::Operations]
|
160
|
+
# @return [::Google::Cloud::AutoML::V1beta1::PredictionService::Operations]
|
160
161
|
#
|
161
162
|
attr_reader :operations_client
|
162
163
|
|
@@ -185,12 +186,12 @@ module Google
|
|
185
186
|
#
|
186
187
|
# @overload predict(request, options = nil)
|
187
188
|
# Pass arguments to `predict` via a request object, either of type
|
188
|
-
# {Google::Cloud::AutoML::V1beta1::PredictRequest} or an equivalent Hash.
|
189
|
+
# {::Google::Cloud::AutoML::V1beta1::PredictRequest} or an equivalent Hash.
|
189
190
|
#
|
190
|
-
# @param request [Google::Cloud::AutoML::V1beta1::PredictRequest, Hash]
|
191
|
+
# @param request [::Google::Cloud::AutoML::V1beta1::PredictRequest, ::Hash]
|
191
192
|
# A request object representing the call parameters. Required. To specify no
|
192
193
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
193
|
-
# @param options [Gapic::CallOptions, Hash]
|
194
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
194
195
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
195
196
|
#
|
196
197
|
# @overload predict(name: nil, payload: nil, params: nil)
|
@@ -198,12 +199,12 @@ module Google
|
|
198
199
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
199
200
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
200
201
|
#
|
201
|
-
# @param name [String]
|
202
|
+
# @param name [::String]
|
202
203
|
# Required. Name of the model requested to serve the prediction.
|
203
|
-
# @param payload [Google::Cloud::AutoML::V1beta1::ExamplePayload, Hash]
|
204
|
+
# @param payload [::Google::Cloud::AutoML::V1beta1::ExamplePayload, ::Hash]
|
204
205
|
# Required. Payload to perform a prediction on. The payload must match the
|
205
206
|
# problem type that the model was trained to solve.
|
206
|
-
# @param params [Hash{String => String}]
|
207
|
+
# @param params [::Hash{::String => ::String}]
|
207
208
|
# Additional domain-specific parameters, any string must be up to 25000
|
208
209
|
# characters long.
|
209
210
|
#
|
@@ -226,26 +227,26 @@ module Google
|
|
226
227
|
# The default is false.
|
227
228
|
#
|
228
229
|
# @yield [response, operation] Access the result along with the RPC operation
|
229
|
-
# @yieldparam response [Google::Cloud::AutoML::V1beta1::PredictResponse]
|
230
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
230
|
+
# @yieldparam response [::Google::Cloud::AutoML::V1beta1::PredictResponse]
|
231
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
231
232
|
#
|
232
|
-
# @return [Google::Cloud::AutoML::V1beta1::PredictResponse]
|
233
|
+
# @return [::Google::Cloud::AutoML::V1beta1::PredictResponse]
|
233
234
|
#
|
234
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
235
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
235
236
|
#
|
236
237
|
def predict request, options = nil
|
237
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
238
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
238
239
|
|
239
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::AutoML::V1beta1::PredictRequest
|
240
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AutoML::V1beta1::PredictRequest
|
240
241
|
|
241
242
|
# Converts hash and nil to an options object
|
242
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
243
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
243
244
|
|
244
245
|
# Customize the options with defaults
|
245
246
|
metadata = @config.rpcs.predict.metadata.to_h
|
246
247
|
|
247
248
|
# Set x-goog-api-client and x-goog-user-project headers
|
248
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
249
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
249
250
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
250
251
|
gapic_version: ::Google::Cloud::Automl::V1beta1::VERSION
|
251
252
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -266,17 +267,17 @@ module Google
|
|
266
267
|
yield response, operation if block_given?
|
267
268
|
return response
|
268
269
|
end
|
269
|
-
rescue GRPC::BadStatus => e
|
270
|
-
raise Google::Cloud::Error.from_error(e)
|
270
|
+
rescue ::GRPC::BadStatus => e
|
271
|
+
raise ::Google::Cloud::Error.from_error(e)
|
271
272
|
end
|
272
273
|
|
273
274
|
##
|
274
|
-
# Perform a batch prediction. Unlike the online {Google::Cloud::AutoML::V1beta1::PredictionService::Client#predict Predict}, batch
|
275
|
+
# Perform a batch prediction. Unlike the online {::Google::Cloud::AutoML::V1beta1::PredictionService::Client#predict Predict}, batch
|
275
276
|
# prediction result won't be immediately available in the response. Instead,
|
276
277
|
# a long running operation object is returned. User can poll the operation
|
277
278
|
# result via GetOperation
|
278
|
-
# method. Once the operation is done, {Google::Cloud::AutoML::V1beta1::BatchPredictResult BatchPredictResult} is returned in
|
279
|
-
# the {Google::Longrunning::Operation#response response} field.
|
279
|
+
# method. Once the operation is done, {::Google::Cloud::AutoML::V1beta1::BatchPredictResult BatchPredictResult} is returned in
|
280
|
+
# the {::Google::Longrunning::Operation#response response} field.
|
280
281
|
# Available for following ML problems:
|
281
282
|
# * Image Classification
|
282
283
|
# * Image Object Detection
|
@@ -286,12 +287,12 @@ module Google
|
|
286
287
|
#
|
287
288
|
# @overload batch_predict(request, options = nil)
|
288
289
|
# Pass arguments to `batch_predict` via a request object, either of type
|
289
|
-
# {Google::Cloud::AutoML::V1beta1::BatchPredictRequest} or an equivalent Hash.
|
290
|
+
# {::Google::Cloud::AutoML::V1beta1::BatchPredictRequest} or an equivalent Hash.
|
290
291
|
#
|
291
|
-
# @param request [Google::Cloud::AutoML::V1beta1::BatchPredictRequest, Hash]
|
292
|
+
# @param request [::Google::Cloud::AutoML::V1beta1::BatchPredictRequest, ::Hash]
|
292
293
|
# A request object representing the call parameters. Required. To specify no
|
293
294
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
294
|
-
# @param options [Gapic::CallOptions, Hash]
|
295
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
295
296
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
296
297
|
#
|
297
298
|
# @overload batch_predict(name: nil, input_config: nil, output_config: nil, params: nil)
|
@@ -299,14 +300,14 @@ module Google
|
|
299
300
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
300
301
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
301
302
|
#
|
302
|
-
# @param name [String]
|
303
|
+
# @param name [::String]
|
303
304
|
# Required. Name of the model requested to serve the batch prediction.
|
304
|
-
# @param input_config [Google::Cloud::AutoML::V1beta1::BatchPredictInputConfig, Hash]
|
305
|
+
# @param input_config [::Google::Cloud::AutoML::V1beta1::BatchPredictInputConfig, ::Hash]
|
305
306
|
# Required. The input configuration for batch prediction.
|
306
|
-
# @param output_config [Google::Cloud::AutoML::V1beta1::BatchPredictOutputConfig, Hash]
|
307
|
+
# @param output_config [::Google::Cloud::AutoML::V1beta1::BatchPredictOutputConfig, ::Hash]
|
307
308
|
# Required. The Configuration specifying where output predictions should
|
308
309
|
# be written.
|
309
|
-
# @param params [Hash{String => String}]
|
310
|
+
# @param params [::Hash{::String => ::String}]
|
310
311
|
# Required. Additional domain-specific parameters for the predictions, any string must
|
311
312
|
# be up to 25000 characters long.
|
312
313
|
#
|
@@ -379,26 +380,26 @@ module Google
|
|
379
380
|
# returned. Value in 0 to 1 range. Default is 0.
|
380
381
|
#
|
381
382
|
# @yield [response, operation] Access the result along with the RPC operation
|
382
|
-
# @yieldparam response [Gapic::Operation]
|
383
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
383
|
+
# @yieldparam response [::Gapic::Operation]
|
384
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
384
385
|
#
|
385
|
-
# @return [Gapic::Operation]
|
386
|
+
# @return [::Gapic::Operation]
|
386
387
|
#
|
387
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
388
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
388
389
|
#
|
389
390
|
def batch_predict request, options = nil
|
390
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
391
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
391
392
|
|
392
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::AutoML::V1beta1::BatchPredictRequest
|
393
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AutoML::V1beta1::BatchPredictRequest
|
393
394
|
|
394
395
|
# Converts hash and nil to an options object
|
395
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
396
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
396
397
|
|
397
398
|
# Customize the options with defaults
|
398
399
|
metadata = @config.rpcs.batch_predict.metadata.to_h
|
399
400
|
|
400
401
|
# Set x-goog-api-client and x-goog-user-project headers
|
401
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
402
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
402
403
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
403
404
|
gapic_version: ::Google::Cloud::Automl::V1beta1::VERSION
|
404
405
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -416,12 +417,12 @@ module Google
|
|
416
417
|
retry_policy: @config.retry_policy
|
417
418
|
|
418
419
|
@prediction_service_stub.call_rpc :batch_predict, request, options: options do |response, operation|
|
419
|
-
response = Gapic::Operation.new response, @operations_client, options: options
|
420
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
420
421
|
yield response, operation if block_given?
|
421
422
|
return response
|
422
423
|
end
|
423
|
-
rescue GRPC::BadStatus => e
|
424
|
-
raise Google::Cloud::Error.from_error(e)
|
424
|
+
rescue ::GRPC::BadStatus => e
|
425
|
+
raise ::Google::Cloud::Error.from_error(e)
|
425
426
|
end
|
426
427
|
|
427
428
|
##
|
@@ -431,7 +432,7 @@ module Google
|
|
431
432
|
# providing control over timeouts, retry behavior, logging, transport
|
432
433
|
# parameters, and other low-level controls. Certain parameters can also be
|
433
434
|
# applied individually to specific RPCs. See
|
434
|
-
# {Google::Cloud::AutoML::V1beta1::PredictionService::Client::Configuration::Rpcs}
|
435
|
+
# {::Google::Cloud::AutoML::V1beta1::PredictionService::Client::Configuration::Rpcs}
|
435
436
|
# for a list of RPCs that can be configured independently.
|
436
437
|
#
|
437
438
|
# Configuration can be applied globally to all clients, or to a single client
|
@@ -442,22 +443,22 @@ module Google
|
|
442
443
|
# To modify the global config, setting the timeout for predict
|
443
444
|
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
444
445
|
#
|
445
|
-
# Google::Cloud::AutoML::V1beta1::PredictionService::Client.configure do |config|
|
446
|
-
# config.timeout =
|
447
|
-
# config.rpcs.predict.timeout =
|
446
|
+
# ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.configure do |config|
|
447
|
+
# config.timeout = 10.0
|
448
|
+
# config.rpcs.predict.timeout = 20.0
|
448
449
|
# end
|
449
450
|
#
|
450
451
|
# To apply the above configuration only to a new client:
|
451
452
|
#
|
452
|
-
# client = Google::Cloud::AutoML::V1beta1::PredictionService::Client.new do |config|
|
453
|
-
# config.timeout =
|
454
|
-
# config.rpcs.predict.timeout =
|
453
|
+
# client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new do |config|
|
454
|
+
# config.timeout = 10.0
|
455
|
+
# config.rpcs.predict.timeout = 20.0
|
455
456
|
# end
|
456
457
|
#
|
457
458
|
# @!attribute [rw] endpoint
|
458
459
|
# The hostname or hostname:port of the service endpoint.
|
459
460
|
# Defaults to `"automl.googleapis.com"`.
|
460
|
-
# @return [String]
|
461
|
+
# @return [::String]
|
461
462
|
# @!attribute [rw] credentials
|
462
463
|
# Credentials to send with calls. You may provide any of the following types:
|
463
464
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -469,29 +470,29 @@ module Google
|
|
469
470
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
470
471
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
471
472
|
# * (`nil`) indicating no credentials
|
472
|
-
# @return [Object]
|
473
|
+
# @return [::Object]
|
473
474
|
# @!attribute [rw] scope
|
474
475
|
# The OAuth scopes
|
475
|
-
# @return [Array
|
476
|
+
# @return [::Array<::String>]
|
476
477
|
# @!attribute [rw] lib_name
|
477
478
|
# The library name as recorded in instrumentation and logging
|
478
|
-
# @return [String]
|
479
|
+
# @return [::String]
|
479
480
|
# @!attribute [rw] lib_version
|
480
481
|
# The library version as recorded in instrumentation and logging
|
481
|
-
# @return [String]
|
482
|
+
# @return [::String]
|
482
483
|
# @!attribute [rw] channel_args
|
483
484
|
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
484
485
|
# `GRPC::Core::Channel` object is provided as the credential.
|
485
|
-
# @return [Hash]
|
486
|
+
# @return [::Hash]
|
486
487
|
# @!attribute [rw] interceptors
|
487
488
|
# An array of interceptors that are run before calls are executed.
|
488
|
-
# @return [Array
|
489
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
489
490
|
# @!attribute [rw] timeout
|
490
|
-
# The call timeout in
|
491
|
-
# @return [Numeric]
|
491
|
+
# The call timeout in seconds.
|
492
|
+
# @return [::Numeric]
|
492
493
|
# @!attribute [rw] metadata
|
493
494
|
# Additional gRPC headers to be sent with the call.
|
494
|
-
# @return [Hash{Symbol
|
495
|
+
# @return [::Hash{::Symbol=>::String}]
|
495
496
|
# @!attribute [rw] retry_policy
|
496
497
|
# The retry policy. The value is a hash with the following keys:
|
497
498
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
@@ -499,25 +500,29 @@ module Google
|
|
499
500
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
500
501
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
501
502
|
# trigger a retry.
|
502
|
-
# @return [Hash]
|
503
|
+
# @return [::Hash]
|
504
|
+
# @!attribute [rw] quota_project
|
505
|
+
# A separate project against which to charge quota.
|
506
|
+
# @return [::String]
|
503
507
|
#
|
504
508
|
class Configuration
|
505
|
-
extend Gapic::Config
|
509
|
+
extend ::Gapic::Config
|
506
510
|
|
507
|
-
config_attr :endpoint,
|
508
|
-
config_attr :credentials,
|
511
|
+
config_attr :endpoint, "automl.googleapis.com", ::String
|
512
|
+
config_attr :credentials, nil do |value|
|
509
513
|
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
510
514
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
511
515
|
allowed.any? { |klass| klass === value }
|
512
516
|
end
|
513
|
-
config_attr :scope,
|
514
|
-
config_attr :lib_name,
|
515
|
-
config_attr :lib_version,
|
516
|
-
config_attr(:channel_args,
|
517
|
-
config_attr :interceptors,
|
518
|
-
config_attr :timeout,
|
519
|
-
config_attr :metadata,
|
520
|
-
config_attr :retry_policy,
|
517
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
518
|
+
config_attr :lib_name, nil, ::String, nil
|
519
|
+
config_attr :lib_version, nil, ::String, nil
|
520
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
521
|
+
config_attr :interceptors, nil, ::Array, nil
|
522
|
+
config_attr :timeout, nil, ::Numeric, nil
|
523
|
+
config_attr :metadata, nil, ::Hash, nil
|
524
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
525
|
+
config_attr :quota_project, nil, ::String, nil
|
521
526
|
|
522
527
|
# @private
|
523
528
|
def initialize parent_config = nil
|
@@ -533,7 +538,7 @@ module Google
|
|
533
538
|
def rpcs
|
534
539
|
@rpcs ||= begin
|
535
540
|
parent_rpcs = nil
|
536
|
-
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to?
|
541
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
537
542
|
Rpcs.new parent_rpcs
|
538
543
|
end
|
539
544
|
end
|
@@ -558,21 +563,21 @@ module Google
|
|
558
563
|
class Rpcs
|
559
564
|
##
|
560
565
|
# RPC-specific configuration for `predict`
|
561
|
-
# @return [Gapic::Config::Method]
|
566
|
+
# @return [::Gapic::Config::Method]
|
562
567
|
#
|
563
568
|
attr_reader :predict
|
564
569
|
##
|
565
570
|
# RPC-specific configuration for `batch_predict`
|
566
|
-
# @return [Gapic::Config::Method]
|
571
|
+
# @return [::Gapic::Config::Method]
|
567
572
|
#
|
568
573
|
attr_reader :batch_predict
|
569
574
|
|
570
575
|
# @private
|
571
576
|
def initialize parent_rpcs = nil
|
572
577
|
predict_config = parent_rpcs&.predict if parent_rpcs&.respond_to? :predict
|
573
|
-
@predict = Gapic::Config::Method.new predict_config
|
578
|
+
@predict = ::Gapic::Config::Method.new predict_config
|
574
579
|
batch_predict_config = parent_rpcs&.batch_predict if parent_rpcs&.respond_to? :batch_predict
|
575
|
-
@batch_predict = Gapic::Config::Method.new batch_predict_config
|
580
|
+
@batch_predict = ::Gapic::Config::Method.new batch_predict_config
|
576
581
|
|
577
582
|
yield self if block_given?
|
578
583
|
end
|