google-cloud-automl 0.1.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.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +11 -0
  3. data/AUTHENTICATION.md +199 -0
  4. data/LICENSE +201 -0
  5. data/README.md +69 -0
  6. data/lib/google/cloud/automl/v1beta1/annotation_payload_pb.rb +34 -0
  7. data/lib/google/cloud/automl/v1beta1/annotation_spec_pb.rb +18 -0
  8. data/lib/google/cloud/automl/v1beta1/automl_client.rb +1914 -0
  9. data/lib/google/cloud/automl/v1beta1/automl_client_config.json +146 -0
  10. data/lib/google/cloud/automl/v1beta1/classification_pb.rb +65 -0
  11. data/lib/google/cloud/automl/v1beta1/column_spec_pb.rb +28 -0
  12. data/lib/google/cloud/automl/v1beta1/credentials.rb +41 -0
  13. data/lib/google/cloud/automl/v1beta1/data_items_pb.rb +48 -0
  14. data/lib/google/cloud/automl/v1beta1/data_stats_pb.rb +77 -0
  15. data/lib/google/cloud/automl/v1beta1/data_types_pb.rb +36 -0
  16. data/lib/google/cloud/automl/v1beta1/dataset_pb.rb +38 -0
  17. data/lib/google/cloud/automl/v1beta1/detection_pb.rb +52 -0
  18. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/annotation_payload.rb +63 -0
  19. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/annotation_spec.rb +41 -0
  20. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/classification.rb +203 -0
  21. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/column_spec.rb +72 -0
  22. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/data_items.rb +94 -0
  23. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/data_stats.rb +160 -0
  24. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/data_types.rb +107 -0
  25. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/dataset.rb +77 -0
  26. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/detection.rb +134 -0
  27. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/geometry.rb +43 -0
  28. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/image.rb +141 -0
  29. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/io.rb +975 -0
  30. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/model.rb +92 -0
  31. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/model_evaluation.rb +100 -0
  32. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/prediction_service.rb +136 -0
  33. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/ranges.rb +31 -0
  34. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/regression.rb +41 -0
  35. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/service.rb +368 -0
  36. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/table_spec.rb +64 -0
  37. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/tables.rb +261 -0
  38. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/temporal.rb +33 -0
  39. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text.rb +53 -0
  40. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text_extraction.rb +60 -0
  41. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text_segment.rb +37 -0
  42. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text_sentiment.rb +76 -0
  43. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/translation.rb +63 -0
  44. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/video.rb +35 -0
  45. data/lib/google/cloud/automl/v1beta1/doc/google/longrunning/operations.rb +51 -0
  46. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/any.rb +131 -0
  47. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/duration.rb +91 -0
  48. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/field_mask.rb +222 -0
  49. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/struct.rb +74 -0
  50. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/timestamp.rb +111 -0
  51. data/lib/google/cloud/automl/v1beta1/doc/google/rpc/status.rb +87 -0
  52. data/lib/google/cloud/automl/v1beta1/geometry_pb.rb +21 -0
  53. data/lib/google/cloud/automl/v1beta1/image_pb.rb +43 -0
  54. data/lib/google/cloud/automl/v1beta1/io_pb.rb +80 -0
  55. data/lib/google/cloud/automl/v1beta1/model_evaluation_pb.rb +37 -0
  56. data/lib/google/cloud/automl/v1beta1/model_pb.rb +44 -0
  57. data/lib/google/cloud/automl/v1beta1/operations_pb.rb +90 -0
  58. data/lib/google/cloud/automl/v1beta1/prediction_service_client.rb +442 -0
  59. data/lib/google/cloud/automl/v1beta1/prediction_service_client_config.json +36 -0
  60. data/lib/google/cloud/automl/v1beta1/prediction_service_pb.rb +39 -0
  61. data/lib/google/cloud/automl/v1beta1/prediction_service_services_pb.rb +72 -0
  62. data/lib/google/cloud/automl/v1beta1/ranges_pb.rb +17 -0
  63. data/lib/google/cloud/automl/v1beta1/regression_pb.rb +20 -0
  64. data/lib/google/cloud/automl/v1beta1/service_pb.rb +177 -0
  65. data/lib/google/cloud/automl/v1beta1/service_services_pb.rb +159 -0
  66. data/lib/google/cloud/automl/v1beta1/table_spec_pb.rb +22 -0
  67. data/lib/google/cloud/automl/v1beta1/tables_pb.rb +56 -0
  68. data/lib/google/cloud/automl/v1beta1/temporal_pb.rb +18 -0
  69. data/lib/google/cloud/automl/v1beta1/text_extraction_pb.rb +32 -0
  70. data/lib/google/cloud/automl/v1beta1/text_pb.rb +33 -0
  71. data/lib/google/cloud/automl/v1beta1/text_segment_pb.rb +18 -0
  72. data/lib/google/cloud/automl/v1beta1/text_sentiment_pb.rb +29 -0
  73. data/lib/google/cloud/automl/v1beta1/translation_pb.rb +33 -0
  74. data/lib/google/cloud/automl/v1beta1/video_pb.rb +25 -0
  75. data/lib/google/cloud/automl/v1beta1.rb +231 -0
  76. data/lib/google/cloud/automl/version.rb +22 -0
  77. data/lib/google/cloud/automl.rb +219 -0
  78. data/lib/google-cloud-automl.rb +15 -0
  79. metadata +203 -0
@@ -0,0 +1,1914 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/cloud/automl/v1beta1/service.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+
22
+
23
+ require "json"
24
+ require "pathname"
25
+
26
+ require "google/gax"
27
+ require "google/gax/operation"
28
+ require "google/longrunning/operations_client"
29
+
30
+ require "google/cloud/automl/v1beta1/service_pb"
31
+ require "google/cloud/automl/v1beta1/credentials"
32
+ require "google/cloud/automl/version"
33
+
34
+ module Google
35
+ module Cloud
36
+ module AutoML
37
+ module V1beta1
38
+ # AutoML Server API.
39
+ #
40
+ # The resource names are assigned by the server.
41
+ # The server never reuses names that it has created after the resources with
42
+ # those names are deleted.
43
+ #
44
+ # An ID of a resource is the last element of the item's resource name. For
45
+ # `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then
46
+ # the id for the item is `{dataset_id}`.
47
+ #
48
+ # Currently the only supported `location_id` is "us-central1".
49
+ #
50
+ # On any input that is documented to expect a string parameter in
51
+ # snake_case or kebab-case, either of those cases is accepted.
52
+ #
53
+ # @!attribute [r] automl_stub
54
+ # @return [Google::Cloud::AutoML::V1beta1::AutoML::Stub]
55
+ class AutoMLClient
56
+ # @private
57
+ attr_reader :automl_stub
58
+
59
+ # The default address of the service.
60
+ SERVICE_ADDRESS = "automl.googleapis.com".freeze
61
+
62
+ # The default port of the service.
63
+ DEFAULT_SERVICE_PORT = 443
64
+
65
+ # The default set of gRPC interceptors.
66
+ GRPC_INTERCEPTORS = []
67
+
68
+ DEFAULT_TIMEOUT = 30
69
+
70
+ PAGE_DESCRIPTORS = {
71
+ "list_datasets" => Google::Gax::PageDescriptor.new(
72
+ "page_token",
73
+ "next_page_token",
74
+ "datasets"),
75
+ "list_models" => Google::Gax::PageDescriptor.new(
76
+ "page_token",
77
+ "next_page_token",
78
+ "model"),
79
+ "list_model_evaluations" => Google::Gax::PageDescriptor.new(
80
+ "page_token",
81
+ "next_page_token",
82
+ "model_evaluation"),
83
+ "list_table_specs" => Google::Gax::PageDescriptor.new(
84
+ "page_token",
85
+ "next_page_token",
86
+ "table_specs"),
87
+ "list_column_specs" => Google::Gax::PageDescriptor.new(
88
+ "page_token",
89
+ "next_page_token",
90
+ "column_specs")
91
+ }.freeze
92
+
93
+ private_constant :PAGE_DESCRIPTORS
94
+
95
+ # The scopes needed to make gRPC calls to all of the methods defined in
96
+ # this service.
97
+ ALL_SCOPES = [
98
+ "https://www.googleapis.com/auth/cloud-platform"
99
+ ].freeze
100
+
101
+ class OperationsClient < Google::Longrunning::OperationsClient
102
+ self::SERVICE_ADDRESS = AutoMLClient::SERVICE_ADDRESS
103
+ self::GRPC_INTERCEPTORS = AutoMLClient::GRPC_INTERCEPTORS
104
+ end
105
+
106
+ ANNOTATION_SPEC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
107
+ "projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}"
108
+ )
109
+
110
+ private_constant :ANNOTATION_SPEC_PATH_TEMPLATE
111
+
112
+ COLUMN_SPEC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
113
+ "projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}/columnSpecs/{column_spec}"
114
+ )
115
+
116
+ private_constant :COLUMN_SPEC_PATH_TEMPLATE
117
+
118
+ DATASET_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
119
+ "projects/{project}/locations/{location}/datasets/{dataset}"
120
+ )
121
+
122
+ private_constant :DATASET_PATH_TEMPLATE
123
+
124
+ LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
125
+ "projects/{project}/locations/{location}"
126
+ )
127
+
128
+ private_constant :LOCATION_PATH_TEMPLATE
129
+
130
+ MODEL_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
131
+ "projects/{project}/locations/{location}/models/{model}"
132
+ )
133
+
134
+ private_constant :MODEL_PATH_TEMPLATE
135
+
136
+ MODEL_EVALUATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
137
+ "projects/{project}/locations/{location}/models/{model}/modelEvaluations/{model_evaluation}"
138
+ )
139
+
140
+ private_constant :MODEL_EVALUATION_PATH_TEMPLATE
141
+
142
+ TABLE_SPEC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
143
+ "projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}"
144
+ )
145
+
146
+ private_constant :TABLE_SPEC_PATH_TEMPLATE
147
+
148
+ # Returns a fully-qualified annotation_spec resource name string.
149
+ # @param project [String]
150
+ # @param location [String]
151
+ # @param dataset [String]
152
+ # @param annotation_spec [String]
153
+ # @return [String]
154
+ def self.annotation_spec_path project, location, dataset, annotation_spec
155
+ ANNOTATION_SPEC_PATH_TEMPLATE.render(
156
+ :"project" => project,
157
+ :"location" => location,
158
+ :"dataset" => dataset,
159
+ :"annotation_spec" => annotation_spec
160
+ )
161
+ end
162
+
163
+ # Returns a fully-qualified column_spec resource name string.
164
+ # @param project [String]
165
+ # @param location [String]
166
+ # @param dataset [String]
167
+ # @param table_spec [String]
168
+ # @param column_spec [String]
169
+ # @return [String]
170
+ def self.column_spec_path project, location, dataset, table_spec, column_spec
171
+ COLUMN_SPEC_PATH_TEMPLATE.render(
172
+ :"project" => project,
173
+ :"location" => location,
174
+ :"dataset" => dataset,
175
+ :"table_spec" => table_spec,
176
+ :"column_spec" => column_spec
177
+ )
178
+ end
179
+
180
+ # Returns a fully-qualified dataset resource name string.
181
+ # @param project [String]
182
+ # @param location [String]
183
+ # @param dataset [String]
184
+ # @return [String]
185
+ def self.dataset_path project, location, dataset
186
+ DATASET_PATH_TEMPLATE.render(
187
+ :"project" => project,
188
+ :"location" => location,
189
+ :"dataset" => dataset
190
+ )
191
+ end
192
+
193
+ # Returns a fully-qualified location resource name string.
194
+ # @param project [String]
195
+ # @param location [String]
196
+ # @return [String]
197
+ def self.location_path project, location
198
+ LOCATION_PATH_TEMPLATE.render(
199
+ :"project" => project,
200
+ :"location" => location
201
+ )
202
+ end
203
+
204
+ # Returns a fully-qualified model resource name string.
205
+ # @param project [String]
206
+ # @param location [String]
207
+ # @param model [String]
208
+ # @return [String]
209
+ def self.model_path project, location, model
210
+ MODEL_PATH_TEMPLATE.render(
211
+ :"project" => project,
212
+ :"location" => location,
213
+ :"model" => model
214
+ )
215
+ end
216
+
217
+ # Returns a fully-qualified model_evaluation resource name string.
218
+ # @param project [String]
219
+ # @param location [String]
220
+ # @param model [String]
221
+ # @param model_evaluation [String]
222
+ # @return [String]
223
+ def self.model_evaluation_path project, location, model, model_evaluation
224
+ MODEL_EVALUATION_PATH_TEMPLATE.render(
225
+ :"project" => project,
226
+ :"location" => location,
227
+ :"model" => model,
228
+ :"model_evaluation" => model_evaluation
229
+ )
230
+ end
231
+
232
+ # Returns a fully-qualified table_spec resource name string.
233
+ # @param project [String]
234
+ # @param location [String]
235
+ # @param dataset [String]
236
+ # @param table_spec [String]
237
+ # @return [String]
238
+ def self.table_spec_path project, location, dataset, table_spec
239
+ TABLE_SPEC_PATH_TEMPLATE.render(
240
+ :"project" => project,
241
+ :"location" => location,
242
+ :"dataset" => dataset,
243
+ :"table_spec" => table_spec
244
+ )
245
+ end
246
+
247
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
248
+ # Provides the means for authenticating requests made by the client. This parameter can
249
+ # be many types.
250
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
251
+ # authenticating requests made by this client.
252
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
253
+ # credentials for this client.
254
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
255
+ # credentials for this client.
256
+ # A `GRPC::Core::Channel` will be used to make calls through.
257
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
258
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
259
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
260
+ # metadata for requests, generally, to give OAuth credentials.
261
+ # @param scopes [Array<String>]
262
+ # The OAuth scopes for this service. This parameter is ignored if
263
+ # an updater_proc is supplied.
264
+ # @param client_config [Hash]
265
+ # A Hash for call options for each method. See
266
+ # Google::Gax#construct_settings for the structure of
267
+ # this data. Falls back to the default config if not specified
268
+ # or the specified config is missing data points.
269
+ # @param timeout [Numeric]
270
+ # The default timeout, in seconds, for calls made through this client.
271
+ # @param metadata [Hash]
272
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
273
+ # @param service_address [String]
274
+ # Override for the service hostname, or `nil` to leave as the default.
275
+ # @param service_port [Integer]
276
+ # Override for the service port, or `nil` to leave as the default.
277
+ # @param exception_transformer [Proc]
278
+ # An optional proc that intercepts any exceptions raised during an API call to inject
279
+ # custom error handling.
280
+ def initialize \
281
+ credentials: nil,
282
+ scopes: ALL_SCOPES,
283
+ client_config: {},
284
+ timeout: DEFAULT_TIMEOUT,
285
+ metadata: nil,
286
+ service_address: nil,
287
+ service_port: nil,
288
+ exception_transformer: nil,
289
+ lib_name: nil,
290
+ lib_version: ""
291
+ # These require statements are intentionally placed here to initialize
292
+ # the gRPC module only when it's required.
293
+ # See https://github.com/googleapis/toolkit/issues/446
294
+ require "google/gax/grpc"
295
+ require "google/cloud/automl/v1beta1/service_services_pb"
296
+
297
+ credentials ||= Google::Cloud::AutoML::V1beta1::Credentials.default
298
+
299
+ @operations_client = OperationsClient.new(
300
+ credentials: credentials,
301
+ scopes: scopes,
302
+ client_config: client_config,
303
+ timeout: timeout,
304
+ lib_name: lib_name,
305
+ service_address: service_address,
306
+ service_port: service_port,
307
+ lib_version: lib_version,
308
+ metadata: metadata,
309
+ )
310
+
311
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
312
+ updater_proc = Google::Cloud::AutoML::V1beta1::Credentials.new(credentials).updater_proc
313
+ end
314
+ if credentials.is_a?(GRPC::Core::Channel)
315
+ channel = credentials
316
+ end
317
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
318
+ chan_creds = credentials
319
+ end
320
+ if credentials.is_a?(Proc)
321
+ updater_proc = credentials
322
+ end
323
+ if credentials.is_a?(Google::Auth::Credentials)
324
+ updater_proc = credentials.updater_proc
325
+ end
326
+
327
+ package_version = Google::Cloud::AutoML::VERSION
328
+
329
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
330
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
331
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
332
+ google_api_client << " grpc/#{GRPC::VERSION}"
333
+ google_api_client.freeze
334
+
335
+ headers = { :"x-goog-api-client" => google_api_client }
336
+ headers.merge!(metadata) unless metadata.nil?
337
+ client_config_file = Pathname.new(__dir__).join(
338
+ "automl_client_config.json"
339
+ )
340
+ defaults = client_config_file.open do |f|
341
+ Google::Gax.construct_settings(
342
+ "google.cloud.automl.v1beta1.AutoMl",
343
+ JSON.parse(f.read),
344
+ client_config,
345
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
346
+ timeout,
347
+ page_descriptors: PAGE_DESCRIPTORS,
348
+ errors: Google::Gax::Grpc::API_ERRORS,
349
+ metadata: headers
350
+ )
351
+ end
352
+
353
+ # Allow overriding the service path/port in subclasses.
354
+ service_path = service_address || self.class::SERVICE_ADDRESS
355
+ port = service_port || self.class::DEFAULT_SERVICE_PORT
356
+ interceptors = self.class::GRPC_INTERCEPTORS
357
+ @automl_stub = Google::Gax::Grpc.create_stub(
358
+ service_path,
359
+ port,
360
+ chan_creds: chan_creds,
361
+ channel: channel,
362
+ updater_proc: updater_proc,
363
+ scopes: scopes,
364
+ interceptors: interceptors,
365
+ &Google::Cloud::AutoML::V1beta1::AutoML::Stub.method(:new)
366
+ )
367
+
368
+ @create_dataset = Google::Gax.create_api_call(
369
+ @automl_stub.method(:create_dataset),
370
+ defaults["create_dataset"],
371
+ exception_transformer: exception_transformer,
372
+ params_extractor: proc do |request|
373
+ {'parent' => request.parent}
374
+ end
375
+ )
376
+ @update_dataset = Google::Gax.create_api_call(
377
+ @automl_stub.method(:update_dataset),
378
+ defaults["update_dataset"],
379
+ exception_transformer: exception_transformer,
380
+ params_extractor: proc do |request|
381
+ {'dataset.name' => request.dataset.name}
382
+ end
383
+ )
384
+ @get_dataset = Google::Gax.create_api_call(
385
+ @automl_stub.method(:get_dataset),
386
+ defaults["get_dataset"],
387
+ exception_transformer: exception_transformer,
388
+ params_extractor: proc do |request|
389
+ {'name' => request.name}
390
+ end
391
+ )
392
+ @list_datasets = Google::Gax.create_api_call(
393
+ @automl_stub.method(:list_datasets),
394
+ defaults["list_datasets"],
395
+ exception_transformer: exception_transformer,
396
+ params_extractor: proc do |request|
397
+ {'parent' => request.parent}
398
+ end
399
+ )
400
+ @delete_dataset = Google::Gax.create_api_call(
401
+ @automl_stub.method(:delete_dataset),
402
+ defaults["delete_dataset"],
403
+ exception_transformer: exception_transformer,
404
+ params_extractor: proc do |request|
405
+ {'name' => request.name}
406
+ end
407
+ )
408
+ @import_data = Google::Gax.create_api_call(
409
+ @automl_stub.method(:import_data),
410
+ defaults["import_data"],
411
+ exception_transformer: exception_transformer,
412
+ params_extractor: proc do |request|
413
+ {'name' => request.name}
414
+ end
415
+ )
416
+ @export_data = Google::Gax.create_api_call(
417
+ @automl_stub.method(:export_data),
418
+ defaults["export_data"],
419
+ exception_transformer: exception_transformer,
420
+ params_extractor: proc do |request|
421
+ {'name' => request.name}
422
+ end
423
+ )
424
+ @create_model = Google::Gax.create_api_call(
425
+ @automl_stub.method(:create_model),
426
+ defaults["create_model"],
427
+ exception_transformer: exception_transformer,
428
+ params_extractor: proc do |request|
429
+ {'parent' => request.parent}
430
+ end
431
+ )
432
+ @get_model = Google::Gax.create_api_call(
433
+ @automl_stub.method(:get_model),
434
+ defaults["get_model"],
435
+ exception_transformer: exception_transformer,
436
+ params_extractor: proc do |request|
437
+ {'name' => request.name}
438
+ end
439
+ )
440
+ @list_models = Google::Gax.create_api_call(
441
+ @automl_stub.method(:list_models),
442
+ defaults["list_models"],
443
+ exception_transformer: exception_transformer,
444
+ params_extractor: proc do |request|
445
+ {'parent' => request.parent}
446
+ end
447
+ )
448
+ @delete_model = Google::Gax.create_api_call(
449
+ @automl_stub.method(:delete_model),
450
+ defaults["delete_model"],
451
+ exception_transformer: exception_transformer,
452
+ params_extractor: proc do |request|
453
+ {'name' => request.name}
454
+ end
455
+ )
456
+ @deploy_model = Google::Gax.create_api_call(
457
+ @automl_stub.method(:deploy_model),
458
+ defaults["deploy_model"],
459
+ exception_transformer: exception_transformer,
460
+ params_extractor: proc do |request|
461
+ {'name' => request.name}
462
+ end
463
+ )
464
+ @undeploy_model = Google::Gax.create_api_call(
465
+ @automl_stub.method(:undeploy_model),
466
+ defaults["undeploy_model"],
467
+ exception_transformer: exception_transformer,
468
+ params_extractor: proc do |request|
469
+ {'name' => request.name}
470
+ end
471
+ )
472
+ @get_model_evaluation = Google::Gax.create_api_call(
473
+ @automl_stub.method(:get_model_evaluation),
474
+ defaults["get_model_evaluation"],
475
+ exception_transformer: exception_transformer,
476
+ params_extractor: proc do |request|
477
+ {'name' => request.name}
478
+ end
479
+ )
480
+ @export_model = Google::Gax.create_api_call(
481
+ @automl_stub.method(:export_model),
482
+ defaults["export_model"],
483
+ exception_transformer: exception_transformer,
484
+ params_extractor: proc do |request|
485
+ {'name' => request.name}
486
+ end
487
+ )
488
+ @export_evaluated_examples = Google::Gax.create_api_call(
489
+ @automl_stub.method(:export_evaluated_examples),
490
+ defaults["export_evaluated_examples"],
491
+ exception_transformer: exception_transformer,
492
+ params_extractor: proc do |request|
493
+ {'name' => request.name}
494
+ end
495
+ )
496
+ @list_model_evaluations = Google::Gax.create_api_call(
497
+ @automl_stub.method(:list_model_evaluations),
498
+ defaults["list_model_evaluations"],
499
+ exception_transformer: exception_transformer,
500
+ params_extractor: proc do |request|
501
+ {'parent' => request.parent}
502
+ end
503
+ )
504
+ @get_annotation_spec = Google::Gax.create_api_call(
505
+ @automl_stub.method(:get_annotation_spec),
506
+ defaults["get_annotation_spec"],
507
+ exception_transformer: exception_transformer,
508
+ params_extractor: proc do |request|
509
+ {'name' => request.name}
510
+ end
511
+ )
512
+ @get_table_spec = Google::Gax.create_api_call(
513
+ @automl_stub.method(:get_table_spec),
514
+ defaults["get_table_spec"],
515
+ exception_transformer: exception_transformer,
516
+ params_extractor: proc do |request|
517
+ {'name' => request.name}
518
+ end
519
+ )
520
+ @list_table_specs = Google::Gax.create_api_call(
521
+ @automl_stub.method(:list_table_specs),
522
+ defaults["list_table_specs"],
523
+ exception_transformer: exception_transformer,
524
+ params_extractor: proc do |request|
525
+ {'parent' => request.parent}
526
+ end
527
+ )
528
+ @update_table_spec = Google::Gax.create_api_call(
529
+ @automl_stub.method(:update_table_spec),
530
+ defaults["update_table_spec"],
531
+ exception_transformer: exception_transformer,
532
+ params_extractor: proc do |request|
533
+ {'table_spec.name' => request.table_spec.name}
534
+ end
535
+ )
536
+ @get_column_spec = Google::Gax.create_api_call(
537
+ @automl_stub.method(:get_column_spec),
538
+ defaults["get_column_spec"],
539
+ exception_transformer: exception_transformer,
540
+ params_extractor: proc do |request|
541
+ {'name' => request.name}
542
+ end
543
+ )
544
+ @list_column_specs = Google::Gax.create_api_call(
545
+ @automl_stub.method(:list_column_specs),
546
+ defaults["list_column_specs"],
547
+ exception_transformer: exception_transformer,
548
+ params_extractor: proc do |request|
549
+ {'parent' => request.parent}
550
+ end
551
+ )
552
+ @update_column_spec = Google::Gax.create_api_call(
553
+ @automl_stub.method(:update_column_spec),
554
+ defaults["update_column_spec"],
555
+ exception_transformer: exception_transformer,
556
+ params_extractor: proc do |request|
557
+ {'column_spec.name' => request.column_spec.name}
558
+ end
559
+ )
560
+ end
561
+
562
+ # Service calls
563
+
564
+ # Creates a dataset.
565
+ #
566
+ # @param parent [String]
567
+ # The resource name of the project to create the dataset for.
568
+ # @param dataset [Google::Cloud::AutoML::V1beta1::Dataset | Hash]
569
+ # The dataset to create.
570
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::Dataset`
571
+ # can also be provided.
572
+ # @param options [Google::Gax::CallOptions]
573
+ # Overrides the default settings for this call, e.g, timeout,
574
+ # retries, etc.
575
+ # @yield [result, operation] Access the result along with the RPC operation
576
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::Dataset]
577
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
578
+ # @return [Google::Cloud::AutoML::V1beta1::Dataset]
579
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
580
+ # @example
581
+ # require "google/cloud/automl"
582
+ #
583
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
584
+ # formatted_parent = Google::Cloud::AutoML::V1beta1::AutoMLClient.location_path("[PROJECT]", "[LOCATION]")
585
+ #
586
+ # # TODO: Initialize `dataset`:
587
+ # dataset = {}
588
+ # response = automl_client.create_dataset(formatted_parent, dataset)
589
+
590
+ def create_dataset \
591
+ parent,
592
+ dataset,
593
+ options: nil,
594
+ &block
595
+ req = {
596
+ parent: parent,
597
+ dataset: dataset
598
+ }.delete_if { |_, v| v.nil? }
599
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::CreateDatasetRequest)
600
+ @create_dataset.call(req, options, &block)
601
+ end
602
+
603
+ # Updates a dataset.
604
+ #
605
+ # @param dataset [Google::Cloud::AutoML::V1beta1::Dataset | Hash]
606
+ # The dataset which replaces the resource on the server.
607
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::Dataset`
608
+ # can also be provided.
609
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
610
+ # The update mask applies to the resource. For the `FieldMask` definition,
611
+ # see
612
+ #
613
+ # https:
614
+ # //developers.google.com/protocol-buffers
615
+ # // /docs/reference/google.protobuf#fieldmask
616
+ # A hash of the same form as `Google::Protobuf::FieldMask`
617
+ # can also be provided.
618
+ # @param options [Google::Gax::CallOptions]
619
+ # Overrides the default settings for this call, e.g, timeout,
620
+ # retries, etc.
621
+ # @yield [result, operation] Access the result along with the RPC operation
622
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::Dataset]
623
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
624
+ # @return [Google::Cloud::AutoML::V1beta1::Dataset]
625
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
626
+ # @example
627
+ # require "google/cloud/automl"
628
+ #
629
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
630
+ #
631
+ # # TODO: Initialize `dataset`:
632
+ # dataset = {}
633
+ # response = automl_client.update_dataset(dataset)
634
+
635
+ def update_dataset \
636
+ dataset,
637
+ update_mask: nil,
638
+ options: nil,
639
+ &block
640
+ req = {
641
+ dataset: dataset,
642
+ update_mask: update_mask
643
+ }.delete_if { |_, v| v.nil? }
644
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::UpdateDatasetRequest)
645
+ @update_dataset.call(req, options, &block)
646
+ end
647
+
648
+ # Gets a dataset.
649
+ #
650
+ # @param name [String]
651
+ # The resource name of the dataset to retrieve.
652
+ # @param options [Google::Gax::CallOptions]
653
+ # Overrides the default settings for this call, e.g, timeout,
654
+ # retries, etc.
655
+ # @yield [result, operation] Access the result along with the RPC operation
656
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::Dataset]
657
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
658
+ # @return [Google::Cloud::AutoML::V1beta1::Dataset]
659
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
660
+ # @example
661
+ # require "google/cloud/automl"
662
+ #
663
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
664
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.dataset_path("[PROJECT]", "[LOCATION]", "[DATASET]")
665
+ # response = automl_client.get_dataset(formatted_name)
666
+
667
+ def get_dataset \
668
+ name,
669
+ options: nil,
670
+ &block
671
+ req = {
672
+ name: name
673
+ }.delete_if { |_, v| v.nil? }
674
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::GetDatasetRequest)
675
+ @get_dataset.call(req, options, &block)
676
+ end
677
+
678
+ # Lists datasets in a project.
679
+ #
680
+ # @param parent [String]
681
+ # The resource name of the project from which to list datasets.
682
+ # @param filter [String]
683
+ # An expression for filtering the results of the request.
684
+ #
685
+ # * `dataset_metadata` - for existence of the case (e.g.
686
+ # image_classification_dataset_metadata:*). Some examples of using the filter are:
687
+ #
688
+ # * `translation_dataset_metadata:*` --> The dataset has
689
+ # translation_dataset_metadata.
690
+ # @param page_size [Integer]
691
+ # The maximum number of resources contained in the underlying API
692
+ # response. If page streaming is performed per-resource, this
693
+ # parameter does not affect the return value. If page streaming is
694
+ # performed per-page, this determines the maximum number of
695
+ # resources in a page.
696
+ # @param options [Google::Gax::CallOptions]
697
+ # Overrides the default settings for this call, e.g, timeout,
698
+ # retries, etc.
699
+ # @yield [result, operation] Access the result along with the RPC operation
700
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::Dataset>]
701
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
702
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::Dataset>]
703
+ # An enumerable of Google::Cloud::AutoML::V1beta1::Dataset instances.
704
+ # See Google::Gax::PagedEnumerable documentation for other
705
+ # operations such as per-page iteration or access to the response
706
+ # object.
707
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
708
+ # @example
709
+ # require "google/cloud/automl"
710
+ #
711
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
712
+ # formatted_parent = Google::Cloud::AutoML::V1beta1::AutoMLClient.location_path("[PROJECT]", "[LOCATION]")
713
+ #
714
+ # # Iterate over all results.
715
+ # automl_client.list_datasets(formatted_parent).each do |element|
716
+ # # Process element.
717
+ # end
718
+ #
719
+ # # Or iterate over results one page at a time.
720
+ # automl_client.list_datasets(formatted_parent).each_page do |page|
721
+ # # Process each page at a time.
722
+ # page.each do |element|
723
+ # # Process element.
724
+ # end
725
+ # end
726
+
727
+ def list_datasets \
728
+ parent,
729
+ filter: nil,
730
+ page_size: nil,
731
+ options: nil,
732
+ &block
733
+ req = {
734
+ parent: parent,
735
+ filter: filter,
736
+ page_size: page_size
737
+ }.delete_if { |_, v| v.nil? }
738
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::ListDatasetsRequest)
739
+ @list_datasets.call(req, options, &block)
740
+ end
741
+
742
+ # Deletes a dataset and all of its contents.
743
+ # Returns empty response in the
744
+ # {Google::Longrunning::Operation#response response} field when it completes,
745
+ # and `delete_details` in the
746
+ # {Google::Longrunning::Operation#metadata metadata} field.
747
+ #
748
+ # @param name [String]
749
+ # The resource name of the dataset to delete.
750
+ # @param options [Google::Gax::CallOptions]
751
+ # Overrides the default settings for this call, e.g, timeout,
752
+ # retries, etc.
753
+ # @return [Google::Gax::Operation]
754
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
755
+ # @example
756
+ # require "google/cloud/automl"
757
+ #
758
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
759
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.dataset_path("[PROJECT]", "[LOCATION]", "[DATASET]")
760
+ #
761
+ # # Register a callback during the method call.
762
+ # operation = automl_client.delete_dataset(formatted_name) do |op|
763
+ # raise op.results.message if op.error?
764
+ # op_results = op.results
765
+ # # Process the results.
766
+ #
767
+ # metadata = op.metadata
768
+ # # Process the metadata.
769
+ # end
770
+ #
771
+ # # Or use the return value to register a callback.
772
+ # operation.on_done do |op|
773
+ # raise op.results.message if op.error?
774
+ # op_results = op.results
775
+ # # Process the results.
776
+ #
777
+ # metadata = op.metadata
778
+ # # Process the metadata.
779
+ # end
780
+ #
781
+ # # Manually reload the operation.
782
+ # operation.reload!
783
+ #
784
+ # # Or block until the operation completes, triggering callbacks on
785
+ # # completion.
786
+ # operation.wait_until_done!
787
+
788
+ def delete_dataset \
789
+ name,
790
+ options: nil
791
+ req = {
792
+ name: name
793
+ }.delete_if { |_, v| v.nil? }
794
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::DeleteDatasetRequest)
795
+ operation = Google::Gax::Operation.new(
796
+ @delete_dataset.call(req, options),
797
+ @operations_client,
798
+ Google::Protobuf::Empty,
799
+ Google::Cloud::AutoML::V1beta1::OperationMetadata,
800
+ call_options: options
801
+ )
802
+ operation.on_done { |operation| yield(operation) } if block_given?
803
+ operation
804
+ end
805
+
806
+ # Imports data into a dataset.
807
+ # For Tables this method can only be called on an empty Dataset.
808
+ #
809
+ # For Tables:
810
+ # * A
811
+ # {Google::Cloud::AutoML::V1beta1::InputConfig#params schema_inference_version}
812
+ # parameter must be explicitly set.
813
+ # Returns an empty response in the
814
+ # {Google::Longrunning::Operation#response response} field when it completes.
815
+ #
816
+ # @param name [String]
817
+ # Required. Dataset name. Dataset must already exist. All imported
818
+ # annotations and examples will be added.
819
+ # @param input_config [Google::Cloud::AutoML::V1beta1::InputConfig | Hash]
820
+ # Required. The desired input location and its domain specific semantics,
821
+ # if any.
822
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::InputConfig`
823
+ # can also be provided.
824
+ # @param options [Google::Gax::CallOptions]
825
+ # Overrides the default settings for this call, e.g, timeout,
826
+ # retries, etc.
827
+ # @return [Google::Gax::Operation]
828
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
829
+ # @example
830
+ # require "google/cloud/automl"
831
+ #
832
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
833
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.dataset_path("[PROJECT]", "[LOCATION]", "[DATASET]")
834
+ #
835
+ # # TODO: Initialize `input_config`:
836
+ # input_config = {}
837
+ #
838
+ # # Register a callback during the method call.
839
+ # operation = automl_client.import_data(formatted_name, input_config) do |op|
840
+ # raise op.results.message if op.error?
841
+ # op_results = op.results
842
+ # # Process the results.
843
+ #
844
+ # metadata = op.metadata
845
+ # # Process the metadata.
846
+ # end
847
+ #
848
+ # # Or use the return value to register a callback.
849
+ # operation.on_done do |op|
850
+ # raise op.results.message if op.error?
851
+ # op_results = op.results
852
+ # # Process the results.
853
+ #
854
+ # metadata = op.metadata
855
+ # # Process the metadata.
856
+ # end
857
+ #
858
+ # # Manually reload the operation.
859
+ # operation.reload!
860
+ #
861
+ # # Or block until the operation completes, triggering callbacks on
862
+ # # completion.
863
+ # operation.wait_until_done!
864
+
865
+ def import_data \
866
+ name,
867
+ input_config,
868
+ options: nil
869
+ req = {
870
+ name: name,
871
+ input_config: input_config
872
+ }.delete_if { |_, v| v.nil? }
873
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::ImportDataRequest)
874
+ operation = Google::Gax::Operation.new(
875
+ @import_data.call(req, options),
876
+ @operations_client,
877
+ Google::Protobuf::Empty,
878
+ Google::Cloud::AutoML::V1beta1::OperationMetadata,
879
+ call_options: options
880
+ )
881
+ operation.on_done { |operation| yield(operation) } if block_given?
882
+ operation
883
+ end
884
+
885
+ # Exports dataset's data to the provided output location.
886
+ # Returns an empty response in the
887
+ # {Google::Longrunning::Operation#response response} field when it completes.
888
+ #
889
+ # @param name [String]
890
+ # Required. The resource name of the dataset.
891
+ # @param output_config [Google::Cloud::AutoML::V1beta1::OutputConfig | Hash]
892
+ # Required. The desired output location.
893
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::OutputConfig`
894
+ # can also be provided.
895
+ # @param options [Google::Gax::CallOptions]
896
+ # Overrides the default settings for this call, e.g, timeout,
897
+ # retries, etc.
898
+ # @return [Google::Gax::Operation]
899
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
900
+ # @example
901
+ # require "google/cloud/automl"
902
+ #
903
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
904
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.dataset_path("[PROJECT]", "[LOCATION]", "[DATASET]")
905
+ #
906
+ # # TODO: Initialize `output_config`:
907
+ # output_config = {}
908
+ #
909
+ # # Register a callback during the method call.
910
+ # operation = automl_client.export_data(formatted_name, output_config) do |op|
911
+ # raise op.results.message if op.error?
912
+ # op_results = op.results
913
+ # # Process the results.
914
+ #
915
+ # metadata = op.metadata
916
+ # # Process the metadata.
917
+ # end
918
+ #
919
+ # # Or use the return value to register a callback.
920
+ # operation.on_done do |op|
921
+ # raise op.results.message if op.error?
922
+ # op_results = op.results
923
+ # # Process the results.
924
+ #
925
+ # metadata = op.metadata
926
+ # # Process the metadata.
927
+ # end
928
+ #
929
+ # # Manually reload the operation.
930
+ # operation.reload!
931
+ #
932
+ # # Or block until the operation completes, triggering callbacks on
933
+ # # completion.
934
+ # operation.wait_until_done!
935
+
936
+ def export_data \
937
+ name,
938
+ output_config,
939
+ options: nil
940
+ req = {
941
+ name: name,
942
+ output_config: output_config
943
+ }.delete_if { |_, v| v.nil? }
944
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::ExportDataRequest)
945
+ operation = Google::Gax::Operation.new(
946
+ @export_data.call(req, options),
947
+ @operations_client,
948
+ Google::Protobuf::Empty,
949
+ Google::Cloud::AutoML::V1beta1::OperationMetadata,
950
+ call_options: options
951
+ )
952
+ operation.on_done { |operation| yield(operation) } if block_given?
953
+ operation
954
+ end
955
+
956
+ # Creates a model.
957
+ # Returns a Model in the {Google::Longrunning::Operation#response response}
958
+ # field when it completes.
959
+ # When you create a model, several model evaluations are created for it:
960
+ # a global evaluation, and one evaluation for each annotation spec.
961
+ #
962
+ # @param parent [String]
963
+ # Resource name of the parent project where the model is being created.
964
+ # @param model [Google::Cloud::AutoML::V1beta1::Model | Hash]
965
+ # The model to create.
966
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::Model`
967
+ # can also be provided.
968
+ # @param options [Google::Gax::CallOptions]
969
+ # Overrides the default settings for this call, e.g, timeout,
970
+ # retries, etc.
971
+ # @return [Google::Gax::Operation]
972
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
973
+ # @example
974
+ # require "google/cloud/automl"
975
+ #
976
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
977
+ # formatted_parent = Google::Cloud::AutoML::V1beta1::AutoMLClient.location_path("[PROJECT]", "[LOCATION]")
978
+ #
979
+ # # TODO: Initialize `model`:
980
+ # model = {}
981
+ #
982
+ # # Register a callback during the method call.
983
+ # operation = automl_client.create_model(formatted_parent, model) do |op|
984
+ # raise op.results.message if op.error?
985
+ # op_results = op.results
986
+ # # Process the results.
987
+ #
988
+ # metadata = op.metadata
989
+ # # Process the metadata.
990
+ # end
991
+ #
992
+ # # Or use the return value to register a callback.
993
+ # operation.on_done do |op|
994
+ # raise op.results.message if op.error?
995
+ # op_results = op.results
996
+ # # Process the results.
997
+ #
998
+ # metadata = op.metadata
999
+ # # Process the metadata.
1000
+ # end
1001
+ #
1002
+ # # Manually reload the operation.
1003
+ # operation.reload!
1004
+ #
1005
+ # # Or block until the operation completes, triggering callbacks on
1006
+ # # completion.
1007
+ # operation.wait_until_done!
1008
+
1009
+ def create_model \
1010
+ parent,
1011
+ model,
1012
+ options: nil
1013
+ req = {
1014
+ parent: parent,
1015
+ model: model
1016
+ }.delete_if { |_, v| v.nil? }
1017
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::CreateModelRequest)
1018
+ operation = Google::Gax::Operation.new(
1019
+ @create_model.call(req, options),
1020
+ @operations_client,
1021
+ Google::Cloud::AutoML::V1beta1::Model,
1022
+ Google::Cloud::AutoML::V1beta1::OperationMetadata,
1023
+ call_options: options
1024
+ )
1025
+ operation.on_done { |operation| yield(operation) } if block_given?
1026
+ operation
1027
+ end
1028
+
1029
+ # Gets a model.
1030
+ #
1031
+ # @param name [String]
1032
+ # Resource name of the model.
1033
+ # @param options [Google::Gax::CallOptions]
1034
+ # Overrides the default settings for this call, e.g, timeout,
1035
+ # retries, etc.
1036
+ # @yield [result, operation] Access the result along with the RPC operation
1037
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::Model]
1038
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1039
+ # @return [Google::Cloud::AutoML::V1beta1::Model]
1040
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1041
+ # @example
1042
+ # require "google/cloud/automl"
1043
+ #
1044
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1045
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.model_path("[PROJECT]", "[LOCATION]", "[MODEL]")
1046
+ # response = automl_client.get_model(formatted_name)
1047
+
1048
+ def get_model \
1049
+ name,
1050
+ options: nil,
1051
+ &block
1052
+ req = {
1053
+ name: name
1054
+ }.delete_if { |_, v| v.nil? }
1055
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::GetModelRequest)
1056
+ @get_model.call(req, options, &block)
1057
+ end
1058
+
1059
+ # Lists models.
1060
+ #
1061
+ # @param parent [String]
1062
+ # Resource name of the project, from which to list the models.
1063
+ # @param filter [String]
1064
+ # An expression for filtering the results of the request.
1065
+ #
1066
+ # * `model_metadata` - for existence of the case (e.g.
1067
+ # video_classification_model_metadata:*).
1068
+ # * `dataset_id` - for = or !=. Some examples of using the filter are:
1069
+ #
1070
+ # * `image_classification_model_metadata:*` --> The model has
1071
+ # image_classification_model_metadata.
1072
+ # * `dataset_id=5` --> The model was created from a dataset with ID 5.
1073
+ # @param page_size [Integer]
1074
+ # The maximum number of resources contained in the underlying API
1075
+ # response. If page streaming is performed per-resource, this
1076
+ # parameter does not affect the return value. If page streaming is
1077
+ # performed per-page, this determines the maximum number of
1078
+ # resources in a page.
1079
+ # @param options [Google::Gax::CallOptions]
1080
+ # Overrides the default settings for this call, e.g, timeout,
1081
+ # retries, etc.
1082
+ # @yield [result, operation] Access the result along with the RPC operation
1083
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::Model>]
1084
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1085
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::Model>]
1086
+ # An enumerable of Google::Cloud::AutoML::V1beta1::Model instances.
1087
+ # See Google::Gax::PagedEnumerable documentation for other
1088
+ # operations such as per-page iteration or access to the response
1089
+ # object.
1090
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1091
+ # @example
1092
+ # require "google/cloud/automl"
1093
+ #
1094
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1095
+ # formatted_parent = Google::Cloud::AutoML::V1beta1::AutoMLClient.location_path("[PROJECT]", "[LOCATION]")
1096
+ #
1097
+ # # Iterate over all results.
1098
+ # automl_client.list_models(formatted_parent).each do |element|
1099
+ # # Process element.
1100
+ # end
1101
+ #
1102
+ # # Or iterate over results one page at a time.
1103
+ # automl_client.list_models(formatted_parent).each_page do |page|
1104
+ # # Process each page at a time.
1105
+ # page.each do |element|
1106
+ # # Process element.
1107
+ # end
1108
+ # end
1109
+
1110
+ def list_models \
1111
+ parent,
1112
+ filter: nil,
1113
+ page_size: nil,
1114
+ options: nil,
1115
+ &block
1116
+ req = {
1117
+ parent: parent,
1118
+ filter: filter,
1119
+ page_size: page_size
1120
+ }.delete_if { |_, v| v.nil? }
1121
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::ListModelsRequest)
1122
+ @list_models.call(req, options, &block)
1123
+ end
1124
+
1125
+ # Deletes a model.
1126
+ # Returns `google.protobuf.Empty` in the
1127
+ # {Google::Longrunning::Operation#response response} field when it completes,
1128
+ # and `delete_details` in the
1129
+ # {Google::Longrunning::Operation#metadata metadata} field.
1130
+ #
1131
+ # @param name [String]
1132
+ # Resource name of the model being deleted.
1133
+ # @param options [Google::Gax::CallOptions]
1134
+ # Overrides the default settings for this call, e.g, timeout,
1135
+ # retries, etc.
1136
+ # @return [Google::Gax::Operation]
1137
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1138
+ # @example
1139
+ # require "google/cloud/automl"
1140
+ #
1141
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1142
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.model_path("[PROJECT]", "[LOCATION]", "[MODEL]")
1143
+ #
1144
+ # # Register a callback during the method call.
1145
+ # operation = automl_client.delete_model(formatted_name) do |op|
1146
+ # raise op.results.message if op.error?
1147
+ # op_results = op.results
1148
+ # # Process the results.
1149
+ #
1150
+ # metadata = op.metadata
1151
+ # # Process the metadata.
1152
+ # end
1153
+ #
1154
+ # # Or use the return value to register a callback.
1155
+ # operation.on_done do |op|
1156
+ # raise op.results.message if op.error?
1157
+ # op_results = op.results
1158
+ # # Process the results.
1159
+ #
1160
+ # metadata = op.metadata
1161
+ # # Process the metadata.
1162
+ # end
1163
+ #
1164
+ # # Manually reload the operation.
1165
+ # operation.reload!
1166
+ #
1167
+ # # Or block until the operation completes, triggering callbacks on
1168
+ # # completion.
1169
+ # operation.wait_until_done!
1170
+
1171
+ def delete_model \
1172
+ name,
1173
+ options: nil
1174
+ req = {
1175
+ name: name
1176
+ }.delete_if { |_, v| v.nil? }
1177
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::DeleteModelRequest)
1178
+ operation = Google::Gax::Operation.new(
1179
+ @delete_model.call(req, options),
1180
+ @operations_client,
1181
+ Google::Protobuf::Empty,
1182
+ Google::Cloud::AutoML::V1beta1::OperationMetadata,
1183
+ call_options: options
1184
+ )
1185
+ operation.on_done { |operation| yield(operation) } if block_given?
1186
+ operation
1187
+ end
1188
+
1189
+ # Deploys a model. If a model is already deployed, deploying it with the
1190
+ # same parameters has no effect. Deploying with different parametrs
1191
+ # (as e.g. changing
1192
+ #
1193
+ # {Google::Cloud::AutoML::V1beta1::ImageObjectDetectionModelDeploymentMetadata#node_number node_number})
1194
+ # will reset the deployment state without pausing the model's availability.
1195
+ #
1196
+ # Only applicable for Text Classification, Image Object Detection and Tables;
1197
+ # all other domains manage deployment automatically.
1198
+ #
1199
+ # Returns an empty response in the
1200
+ # {Google::Longrunning::Operation#response response} field when it completes.
1201
+ #
1202
+ # @param name [String]
1203
+ # Resource name of the model to deploy.
1204
+ # @param image_object_detection_model_deployment_metadata [Google::Cloud::AutoML::V1beta1::ImageObjectDetectionModelDeploymentMetadata | Hash]
1205
+ # Model deployment metadata specific to Image Object Detection.
1206
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::ImageObjectDetectionModelDeploymentMetadata`
1207
+ # can also be provided.
1208
+ # @param options [Google::Gax::CallOptions]
1209
+ # Overrides the default settings for this call, e.g, timeout,
1210
+ # retries, etc.
1211
+ # @return [Google::Gax::Operation]
1212
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1213
+ # @example
1214
+ # require "google/cloud/automl"
1215
+ #
1216
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1217
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.model_path("[PROJECT]", "[LOCATION]", "[MODEL]")
1218
+ #
1219
+ # # Register a callback during the method call.
1220
+ # operation = automl_client.deploy_model(formatted_name) do |op|
1221
+ # raise op.results.message if op.error?
1222
+ # op_results = op.results
1223
+ # # Process the results.
1224
+ #
1225
+ # metadata = op.metadata
1226
+ # # Process the metadata.
1227
+ # end
1228
+ #
1229
+ # # Or use the return value to register a callback.
1230
+ # operation.on_done do |op|
1231
+ # raise op.results.message if op.error?
1232
+ # op_results = op.results
1233
+ # # Process the results.
1234
+ #
1235
+ # metadata = op.metadata
1236
+ # # Process the metadata.
1237
+ # end
1238
+ #
1239
+ # # Manually reload the operation.
1240
+ # operation.reload!
1241
+ #
1242
+ # # Or block until the operation completes, triggering callbacks on
1243
+ # # completion.
1244
+ # operation.wait_until_done!
1245
+
1246
+ def deploy_model \
1247
+ name,
1248
+ image_object_detection_model_deployment_metadata: nil,
1249
+ options: nil
1250
+ req = {
1251
+ name: name,
1252
+ image_object_detection_model_deployment_metadata: image_object_detection_model_deployment_metadata
1253
+ }.delete_if { |_, v| v.nil? }
1254
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::DeployModelRequest)
1255
+ operation = Google::Gax::Operation.new(
1256
+ @deploy_model.call(req, options),
1257
+ @operations_client,
1258
+ Google::Protobuf::Empty,
1259
+ Google::Cloud::AutoML::V1beta1::OperationMetadata,
1260
+ call_options: options
1261
+ )
1262
+ operation.on_done { |operation| yield(operation) } if block_given?
1263
+ operation
1264
+ end
1265
+
1266
+ # Undeploys a model. If the model is not deployed this method has no effect.
1267
+ #
1268
+ # Only applicable for Text Classification, Image Object Detection and Tables;
1269
+ # all other domains manage deployment automatically.
1270
+ #
1271
+ # Returns an empty response in the
1272
+ # {Google::Longrunning::Operation#response response} field when it completes.
1273
+ #
1274
+ # @param name [String]
1275
+ # Resource name of the model to undeploy.
1276
+ # @param options [Google::Gax::CallOptions]
1277
+ # Overrides the default settings for this call, e.g, timeout,
1278
+ # retries, etc.
1279
+ # @return [Google::Gax::Operation]
1280
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1281
+ # @example
1282
+ # require "google/cloud/automl"
1283
+ #
1284
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1285
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.model_path("[PROJECT]", "[LOCATION]", "[MODEL]")
1286
+ #
1287
+ # # Register a callback during the method call.
1288
+ # operation = automl_client.undeploy_model(formatted_name) do |op|
1289
+ # raise op.results.message if op.error?
1290
+ # op_results = op.results
1291
+ # # Process the results.
1292
+ #
1293
+ # metadata = op.metadata
1294
+ # # Process the metadata.
1295
+ # end
1296
+ #
1297
+ # # Or use the return value to register a callback.
1298
+ # operation.on_done do |op|
1299
+ # raise op.results.message if op.error?
1300
+ # op_results = op.results
1301
+ # # Process the results.
1302
+ #
1303
+ # metadata = op.metadata
1304
+ # # Process the metadata.
1305
+ # end
1306
+ #
1307
+ # # Manually reload the operation.
1308
+ # operation.reload!
1309
+ #
1310
+ # # Or block until the operation completes, triggering callbacks on
1311
+ # # completion.
1312
+ # operation.wait_until_done!
1313
+
1314
+ def undeploy_model \
1315
+ name,
1316
+ options: nil
1317
+ req = {
1318
+ name: name
1319
+ }.delete_if { |_, v| v.nil? }
1320
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::UndeployModelRequest)
1321
+ operation = Google::Gax::Operation.new(
1322
+ @undeploy_model.call(req, options),
1323
+ @operations_client,
1324
+ Google::Protobuf::Empty,
1325
+ Google::Cloud::AutoML::V1beta1::OperationMetadata,
1326
+ call_options: options
1327
+ )
1328
+ operation.on_done { |operation| yield(operation) } if block_given?
1329
+ operation
1330
+ end
1331
+
1332
+ # Gets a model evaluation.
1333
+ #
1334
+ # @param name [String]
1335
+ # Resource name for the model evaluation.
1336
+ # @param options [Google::Gax::CallOptions]
1337
+ # Overrides the default settings for this call, e.g, timeout,
1338
+ # retries, etc.
1339
+ # @yield [result, operation] Access the result along with the RPC operation
1340
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::ModelEvaluation]
1341
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1342
+ # @return [Google::Cloud::AutoML::V1beta1::ModelEvaluation]
1343
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1344
+ # @example
1345
+ # require "google/cloud/automl"
1346
+ #
1347
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1348
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.model_evaluation_path("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]")
1349
+ # response = automl_client.get_model_evaluation(formatted_name)
1350
+
1351
+ def get_model_evaluation \
1352
+ name,
1353
+ options: nil,
1354
+ &block
1355
+ req = {
1356
+ name: name
1357
+ }.delete_if { |_, v| v.nil? }
1358
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::GetModelEvaluationRequest)
1359
+ @get_model_evaluation.call(req, options, &block)
1360
+ end
1361
+
1362
+ # Exports a trained, "export-able", model to a user specified Google Cloud
1363
+ # Storage location. A model is considered export-able if and only if it has
1364
+ # an export format defined for it in
1365
+ #
1366
+ # {Google::Cloud::AutoML::V1beta1::ModelExportOutputConfig ModelExportOutputConfig}.
1367
+ #
1368
+ # Returns an empty response in the
1369
+ # {Google::Longrunning::Operation#response response} field when it completes.
1370
+ #
1371
+ # @param name [String]
1372
+ # Required. The resource name of the model to export.
1373
+ # @param output_config [Google::Cloud::AutoML::V1beta1::ModelExportOutputConfig | Hash]
1374
+ # Required. The desired output location and configuration.
1375
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::ModelExportOutputConfig`
1376
+ # can also be provided.
1377
+ # @param options [Google::Gax::CallOptions]
1378
+ # Overrides the default settings for this call, e.g, timeout,
1379
+ # retries, etc.
1380
+ # @return [Google::Gax::Operation]
1381
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1382
+ # @example
1383
+ # require "google/cloud/automl"
1384
+ #
1385
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1386
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.model_path("[PROJECT]", "[LOCATION]", "[MODEL]")
1387
+ #
1388
+ # # TODO: Initialize `output_config`:
1389
+ # output_config = {}
1390
+ #
1391
+ # # Register a callback during the method call.
1392
+ # operation = automl_client.export_model(formatted_name, output_config) do |op|
1393
+ # raise op.results.message if op.error?
1394
+ # op_results = op.results
1395
+ # # Process the results.
1396
+ #
1397
+ # metadata = op.metadata
1398
+ # # Process the metadata.
1399
+ # end
1400
+ #
1401
+ # # Or use the return value to register a callback.
1402
+ # operation.on_done do |op|
1403
+ # raise op.results.message if op.error?
1404
+ # op_results = op.results
1405
+ # # Process the results.
1406
+ #
1407
+ # metadata = op.metadata
1408
+ # # Process the metadata.
1409
+ # end
1410
+ #
1411
+ # # Manually reload the operation.
1412
+ # operation.reload!
1413
+ #
1414
+ # # Or block until the operation completes, triggering callbacks on
1415
+ # # completion.
1416
+ # operation.wait_until_done!
1417
+
1418
+ def export_model \
1419
+ name,
1420
+ output_config,
1421
+ options: nil
1422
+ req = {
1423
+ name: name,
1424
+ output_config: output_config
1425
+ }.delete_if { |_, v| v.nil? }
1426
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::ExportModelRequest)
1427
+ operation = Google::Gax::Operation.new(
1428
+ @export_model.call(req, options),
1429
+ @operations_client,
1430
+ Google::Protobuf::Empty,
1431
+ Google::Cloud::AutoML::V1beta1::OperationMetadata,
1432
+ call_options: options
1433
+ )
1434
+ operation.on_done { |operation| yield(operation) } if block_given?
1435
+ operation
1436
+ end
1437
+
1438
+ # Exports examples on which the model was evaluated (i.e. which were in the
1439
+ # TEST set of the dataset the model was created from), together with their
1440
+ # ground truth annotations and the annotations created (predicted) by the
1441
+ # model.
1442
+ # The examples, ground truth and predictions are exported in the state
1443
+ # they were at the moment the model was evaluated.
1444
+ #
1445
+ # This export is available only for 30 days since the model evaluation is
1446
+ # created.
1447
+ #
1448
+ # Currently only available for Tables.
1449
+ #
1450
+ # Returns an empty response in the
1451
+ # {Google::Longrunning::Operation#response response} field when it completes.
1452
+ #
1453
+ # @param name [String]
1454
+ # Required. The resource name of the model whose evaluated examples are to
1455
+ # be exported.
1456
+ # @param output_config [Google::Cloud::AutoML::V1beta1::ExportEvaluatedExamplesOutputConfig | Hash]
1457
+ # Required. The desired output location and configuration.
1458
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::ExportEvaluatedExamplesOutputConfig`
1459
+ # can also be provided.
1460
+ # @param options [Google::Gax::CallOptions]
1461
+ # Overrides the default settings for this call, e.g, timeout,
1462
+ # retries, etc.
1463
+ # @return [Google::Gax::Operation]
1464
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1465
+ # @example
1466
+ # require "google/cloud/automl"
1467
+ #
1468
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1469
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.model_path("[PROJECT]", "[LOCATION]", "[MODEL]")
1470
+ #
1471
+ # # TODO: Initialize `output_config`:
1472
+ # output_config = {}
1473
+ #
1474
+ # # Register a callback during the method call.
1475
+ # operation = automl_client.export_evaluated_examples(formatted_name, output_config) do |op|
1476
+ # raise op.results.message if op.error?
1477
+ # op_results = op.results
1478
+ # # Process the results.
1479
+ #
1480
+ # metadata = op.metadata
1481
+ # # Process the metadata.
1482
+ # end
1483
+ #
1484
+ # # Or use the return value to register a callback.
1485
+ # operation.on_done do |op|
1486
+ # raise op.results.message if op.error?
1487
+ # op_results = op.results
1488
+ # # Process the results.
1489
+ #
1490
+ # metadata = op.metadata
1491
+ # # Process the metadata.
1492
+ # end
1493
+ #
1494
+ # # Manually reload the operation.
1495
+ # operation.reload!
1496
+ #
1497
+ # # Or block until the operation completes, triggering callbacks on
1498
+ # # completion.
1499
+ # operation.wait_until_done!
1500
+
1501
+ def export_evaluated_examples \
1502
+ name,
1503
+ output_config,
1504
+ options: nil
1505
+ req = {
1506
+ name: name,
1507
+ output_config: output_config
1508
+ }.delete_if { |_, v| v.nil? }
1509
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::ExportEvaluatedExamplesRequest)
1510
+ operation = Google::Gax::Operation.new(
1511
+ @export_evaluated_examples.call(req, options),
1512
+ @operations_client,
1513
+ Google::Protobuf::Empty,
1514
+ Google::Cloud::AutoML::V1beta1::OperationMetadata,
1515
+ call_options: options
1516
+ )
1517
+ operation.on_done { |operation| yield(operation) } if block_given?
1518
+ operation
1519
+ end
1520
+
1521
+ # Lists model evaluations.
1522
+ #
1523
+ # @param parent [String]
1524
+ # Resource name of the model to list the model evaluations for.
1525
+ # If modelId is set as "-", this will list model evaluations from across all
1526
+ # models of the parent location.
1527
+ # @param filter [String]
1528
+ # An expression for filtering the results of the request.
1529
+ #
1530
+ # * `annotation_spec_id` - for =, != or existence. See example below for
1531
+ # the last.
1532
+ #
1533
+ # Some examples of using the filter are:
1534
+ #
1535
+ # * `annotation_spec_id!=4` --> The model evaluation was done for
1536
+ # annotation spec with ID different than 4.
1537
+ # * `NOT annotation_spec_id:*` --> The model evaluation was done for
1538
+ # aggregate of all annotation specs.
1539
+ # @param page_size [Integer]
1540
+ # The maximum number of resources contained in the underlying API
1541
+ # response. If page streaming is performed per-resource, this
1542
+ # parameter does not affect the return value. If page streaming is
1543
+ # performed per-page, this determines the maximum number of
1544
+ # resources in a page.
1545
+ # @param options [Google::Gax::CallOptions]
1546
+ # Overrides the default settings for this call, e.g, timeout,
1547
+ # retries, etc.
1548
+ # @yield [result, operation] Access the result along with the RPC operation
1549
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::ModelEvaluation>]
1550
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1551
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::ModelEvaluation>]
1552
+ # An enumerable of Google::Cloud::AutoML::V1beta1::ModelEvaluation instances.
1553
+ # See Google::Gax::PagedEnumerable documentation for other
1554
+ # operations such as per-page iteration or access to the response
1555
+ # object.
1556
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1557
+ # @example
1558
+ # require "google/cloud/automl"
1559
+ #
1560
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1561
+ # formatted_parent = Google::Cloud::AutoML::V1beta1::AutoMLClient.model_path("[PROJECT]", "[LOCATION]", "[MODEL]")
1562
+ #
1563
+ # # Iterate over all results.
1564
+ # automl_client.list_model_evaluations(formatted_parent).each do |element|
1565
+ # # Process element.
1566
+ # end
1567
+ #
1568
+ # # Or iterate over results one page at a time.
1569
+ # automl_client.list_model_evaluations(formatted_parent).each_page do |page|
1570
+ # # Process each page at a time.
1571
+ # page.each do |element|
1572
+ # # Process element.
1573
+ # end
1574
+ # end
1575
+
1576
+ def list_model_evaluations \
1577
+ parent,
1578
+ filter: nil,
1579
+ page_size: nil,
1580
+ options: nil,
1581
+ &block
1582
+ req = {
1583
+ parent: parent,
1584
+ filter: filter,
1585
+ page_size: page_size
1586
+ }.delete_if { |_, v| v.nil? }
1587
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::ListModelEvaluationsRequest)
1588
+ @list_model_evaluations.call(req, options, &block)
1589
+ end
1590
+
1591
+ # Gets an annotation spec.
1592
+ #
1593
+ # @param name [String]
1594
+ # The resource name of the annotation spec to retrieve.
1595
+ # @param options [Google::Gax::CallOptions]
1596
+ # Overrides the default settings for this call, e.g, timeout,
1597
+ # retries, etc.
1598
+ # @yield [result, operation] Access the result along with the RPC operation
1599
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::AnnotationSpec]
1600
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1601
+ # @return [Google::Cloud::AutoML::V1beta1::AnnotationSpec]
1602
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1603
+ # @example
1604
+ # require "google/cloud/automl"
1605
+ #
1606
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1607
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.annotation_spec_path("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]")
1608
+ # response = automl_client.get_annotation_spec(formatted_name)
1609
+
1610
+ def get_annotation_spec \
1611
+ name,
1612
+ options: nil,
1613
+ &block
1614
+ req = {
1615
+ name: name
1616
+ }.delete_if { |_, v| v.nil? }
1617
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::GetAnnotationSpecRequest)
1618
+ @get_annotation_spec.call(req, options, &block)
1619
+ end
1620
+
1621
+ # Gets a table spec.
1622
+ #
1623
+ # @param name [String]
1624
+ # The resource name of the table spec to retrieve.
1625
+ # @param field_mask [Google::Protobuf::FieldMask | Hash]
1626
+ # Mask specifying which fields to read.
1627
+ # A hash of the same form as `Google::Protobuf::FieldMask`
1628
+ # can also be provided.
1629
+ # @param options [Google::Gax::CallOptions]
1630
+ # Overrides the default settings for this call, e.g, timeout,
1631
+ # retries, etc.
1632
+ # @yield [result, operation] Access the result along with the RPC operation
1633
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::TableSpec]
1634
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1635
+ # @return [Google::Cloud::AutoML::V1beta1::TableSpec]
1636
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1637
+ # @example
1638
+ # require "google/cloud/automl"
1639
+ #
1640
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1641
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.table_spec_path("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]")
1642
+ # response = automl_client.get_table_spec(formatted_name)
1643
+
1644
+ def get_table_spec \
1645
+ name,
1646
+ field_mask: nil,
1647
+ options: nil,
1648
+ &block
1649
+ req = {
1650
+ name: name,
1651
+ field_mask: field_mask
1652
+ }.delete_if { |_, v| v.nil? }
1653
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::GetTableSpecRequest)
1654
+ @get_table_spec.call(req, options, &block)
1655
+ end
1656
+
1657
+ # Lists table specs in a dataset.
1658
+ #
1659
+ # @param parent [String]
1660
+ # The resource name of the dataset to list table specs from.
1661
+ # @param field_mask [Google::Protobuf::FieldMask | Hash]
1662
+ # Mask specifying which fields to read.
1663
+ # A hash of the same form as `Google::Protobuf::FieldMask`
1664
+ # can also be provided.
1665
+ # @param filter [String]
1666
+ # Filter expression, see go/filtering.
1667
+ # @param page_size [Integer]
1668
+ # The maximum number of resources contained in the underlying API
1669
+ # response. If page streaming is performed per-resource, this
1670
+ # parameter does not affect the return value. If page streaming is
1671
+ # performed per-page, this determines the maximum number of
1672
+ # resources in a page.
1673
+ # @param options [Google::Gax::CallOptions]
1674
+ # Overrides the default settings for this call, e.g, timeout,
1675
+ # retries, etc.
1676
+ # @yield [result, operation] Access the result along with the RPC operation
1677
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::TableSpec>]
1678
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1679
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::TableSpec>]
1680
+ # An enumerable of Google::Cloud::AutoML::V1beta1::TableSpec instances.
1681
+ # See Google::Gax::PagedEnumerable documentation for other
1682
+ # operations such as per-page iteration or access to the response
1683
+ # object.
1684
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1685
+ # @example
1686
+ # require "google/cloud/automl"
1687
+ #
1688
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1689
+ # formatted_parent = Google::Cloud::AutoML::V1beta1::AutoMLClient.dataset_path("[PROJECT]", "[LOCATION]", "[DATASET]")
1690
+ #
1691
+ # # Iterate over all results.
1692
+ # automl_client.list_table_specs(formatted_parent).each do |element|
1693
+ # # Process element.
1694
+ # end
1695
+ #
1696
+ # # Or iterate over results one page at a time.
1697
+ # automl_client.list_table_specs(formatted_parent).each_page do |page|
1698
+ # # Process each page at a time.
1699
+ # page.each do |element|
1700
+ # # Process element.
1701
+ # end
1702
+ # end
1703
+
1704
+ def list_table_specs \
1705
+ parent,
1706
+ field_mask: nil,
1707
+ filter: nil,
1708
+ page_size: nil,
1709
+ options: nil,
1710
+ &block
1711
+ req = {
1712
+ parent: parent,
1713
+ field_mask: field_mask,
1714
+ filter: filter,
1715
+ page_size: page_size
1716
+ }.delete_if { |_, v| v.nil? }
1717
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::ListTableSpecsRequest)
1718
+ @list_table_specs.call(req, options, &block)
1719
+ end
1720
+
1721
+ # Updates a table spec.
1722
+ #
1723
+ # @param table_spec [Google::Cloud::AutoML::V1beta1::TableSpec | Hash]
1724
+ # The table spec which replaces the resource on the server.
1725
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::TableSpec`
1726
+ # can also be provided.
1727
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
1728
+ # The update mask applies to the resource. For the `FieldMask` definition,
1729
+ # see
1730
+ #
1731
+ # https:
1732
+ # //developers.google.com/protocol-buffers
1733
+ # // /docs/reference/google.protobuf#fieldmask
1734
+ # A hash of the same form as `Google::Protobuf::FieldMask`
1735
+ # can also be provided.
1736
+ # @param options [Google::Gax::CallOptions]
1737
+ # Overrides the default settings for this call, e.g, timeout,
1738
+ # retries, etc.
1739
+ # @yield [result, operation] Access the result along with the RPC operation
1740
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::TableSpec]
1741
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1742
+ # @return [Google::Cloud::AutoML::V1beta1::TableSpec]
1743
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1744
+ # @example
1745
+ # require "google/cloud/automl"
1746
+ #
1747
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1748
+ #
1749
+ # # TODO: Initialize `table_spec`:
1750
+ # table_spec = {}
1751
+ # response = automl_client.update_table_spec(table_spec)
1752
+
1753
+ def update_table_spec \
1754
+ table_spec,
1755
+ update_mask: nil,
1756
+ options: nil,
1757
+ &block
1758
+ req = {
1759
+ table_spec: table_spec,
1760
+ update_mask: update_mask
1761
+ }.delete_if { |_, v| v.nil? }
1762
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::UpdateTableSpecRequest)
1763
+ @update_table_spec.call(req, options, &block)
1764
+ end
1765
+
1766
+ # Gets a column spec.
1767
+ #
1768
+ # @param name [String]
1769
+ # The resource name of the column spec to retrieve.
1770
+ # @param field_mask [Google::Protobuf::FieldMask | Hash]
1771
+ # Mask specifying which fields to read.
1772
+ # A hash of the same form as `Google::Protobuf::FieldMask`
1773
+ # can also be provided.
1774
+ # @param options [Google::Gax::CallOptions]
1775
+ # Overrides the default settings for this call, e.g, timeout,
1776
+ # retries, etc.
1777
+ # @yield [result, operation] Access the result along with the RPC operation
1778
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::ColumnSpec]
1779
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1780
+ # @return [Google::Cloud::AutoML::V1beta1::ColumnSpec]
1781
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1782
+ # @example
1783
+ # require "google/cloud/automl"
1784
+ #
1785
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1786
+ # formatted_name = Google::Cloud::AutoML::V1beta1::AutoMLClient.column_spec_path("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]", "[COLUMN_SPEC]")
1787
+ # response = automl_client.get_column_spec(formatted_name)
1788
+
1789
+ def get_column_spec \
1790
+ name,
1791
+ field_mask: nil,
1792
+ options: nil,
1793
+ &block
1794
+ req = {
1795
+ name: name,
1796
+ field_mask: field_mask
1797
+ }.delete_if { |_, v| v.nil? }
1798
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::GetColumnSpecRequest)
1799
+ @get_column_spec.call(req, options, &block)
1800
+ end
1801
+
1802
+ # Lists column specs in a table spec.
1803
+ #
1804
+ # @param parent [String]
1805
+ # The resource name of the table spec to list column specs from.
1806
+ # @param field_mask [Google::Protobuf::FieldMask | Hash]
1807
+ # Mask specifying which fields to read.
1808
+ # A hash of the same form as `Google::Protobuf::FieldMask`
1809
+ # can also be provided.
1810
+ # @param filter [String]
1811
+ # Filter expression, see go/filtering.
1812
+ # @param page_size [Integer]
1813
+ # The maximum number of resources contained in the underlying API
1814
+ # response. If page streaming is performed per-resource, this
1815
+ # parameter does not affect the return value. If page streaming is
1816
+ # performed per-page, this determines the maximum number of
1817
+ # resources in a page.
1818
+ # @param options [Google::Gax::CallOptions]
1819
+ # Overrides the default settings for this call, e.g, timeout,
1820
+ # retries, etc.
1821
+ # @yield [result, operation] Access the result along with the RPC operation
1822
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::ColumnSpec>]
1823
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1824
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::AutoML::V1beta1::ColumnSpec>]
1825
+ # An enumerable of Google::Cloud::AutoML::V1beta1::ColumnSpec instances.
1826
+ # See Google::Gax::PagedEnumerable documentation for other
1827
+ # operations such as per-page iteration or access to the response
1828
+ # object.
1829
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1830
+ # @example
1831
+ # require "google/cloud/automl"
1832
+ #
1833
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1834
+ # formatted_parent = Google::Cloud::AutoML::V1beta1::AutoMLClient.table_spec_path("[PROJECT]", "[LOCATION]", "[DATASET]", "[TABLE_SPEC]")
1835
+ #
1836
+ # # Iterate over all results.
1837
+ # automl_client.list_column_specs(formatted_parent).each do |element|
1838
+ # # Process element.
1839
+ # end
1840
+ #
1841
+ # # Or iterate over results one page at a time.
1842
+ # automl_client.list_column_specs(formatted_parent).each_page do |page|
1843
+ # # Process each page at a time.
1844
+ # page.each do |element|
1845
+ # # Process element.
1846
+ # end
1847
+ # end
1848
+
1849
+ def list_column_specs \
1850
+ parent,
1851
+ field_mask: nil,
1852
+ filter: nil,
1853
+ page_size: nil,
1854
+ options: nil,
1855
+ &block
1856
+ req = {
1857
+ parent: parent,
1858
+ field_mask: field_mask,
1859
+ filter: filter,
1860
+ page_size: page_size
1861
+ }.delete_if { |_, v| v.nil? }
1862
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::ListColumnSpecsRequest)
1863
+ @list_column_specs.call(req, options, &block)
1864
+ end
1865
+
1866
+ # Updates a column spec.
1867
+ #
1868
+ # @param column_spec [Google::Cloud::AutoML::V1beta1::ColumnSpec | Hash]
1869
+ # The column spec which replaces the resource on the server.
1870
+ # A hash of the same form as `Google::Cloud::AutoML::V1beta1::ColumnSpec`
1871
+ # can also be provided.
1872
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
1873
+ # The update mask applies to the resource. For the `FieldMask` definition,
1874
+ # see
1875
+ #
1876
+ # https:
1877
+ # //developers.google.com/protocol-buffers
1878
+ # // /docs/reference/google.protobuf#fieldmask
1879
+ # A hash of the same form as `Google::Protobuf::FieldMask`
1880
+ # can also be provided.
1881
+ # @param options [Google::Gax::CallOptions]
1882
+ # Overrides the default settings for this call, e.g, timeout,
1883
+ # retries, etc.
1884
+ # @yield [result, operation] Access the result along with the RPC operation
1885
+ # @yieldparam result [Google::Cloud::AutoML::V1beta1::ColumnSpec]
1886
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1887
+ # @return [Google::Cloud::AutoML::V1beta1::ColumnSpec]
1888
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1889
+ # @example
1890
+ # require "google/cloud/automl"
1891
+ #
1892
+ # automl_client = Google::Cloud::AutoML::AutoML.new(version: :v1beta1)
1893
+ #
1894
+ # # TODO: Initialize `column_spec`:
1895
+ # column_spec = {}
1896
+ # response = automl_client.update_column_spec(column_spec)
1897
+
1898
+ def update_column_spec \
1899
+ column_spec,
1900
+ update_mask: nil,
1901
+ options: nil,
1902
+ &block
1903
+ req = {
1904
+ column_spec: column_spec,
1905
+ update_mask: update_mask
1906
+ }.delete_if { |_, v| v.nil? }
1907
+ req = Google::Gax::to_proto(req, Google::Cloud::AutoML::V1beta1::UpdateColumnSpecRequest)
1908
+ @update_column_spec.call(req, options, &block)
1909
+ end
1910
+ end
1911
+ end
1912
+ end
1913
+ end
1914
+ end