google-cloud-automl-v1 0.2.5 → 0.4.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.
@@ -34,3 +34,6 @@ module Google
34
34
  end
35
35
  end
36
36
  end
37
+
38
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
39
+ require "google/cloud/automl/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+
18
+ module Google
19
+ module Cloud
20
+ module Automl
21
+ module V1
22
+ VERSION = ::Google::Cloud::AutoML::V1::VERSION
23
+ end
24
+ end
25
+ end
26
+ end
@@ -73,7 +73,7 @@ module Google
73
73
  parent_config = while namespace.any?
74
74
  parent_name = namespace.join "::"
75
75
  parent_const = const_get parent_name
76
- break parent_const.configure if parent_const&.respond_to? :configure
76
+ break parent_const.configure if parent_const.respond_to? :configure
77
77
  namespace.pop
78
78
  end
79
79
  default_config = Client::Configuration.new parent_config
@@ -83,17 +83,17 @@ module Google
83
83
  default_config.rpcs.get_dataset.timeout = 5.0
84
84
  default_config.rpcs.get_dataset.retry_policy = {
85
85
  initial_delay: 0.1,
86
- max_delay: 60.0,
87
- multiplier: 1.3,
88
- retry_codes: [4, 14]
86
+ max_delay: 60.0,
87
+ multiplier: 1.3,
88
+ retry_codes: [4, 14]
89
89
  }
90
90
 
91
91
  default_config.rpcs.list_datasets.timeout = 5.0
92
92
  default_config.rpcs.list_datasets.retry_policy = {
93
93
  initial_delay: 0.1,
94
- max_delay: 60.0,
95
- multiplier: 1.3,
96
- retry_codes: [4, 14]
94
+ max_delay: 60.0,
95
+ multiplier: 1.3,
96
+ retry_codes: [4, 14]
97
97
  }
98
98
 
99
99
  default_config.rpcs.update_dataset.timeout = 5.0
@@ -101,9 +101,9 @@ module Google
101
101
  default_config.rpcs.delete_dataset.timeout = 5.0
102
102
  default_config.rpcs.delete_dataset.retry_policy = {
103
103
  initial_delay: 0.1,
104
- max_delay: 60.0,
105
- multiplier: 1.3,
106
- retry_codes: [4, 14]
104
+ max_delay: 60.0,
105
+ multiplier: 1.3,
106
+ retry_codes: [4, 14]
107
107
  }
108
108
 
109
109
  default_config.rpcs.import_data.timeout = 5.0
@@ -113,9 +113,9 @@ module Google
113
113
  default_config.rpcs.get_annotation_spec.timeout = 5.0
114
114
  default_config.rpcs.get_annotation_spec.retry_policy = {
115
115
  initial_delay: 0.1,
116
- max_delay: 60.0,
117
- multiplier: 1.3,
118
- retry_codes: [4, 14]
116
+ max_delay: 60.0,
117
+ multiplier: 1.3,
118
+ retry_codes: [4, 14]
119
119
  }
120
120
 
121
121
  default_config.rpcs.create_model.timeout = 5.0
@@ -123,25 +123,25 @@ module Google
123
123
  default_config.rpcs.get_model.timeout = 5.0
124
124
  default_config.rpcs.get_model.retry_policy = {
125
125
  initial_delay: 0.1,
126
- max_delay: 60.0,
127
- multiplier: 1.3,
128
- retry_codes: [4, 14]
126
+ max_delay: 60.0,
127
+ multiplier: 1.3,
128
+ retry_codes: [4, 14]
129
129
  }
130
130
 
131
131
  default_config.rpcs.list_models.timeout = 5.0
132
132
  default_config.rpcs.list_models.retry_policy = {
133
133
  initial_delay: 0.1,
134
- max_delay: 60.0,
135
- multiplier: 1.3,
136
- retry_codes: [4, 14]
134
+ max_delay: 60.0,
135
+ multiplier: 1.3,
136
+ retry_codes: [4, 14]
137
137
  }
138
138
 
139
139
  default_config.rpcs.delete_model.timeout = 5.0
140
140
  default_config.rpcs.delete_model.retry_policy = {
141
141
  initial_delay: 0.1,
142
- max_delay: 60.0,
143
- multiplier: 1.3,
144
- retry_codes: [4, 14]
142
+ max_delay: 60.0,
143
+ multiplier: 1.3,
144
+ retry_codes: [4, 14]
145
145
  }
146
146
 
147
147
  default_config.rpcs.update_model.timeout = 5.0
@@ -155,17 +155,17 @@ module Google
155
155
  default_config.rpcs.get_model_evaluation.timeout = 5.0
156
156
  default_config.rpcs.get_model_evaluation.retry_policy = {
157
157
  initial_delay: 0.1,
158
- max_delay: 60.0,
159
- multiplier: 1.3,
160
- retry_codes: [4, 14]
158
+ max_delay: 60.0,
159
+ multiplier: 1.3,
160
+ retry_codes: [4, 14]
161
161
  }
162
162
 
163
163
  default_config.rpcs.list_model_evaluations.timeout = 5.0
164
164
  default_config.rpcs.list_model_evaluations.retry_policy = {
165
165
  initial_delay: 0.1,
166
- max_delay: 60.0,
167
- multiplier: 1.3,
168
- retry_codes: [4, 14]
166
+ max_delay: 60.0,
167
+ multiplier: 1.3,
168
+ retry_codes: [4, 14]
169
169
  }
170
170
 
171
171
  default_config
@@ -229,7 +229,13 @@ module Google
229
229
 
230
230
  # Create credentials
231
231
  credentials = @config.credentials
232
- credentials ||= Credentials.default scope: @config.scope
232
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
233
+ # but only if the default endpoint does not have a region prefix.
234
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
235
+ @config.endpoint == Client.configure.endpoint &&
236
+ !@config.endpoint.split(".").first.include?("-")
237
+ credentials ||= Credentials.default scope: @config.scope,
238
+ enable_self_signed_jwt: enable_self_signed_jwt
233
239
  if credentials.is_a?(String) || credentials.is_a?(Hash)
234
240
  credentials = Credentials.new credentials, scope: @config.scope
235
241
  end
@@ -304,7 +310,7 @@ module Google
304
310
  # Set x-goog-api-client and x-goog-user-project headers
305
311
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
306
312
  lib_name: @config.lib_name, lib_version: @config.lib_version,
307
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
313
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
308
314
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
309
315
 
310
316
  header_params = {
@@ -371,7 +377,7 @@ module Google
371
377
  # Set x-goog-api-client and x-goog-user-project headers
372
378
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
373
379
  lib_name: @config.lib_name, lib_version: @config.lib_version,
374
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
380
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
375
381
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
376
382
 
377
383
  header_params = {
@@ -453,7 +459,7 @@ module Google
453
459
  # Set x-goog-api-client and x-goog-user-project headers
454
460
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
455
461
  lib_name: @config.lib_name, lib_version: @config.lib_version,
456
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
462
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
457
463
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
458
464
 
459
465
  header_params = {
@@ -522,7 +528,7 @@ module Google
522
528
  # Set x-goog-api-client and x-goog-user-project headers
523
529
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
524
530
  lib_name: @config.lib_name, lib_version: @config.lib_version,
525
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
531
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
526
532
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
527
533
 
528
534
  header_params = {
@@ -592,7 +598,7 @@ module Google
592
598
  # Set x-goog-api-client and x-goog-user-project headers
593
599
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
594
600
  lib_name: @config.lib_name, lib_version: @config.lib_version,
595
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
601
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
596
602
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
597
603
 
598
604
  header_params = {
@@ -671,7 +677,7 @@ module Google
671
677
  # Set x-goog-api-client and x-goog-user-project headers
672
678
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
673
679
  lib_name: @config.lib_name, lib_version: @config.lib_version,
674
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
680
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
675
681
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
676
682
 
677
683
  header_params = {
@@ -742,7 +748,7 @@ module Google
742
748
  # Set x-goog-api-client and x-goog-user-project headers
743
749
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
744
750
  lib_name: @config.lib_name, lib_version: @config.lib_version,
745
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
751
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
746
752
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
747
753
 
748
754
  header_params = {
@@ -809,7 +815,7 @@ module Google
809
815
  # Set x-goog-api-client and x-goog-user-project headers
810
816
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
811
817
  lib_name: @config.lib_name, lib_version: @config.lib_version,
812
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
818
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
813
819
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
814
820
 
815
821
  header_params = {
@@ -881,7 +887,7 @@ module Google
881
887
  # Set x-goog-api-client and x-goog-user-project headers
882
888
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
883
889
  lib_name: @config.lib_name, lib_version: @config.lib_version,
884
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
890
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
885
891
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
886
892
 
887
893
  header_params = {
@@ -948,7 +954,7 @@ module Google
948
954
  # Set x-goog-api-client and x-goog-user-project headers
949
955
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
950
956
  lib_name: @config.lib_name, lib_version: @config.lib_version,
951
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
957
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
952
958
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
953
959
 
954
960
  header_params = {
@@ -1031,7 +1037,7 @@ module Google
1031
1037
  # Set x-goog-api-client and x-goog-user-project headers
1032
1038
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1033
1039
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1034
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
1040
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
1035
1041
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1036
1042
 
1037
1043
  header_params = {
@@ -1102,7 +1108,7 @@ module Google
1102
1108
  # Set x-goog-api-client and x-goog-user-project headers
1103
1109
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1104
1110
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1105
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
1111
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
1106
1112
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1107
1113
 
1108
1114
  header_params = {
@@ -1171,7 +1177,7 @@ module Google
1171
1177
  # Set x-goog-api-client and x-goog-user-project headers
1172
1178
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1173
1179
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1174
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
1180
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
1175
1181
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1176
1182
 
1177
1183
  header_params = {
@@ -1252,7 +1258,7 @@ module Google
1252
1258
  # Set x-goog-api-client and x-goog-user-project headers
1253
1259
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1254
1260
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1255
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
1261
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
1256
1262
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1257
1263
 
1258
1264
  header_params = {
@@ -1325,7 +1331,7 @@ module Google
1325
1331
  # Set x-goog-api-client and x-goog-user-project headers
1326
1332
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1327
1333
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1328
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
1334
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
1329
1335
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1330
1336
 
1331
1337
  header_params = {
@@ -1400,7 +1406,7 @@ module Google
1400
1406
  # Set x-goog-api-client and x-goog-user-project headers
1401
1407
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1402
1408
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1403
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
1409
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
1404
1410
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1405
1411
 
1406
1412
  header_params = {
@@ -1467,7 +1473,7 @@ module Google
1467
1473
  # Set x-goog-api-client and x-goog-user-project headers
1468
1474
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1469
1475
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1470
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
1476
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
1471
1477
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1472
1478
 
1473
1479
  header_params = {
@@ -1554,7 +1560,7 @@ module Google
1554
1560
  # Set x-goog-api-client and x-goog-user-project headers
1555
1561
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1556
1562
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1557
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
1563
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
1558
1564
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1559
1565
 
1560
1566
  header_params = {
@@ -1663,14 +1669,14 @@ module Google
1663
1669
 
1664
1670
  config_attr :endpoint, "automl.googleapis.com", ::String
1665
1671
  config_attr :credentials, nil do |value|
1666
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1672
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1667
1673
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1668
1674
  allowed.any? { |klass| klass === value }
1669
1675
  end
1670
1676
  config_attr :scope, nil, ::String, ::Array, nil
1671
1677
  config_attr :lib_name, nil, ::String, nil
1672
1678
  config_attr :lib_version, nil, ::String, nil
1673
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
1679
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1674
1680
  config_attr :interceptors, nil, ::Array, nil
1675
1681
  config_attr :timeout, nil, ::Numeric, nil
1676
1682
  config_attr :metadata, nil, ::Hash, nil
@@ -1691,7 +1697,7 @@ module Google
1691
1697
  def rpcs
1692
1698
  @rpcs ||= begin
1693
1699
  parent_rpcs = nil
1694
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1700
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1695
1701
  Rpcs.new parent_rpcs
1696
1702
  end
1697
1703
  end
@@ -1703,7 +1709,7 @@ module Google
1703
1709
  # Each configuration object is of type `Gapic::Config::Method` and includes
1704
1710
  # the following configuration fields:
1705
1711
  #
1706
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1712
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1707
1713
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1708
1714
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1709
1715
  # include the following keys:
@@ -1807,41 +1813,41 @@ module Google
1807
1813
 
1808
1814
  # @private
1809
1815
  def initialize parent_rpcs = nil
1810
- create_dataset_config = parent_rpcs&.create_dataset if parent_rpcs&.respond_to? :create_dataset
1816
+ create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset
1811
1817
  @create_dataset = ::Gapic::Config::Method.new create_dataset_config
1812
- get_dataset_config = parent_rpcs&.get_dataset if parent_rpcs&.respond_to? :get_dataset
1818
+ get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset
1813
1819
  @get_dataset = ::Gapic::Config::Method.new get_dataset_config
1814
- list_datasets_config = parent_rpcs&.list_datasets if parent_rpcs&.respond_to? :list_datasets
1820
+ list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets
1815
1821
  @list_datasets = ::Gapic::Config::Method.new list_datasets_config
1816
- update_dataset_config = parent_rpcs&.update_dataset if parent_rpcs&.respond_to? :update_dataset
1822
+ update_dataset_config = parent_rpcs.update_dataset if parent_rpcs.respond_to? :update_dataset
1817
1823
  @update_dataset = ::Gapic::Config::Method.new update_dataset_config
1818
- delete_dataset_config = parent_rpcs&.delete_dataset if parent_rpcs&.respond_to? :delete_dataset
1824
+ delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset
1819
1825
  @delete_dataset = ::Gapic::Config::Method.new delete_dataset_config
1820
- import_data_config = parent_rpcs&.import_data if parent_rpcs&.respond_to? :import_data
1826
+ import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data
1821
1827
  @import_data = ::Gapic::Config::Method.new import_data_config
1822
- export_data_config = parent_rpcs&.export_data if parent_rpcs&.respond_to? :export_data
1828
+ export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data
1823
1829
  @export_data = ::Gapic::Config::Method.new export_data_config
1824
- get_annotation_spec_config = parent_rpcs&.get_annotation_spec if parent_rpcs&.respond_to? :get_annotation_spec
1830
+ get_annotation_spec_config = parent_rpcs.get_annotation_spec if parent_rpcs.respond_to? :get_annotation_spec
1825
1831
  @get_annotation_spec = ::Gapic::Config::Method.new get_annotation_spec_config
1826
- create_model_config = parent_rpcs&.create_model if parent_rpcs&.respond_to? :create_model
1832
+ create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model
1827
1833
  @create_model = ::Gapic::Config::Method.new create_model_config
1828
- get_model_config = parent_rpcs&.get_model if parent_rpcs&.respond_to? :get_model
1834
+ get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model
1829
1835
  @get_model = ::Gapic::Config::Method.new get_model_config
1830
- list_models_config = parent_rpcs&.list_models if parent_rpcs&.respond_to? :list_models
1836
+ list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models
1831
1837
  @list_models = ::Gapic::Config::Method.new list_models_config
1832
- delete_model_config = parent_rpcs&.delete_model if parent_rpcs&.respond_to? :delete_model
1838
+ delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model
1833
1839
  @delete_model = ::Gapic::Config::Method.new delete_model_config
1834
- update_model_config = parent_rpcs&.update_model if parent_rpcs&.respond_to? :update_model
1840
+ update_model_config = parent_rpcs.update_model if parent_rpcs.respond_to? :update_model
1835
1841
  @update_model = ::Gapic::Config::Method.new update_model_config
1836
- deploy_model_config = parent_rpcs&.deploy_model if parent_rpcs&.respond_to? :deploy_model
1842
+ deploy_model_config = parent_rpcs.deploy_model if parent_rpcs.respond_to? :deploy_model
1837
1843
  @deploy_model = ::Gapic::Config::Method.new deploy_model_config
1838
- undeploy_model_config = parent_rpcs&.undeploy_model if parent_rpcs&.respond_to? :undeploy_model
1844
+ undeploy_model_config = parent_rpcs.undeploy_model if parent_rpcs.respond_to? :undeploy_model
1839
1845
  @undeploy_model = ::Gapic::Config::Method.new undeploy_model_config
1840
- export_model_config = parent_rpcs&.export_model if parent_rpcs&.respond_to? :export_model
1846
+ export_model_config = parent_rpcs.export_model if parent_rpcs.respond_to? :export_model
1841
1847
  @export_model = ::Gapic::Config::Method.new export_model_config
1842
- get_model_evaluation_config = parent_rpcs&.get_model_evaluation if parent_rpcs&.respond_to? :get_model_evaluation
1848
+ get_model_evaluation_config = parent_rpcs.get_model_evaluation if parent_rpcs.respond_to? :get_model_evaluation
1843
1849
  @get_model_evaluation = ::Gapic::Config::Method.new get_model_evaluation_config
1844
- list_model_evaluations_config = parent_rpcs&.list_model_evaluations if parent_rpcs&.respond_to? :list_model_evaluations
1850
+ list_model_evaluations_config = parent_rpcs.list_model_evaluations if parent_rpcs.respond_to? :list_model_evaluations
1845
1851
  @list_model_evaluations = ::Gapic::Config::Method.new list_model_evaluations_config
1846
1852
 
1847
1853
  yield self if block_given?
@@ -103,8 +103,13 @@ module Google
103
103
  # Lists operations that match the specified filter in the request. If the
104
104
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
105
105
  #
106
- # NOTE: the `name` binding below allows API services to override the binding
107
- # to use different resource name schemes, such as `users/*/operations`.
106
+ # NOTE: the `name` binding allows API services to override the binding
107
+ # to use different resource name schemes, such as `users/*/operations`. To
108
+ # override the binding, API services can add a binding such as
109
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
110
+ # For backwards compatibility, the default name includes the operations
111
+ # collection id, however overriding users must ensure the name binding
112
+ # is the parent resource, without the operations collection id.
108
113
  #
109
114
  # @overload list_operations(request, options = nil)
110
115
  # Pass arguments to `list_operations` via a request object, either of type
@@ -122,7 +127,7 @@ module Google
122
127
  # the default parameter values, pass an empty Hash as a request object (see above).
123
128
  #
124
129
  # @param name [::String]
125
- # The name of the operation collection.
130
+ # The name of the operation's parent resource.
126
131
  # @param filter [::String]
127
132
  # The standard list filter.
128
133
  # @param page_size [::Integer]
@@ -152,7 +157,7 @@ module Google
152
157
  # Set x-goog-api-client and x-goog-user-project headers
153
158
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
154
159
  lib_name: @config.lib_name, lib_version: @config.lib_version,
155
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
160
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
156
161
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
157
162
 
158
163
  header_params = {
@@ -222,7 +227,7 @@ module Google
222
227
  # Set x-goog-api-client and x-goog-user-project headers
223
228
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
224
229
  lib_name: @config.lib_name, lib_version: @config.lib_version,
225
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
230
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
226
231
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
227
232
 
228
233
  header_params = {
@@ -292,7 +297,7 @@ module Google
292
297
  # Set x-goog-api-client and x-goog-user-project headers
293
298
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
294
299
  lib_name: @config.lib_name, lib_version: @config.lib_version,
295
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
300
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
296
301
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
297
302
 
298
303
  header_params = {
@@ -367,7 +372,7 @@ module Google
367
372
  # Set x-goog-api-client and x-goog-user-project headers
368
373
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
369
374
  lib_name: @config.lib_name, lib_version: @config.lib_version,
370
- gapic_version: ::Google::Cloud::Automl::V1::VERSION
375
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
371
376
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
372
377
 
373
378
  header_params = {
@@ -390,6 +395,79 @@ module Google
390
395
  raise ::Google::Cloud::Error.from_error(e)
391
396
  end
392
397
 
398
+ ##
399
+ # Waits for the specified long-running operation until it is done or reaches
400
+ # at most a specified timeout, returning the latest state. If the operation
401
+ # is already done, the latest state is immediately returned. If the timeout
402
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
403
+ # timeout is used. If the server does not support this method, it returns
404
+ # `google.rpc.Code.UNIMPLEMENTED`.
405
+ # Note that this method is on a best-effort basis. It may return the latest
406
+ # state before the specified timeout (including immediately), meaning even an
407
+ # immediate response is no guarantee that the operation is done.
408
+ #
409
+ # @overload wait_operation(request, options = nil)
410
+ # Pass arguments to `wait_operation` via a request object, either of type
411
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
412
+ #
413
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
414
+ # A request object representing the call parameters. Required. To specify no
415
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
416
+ # @param options [::Gapic::CallOptions, ::Hash]
417
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
418
+ #
419
+ # @overload wait_operation(name: nil, timeout: nil)
420
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
421
+ # least one keyword argument is required. To specify no parameters, or to keep all
422
+ # the default parameter values, pass an empty Hash as a request object (see above).
423
+ #
424
+ # @param name [::String]
425
+ # The name of the operation resource to wait on.
426
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
427
+ # The maximum duration to wait before timing out. If left blank, the wait
428
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
429
+ # If RPC context deadline is also specified, the shorter one will be used.
430
+ #
431
+ # @yield [response, operation] Access the result along with the RPC operation
432
+ # @yieldparam response [::Gapic::Operation]
433
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
434
+ #
435
+ # @return [::Gapic::Operation]
436
+ #
437
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
438
+ #
439
+ def wait_operation request, options = nil
440
+ raise ::ArgumentError, "request must be provided" if request.nil?
441
+
442
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
443
+
444
+ # Converts hash and nil to an options object
445
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
446
+
447
+ # Customize the options with defaults
448
+ metadata = @config.rpcs.wait_operation.metadata.to_h
449
+
450
+ # Set x-goog-api-client and x-goog-user-project headers
451
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
452
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
453
+ gapic_version: ::Google::Cloud::AutoML::V1::VERSION
454
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
455
+
456
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
457
+ metadata: metadata,
458
+ retry_policy: @config.rpcs.wait_operation.retry_policy
459
+ options.apply_defaults metadata: @config.metadata,
460
+ retry_policy: @config.retry_policy
461
+
462
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
463
+ response = ::Gapic::Operation.new response, @operations_client, options: options
464
+ yield response, operation if block_given?
465
+ return response
466
+ end
467
+ rescue ::GRPC::BadStatus => e
468
+ raise ::Google::Cloud::Error.from_error(e)
469
+ end
470
+
393
471
  ##
394
472
  # Configuration class for the Operations API.
395
473
  #
@@ -475,14 +553,14 @@ module Google
475
553
 
476
554
  config_attr :endpoint, "automl.googleapis.com", ::String
477
555
  config_attr :credentials, nil do |value|
478
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
556
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
479
557
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
480
558
  allowed.any? { |klass| klass === value }
481
559
  end
482
560
  config_attr :scope, nil, ::String, ::Array, nil
483
561
  config_attr :lib_name, nil, ::String, nil
484
562
  config_attr :lib_version, nil, ::String, nil
485
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
563
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
486
564
  config_attr :interceptors, nil, ::Array, nil
487
565
  config_attr :timeout, nil, ::Numeric, nil
488
566
  config_attr :metadata, nil, ::Hash, nil
@@ -503,7 +581,7 @@ module Google
503
581
  def rpcs
504
582
  @rpcs ||= begin
505
583
  parent_rpcs = nil
506
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
584
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
507
585
  Rpcs.new parent_rpcs
508
586
  end
509
587
  end
@@ -515,7 +593,7 @@ module Google
515
593
  # Each configuration object is of type `Gapic::Config::Method` and includes
516
594
  # the following configuration fields:
517
595
  #
518
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
596
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
519
597
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
520
598
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
521
599
  # include the following keys:
@@ -546,17 +624,24 @@ module Google
546
624
  # @return [::Gapic::Config::Method]
547
625
  #
548
626
  attr_reader :cancel_operation
627
+ ##
628
+ # RPC-specific configuration for `wait_operation`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :wait_operation
549
632
 
550
633
  # @private
551
634
  def initialize parent_rpcs = nil
552
- list_operations_config = parent_rpcs&.list_operations if parent_rpcs&.respond_to? :list_operations
635
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
553
636
  @list_operations = ::Gapic::Config::Method.new list_operations_config
554
- get_operation_config = parent_rpcs&.get_operation if parent_rpcs&.respond_to? :get_operation
637
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
555
638
  @get_operation = ::Gapic::Config::Method.new get_operation_config
556
- delete_operation_config = parent_rpcs&.delete_operation if parent_rpcs&.respond_to? :delete_operation
639
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
557
640
  @delete_operation = ::Gapic::Config::Method.new delete_operation_config
558
- cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
641
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
559
642
  @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
643
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
644
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
560
645
 
561
646
  yield self if block_given?
562
647
  end