google-cloud-talent-v4 0.2.0 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,3 +37,6 @@ module Google
37
37
  end
38
38
  end
39
39
  end
40
+
41
+ helper_path = ::File.join __dir__, "v4", "_helpers.rb"
42
+ require "google/cloud/talent/v4/_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,28 +69,19 @@ module Google
69
69
 
70
70
  default_config.rpcs.get_company.timeout = 30.0
71
71
  default_config.rpcs.get_company.retry_policy = {
72
- initial_delay: 0.1,
73
- max_delay: 60.0,
74
- multiplier: 1.3,
75
- retry_codes: [4, 14]
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
76
73
  }
77
74
 
78
75
  default_config.rpcs.update_company.timeout = 30.0
79
76
 
80
77
  default_config.rpcs.delete_company.timeout = 30.0
81
78
  default_config.rpcs.delete_company.retry_policy = {
82
- initial_delay: 0.1,
83
- max_delay: 60.0,
84
- multiplier: 1.3,
85
- retry_codes: [4, 14]
79
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
86
80
  }
87
81
 
88
82
  default_config.rpcs.list_companies.timeout = 30.0
89
83
  default_config.rpcs.list_companies.retry_policy = {
90
- initial_delay: 0.1,
91
- max_delay: 60.0,
92
- multiplier: 1.3,
93
- retry_codes: [4, 14]
84
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
94
85
  }
95
86
 
96
87
  default_config
@@ -154,8 +145,14 @@ module Google
154
145
 
155
146
  # Create credentials
156
147
  credentials = @config.credentials
157
- credentials ||= Credentials.default scope: @config.scope
158
- if credentials.is_a?(String) || credentials.is_a?(Hash)
148
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
149
+ # but only if the default endpoint does not have a region prefix.
150
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
151
+ @config.endpoint == Client.configure.endpoint &&
152
+ !@config.endpoint.split(".").first.include?("-")
153
+ credentials ||= Credentials.default scope: @config.scope,
154
+ enable_self_signed_jwt: enable_self_signed_jwt
155
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
159
156
  credentials = Credentials.new credentials, scope: @config.scope
160
157
  end
161
158
  @quota_project_id = @config.quota_project
@@ -632,7 +629,7 @@ module Google
632
629
  config_attr :scope, nil, ::String, ::Array, nil
633
630
  config_attr :lib_name, nil, ::String, nil
634
631
  config_attr :lib_version, nil, ::String, nil
635
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
632
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
636
633
  config_attr :interceptors, nil, ::Array, nil
637
634
  config_attr :timeout, nil, ::Numeric, nil
638
635
  config_attr :metadata, nil, ::Hash, nil
@@ -653,7 +650,7 @@ module Google
653
650
  def rpcs
654
651
  @rpcs ||= begin
655
652
  parent_rpcs = nil
656
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
653
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
657
654
  Rpcs.new parent_rpcs
658
655
  end
659
656
  end
@@ -665,7 +662,7 @@ module Google
665
662
  # Each configuration object is of type `Gapic::Config::Method` and includes
666
663
  # the following configuration fields:
667
664
  #
668
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
665
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
669
666
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
670
667
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
671
668
  # include the following keys:
@@ -704,15 +701,15 @@ module Google
704
701
 
705
702
  # @private
706
703
  def initialize parent_rpcs = nil
707
- create_company_config = parent_rpcs&.create_company if parent_rpcs&.respond_to? :create_company
704
+ create_company_config = parent_rpcs.create_company if parent_rpcs.respond_to? :create_company
708
705
  @create_company = ::Gapic::Config::Method.new create_company_config
709
- get_company_config = parent_rpcs&.get_company if parent_rpcs&.respond_to? :get_company
706
+ get_company_config = parent_rpcs.get_company if parent_rpcs.respond_to? :get_company
710
707
  @get_company = ::Gapic::Config::Method.new get_company_config
711
- update_company_config = parent_rpcs&.update_company if parent_rpcs&.respond_to? :update_company
708
+ update_company_config = parent_rpcs.update_company if parent_rpcs.respond_to? :update_company
712
709
  @update_company = ::Gapic::Config::Method.new update_company_config
713
- delete_company_config = parent_rpcs&.delete_company if parent_rpcs&.respond_to? :delete_company
710
+ delete_company_config = parent_rpcs.delete_company if parent_rpcs.respond_to? :delete_company
714
711
  @delete_company = ::Gapic::Config::Method.new delete_company_config
715
- list_companies_config = parent_rpcs&.list_companies if parent_rpcs&.respond_to? :list_companies
712
+ list_companies_config = parent_rpcs.list_companies if parent_rpcs.respond_to? :list_companies
716
713
  @list_companies = ::Gapic::Config::Method.new list_companies_config
717
714
 
718
715
  yield self if block_given?
@@ -60,17 +60,14 @@ 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
67
67
 
68
68
  default_config.rpcs.complete_query.timeout = 30.0
69
69
  default_config.rpcs.complete_query.retry_policy = {
70
- initial_delay: 0.1,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: [4, 14]
70
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
74
71
  }
75
72
 
76
73
  default_config
@@ -134,8 +131,14 @@ module Google
134
131
 
135
132
  # Create credentials
136
133
  credentials = @config.credentials
137
- credentials ||= Credentials.default scope: @config.scope
138
- if credentials.is_a?(String) || credentials.is_a?(Hash)
134
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
135
+ # but only if the default endpoint does not have a region prefix.
136
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
137
+ @config.endpoint == Client.configure.endpoint &&
138
+ !@config.endpoint.split(".").first.include?("-")
139
+ credentials ||= Credentials.default scope: @config.scope,
140
+ enable_self_signed_jwt: enable_self_signed_jwt
141
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
139
142
  credentials = Credentials.new credentials, scope: @config.scope
140
143
  end
141
144
  @quota_project_id = @config.quota_project
@@ -339,7 +342,7 @@ module Google
339
342
  config_attr :scope, nil, ::String, ::Array, nil
340
343
  config_attr :lib_name, nil, ::String, nil
341
344
  config_attr :lib_version, nil, ::String, nil
342
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
345
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
343
346
  config_attr :interceptors, nil, ::Array, nil
344
347
  config_attr :timeout, nil, ::Numeric, nil
345
348
  config_attr :metadata, nil, ::Hash, nil
@@ -360,7 +363,7 @@ module Google
360
363
  def rpcs
361
364
  @rpcs ||= begin
362
365
  parent_rpcs = nil
363
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
366
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
364
367
  Rpcs.new parent_rpcs
365
368
  end
366
369
  end
@@ -372,7 +375,7 @@ module Google
372
375
  # Each configuration object is of type `Gapic::Config::Method` and includes
373
376
  # the following configuration fields:
374
377
  #
375
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
378
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
376
379
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
377
380
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
378
381
  # include the following keys:
@@ -391,7 +394,7 @@ module Google
391
394
 
392
395
  # @private
393
396
  def initialize parent_rpcs = nil
394
- complete_query_config = parent_rpcs&.complete_query if parent_rpcs&.respond_to? :complete_query
397
+ complete_query_config = parent_rpcs.complete_query if parent_rpcs.respond_to? :complete_query
395
398
  @complete_query = ::Gapic::Config::Method.new complete_query_config
396
399
 
397
400
  yield self if block_given?
@@ -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
@@ -128,8 +128,14 @@ module Google
128
128
 
129
129
  # Create credentials
130
130
  credentials = @config.credentials
131
- credentials ||= Credentials.default scope: @config.scope
132
- if credentials.is_a?(String) || credentials.is_a?(Hash)
131
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
132
+ # but only if the default endpoint does not have a region prefix.
133
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
134
+ @config.endpoint == Client.configure.endpoint &&
135
+ !@config.endpoint.split(".").first.include?("-")
136
+ credentials ||= Credentials.default scope: @config.scope,
137
+ enable_self_signed_jwt: enable_self_signed_jwt
138
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
133
139
  credentials = Credentials.new credentials, scope: @config.scope
134
140
  end
135
141
  @quota_project_id = @config.quota_project
@@ -316,7 +322,7 @@ module Google
316
322
  config_attr :scope, nil, ::String, ::Array, nil
317
323
  config_attr :lib_name, nil, ::String, nil
318
324
  config_attr :lib_version, nil, ::String, nil
319
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
325
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
320
326
  config_attr :interceptors, nil, ::Array, nil
321
327
  config_attr :timeout, nil, ::Numeric, nil
322
328
  config_attr :metadata, nil, ::Hash, nil
@@ -337,7 +343,7 @@ module Google
337
343
  def rpcs
338
344
  @rpcs ||= begin
339
345
  parent_rpcs = nil
340
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
346
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
341
347
  Rpcs.new parent_rpcs
342
348
  end
343
349
  end
@@ -349,7 +355,7 @@ module Google
349
355
  # Each configuration object is of type `Gapic::Config::Method` and includes
350
356
  # the following configuration fields:
351
357
  #
352
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
358
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
353
359
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
354
360
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
355
361
  # include the following keys:
@@ -368,7 +374,7 @@ module Google
368
374
 
369
375
  # @private
370
376
  def initialize parent_rpcs = nil
371
- create_client_event_config = parent_rpcs&.create_client_event if parent_rpcs&.respond_to? :create_client_event
377
+ create_client_event_config = parent_rpcs.create_client_event if parent_rpcs.respond_to? :create_client_event
372
378
  @create_client_event = ::Gapic::Config::Method.new create_client_event_config
373
379
 
374
380
  yield self if block_given?
@@ -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
@@ -71,10 +71,7 @@ module Google
71
71
 
72
72
  default_config.rpcs.get_job.timeout = 30.0
73
73
  default_config.rpcs.get_job.retry_policy = {
74
- initial_delay: 0.1,
75
- max_delay: 60.0,
76
- multiplier: 1.3,
77
- retry_codes: [4, 14]
74
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
78
75
  }
79
76
 
80
77
  default_config.rpcs.update_job.timeout = 30.0
@@ -83,20 +80,14 @@ module Google
83
80
 
84
81
  default_config.rpcs.delete_job.timeout = 30.0
85
82
  default_config.rpcs.delete_job.retry_policy = {
86
- initial_delay: 0.1,
87
- max_delay: 60.0,
88
- multiplier: 1.3,
89
- retry_codes: [4, 14]
83
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
90
84
  }
91
85
 
92
86
  default_config.rpcs.batch_delete_jobs.timeout = 30.0
93
87
 
94
88
  default_config.rpcs.list_jobs.timeout = 30.0
95
89
  default_config.rpcs.list_jobs.retry_policy = {
96
- initial_delay: 0.1,
97
- max_delay: 60.0,
98
- multiplier: 1.3,
99
- retry_codes: [4, 14]
90
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
100
91
  }
101
92
 
102
93
  default_config.rpcs.search_jobs.timeout = 30.0
@@ -164,8 +155,14 @@ module Google
164
155
 
165
156
  # Create credentials
166
157
  credentials = @config.credentials
167
- credentials ||= Credentials.default scope: @config.scope
168
- if credentials.is_a?(String) || credentials.is_a?(Hash)
158
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
159
+ # but only if the default endpoint does not have a region prefix.
160
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
161
+ @config.endpoint == Client.configure.endpoint &&
162
+ !@config.endpoint.split(".").first.include?("-")
163
+ credentials ||= Credentials.default scope: @config.scope,
164
+ enable_self_signed_jwt: enable_self_signed_jwt
165
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
169
166
  credentials = Credentials.new credentials, scope: @config.scope
170
167
  end
171
168
  @quota_project_id = @config.quota_project
@@ -1502,7 +1499,7 @@ module Google
1502
1499
  config_attr :scope, nil, ::String, ::Array, nil
1503
1500
  config_attr :lib_name, nil, ::String, nil
1504
1501
  config_attr :lib_version, nil, ::String, nil
1505
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
1502
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1506
1503
  config_attr :interceptors, nil, ::Array, nil
1507
1504
  config_attr :timeout, nil, ::Numeric, nil
1508
1505
  config_attr :metadata, nil, ::Hash, nil
@@ -1523,7 +1520,7 @@ module Google
1523
1520
  def rpcs
1524
1521
  @rpcs ||= begin
1525
1522
  parent_rpcs = nil
1526
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1523
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1527
1524
  Rpcs.new parent_rpcs
1528
1525
  end
1529
1526
  end
@@ -1535,7 +1532,7 @@ module Google
1535
1532
  # Each configuration object is of type `Gapic::Config::Method` and includes
1536
1533
  # the following configuration fields:
1537
1534
  #
1538
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1535
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1539
1536
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1540
1537
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1541
1538
  # include the following keys:
@@ -1599,25 +1596,25 @@ module Google
1599
1596
 
1600
1597
  # @private
1601
1598
  def initialize parent_rpcs = nil
1602
- create_job_config = parent_rpcs&.create_job if parent_rpcs&.respond_to? :create_job
1599
+ create_job_config = parent_rpcs.create_job if parent_rpcs.respond_to? :create_job
1603
1600
  @create_job = ::Gapic::Config::Method.new create_job_config
1604
- batch_create_jobs_config = parent_rpcs&.batch_create_jobs if parent_rpcs&.respond_to? :batch_create_jobs
1601
+ batch_create_jobs_config = parent_rpcs.batch_create_jobs if parent_rpcs.respond_to? :batch_create_jobs
1605
1602
  @batch_create_jobs = ::Gapic::Config::Method.new batch_create_jobs_config
1606
- get_job_config = parent_rpcs&.get_job if parent_rpcs&.respond_to? :get_job
1603
+ get_job_config = parent_rpcs.get_job if parent_rpcs.respond_to? :get_job
1607
1604
  @get_job = ::Gapic::Config::Method.new get_job_config
1608
- update_job_config = parent_rpcs&.update_job if parent_rpcs&.respond_to? :update_job
1605
+ update_job_config = parent_rpcs.update_job if parent_rpcs.respond_to? :update_job
1609
1606
  @update_job = ::Gapic::Config::Method.new update_job_config
1610
- batch_update_jobs_config = parent_rpcs&.batch_update_jobs if parent_rpcs&.respond_to? :batch_update_jobs
1607
+ batch_update_jobs_config = parent_rpcs.batch_update_jobs if parent_rpcs.respond_to? :batch_update_jobs
1611
1608
  @batch_update_jobs = ::Gapic::Config::Method.new batch_update_jobs_config
1612
- delete_job_config = parent_rpcs&.delete_job if parent_rpcs&.respond_to? :delete_job
1609
+ delete_job_config = parent_rpcs.delete_job if parent_rpcs.respond_to? :delete_job
1613
1610
  @delete_job = ::Gapic::Config::Method.new delete_job_config
1614
- batch_delete_jobs_config = parent_rpcs&.batch_delete_jobs if parent_rpcs&.respond_to? :batch_delete_jobs
1611
+ batch_delete_jobs_config = parent_rpcs.batch_delete_jobs if parent_rpcs.respond_to? :batch_delete_jobs
1615
1612
  @batch_delete_jobs = ::Gapic::Config::Method.new batch_delete_jobs_config
1616
- list_jobs_config = parent_rpcs&.list_jobs if parent_rpcs&.respond_to? :list_jobs
1613
+ list_jobs_config = parent_rpcs.list_jobs if parent_rpcs.respond_to? :list_jobs
1617
1614
  @list_jobs = ::Gapic::Config::Method.new list_jobs_config
1618
- search_jobs_config = parent_rpcs&.search_jobs if parent_rpcs&.respond_to? :search_jobs
1615
+ search_jobs_config = parent_rpcs.search_jobs if parent_rpcs.respond_to? :search_jobs
1619
1616
  @search_jobs = ::Gapic::Config::Method.new search_jobs_config
1620
- search_jobs_for_alert_config = parent_rpcs&.search_jobs_for_alert if parent_rpcs&.respond_to? :search_jobs_for_alert
1617
+ search_jobs_for_alert_config = parent_rpcs.search_jobs_for_alert if parent_rpcs.respond_to? :search_jobs_for_alert
1621
1618
  @search_jobs_for_alert = ::Gapic::Config::Method.new search_jobs_for_alert_config
1622
1619
 
1623
1620
  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::Talent::V4::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