google-cloud-automl-v1 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/automl/v1/version"
24
+
25
+ require "google/cloud/automl/v1/automl/credentials"
26
+ require "google/cloud/automl/v1/automl/paths"
27
+ require "google/cloud/automl/v1/automl/rest/operations"
28
+ require "google/cloud/automl/v1/automl/rest/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module AutoML
33
+ module V1
34
+ ##
35
+ # AutoML Server API.
36
+ #
37
+ # The resource names are assigned by the server.
38
+ # The server never reuses names that it has created after the resources with
39
+ # those names are deleted.
40
+ #
41
+ # An ID of a resource is the last element of the item's resource name. For
42
+ # `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then
43
+ # the id for the item is `{dataset_id}`.
44
+ #
45
+ # Currently the only supported `location_id` is "us-central1".
46
+ #
47
+ # On any input that is documented to expect a string parameter in
48
+ # snake_case or dash-case, either of those cases is accepted.
49
+ #
50
+ # To load this service and instantiate a REST client:
51
+ #
52
+ # require "google/cloud/automl/v1/automl/rest"
53
+ # client = ::Google::Cloud::AutoML::V1::AutoML::Rest::Client.new
54
+ #
55
+ module AutoML
56
+ # Client for the REST transport
57
+ module Rest
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
66
+ require "google/cloud/automl/v1/automl/rest/helpers" if ::File.file? helper_path
@@ -26,6 +26,7 @@ require "google/cloud/automl/v1/automl/credentials"
26
26
  require "google/cloud/automl/v1/automl/paths"
27
27
  require "google/cloud/automl/v1/automl/operations"
28
28
  require "google/cloud/automl/v1/automl/client"
29
+ require "google/cloud/automl/v1/automl/rest"
29
30
 
30
31
  module Google
31
32
  module Cloud
@@ -47,11 +48,16 @@ module Google
47
48
  # On any input that is documented to expect a string parameter in
48
49
  # snake_case or dash-case, either of those cases is accepted.
49
50
  #
50
- # To load this service and instantiate a client:
51
+ # @example Load this service and instantiate a gRPC client
51
52
  #
52
53
  # require "google/cloud/automl/v1/automl"
53
54
  # client = ::Google::Cloud::AutoML::V1::AutoML::Client.new
54
55
  #
56
+ # @example Load this service and instantiate a REST client
57
+ #
58
+ # require "google/cloud/automl/v1/automl/rest"
59
+ # client = ::Google::Cloud::AutoML::V1::AutoML::Rest::Client.new
60
+ #
55
61
  module AutoML
56
62
  end
57
63
  end
@@ -462,14 +462,14 @@ module Google
462
462
  # # Call the batch_predict method.
463
463
  # result = client.batch_predict request
464
464
  #
465
- # # The returned object is of type Gapic::Operation. You can use this
466
- # # object to check the status of an operation, cancel it, or wait
467
- # # for results. Here is how to block until completion:
465
+ # # The returned object is of type Gapic::Operation. You can use it to
466
+ # # check the status of an operation, cancel it, or wait for results.
467
+ # # Here is how to wait for a response.
468
468
  # result.wait_until_done! timeout: 60
469
469
  # if result.response?
470
470
  # p result.response
471
471
  # else
472
- # puts "Error!"
472
+ # puts "No response received."
473
473
  # end
474
474
  #
475
475
  def batch_predict request, options = nil
@@ -158,13 +158,11 @@ module Google
158
158
  # # Call the list_operations method.
159
159
  # result = client.list_operations request
160
160
  #
161
- # # The returned object is of type Gapic::PagedEnumerable. You can
162
- # # iterate over all elements by calling #each, and the enumerable
163
- # # will lazily make API calls to fetch subsequent pages. Other
164
- # # methods are also available for managing paging directly.
165
- # result.each do |response|
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
166
164
  # # Each element is of type ::Google::Longrunning::Operation.
167
- # p response
165
+ # p item
168
166
  # end
169
167
  #
170
168
  def list_operations request, options = nil
@@ -253,14 +251,14 @@ module Google
253
251
  # # Call the get_operation method.
254
252
  # result = client.get_operation request
255
253
  #
256
- # # The returned object is of type Gapic::Operation. You can use this
257
- # # object to check the status of an operation, cancel it, or wait
258
- # # for results. Here is how to block until completion:
254
+ # # The returned object is of type Gapic::Operation. You can use it to
255
+ # # check the status of an operation, cancel it, or wait for results.
256
+ # # Here is how to wait for a response.
259
257
  # result.wait_until_done! timeout: 60
260
258
  # if result.response?
261
259
  # p result.response
262
260
  # else
263
- # puts "Error!"
261
+ # puts "No response received."
264
262
  # end
265
263
  #
266
264
  def get_operation request, options = nil
@@ -540,14 +538,14 @@ module Google
540
538
  # # Call the wait_operation method.
541
539
  # result = client.wait_operation request
542
540
  #
543
- # # The returned object is of type Gapic::Operation. You can use this
544
- # # object to check the status of an operation, cancel it, or wait
545
- # # for results. Here is how to block until completion:
541
+ # # The returned object is of type Gapic::Operation. You can use it to
542
+ # # check the status of an operation, cancel it, or wait for results.
543
+ # # Here is how to wait for a response.
546
544
  # result.wait_until_done! timeout: 60
547
545
  # if result.response?
548
546
  # p result.response
549
547
  # else
550
- # puts "Error!"
548
+ # puts "No response received."
551
549
  # end
552
550
  #
553
551
  def wait_operation request, options = nil
@@ -567,6 +565,14 @@ module Google
567
565
  gapic_version: ::Google::Cloud::AutoML::V1::VERSION
568
566
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
569
567
 
568
+ header_params = {}
569
+ if request.name
570
+ header_params["name"] = request.name
571
+ end
572
+
573
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
574
+ metadata[:"x-goog-request-params"] ||= request_params_header
575
+
570
576
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
571
577
  metadata: metadata,
572
578
  retry_policy: @config.rpcs.wait_operation.retry_policy