google-cloud-data_labeling-v1beta1 0.1.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,3 +33,6 @@ module Google
33
33
  end
34
34
  end
35
35
  end
36
+
37
+ helper_path = ::File.join __dir__, "v1beta1", "_helpers.rb"
38
+ require "google/cloud/data_labeling/v1beta1/_helpers" if ::File.file? helper_path
@@ -60,7 +60,7 @@ module Google
60
60
  parent_config = while namespace.any?
61
61
  parent_name = namespace.join "::"
62
62
  parent_const = const_get parent_name
63
- break parent_const.configure if parent_const&.respond_to? :configure
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
64
  namespace.pop
65
65
  end
66
66
  default_config = Client::Configuration.new parent_config
@@ -69,68 +69,44 @@ module Google
69
69
 
70
70
  default_config.rpcs.get_dataset.timeout = 30.0
71
71
  default_config.rpcs.get_dataset.retry_policy = {
72
- initial_delay: 0.1,
73
- max_delay: 30.0,
74
- multiplier: 1.3,
75
- retry_codes: [4, 14]
72
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
76
73
  }
77
74
 
78
75
  default_config.rpcs.list_datasets.timeout = 30.0
79
76
  default_config.rpcs.list_datasets.retry_policy = {
80
- initial_delay: 0.1,
81
- max_delay: 30.0,
82
- multiplier: 1.3,
83
- retry_codes: [4, 14]
77
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
84
78
  }
85
79
 
86
80
  default_config.rpcs.delete_dataset.timeout = 30.0
87
81
  default_config.rpcs.delete_dataset.retry_policy = {
88
- initial_delay: 0.1,
89
- max_delay: 30.0,
90
- multiplier: 1.3,
91
- retry_codes: [4, 14]
82
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
92
83
  }
93
84
 
94
85
  default_config.rpcs.import_data.timeout = 30.0
95
86
 
96
87
  default_config.rpcs.export_data.timeout = 30.0
97
88
  default_config.rpcs.export_data.retry_policy = {
98
- initial_delay: 0.1,
99
- max_delay: 30.0,
100
- multiplier: 1.3,
101
- retry_codes: [4, 14]
89
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
102
90
  }
103
91
 
104
92
  default_config.rpcs.get_data_item.timeout = 30.0
105
93
  default_config.rpcs.get_data_item.retry_policy = {
106
- initial_delay: 0.1,
107
- max_delay: 30.0,
108
- multiplier: 1.3,
109
- retry_codes: [4, 14]
94
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
110
95
  }
111
96
 
112
97
  default_config.rpcs.list_data_items.timeout = 30.0
113
98
  default_config.rpcs.list_data_items.retry_policy = {
114
- initial_delay: 0.1,
115
- max_delay: 30.0,
116
- multiplier: 1.3,
117
- retry_codes: [4, 14]
99
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
118
100
  }
119
101
 
120
102
  default_config.rpcs.get_annotated_dataset.timeout = 30.0
121
103
  default_config.rpcs.get_annotated_dataset.retry_policy = {
122
- initial_delay: 0.1,
123
- max_delay: 30.0,
124
- multiplier: 1.3,
125
- retry_codes: [4, 14]
104
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
126
105
  }
127
106
 
128
107
  default_config.rpcs.list_annotated_datasets.timeout = 30.0
129
108
  default_config.rpcs.list_annotated_datasets.retry_policy = {
130
- initial_delay: 0.1,
131
- max_delay: 30.0,
132
- multiplier: 1.3,
133
- retry_codes: [4, 14]
109
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
134
110
  }
135
111
 
136
112
  default_config.rpcs.label_image.timeout = 30.0
@@ -141,86 +117,56 @@ module Google
141
117
 
142
118
  default_config.rpcs.get_example.timeout = 30.0
143
119
  default_config.rpcs.get_example.retry_policy = {
144
- initial_delay: 0.1,
145
- max_delay: 30.0,
146
- multiplier: 1.3,
147
- retry_codes: [4, 14]
120
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
148
121
  }
149
122
 
150
123
  default_config.rpcs.list_examples.timeout = 30.0
151
124
  default_config.rpcs.list_examples.retry_policy = {
152
- initial_delay: 0.1,
153
- max_delay: 30.0,
154
- multiplier: 1.3,
155
- retry_codes: [4, 14]
125
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
156
126
  }
157
127
 
158
128
  default_config.rpcs.create_annotation_spec_set.timeout = 30.0
159
129
 
160
130
  default_config.rpcs.get_annotation_spec_set.timeout = 30.0
161
131
  default_config.rpcs.get_annotation_spec_set.retry_policy = {
162
- initial_delay: 0.1,
163
- max_delay: 30.0,
164
- multiplier: 1.3,
165
- retry_codes: [4, 14]
132
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
166
133
  }
167
134
 
168
135
  default_config.rpcs.list_annotation_spec_sets.timeout = 30.0
169
136
  default_config.rpcs.list_annotation_spec_sets.retry_policy = {
170
- initial_delay: 0.1,
171
- max_delay: 30.0,
172
- multiplier: 1.3,
173
- retry_codes: [4, 14]
137
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
174
138
  }
175
139
 
176
140
  default_config.rpcs.delete_annotation_spec_set.timeout = 30.0
177
141
  default_config.rpcs.delete_annotation_spec_set.retry_policy = {
178
- initial_delay: 0.1,
179
- max_delay: 30.0,
180
- multiplier: 1.3,
181
- retry_codes: [4, 14]
142
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
182
143
  }
183
144
 
184
145
  default_config.rpcs.create_instruction.timeout = 30.0
185
146
 
186
147
  default_config.rpcs.get_instruction.timeout = 30.0
187
148
  default_config.rpcs.get_instruction.retry_policy = {
188
- initial_delay: 0.1,
189
- max_delay: 30.0,
190
- multiplier: 1.3,
191
- retry_codes: [4, 14]
149
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
192
150
  }
193
151
 
194
152
  default_config.rpcs.list_instructions.timeout = 30.0
195
153
  default_config.rpcs.list_instructions.retry_policy = {
196
- initial_delay: 0.1,
197
- max_delay: 30.0,
198
- multiplier: 1.3,
199
- retry_codes: [4, 14]
154
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
200
155
  }
201
156
 
202
157
  default_config.rpcs.delete_instruction.timeout = 30.0
203
158
  default_config.rpcs.delete_instruction.retry_policy = {
204
- initial_delay: 0.1,
205
- max_delay: 30.0,
206
- multiplier: 1.3,
207
- retry_codes: [4, 14]
159
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
208
160
  }
209
161
 
210
162
  default_config.rpcs.get_evaluation.timeout = 30.0
211
163
  default_config.rpcs.get_evaluation.retry_policy = {
212
- initial_delay: 0.1,
213
- max_delay: 30.0,
214
- multiplier: 1.3,
215
- retry_codes: [4, 14]
164
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
216
165
  }
217
166
 
218
167
  default_config.rpcs.search_evaluations.timeout = 30.0
219
168
  default_config.rpcs.search_evaluations.retry_policy = {
220
- initial_delay: 0.1,
221
- max_delay: 30.0,
222
- multiplier: 1.3,
223
- retry_codes: [4, 14]
169
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
224
170
  }
225
171
 
226
172
  default_config.rpcs.search_example_comparisons.timeout = 30.0
@@ -231,10 +177,7 @@ module Google
231
177
 
232
178
  default_config.rpcs.get_evaluation_job.timeout = 30.0
233
179
  default_config.rpcs.get_evaluation_job.retry_policy = {
234
- initial_delay: 0.1,
235
- max_delay: 30.0,
236
- multiplier: 1.3,
237
- retry_codes: [4, 14]
180
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
238
181
  }
239
182
 
240
183
  default_config.rpcs.pause_evaluation_job.timeout = 30.0
@@ -243,18 +186,12 @@ module Google
243
186
 
244
187
  default_config.rpcs.delete_evaluation_job.timeout = 30.0
245
188
  default_config.rpcs.delete_evaluation_job.retry_policy = {
246
- initial_delay: 0.1,
247
- max_delay: 30.0,
248
- multiplier: 1.3,
249
- retry_codes: [4, 14]
189
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
250
190
  }
251
191
 
252
192
  default_config.rpcs.list_evaluation_jobs.timeout = 30.0
253
193
  default_config.rpcs.list_evaluation_jobs.retry_policy = {
254
- initial_delay: 0.1,
255
- max_delay: 30.0,
256
- multiplier: 1.3,
257
- retry_codes: [4, 14]
194
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
258
195
  }
259
196
 
260
197
  default_config
@@ -318,8 +255,14 @@ module Google
318
255
 
319
256
  # Create credentials
320
257
  credentials = @config.credentials
321
- credentials ||= Credentials.default scope: @config.scope
322
- if credentials.is_a?(String) || credentials.is_a?(Hash)
258
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
259
+ # but only if the default endpoint does not have a region prefix.
260
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
261
+ @config.endpoint == Client.configure.endpoint &&
262
+ !@config.endpoint.split(".").first.include?("-")
263
+ credentials ||= Credentials.default scope: @config.scope,
264
+ enable_self_signed_jwt: enable_self_signed_jwt
265
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
323
266
  credentials = Credentials.new credentials, scope: @config.scope
324
267
  end
325
268
  @quota_project_id = @config.quota_project
@@ -2996,7 +2939,7 @@ module Google
2996
2939
  config_attr :scope, nil, ::String, ::Array, nil
2997
2940
  config_attr :lib_name, nil, ::String, nil
2998
2941
  config_attr :lib_version, nil, ::String, nil
2999
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
2942
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
3000
2943
  config_attr :interceptors, nil, ::Array, nil
3001
2944
  config_attr :timeout, nil, ::Numeric, nil
3002
2945
  config_attr :metadata, nil, ::Hash, nil
@@ -3017,7 +2960,7 @@ module Google
3017
2960
  def rpcs
3018
2961
  @rpcs ||= begin
3019
2962
  parent_rpcs = nil
3020
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
2963
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
3021
2964
  Rpcs.new parent_rpcs
3022
2965
  end
3023
2966
  end
@@ -3029,7 +2972,7 @@ module Google
3029
2972
  # Each configuration object is of type `Gapic::Config::Method` and includes
3030
2973
  # the following configuration fields:
3031
2974
  #
3032
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
2975
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
3033
2976
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
3034
2977
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
3035
2978
  # include the following keys:
@@ -3213,73 +3156,73 @@ module Google
3213
3156
 
3214
3157
  # @private
3215
3158
  def initialize parent_rpcs = nil
3216
- create_dataset_config = parent_rpcs&.create_dataset if parent_rpcs&.respond_to? :create_dataset
3159
+ create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset
3217
3160
  @create_dataset = ::Gapic::Config::Method.new create_dataset_config
3218
- get_dataset_config = parent_rpcs&.get_dataset if parent_rpcs&.respond_to? :get_dataset
3161
+ get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset
3219
3162
  @get_dataset = ::Gapic::Config::Method.new get_dataset_config
3220
- list_datasets_config = parent_rpcs&.list_datasets if parent_rpcs&.respond_to? :list_datasets
3163
+ list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets
3221
3164
  @list_datasets = ::Gapic::Config::Method.new list_datasets_config
3222
- delete_dataset_config = parent_rpcs&.delete_dataset if parent_rpcs&.respond_to? :delete_dataset
3165
+ delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset
3223
3166
  @delete_dataset = ::Gapic::Config::Method.new delete_dataset_config
3224
- import_data_config = parent_rpcs&.import_data if parent_rpcs&.respond_to? :import_data
3167
+ import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data
3225
3168
  @import_data = ::Gapic::Config::Method.new import_data_config
3226
- export_data_config = parent_rpcs&.export_data if parent_rpcs&.respond_to? :export_data
3169
+ export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data
3227
3170
  @export_data = ::Gapic::Config::Method.new export_data_config
3228
- get_data_item_config = parent_rpcs&.get_data_item if parent_rpcs&.respond_to? :get_data_item
3171
+ get_data_item_config = parent_rpcs.get_data_item if parent_rpcs.respond_to? :get_data_item
3229
3172
  @get_data_item = ::Gapic::Config::Method.new get_data_item_config
3230
- list_data_items_config = parent_rpcs&.list_data_items if parent_rpcs&.respond_to? :list_data_items
3173
+ list_data_items_config = parent_rpcs.list_data_items if parent_rpcs.respond_to? :list_data_items
3231
3174
  @list_data_items = ::Gapic::Config::Method.new list_data_items_config
3232
- get_annotated_dataset_config = parent_rpcs&.get_annotated_dataset if parent_rpcs&.respond_to? :get_annotated_dataset
3175
+ get_annotated_dataset_config = parent_rpcs.get_annotated_dataset if parent_rpcs.respond_to? :get_annotated_dataset
3233
3176
  @get_annotated_dataset = ::Gapic::Config::Method.new get_annotated_dataset_config
3234
- list_annotated_datasets_config = parent_rpcs&.list_annotated_datasets if parent_rpcs&.respond_to? :list_annotated_datasets
3177
+ list_annotated_datasets_config = parent_rpcs.list_annotated_datasets if parent_rpcs.respond_to? :list_annotated_datasets
3235
3178
  @list_annotated_datasets = ::Gapic::Config::Method.new list_annotated_datasets_config
3236
- delete_annotated_dataset_config = parent_rpcs&.delete_annotated_dataset if parent_rpcs&.respond_to? :delete_annotated_dataset
3179
+ delete_annotated_dataset_config = parent_rpcs.delete_annotated_dataset if parent_rpcs.respond_to? :delete_annotated_dataset
3237
3180
  @delete_annotated_dataset = ::Gapic::Config::Method.new delete_annotated_dataset_config
3238
- label_image_config = parent_rpcs&.label_image if parent_rpcs&.respond_to? :label_image
3181
+ label_image_config = parent_rpcs.label_image if parent_rpcs.respond_to? :label_image
3239
3182
  @label_image = ::Gapic::Config::Method.new label_image_config
3240
- label_video_config = parent_rpcs&.label_video if parent_rpcs&.respond_to? :label_video
3183
+ label_video_config = parent_rpcs.label_video if parent_rpcs.respond_to? :label_video
3241
3184
  @label_video = ::Gapic::Config::Method.new label_video_config
3242
- label_text_config = parent_rpcs&.label_text if parent_rpcs&.respond_to? :label_text
3185
+ label_text_config = parent_rpcs.label_text if parent_rpcs.respond_to? :label_text
3243
3186
  @label_text = ::Gapic::Config::Method.new label_text_config
3244
- get_example_config = parent_rpcs&.get_example if parent_rpcs&.respond_to? :get_example
3187
+ get_example_config = parent_rpcs.get_example if parent_rpcs.respond_to? :get_example
3245
3188
  @get_example = ::Gapic::Config::Method.new get_example_config
3246
- list_examples_config = parent_rpcs&.list_examples if parent_rpcs&.respond_to? :list_examples
3189
+ list_examples_config = parent_rpcs.list_examples if parent_rpcs.respond_to? :list_examples
3247
3190
  @list_examples = ::Gapic::Config::Method.new list_examples_config
3248
- create_annotation_spec_set_config = parent_rpcs&.create_annotation_spec_set if parent_rpcs&.respond_to? :create_annotation_spec_set
3191
+ create_annotation_spec_set_config = parent_rpcs.create_annotation_spec_set if parent_rpcs.respond_to? :create_annotation_spec_set
3249
3192
  @create_annotation_spec_set = ::Gapic::Config::Method.new create_annotation_spec_set_config
3250
- get_annotation_spec_set_config = parent_rpcs&.get_annotation_spec_set if parent_rpcs&.respond_to? :get_annotation_spec_set
3193
+ get_annotation_spec_set_config = parent_rpcs.get_annotation_spec_set if parent_rpcs.respond_to? :get_annotation_spec_set
3251
3194
  @get_annotation_spec_set = ::Gapic::Config::Method.new get_annotation_spec_set_config
3252
- list_annotation_spec_sets_config = parent_rpcs&.list_annotation_spec_sets if parent_rpcs&.respond_to? :list_annotation_spec_sets
3195
+ list_annotation_spec_sets_config = parent_rpcs.list_annotation_spec_sets if parent_rpcs.respond_to? :list_annotation_spec_sets
3253
3196
  @list_annotation_spec_sets = ::Gapic::Config::Method.new list_annotation_spec_sets_config
3254
- delete_annotation_spec_set_config = parent_rpcs&.delete_annotation_spec_set if parent_rpcs&.respond_to? :delete_annotation_spec_set
3197
+ delete_annotation_spec_set_config = parent_rpcs.delete_annotation_spec_set if parent_rpcs.respond_to? :delete_annotation_spec_set
3255
3198
  @delete_annotation_spec_set = ::Gapic::Config::Method.new delete_annotation_spec_set_config
3256
- create_instruction_config = parent_rpcs&.create_instruction if parent_rpcs&.respond_to? :create_instruction
3199
+ create_instruction_config = parent_rpcs.create_instruction if parent_rpcs.respond_to? :create_instruction
3257
3200
  @create_instruction = ::Gapic::Config::Method.new create_instruction_config
3258
- get_instruction_config = parent_rpcs&.get_instruction if parent_rpcs&.respond_to? :get_instruction
3201
+ get_instruction_config = parent_rpcs.get_instruction if parent_rpcs.respond_to? :get_instruction
3259
3202
  @get_instruction = ::Gapic::Config::Method.new get_instruction_config
3260
- list_instructions_config = parent_rpcs&.list_instructions if parent_rpcs&.respond_to? :list_instructions
3203
+ list_instructions_config = parent_rpcs.list_instructions if parent_rpcs.respond_to? :list_instructions
3261
3204
  @list_instructions = ::Gapic::Config::Method.new list_instructions_config
3262
- delete_instruction_config = parent_rpcs&.delete_instruction if parent_rpcs&.respond_to? :delete_instruction
3205
+ delete_instruction_config = parent_rpcs.delete_instruction if parent_rpcs.respond_to? :delete_instruction
3263
3206
  @delete_instruction = ::Gapic::Config::Method.new delete_instruction_config
3264
- get_evaluation_config = parent_rpcs&.get_evaluation if parent_rpcs&.respond_to? :get_evaluation
3207
+ get_evaluation_config = parent_rpcs.get_evaluation if parent_rpcs.respond_to? :get_evaluation
3265
3208
  @get_evaluation = ::Gapic::Config::Method.new get_evaluation_config
3266
- search_evaluations_config = parent_rpcs&.search_evaluations if parent_rpcs&.respond_to? :search_evaluations
3209
+ search_evaluations_config = parent_rpcs.search_evaluations if parent_rpcs.respond_to? :search_evaluations
3267
3210
  @search_evaluations = ::Gapic::Config::Method.new search_evaluations_config
3268
- search_example_comparisons_config = parent_rpcs&.search_example_comparisons if parent_rpcs&.respond_to? :search_example_comparisons
3211
+ search_example_comparisons_config = parent_rpcs.search_example_comparisons if parent_rpcs.respond_to? :search_example_comparisons
3269
3212
  @search_example_comparisons = ::Gapic::Config::Method.new search_example_comparisons_config
3270
- create_evaluation_job_config = parent_rpcs&.create_evaluation_job if parent_rpcs&.respond_to? :create_evaluation_job
3213
+ create_evaluation_job_config = parent_rpcs.create_evaluation_job if parent_rpcs.respond_to? :create_evaluation_job
3271
3214
  @create_evaluation_job = ::Gapic::Config::Method.new create_evaluation_job_config
3272
- update_evaluation_job_config = parent_rpcs&.update_evaluation_job if parent_rpcs&.respond_to? :update_evaluation_job
3215
+ update_evaluation_job_config = parent_rpcs.update_evaluation_job if parent_rpcs.respond_to? :update_evaluation_job
3273
3216
  @update_evaluation_job = ::Gapic::Config::Method.new update_evaluation_job_config
3274
- get_evaluation_job_config = parent_rpcs&.get_evaluation_job if parent_rpcs&.respond_to? :get_evaluation_job
3217
+ get_evaluation_job_config = parent_rpcs.get_evaluation_job if parent_rpcs.respond_to? :get_evaluation_job
3275
3218
  @get_evaluation_job = ::Gapic::Config::Method.new get_evaluation_job_config
3276
- pause_evaluation_job_config = parent_rpcs&.pause_evaluation_job if parent_rpcs&.respond_to? :pause_evaluation_job
3219
+ pause_evaluation_job_config = parent_rpcs.pause_evaluation_job if parent_rpcs.respond_to? :pause_evaluation_job
3277
3220
  @pause_evaluation_job = ::Gapic::Config::Method.new pause_evaluation_job_config
3278
- resume_evaluation_job_config = parent_rpcs&.resume_evaluation_job if parent_rpcs&.respond_to? :resume_evaluation_job
3221
+ resume_evaluation_job_config = parent_rpcs.resume_evaluation_job if parent_rpcs.respond_to? :resume_evaluation_job
3279
3222
  @resume_evaluation_job = ::Gapic::Config::Method.new resume_evaluation_job_config
3280
- delete_evaluation_job_config = parent_rpcs&.delete_evaluation_job if parent_rpcs&.respond_to? :delete_evaluation_job
3223
+ delete_evaluation_job_config = parent_rpcs.delete_evaluation_job if parent_rpcs.respond_to? :delete_evaluation_job
3281
3224
  @delete_evaluation_job = ::Gapic::Config::Method.new delete_evaluation_job_config
3282
- list_evaluation_jobs_config = parent_rpcs&.list_evaluation_jobs if parent_rpcs&.respond_to? :list_evaluation_jobs
3225
+ list_evaluation_jobs_config = parent_rpcs.list_evaluation_jobs if parent_rpcs.respond_to? :list_evaluation_jobs
3283
3226
  @list_evaluation_jobs = ::Gapic::Config::Method.new list_evaluation_jobs_config
3284
3227
 
3285
3228
  yield self if block_given?
@@ -82,7 +82,7 @@ module Google
82
82
  # Create credentials
83
83
  credentials = @config.credentials
84
84
  credentials ||= Credentials.default scope: @config.scope
85
- if credentials.is_a?(String) || credentials.is_a?(Hash)
85
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
86
86
  credentials = Credentials.new credentials, scope: @config.scope
87
87
  end
88
88
  @quota_project_id = @config.quota_project
@@ -103,8 +103,13 @@ module Google
103
103
  # Lists operations that match the specified filter in the request. If the
104
104
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
105
105
  #
106
- # NOTE: the `name` binding 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]
@@ -390,6 +395,79 @@ module Google
390
395
  raise ::Google::Cloud::Error.from_error(e)
391
396
  end
392
397
 
398
+ ##
399
+ # Waits until the specified long-running operation is done or reaches at most
400
+ # a specified timeout, returning the latest state. If the operation is
401
+ # already done, the latest state is immediately returned. If the timeout
402
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
403
+ # timeout is used. If the server does not support this method, it returns
404
+ # `google.rpc.Code.UNIMPLEMENTED`.
405
+ # Note that this method is on a best-effort basis. It may return the latest
406
+ # state before the specified timeout (including immediately), meaning even an
407
+ # immediate response is no guarantee that the operation is done.
408
+ #
409
+ # @overload wait_operation(request, options = nil)
410
+ # Pass arguments to `wait_operation` via a request object, either of type
411
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
412
+ #
413
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
414
+ # A request object representing the call parameters. Required. To specify no
415
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
416
+ # @param options [::Gapic::CallOptions, ::Hash]
417
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
418
+ #
419
+ # @overload wait_operation(name: nil, timeout: nil)
420
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
421
+ # least one keyword argument is required. To specify no parameters, or to keep all
422
+ # the default parameter values, pass an empty Hash as a request object (see above).
423
+ #
424
+ # @param name [::String]
425
+ # The name of the operation resource to wait on.
426
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
427
+ # The maximum duration to wait before timing out. If left blank, the wait
428
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
429
+ # If RPC context deadline is also specified, the shorter one will be used.
430
+ #
431
+ # @yield [response, operation] Access the result along with the RPC operation
432
+ # @yieldparam response [::Gapic::Operation]
433
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
434
+ #
435
+ # @return [::Gapic::Operation]
436
+ #
437
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
438
+ #
439
+ def wait_operation request, options = nil
440
+ raise ::ArgumentError, "request must be provided" if request.nil?
441
+
442
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
443
+
444
+ # Converts hash and nil to an options object
445
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
446
+
447
+ # Customize the options with defaults
448
+ metadata = @config.rpcs.wait_operation.metadata.to_h
449
+
450
+ # Set x-goog-api-client and x-goog-user-project headers
451
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
452
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
453
+ gapic_version: ::Google::Cloud::DataLabeling::V1beta1::VERSION
454
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
455
+
456
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
457
+ metadata: metadata,
458
+ retry_policy: @config.rpcs.wait_operation.retry_policy
459
+ options.apply_defaults metadata: @config.metadata,
460
+ retry_policy: @config.retry_policy
461
+
462
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
463
+ response = ::Gapic::Operation.new response, @operations_client, options: options
464
+ yield response, operation if block_given?
465
+ return response
466
+ end
467
+ rescue ::GRPC::BadStatus => e
468
+ raise ::Google::Cloud::Error.from_error(e)
469
+ end
470
+
393
471
  ##
394
472
  # Configuration class for the Operations API.
395
473
  #
@@ -482,7 +560,7 @@ module Google
482
560
  config_attr :scope, nil, ::String, ::Array, nil
483
561
  config_attr :lib_name, nil, ::String, nil
484
562
  config_attr :lib_version, nil, ::String, nil
485
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
563
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
486
564
  config_attr :interceptors, nil, ::Array, nil
487
565
  config_attr :timeout, nil, ::Numeric, nil
488
566
  config_attr :metadata, nil, ::Hash, nil
@@ -503,7 +581,7 @@ module Google
503
581
  def rpcs
504
582
  @rpcs ||= begin
505
583
  parent_rpcs = nil
506
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.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