google-cloud-tasks-v2 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,7 @@
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/tasks/v2/cloudtasks_pb"
21
21
  require "google/cloud/tasks/v2/cloud_tasks/rest/service_stub"
22
+ require "google/cloud/location/rest"
22
23
 
23
24
  module Google
24
25
  module Cloud
@@ -67,61 +68,61 @@ module Google
67
68
  end
68
69
  default_config = Client::Configuration.new parent_config
69
70
 
70
- default_config.rpcs.list_queues.timeout = 10.0
71
+ default_config.rpcs.list_queues.timeout = 20.0
71
72
  default_config.rpcs.list_queues.retry_policy = {
72
73
  initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
73
74
  }
74
75
 
75
- default_config.rpcs.get_queue.timeout = 10.0
76
+ default_config.rpcs.get_queue.timeout = 20.0
76
77
  default_config.rpcs.get_queue.retry_policy = {
77
78
  initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
78
79
  }
79
80
 
80
- default_config.rpcs.create_queue.timeout = 10.0
81
+ default_config.rpcs.create_queue.timeout = 20.0
81
82
 
82
- default_config.rpcs.update_queue.timeout = 10.0
83
+ default_config.rpcs.update_queue.timeout = 20.0
83
84
 
84
- default_config.rpcs.delete_queue.timeout = 10.0
85
+ default_config.rpcs.delete_queue.timeout = 20.0
85
86
  default_config.rpcs.delete_queue.retry_policy = {
86
87
  initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
87
88
  }
88
89
 
89
- default_config.rpcs.purge_queue.timeout = 10.0
90
+ default_config.rpcs.purge_queue.timeout = 20.0
90
91
 
91
- default_config.rpcs.pause_queue.timeout = 10.0
92
+ default_config.rpcs.pause_queue.timeout = 20.0
92
93
 
93
- default_config.rpcs.resume_queue.timeout = 10.0
94
+ default_config.rpcs.resume_queue.timeout = 20.0
94
95
 
95
- default_config.rpcs.get_iam_policy.timeout = 10.0
96
+ default_config.rpcs.get_iam_policy.timeout = 20.0
96
97
  default_config.rpcs.get_iam_policy.retry_policy = {
97
98
  initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
98
99
  }
99
100
 
100
- default_config.rpcs.set_iam_policy.timeout = 10.0
101
+ default_config.rpcs.set_iam_policy.timeout = 20.0
101
102
 
102
- default_config.rpcs.test_iam_permissions.timeout = 10.0
103
+ default_config.rpcs.test_iam_permissions.timeout = 20.0
103
104
  default_config.rpcs.test_iam_permissions.retry_policy = {
104
105
  initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
105
106
  }
106
107
 
107
- default_config.rpcs.list_tasks.timeout = 10.0
108
+ default_config.rpcs.list_tasks.timeout = 20.0
108
109
  default_config.rpcs.list_tasks.retry_policy = {
109
110
  initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
110
111
  }
111
112
 
112
- default_config.rpcs.get_task.timeout = 10.0
113
+ default_config.rpcs.get_task.timeout = 20.0
113
114
  default_config.rpcs.get_task.retry_policy = {
114
115
  initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
115
116
  }
116
117
 
117
- default_config.rpcs.create_task.timeout = 10.0
118
+ default_config.rpcs.create_task.timeout = 20.0
118
119
 
119
- default_config.rpcs.delete_task.timeout = 10.0
120
+ default_config.rpcs.delete_task.timeout = 20.0
120
121
  default_config.rpcs.delete_task.retry_policy = {
121
122
  initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
122
123
  }
123
124
 
124
- default_config.rpcs.run_task.timeout = 10.0
125
+ default_config.rpcs.run_task.timeout = 20.0
125
126
 
126
127
  default_config
127
128
  end
@@ -187,9 +188,23 @@ module Google
187
188
  @quota_project_id = @config.quota_project
188
189
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
189
190
 
191
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
192
+ config.credentials = credentials
193
+ config.quota_project = @quota_project_id
194
+ config.endpoint = @config.endpoint
195
+ config.bindings_override = @config.bindings_override
196
+ end
197
+
190
198
  @cloud_tasks_stub = ::Google::Cloud::Tasks::V2::CloudTasks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
191
199
  end
192
200
 
201
+ ##
202
+ # Get the associated client for mix-in of the Locations.
203
+ #
204
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
205
+ #
206
+ attr_reader :location_client
207
+
193
208
  # Service calls
194
209
 
195
210
  ##
@@ -216,11 +231,10 @@ module Google
216
231
  # Required. The location name.
217
232
  # For example: `projects/PROJECT_ID/locations/LOCATION_ID`
218
233
  # @param filter [::String]
219
- # `filter` can be used to specify a subset of queues. Any {::Google::Cloud::Tasks::V2::Queue Queue}
220
- # field can be used as a filter and several operators as supported.
221
- # For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as
222
- # described in
223
- # [Stackdriver's Advanced Logs
234
+ # `filter` can be used to specify a subset of queues. Any
235
+ # {::Google::Cloud::Tasks::V2::Queue Queue} field can be used as a filter and
236
+ # several operators as supported. For example: `<=, <, >=, >, !=, =, :`. The
237
+ # filter syntax is the same as described in [Stackdriver's Advanced Logs
224
238
  # Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
225
239
  #
226
240
  # Sample filter "state: PAUSED".
@@ -233,17 +247,19 @@ module Google
233
247
  # The maximum page size is 9800. If unspecified, the page size will
234
248
  # be the maximum. Fewer queues than requested might be returned,
235
249
  # even if more queues exist; use the
236
- # {::Google::Cloud::Tasks::V2::ListQueuesResponse#next_page_token next_page_token} in the
237
- # response to determine if more queues exist.
250
+ # {::Google::Cloud::Tasks::V2::ListQueuesResponse#next_page_token next_page_token}
251
+ # in the response to determine if more queues exist.
238
252
  # @param page_token [::String]
239
253
  # A token identifying the page of results to return.
240
254
  #
241
255
  # To request the first page results, page_token must be empty. To
242
256
  # request the next page of results, page_token must be the value of
243
- # {::Google::Cloud::Tasks::V2::ListQueuesResponse#next_page_token next_page_token} returned
244
- # from the previous call to {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#list_queues ListQueues}
245
- # method. It is an error to switch the value of the
246
- # {::Google::Cloud::Tasks::V2::ListQueuesRequest#filter filter} while iterating through pages.
257
+ # {::Google::Cloud::Tasks::V2::ListQueuesResponse#next_page_token next_page_token}
258
+ # returned from the previous call to
259
+ # {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#list_queues ListQueues} method. It is an
260
+ # error to switch the value of the
261
+ # {::Google::Cloud::Tasks::V2::ListQueuesRequest#filter filter} while iterating
262
+ # through pages.
247
263
  # @yield [result, operation] Access the result along with the TransportOperation object
248
264
  # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Tasks::V2::Queue>]
249
265
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -251,6 +267,26 @@ module Google
251
267
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Tasks::V2::Queue>]
252
268
  #
253
269
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
270
+ #
271
+ # @example Basic example
272
+ # require "google/cloud/tasks/v2"
273
+ #
274
+ # # Create a client object. The client can be reused for multiple calls.
275
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
276
+ #
277
+ # # Create a request. To set request fields, pass in keyword arguments.
278
+ # request = Google::Cloud::Tasks::V2::ListQueuesRequest.new
279
+ #
280
+ # # Call the list_queues method.
281
+ # result = client.list_queues request
282
+ #
283
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
284
+ # # over elements, and API calls will be issued to fetch pages as needed.
285
+ # result.each do |item|
286
+ # # Each element is of type ::Google::Cloud::Tasks::V2::Queue.
287
+ # p item
288
+ # end
289
+ #
254
290
  def list_queues request, options = nil
255
291
  raise ::ArgumentError, "request must be provided" if request.nil?
256
292
 
@@ -315,6 +351,22 @@ module Google
315
351
  # @return [::Google::Cloud::Tasks::V2::Queue]
316
352
  #
317
353
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
354
+ #
355
+ # @example Basic example
356
+ # require "google/cloud/tasks/v2"
357
+ #
358
+ # # Create a client object. The client can be reused for multiple calls.
359
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
360
+ #
361
+ # # Create a request. To set request fields, pass in keyword arguments.
362
+ # request = Google::Cloud::Tasks::V2::GetQueueRequest.new
363
+ #
364
+ # # Call the get_queue method.
365
+ # result = client.get_queue request
366
+ #
367
+ # # The returned object is of type Google::Cloud::Tasks::V2::Queue.
368
+ # p result
369
+ #
318
370
  def get_queue request, options = nil
319
371
  raise ::ArgumentError, "request must be provided" if request.nil?
320
372
 
@@ -354,8 +406,8 @@ module Google
354
406
  # Creates a queue.
355
407
  #
356
408
  # Queues created with this method allow tasks to live for a maximum of 31
357
- # days. After a task is 31 days old, the task will be deleted regardless of whether
358
- # it was dispatched or not.
409
+ # days. After a task is 31 days old, the task will be deleted regardless of
410
+ # whether it was dispatched or not.
359
411
  #
360
412
  # WARNING: Using this method may have unintended side effects if you are
361
413
  # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
@@ -385,11 +437,12 @@ module Google
385
437
  #
386
438
  # The list of allowed locations can be obtained by calling Cloud
387
439
  # Tasks' implementation of
388
- # [ListLocations][google.cloud.location.Locations.ListLocations].
440
+ # `::Google::Cloud::Location::Locations::Rest::Client#list_locations`.
389
441
  # @param queue [::Google::Cloud::Tasks::V2::Queue, ::Hash]
390
442
  # Required. The queue to create.
391
443
  #
392
- # [Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an existing queue.
444
+ # [Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an
445
+ # existing queue.
393
446
  # @yield [result, operation] Access the result along with the TransportOperation object
394
447
  # @yieldparam result [::Google::Cloud::Tasks::V2::Queue]
395
448
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -397,6 +450,22 @@ module Google
397
450
  # @return [::Google::Cloud::Tasks::V2::Queue]
398
451
  #
399
452
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
453
+ #
454
+ # @example Basic example
455
+ # require "google/cloud/tasks/v2"
456
+ #
457
+ # # Create a client object. The client can be reused for multiple calls.
458
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
459
+ #
460
+ # # Create a request. To set request fields, pass in keyword arguments.
461
+ # request = Google::Cloud::Tasks::V2::CreateQueueRequest.new
462
+ #
463
+ # # Call the create_queue method.
464
+ # result = client.create_queue request
465
+ #
466
+ # # The returned object is of type Google::Cloud::Tasks::V2::Queue.
467
+ # p result
468
+ #
400
469
  def create_queue request, options = nil
401
470
  raise ::ArgumentError, "request must be provided" if request.nil?
402
471
 
@@ -439,8 +508,8 @@ module Google
439
508
  # the queue if it does exist.
440
509
  #
441
510
  # Queues created with this method allow tasks to live for a maximum of 31
442
- # days. After a task is 31 days old, the task will be deleted regardless of whether
443
- # it was dispatched or not.
511
+ # days. After a task is 31 days old, the task will be deleted regardless of
512
+ # whether it was dispatched or not.
444
513
  #
445
514
  # WARNING: Using this method may have unintended side effects if you are
446
515
  # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
@@ -483,6 +552,22 @@ module Google
483
552
  # @return [::Google::Cloud::Tasks::V2::Queue]
484
553
  #
485
554
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
555
+ #
556
+ # @example Basic example
557
+ # require "google/cloud/tasks/v2"
558
+ #
559
+ # # Create a client object. The client can be reused for multiple calls.
560
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
561
+ #
562
+ # # Create a request. To set request fields, pass in keyword arguments.
563
+ # request = Google::Cloud::Tasks::V2::UpdateQueueRequest.new
564
+ #
565
+ # # Call the update_queue method.
566
+ # result = client.update_queue request
567
+ #
568
+ # # The returned object is of type Google::Cloud::Tasks::V2::Queue.
569
+ # p result
570
+ #
486
571
  def update_queue request, options = nil
487
572
  raise ::ArgumentError, "request must be provided" if request.nil?
488
573
 
@@ -558,6 +643,22 @@ module Google
558
643
  # @return [::Google::Protobuf::Empty]
559
644
  #
560
645
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
646
+ #
647
+ # @example Basic example
648
+ # require "google/cloud/tasks/v2"
649
+ #
650
+ # # Create a client object. The client can be reused for multiple calls.
651
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
652
+ #
653
+ # # Create a request. To set request fields, pass in keyword arguments.
654
+ # request = Google::Cloud::Tasks::V2::DeleteQueueRequest.new
655
+ #
656
+ # # Call the delete_queue method.
657
+ # result = client.delete_queue request
658
+ #
659
+ # # The returned object is of type Google::Protobuf::Empty.
660
+ # p result
661
+ #
561
662
  def delete_queue request, options = nil
562
663
  raise ::ArgumentError, "request must be provided" if request.nil?
563
664
 
@@ -626,6 +727,22 @@ module Google
626
727
  # @return [::Google::Cloud::Tasks::V2::Queue]
627
728
  #
628
729
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
730
+ #
731
+ # @example Basic example
732
+ # require "google/cloud/tasks/v2"
733
+ #
734
+ # # Create a client object. The client can be reused for multiple calls.
735
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
736
+ #
737
+ # # Create a request. To set request fields, pass in keyword arguments.
738
+ # request = Google::Cloud::Tasks::V2::PurgeQueueRequest.new
739
+ #
740
+ # # Call the purge_queue method.
741
+ # result = client.purge_queue request
742
+ #
743
+ # # The returned object is of type Google::Cloud::Tasks::V2::Queue.
744
+ # p result
745
+ #
629
746
  def purge_queue request, options = nil
630
747
  raise ::ArgumentError, "request must be provided" if request.nil?
631
748
 
@@ -666,9 +783,10 @@ module Google
666
783
  #
667
784
  # If a queue is paused then the system will stop dispatching tasks
668
785
  # until the queue is resumed via
669
- # {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#resume_queue ResumeQueue}. Tasks can still be added
670
- # when the queue is paused. A queue is paused if its
671
- # {::Google::Cloud::Tasks::V2::Queue#state state} is {::Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED}.
786
+ # {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#resume_queue ResumeQueue}. Tasks can
787
+ # still be added when the queue is paused. A queue is paused if its
788
+ # {::Google::Cloud::Tasks::V2::Queue#state state} is
789
+ # {::Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED}.
672
790
  #
673
791
  # @overload pause_queue(request, options = nil)
674
792
  # Pass arguments to `pause_queue` via a request object, either of type
@@ -695,6 +813,22 @@ module Google
695
813
  # @return [::Google::Cloud::Tasks::V2::Queue]
696
814
  #
697
815
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
816
+ #
817
+ # @example Basic example
818
+ # require "google/cloud/tasks/v2"
819
+ #
820
+ # # Create a client object. The client can be reused for multiple calls.
821
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
822
+ #
823
+ # # Create a request. To set request fields, pass in keyword arguments.
824
+ # request = Google::Cloud::Tasks::V2::PauseQueueRequest.new
825
+ #
826
+ # # Call the pause_queue method.
827
+ # result = client.pause_queue request
828
+ #
829
+ # # The returned object is of type Google::Cloud::Tasks::V2::Queue.
830
+ # p result
831
+ #
698
832
  def pause_queue request, options = nil
699
833
  raise ::ArgumentError, "request must be provided" if request.nil?
700
834
 
@@ -735,9 +869,10 @@ module Google
735
869
  #
736
870
  # This method resumes a queue after it has been
737
871
  # {::Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED} or
738
- # {::Google::Cloud::Tasks::V2::Queue::State::DISABLED DISABLED}. The state of a queue is stored
739
- # in the queue's {::Google::Cloud::Tasks::V2::Queue#state state}; after calling this method it
740
- # will be set to {::Google::Cloud::Tasks::V2::Queue::State::RUNNING RUNNING}.
872
+ # {::Google::Cloud::Tasks::V2::Queue::State::DISABLED DISABLED}. The state of a
873
+ # queue is stored in the queue's {::Google::Cloud::Tasks::V2::Queue#state state};
874
+ # after calling this method it will be set to
875
+ # {::Google::Cloud::Tasks::V2::Queue::State::RUNNING RUNNING}.
741
876
  #
742
877
  # WARNING: Resuming many high-QPS queues at the same time can
743
878
  # lead to target overloading. If you are resuming high-QPS
@@ -770,6 +905,22 @@ module Google
770
905
  # @return [::Google::Cloud::Tasks::V2::Queue]
771
906
  #
772
907
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
908
+ #
909
+ # @example Basic example
910
+ # require "google/cloud/tasks/v2"
911
+ #
912
+ # # Create a client object. The client can be reused for multiple calls.
913
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
914
+ #
915
+ # # Create a request. To set request fields, pass in keyword arguments.
916
+ # request = Google::Cloud::Tasks::V2::ResumeQueueRequest.new
917
+ #
918
+ # # Call the resume_queue method.
919
+ # result = client.resume_queue request
920
+ #
921
+ # # The returned object is of type Google::Cloud::Tasks::V2::Queue.
922
+ # p result
923
+ #
773
924
  def resume_queue request, options = nil
774
925
  raise ::ArgumentError, "request must be provided" if request.nil?
775
926
 
@@ -844,6 +995,22 @@ module Google
844
995
  # @return [::Google::Iam::V1::Policy]
845
996
  #
846
997
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
998
+ #
999
+ # @example Basic example
1000
+ # require "google/cloud/tasks/v2"
1001
+ #
1002
+ # # Create a client object. The client can be reused for multiple calls.
1003
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1004
+ #
1005
+ # # Create a request. To set request fields, pass in keyword arguments.
1006
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
1007
+ #
1008
+ # # Call the get_iam_policy method.
1009
+ # result = client.get_iam_policy request
1010
+ #
1011
+ # # The returned object is of type Google::Iam::V1::Policy.
1012
+ # p result
1013
+ #
847
1014
  def get_iam_policy request, options = nil
848
1015
  raise ::ArgumentError, "request must be provided" if request.nil?
849
1016
 
@@ -880,8 +1047,8 @@ module Google
880
1047
  end
881
1048
 
882
1049
  ##
883
- # Sets the access control policy for a {::Google::Cloud::Tasks::V2::Queue Queue}. Replaces any existing
884
- # policy.
1050
+ # Sets the access control policy for a {::Google::Cloud::Tasks::V2::Queue Queue}.
1051
+ # Replaces any existing policy.
885
1052
  #
886
1053
  # Note: The Cloud Console does not check queue-level IAM permissions yet.
887
1054
  # Project-level permissions are required to use the Cloud Console.
@@ -928,6 +1095,22 @@ module Google
928
1095
  # @return [::Google::Iam::V1::Policy]
929
1096
  #
930
1097
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1098
+ #
1099
+ # @example Basic example
1100
+ # require "google/cloud/tasks/v2"
1101
+ #
1102
+ # # Create a client object. The client can be reused for multiple calls.
1103
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1104
+ #
1105
+ # # Create a request. To set request fields, pass in keyword arguments.
1106
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
1107
+ #
1108
+ # # Call the set_iam_policy method.
1109
+ # result = client.set_iam_policy request
1110
+ #
1111
+ # # The returned object is of type Google::Iam::V1::Policy.
1112
+ # p result
1113
+ #
931
1114
  def set_iam_policy request, options = nil
932
1115
  raise ::ArgumentError, "request must be provided" if request.nil?
933
1116
 
@@ -964,9 +1147,10 @@ module Google
964
1147
  end
965
1148
 
966
1149
  ##
967
- # Returns permissions that a caller has on a {::Google::Cloud::Tasks::V2::Queue Queue}.
968
- # If the resource does not exist, this will return an empty set of
969
- # permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
1150
+ # Returns permissions that a caller has on a
1151
+ # {::Google::Cloud::Tasks::V2::Queue Queue}. If the resource does not exist, this
1152
+ # will return an empty set of permissions, not a
1153
+ # [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
970
1154
  #
971
1155
  # Note: This operation is designed to be used for building permission-aware
972
1156
  # UIs and command-line tools, not for authorization checking. This operation
@@ -1002,6 +1186,22 @@ module Google
1002
1186
  # @return [::Google::Iam::V1::TestIamPermissionsResponse]
1003
1187
  #
1004
1188
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1189
+ #
1190
+ # @example Basic example
1191
+ # require "google/cloud/tasks/v2"
1192
+ #
1193
+ # # Create a client object. The client can be reused for multiple calls.
1194
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1195
+ #
1196
+ # # Create a request. To set request fields, pass in keyword arguments.
1197
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
1198
+ #
1199
+ # # Call the test_iam_permissions method.
1200
+ # result = client.test_iam_permissions request
1201
+ #
1202
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
1203
+ # p result
1204
+ #
1005
1205
  def test_iam_permissions request, options = nil
1006
1206
  raise ::ArgumentError, "request must be provided" if request.nil?
1007
1207
 
@@ -1040,10 +1240,10 @@ module Google
1040
1240
  ##
1041
1241
  # Lists the tasks in a queue.
1042
1242
  #
1043
- # By default, only the {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC} view is retrieved
1044
- # due to performance considerations;
1045
- # {::Google::Cloud::Tasks::V2::ListTasksRequest#response_view response_view} controls the
1046
- # subset of information which is returned.
1243
+ # By default, only the {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC} view is
1244
+ # retrieved due to performance considerations;
1245
+ # {::Google::Cloud::Tasks::V2::ListTasksRequest#response_view response_view}
1246
+ # controls the subset of information which is returned.
1047
1247
  #
1048
1248
  # The tasks may be returned in any order. The ordering may change at any
1049
1249
  # time.
@@ -1067,11 +1267,11 @@ module Google
1067
1267
  # Required. The queue name. For example:
1068
1268
  # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1069
1269
  # @param response_view [::Google::Cloud::Tasks::V2::Task::View]
1070
- # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2::Task Task} will be
1071
- # returned.
1270
+ # The response_view specifies which subset of the
1271
+ # {::Google::Cloud::Tasks::V2::Task Task} will be returned.
1072
1272
  #
1073
- # By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
1074
- # information is retrieved by default because some data, such as
1273
+ # By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC};
1274
+ # not all information is retrieved by default because some data, such as
1075
1275
  # payloads, might be desirable to return only when needed because
1076
1276
  # of its large size or because of the sensitivity of data that it
1077
1277
  # contains.
@@ -1083,8 +1283,8 @@ module Google
1083
1283
  # Maximum page size.
1084
1284
  #
1085
1285
  # Fewer tasks than requested might be returned, even if more tasks exist; use
1086
- # {::Google::Cloud::Tasks::V2::ListTasksResponse#next_page_token next_page_token} in the response to
1087
- # determine if more tasks exist.
1286
+ # {::Google::Cloud::Tasks::V2::ListTasksResponse#next_page_token next_page_token}
1287
+ # in the response to determine if more tasks exist.
1088
1288
  #
1089
1289
  # The maximum page size is 1000. If unspecified, the page size will be the
1090
1290
  # maximum.
@@ -1093,9 +1293,9 @@ module Google
1093
1293
  #
1094
1294
  # To request the first page results, page_token must be empty. To
1095
1295
  # request the next page of results, page_token must be the value of
1096
- # {::Google::Cloud::Tasks::V2::ListTasksResponse#next_page_token next_page_token} returned
1097
- # from the previous call to {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#list_tasks ListTasks}
1098
- # method.
1296
+ # {::Google::Cloud::Tasks::V2::ListTasksResponse#next_page_token next_page_token}
1297
+ # returned from the previous call to
1298
+ # {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#list_tasks ListTasks} method.
1099
1299
  #
1100
1300
  # The page token is valid for only 2 hours.
1101
1301
  # @yield [result, operation] Access the result along with the TransportOperation object
@@ -1105,6 +1305,26 @@ module Google
1105
1305
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Tasks::V2::Task>]
1106
1306
  #
1107
1307
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1308
+ #
1309
+ # @example Basic example
1310
+ # require "google/cloud/tasks/v2"
1311
+ #
1312
+ # # Create a client object. The client can be reused for multiple calls.
1313
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1314
+ #
1315
+ # # Create a request. To set request fields, pass in keyword arguments.
1316
+ # request = Google::Cloud::Tasks::V2::ListTasksRequest.new
1317
+ #
1318
+ # # Call the list_tasks method.
1319
+ # result = client.list_tasks request
1320
+ #
1321
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1322
+ # # over elements, and API calls will be issued to fetch pages as needed.
1323
+ # result.each do |item|
1324
+ # # Each element is of type ::Google::Cloud::Tasks::V2::Task.
1325
+ # p item
1326
+ # end
1327
+ #
1108
1328
  def list_tasks request, options = nil
1109
1329
  raise ::ArgumentError, "request must be provided" if request.nil?
1110
1330
 
@@ -1163,11 +1383,11 @@ module Google
1163
1383
  # Required. The task name. For example:
1164
1384
  # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1165
1385
  # @param response_view [::Google::Cloud::Tasks::V2::Task::View]
1166
- # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2::Task Task} will be
1167
- # returned.
1386
+ # The response_view specifies which subset of the
1387
+ # {::Google::Cloud::Tasks::V2::Task Task} will be returned.
1168
1388
  #
1169
- # By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
1170
- # information is retrieved by default because some data, such as
1389
+ # By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC};
1390
+ # not all information is retrieved by default because some data, such as
1171
1391
  # payloads, might be desirable to return only when needed because
1172
1392
  # of its large size or because of the sensitivity of data that it
1173
1393
  # contains.
@@ -1182,6 +1402,22 @@ module Google
1182
1402
  # @return [::Google::Cloud::Tasks::V2::Task]
1183
1403
  #
1184
1404
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1405
+ #
1406
+ # @example Basic example
1407
+ # require "google/cloud/tasks/v2"
1408
+ #
1409
+ # # Create a client object. The client can be reused for multiple calls.
1410
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1411
+ #
1412
+ # # Create a request. To set request fields, pass in keyword arguments.
1413
+ # request = Google::Cloud::Tasks::V2::GetTaskRequest.new
1414
+ #
1415
+ # # Call the get_task method.
1416
+ # result = client.get_task request
1417
+ #
1418
+ # # The returned object is of type Google::Cloud::Tasks::V2::Task.
1419
+ # p result
1420
+ #
1185
1421
  def get_task request, options = nil
1186
1422
  raise ::ArgumentError, "request must be provided" if request.nil?
1187
1423
 
@@ -1249,13 +1485,13 @@ module Google
1249
1485
  #
1250
1486
  # Task names have the following format:
1251
1487
  # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
1252
- # The user can optionally specify a task {::Google::Cloud::Tasks::V2::Task#name name}. If a
1253
- # name is not specified then the system will generate a random
1254
- # unique task id, which will be set in the task returned in the
1255
- # {::Google::Cloud::Tasks::V2::Task#name response}.
1488
+ # The user can optionally specify a task
1489
+ # {::Google::Cloud::Tasks::V2::Task#name name}. If a name is not specified then
1490
+ # the system will generate a random unique task id, which will be set in the
1491
+ # task returned in the {::Google::Cloud::Tasks::V2::Task#name response}.
1256
1492
  #
1257
- # If {::Google::Cloud::Tasks::V2::Task#schedule_time schedule_time} is not set or is in the
1258
- # past then Cloud Tasks will set it to the current time.
1493
+ # If {::Google::Cloud::Tasks::V2::Task#schedule_time schedule_time} is not set or
1494
+ # is in the past then Cloud Tasks will set it to the current time.
1259
1495
  #
1260
1496
  # Task De-duplication:
1261
1497
  #
@@ -1270,20 +1506,20 @@ module Google
1270
1506
  # for ~9days after the original task was deleted or executed.
1271
1507
  #
1272
1508
  # Because there is an extra lookup cost to identify duplicate task
1273
- # names, these {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#create_task CreateTask} calls have significantly
1274
- # increased latency. Using hashed strings for the task id or for
1275
- # the prefix of the task id is recommended. Choosing task ids that
1276
- # are sequential or have sequential prefixes, for example using a
1509
+ # names, these {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#create_task CreateTask}
1510
+ # calls have significantly increased latency. Using hashed strings for the
1511
+ # task id or for the prefix of the task id is recommended. Choosing task ids
1512
+ # that are sequential or have sequential prefixes, for example using a
1277
1513
  # timestamp, causes an increase in latency and error rates in all
1278
1514
  # task commands. The infrastructure relies on an approximately
1279
1515
  # uniform distribution of task ids to store and serve tasks
1280
1516
  # efficiently.
1281
1517
  # @param response_view [::Google::Cloud::Tasks::V2::Task::View]
1282
- # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2::Task Task} will be
1283
- # returned.
1518
+ # The response_view specifies which subset of the
1519
+ # {::Google::Cloud::Tasks::V2::Task Task} will be returned.
1284
1520
  #
1285
- # By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
1286
- # information is retrieved by default because some data, such as
1521
+ # By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC};
1522
+ # not all information is retrieved by default because some data, such as
1287
1523
  # payloads, might be desirable to return only when needed because
1288
1524
  # of its large size or because of the sensitivity of data that it
1289
1525
  # contains.
@@ -1298,6 +1534,22 @@ module Google
1298
1534
  # @return [::Google::Cloud::Tasks::V2::Task]
1299
1535
  #
1300
1536
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1537
+ #
1538
+ # @example Basic example
1539
+ # require "google/cloud/tasks/v2"
1540
+ #
1541
+ # # Create a client object. The client can be reused for multiple calls.
1542
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1543
+ #
1544
+ # # Create a request. To set request fields, pass in keyword arguments.
1545
+ # request = Google::Cloud::Tasks::V2::CreateTaskRequest.new
1546
+ #
1547
+ # # Call the create_task method.
1548
+ # result = client.create_task request
1549
+ #
1550
+ # # The returned object is of type Google::Cloud::Tasks::V2::Task.
1551
+ # p result
1552
+ #
1301
1553
  def create_task request, options = nil
1302
1554
  raise ::ArgumentError, "request must be provided" if request.nil?
1303
1555
 
@@ -1365,6 +1617,22 @@ module Google
1365
1617
  # @return [::Google::Protobuf::Empty]
1366
1618
  #
1367
1619
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1620
+ #
1621
+ # @example Basic example
1622
+ # require "google/cloud/tasks/v2"
1623
+ #
1624
+ # # Create a client object. The client can be reused for multiple calls.
1625
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1626
+ #
1627
+ # # Create a request. To set request fields, pass in keyword arguments.
1628
+ # request = Google::Cloud::Tasks::V2::DeleteTaskRequest.new
1629
+ #
1630
+ # # Call the delete_task method.
1631
+ # result = client.delete_task request
1632
+ #
1633
+ # # The returned object is of type Google::Protobuf::Empty.
1634
+ # p result
1635
+ #
1368
1636
  def delete_task request, options = nil
1369
1637
  raise ::ArgumentError, "request must be provided" if request.nil?
1370
1638
 
@@ -1404,13 +1672,14 @@ module Google
1404
1672
  # Forces a task to run now.
1405
1673
  #
1406
1674
  # When this method is called, Cloud Tasks will dispatch the task, even if
1407
- # the task is already running, the queue has reached its {::Google::Cloud::Tasks::V2::RateLimits RateLimits} or
1408
- # is {::Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED}.
1675
+ # the task is already running, the queue has reached its
1676
+ # {::Google::Cloud::Tasks::V2::RateLimits RateLimits} or is
1677
+ # {::Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED}.
1409
1678
  #
1410
1679
  # This command is meant to be used for manual debugging. For
1411
- # example, {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#run_task RunTask} can be used to retry a failed
1412
- # task after a fix has been made or to manually force a task to be
1413
- # dispatched now.
1680
+ # example, {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#run_task RunTask} can be used to
1681
+ # retry a failed task after a fix has been made or to manually force a task
1682
+ # to be dispatched now.
1414
1683
  #
1415
1684
  # The dispatched task is returned. That is, the task that is returned
1416
1685
  # contains the [status][Task.status] after the task is dispatched but
@@ -1418,9 +1687,10 @@ module Google
1418
1687
  #
1419
1688
  # If Cloud Tasks receives a successful response from the task's
1420
1689
  # target, then the task will be deleted; otherwise the task's
1421
- # {::Google::Cloud::Tasks::V2::Task#schedule_time schedule_time} will be reset to the time that
1422
- # {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#run_task RunTask} was called plus the retry delay specified
1423
- # in the queue's {::Google::Cloud::Tasks::V2::RetryConfig RetryConfig}.
1690
+ # {::Google::Cloud::Tasks::V2::Task#schedule_time schedule_time} will be reset to
1691
+ # the time that {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#run_task RunTask} was
1692
+ # called plus the retry delay specified in the queue's
1693
+ # {::Google::Cloud::Tasks::V2::RetryConfig RetryConfig}.
1424
1694
  #
1425
1695
  # {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#run_task RunTask} returns
1426
1696
  # [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a
@@ -1445,11 +1715,11 @@ module Google
1445
1715
  # Required. The task name. For example:
1446
1716
  # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1447
1717
  # @param response_view [::Google::Cloud::Tasks::V2::Task::View]
1448
- # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2::Task Task} will be
1449
- # returned.
1718
+ # The response_view specifies which subset of the
1719
+ # {::Google::Cloud::Tasks::V2::Task Task} will be returned.
1450
1720
  #
1451
- # By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
1452
- # information is retrieved by default because some data, such as
1721
+ # By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC};
1722
+ # not all information is retrieved by default because some data, such as
1453
1723
  # payloads, might be desirable to return only when needed because
1454
1724
  # of its large size or because of the sensitivity of data that it
1455
1725
  # contains.
@@ -1464,6 +1734,22 @@ module Google
1464
1734
  # @return [::Google::Cloud::Tasks::V2::Task]
1465
1735
  #
1466
1736
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1737
+ #
1738
+ # @example Basic example
1739
+ # require "google/cloud/tasks/v2"
1740
+ #
1741
+ # # Create a client object. The client can be reused for multiple calls.
1742
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1743
+ #
1744
+ # # Create a request. To set request fields, pass in keyword arguments.
1745
+ # request = Google::Cloud::Tasks::V2::RunTaskRequest.new
1746
+ #
1747
+ # # Call the run_task method.
1748
+ # result = client.run_task request
1749
+ #
1750
+ # # The returned object is of type Google::Cloud::Tasks::V2::Task.
1751
+ # p result
1752
+ #
1467
1753
  def run_task request, options = nil
1468
1754
  raise ::ArgumentError, "request must be provided" if request.nil?
1469
1755
 
@@ -1587,6 +1873,13 @@ module Google
1587
1873
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1588
1874
  config_attr :quota_project, nil, ::String, nil
1589
1875
 
1876
+ # @private
1877
+ # Overrides for http bindings for the RPCs of this service
1878
+ # are only used when this service is used as mixin, and only
1879
+ # by the host service.
1880
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1881
+ config_attr :bindings_override, {}, ::Hash, nil
1882
+
1590
1883
  # @private
1591
1884
  def initialize parent_config = nil
1592
1885
  @parent_config = parent_config unless parent_config.nil?