google-cloud-tasks-v2beta3 0.10.0 → 0.10.2

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/v2beta3/cloudtasks_pb"
21
21
  require "google/cloud/tasks/v2beta3/cloud_tasks/rest/service_stub"
22
+ require "google/cloud/location/rest"
22
23
 
23
24
  module Google
24
25
  module Cloud
@@ -123,6 +124,8 @@ module Google
123
124
 
124
125
  default_config.rpcs.run_task.timeout = 20.0
125
126
 
127
+ default_config.rpcs.buffer_task.timeout = 20.0
128
+
126
129
  default_config
127
130
  end
128
131
  yield @configure if block_given?
@@ -176,7 +179,7 @@ module Google
176
179
  credentials = @config.credentials
177
180
  # Use self-signed JWT if the endpoint is unchanged from default,
178
181
  # but only if the default endpoint does not have a region prefix.
179
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
182
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
180
183
  !@config.endpoint.split(".").first.include?("-")
181
184
  credentials ||= Credentials.default scope: @config.scope,
182
185
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -187,9 +190,23 @@ module Google
187
190
  @quota_project_id = @config.quota_project
188
191
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
189
192
 
193
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
194
+ config.credentials = credentials
195
+ config.quota_project = @quota_project_id
196
+ config.endpoint = @config.endpoint
197
+ config.bindings_override = @config.bindings_override
198
+ end
199
+
190
200
  @cloud_tasks_stub = ::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
191
201
  end
192
202
 
203
+ ##
204
+ # Get the associated client for mix-in of the Locations.
205
+ #
206
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
207
+ #
208
+ attr_reader :location_client
209
+
193
210
  # Service calls
194
211
 
195
212
  ##
@@ -216,11 +233,10 @@ module Google
216
233
  # Required. The location name.
217
234
  # For example: `projects/PROJECT_ID/locations/LOCATION_ID`
218
235
  # @param filter [::String]
219
- # `filter` can be used to specify a subset of queues. Any {::Google::Cloud::Tasks::V2beta3::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
236
+ # `filter` can be used to specify a subset of queues. Any
237
+ # {::Google::Cloud::Tasks::V2beta3::Queue Queue} field can be used as a filter and
238
+ # several operators as supported. For example: `<=, <, >=, >, !=, =, :`. The
239
+ # filter syntax is the same as described in [Stackdriver's Advanced Logs
224
240
  # Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
225
241
  #
226
242
  # Sample filter "state: PAUSED".
@@ -233,20 +249,22 @@ module Google
233
249
  # The maximum page size is 9800. If unspecified, the page size will
234
250
  # be the maximum. Fewer queues than requested might be returned,
235
251
  # even if more queues exist; use the
236
- # {::Google::Cloud::Tasks::V2beta3::ListQueuesResponse#next_page_token next_page_token} in the
237
- # response to determine if more queues exist.
252
+ # {::Google::Cloud::Tasks::V2beta3::ListQueuesResponse#next_page_token next_page_token}
253
+ # in the response to determine if more queues exist.
238
254
  # @param page_token [::String]
239
255
  # A token identifying the page of results to return.
240
256
  #
241
257
  # To request the first page results, page_token must be empty. To
242
258
  # request the next page of results, page_token must be the value of
243
- # {::Google::Cloud::Tasks::V2beta3::ListQueuesResponse#next_page_token next_page_token} returned
244
- # from the previous call to {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#list_queues ListQueues}
245
- # method. It is an error to switch the value of the
246
- # {::Google::Cloud::Tasks::V2beta3::ListQueuesRequest#filter filter} while iterating through pages.
259
+ # {::Google::Cloud::Tasks::V2beta3::ListQueuesResponse#next_page_token next_page_token}
260
+ # returned from the previous call to
261
+ # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#list_queues ListQueues} method. It
262
+ # is an error to switch the value of the
263
+ # {::Google::Cloud::Tasks::V2beta3::ListQueuesRequest#filter filter} while
264
+ # iterating through pages.
247
265
  # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
248
- # Optional. Read mask is used for a more granular control over what the API returns.
249
- # If the mask is not present all fields will be returned except
266
+ # Optional. Read mask is used for a more granular control over what the API
267
+ # returns. If the mask is not present all fields will be returned except
250
268
  # [Queue.stats]. [Queue.stats] will be returned only if it was explicitly
251
269
  # specified in the mask.
252
270
  # @yield [result, operation] Access the result along with the TransportOperation object
@@ -314,8 +332,8 @@ module Google
314
332
  # Required. The resource name of the queue. For example:
315
333
  # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
316
334
  # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
317
- # Optional. Read mask is used for a more granular control over what the API returns.
318
- # If the mask is not present all fields will be returned except
335
+ # Optional. Read mask is used for a more granular control over what the API
336
+ # returns. If the mask is not present all fields will be returned except
319
337
  # [Queue.stats]. [Queue.stats] will be returned only if it was explicitly
320
338
  # specified in the mask.
321
339
  # @yield [result, operation] Access the result along with the TransportOperation object
@@ -364,8 +382,8 @@ module Google
364
382
  # Creates a queue.
365
383
  #
366
384
  # Queues created with this method allow tasks to live for a maximum of 31
367
- # days. After a task is 31 days old, the task will be deleted regardless of whether
368
- # it was dispatched or not.
385
+ # days. After a task is 31 days old, the task will be deleted regardless of
386
+ # whether it was dispatched or not.
369
387
  #
370
388
  # WARNING: Using this method may have unintended side effects if you are
371
389
  # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
@@ -395,11 +413,12 @@ module Google
395
413
  #
396
414
  # The list of allowed locations can be obtained by calling Cloud
397
415
  # Tasks' implementation of
398
- # [ListLocations][google.cloud.location.Locations.ListLocations].
416
+ # `::Google::Cloud::Location::Locations::Rest::Client#list_locations`.
399
417
  # @param queue [::Google::Cloud::Tasks::V2beta3::Queue, ::Hash]
400
418
  # Required. The queue to create.
401
419
  #
402
- # [Queue's name][google.cloud.tasks.v2beta3.Queue.name] cannot be the same as an existing queue.
420
+ # [Queue's name][google.cloud.tasks.v2beta3.Queue.name] cannot be the same as
421
+ # an existing queue.
403
422
  # @yield [result, operation] Access the result along with the TransportOperation object
404
423
  # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Queue]
405
424
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -449,8 +468,8 @@ module Google
449
468
  # the queue if it does exist.
450
469
  #
451
470
  # Queues created with this method allow tasks to live for a maximum of 31
452
- # days. After a task is 31 days old, the task will be deleted regardless of whether
453
- # it was dispatched or not.
471
+ # days. After a task is 31 days old, the task will be deleted regardless of
472
+ # whether it was dispatched or not.
454
473
  #
455
474
  # WARNING: Using this method may have unintended side effects if you are
456
475
  # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
@@ -477,11 +496,13 @@ module Google
477
496
  # @param queue [::Google::Cloud::Tasks::V2beta3::Queue, ::Hash]
478
497
  # Required. The queue to create or update.
479
498
  #
480
- # The queue's {::Google::Cloud::Tasks::V2beta3::Queue#name name} must be specified.
499
+ # The queue's {::Google::Cloud::Tasks::V2beta3::Queue#name name} must be
500
+ # specified.
481
501
  #
482
502
  # Output only fields cannot be modified using UpdateQueue.
483
503
  # Any value specified for an output only field will be ignored.
484
- # The queue's {::Google::Cloud::Tasks::V2beta3::Queue#name name} cannot be changed.
504
+ # The queue's {::Google::Cloud::Tasks::V2beta3::Queue#name name} cannot be
505
+ # changed.
485
506
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
486
507
  # A mask used to specify which fields of the queue are being updated.
487
508
  #
@@ -676,9 +697,10 @@ module Google
676
697
  #
677
698
  # If a queue is paused then the system will stop dispatching tasks
678
699
  # until the queue is resumed via
679
- # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#resume_queue ResumeQueue}. Tasks can still be added
680
- # when the queue is paused. A queue is paused if its
681
- # {::Google::Cloud::Tasks::V2beta3::Queue#state state} is {::Google::Cloud::Tasks::V2beta3::Queue::State::PAUSED PAUSED}.
700
+ # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#resume_queue ResumeQueue}. Tasks can
701
+ # still be added when the queue is paused. A queue is paused if its
702
+ # {::Google::Cloud::Tasks::V2beta3::Queue#state state} is
703
+ # {::Google::Cloud::Tasks::V2beta3::Queue::State::PAUSED PAUSED}.
682
704
  #
683
705
  # @overload pause_queue(request, options = nil)
684
706
  # Pass arguments to `pause_queue` via a request object, either of type
@@ -745,9 +767,11 @@ module Google
745
767
  #
746
768
  # This method resumes a queue after it has been
747
769
  # {::Google::Cloud::Tasks::V2beta3::Queue::State::PAUSED PAUSED} or
748
- # {::Google::Cloud::Tasks::V2beta3::Queue::State::DISABLED DISABLED}. The state of a queue is stored
749
- # in the queue's {::Google::Cloud::Tasks::V2beta3::Queue#state state}; after calling this method it
750
- # will be set to {::Google::Cloud::Tasks::V2beta3::Queue::State::RUNNING RUNNING}.
770
+ # {::Google::Cloud::Tasks::V2beta3::Queue::State::DISABLED DISABLED}. The state of a
771
+ # queue is stored in the queue's
772
+ # {::Google::Cloud::Tasks::V2beta3::Queue#state state}; after calling this method
773
+ # it will be set to
774
+ # {::Google::Cloud::Tasks::V2beta3::Queue::State::RUNNING RUNNING}.
751
775
  #
752
776
  # WARNING: Resuming many high-QPS queues at the same time can
753
777
  # lead to target overloading. If you are resuming high-QPS
@@ -816,9 +840,9 @@ module Google
816
840
  end
817
841
 
818
842
  ##
819
- # Gets the access control policy for a {::Google::Cloud::Tasks::V2beta3::Queue Queue}.
820
- # Returns an empty policy if the resource exists and does not have a policy
821
- # set.
843
+ # Gets the access control policy for a
844
+ # {::Google::Cloud::Tasks::V2beta3::Queue Queue}. Returns an empty policy if the
845
+ # resource exists and does not have a policy set.
822
846
  #
823
847
  # Authorization requires the following
824
848
  # [Google IAM](https://cloud.google.com/iam) permission on the specified
@@ -890,8 +914,8 @@ module Google
890
914
  end
891
915
 
892
916
  ##
893
- # Sets the access control policy for a {::Google::Cloud::Tasks::V2beta3::Queue Queue}. Replaces any existing
894
- # policy.
917
+ # Sets the access control policy for a
918
+ # {::Google::Cloud::Tasks::V2beta3::Queue Queue}. Replaces any existing policy.
895
919
  #
896
920
  # Note: The Cloud Console does not check queue-level IAM permissions yet.
897
921
  # Project-level permissions are required to use the Cloud Console.
@@ -974,9 +998,10 @@ module Google
974
998
  end
975
999
 
976
1000
  ##
977
- # Returns permissions that a caller has on a {::Google::Cloud::Tasks::V2beta3::Queue Queue}.
978
- # If the resource does not exist, this will return an empty set of
979
- # permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
1001
+ # Returns permissions that a caller has on a
1002
+ # {::Google::Cloud::Tasks::V2beta3::Queue Queue}. If the resource does not exist,
1003
+ # this will return an empty set of permissions, not a
1004
+ # [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
980
1005
  #
981
1006
  # Note: This operation is designed to be used for building permission-aware
982
1007
  # UIs and command-line tools, not for authorization checking. This operation
@@ -1050,10 +1075,10 @@ module Google
1050
1075
  ##
1051
1076
  # Lists the tasks in a queue.
1052
1077
  #
1053
- # By default, only the {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC} view is retrieved
1054
- # due to performance considerations;
1055
- # {::Google::Cloud::Tasks::V2beta3::ListTasksRequest#response_view response_view} controls the
1056
- # subset of information which is returned.
1078
+ # By default, only the {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}
1079
+ # view is retrieved due to performance considerations;
1080
+ # {::Google::Cloud::Tasks::V2beta3::ListTasksRequest#response_view response_view}
1081
+ # controls the subset of information which is returned.
1057
1082
  #
1058
1083
  # The tasks may be returned in any order. The ordering may change at any
1059
1084
  # time.
@@ -1077,24 +1102,25 @@ module Google
1077
1102
  # Required. The queue name. For example:
1078
1103
  # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1079
1104
  # @param response_view [::Google::Cloud::Tasks::V2beta3::Task::View]
1080
- # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta3::Task Task} will be
1081
- # returned.
1082
- #
1083
- # By default response_view is {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all
1084
- # information is retrieved by default because some data, such as
1085
- # payloads, might be desirable to return only when needed because
1086
- # of its large size or because of the sensitivity of data that it
1087
- # contains.
1088
- #
1089
- # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL} requires
1090
- # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1091
- # permission on the {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1105
+ # The response_view specifies which subset of the
1106
+ # {::Google::Cloud::Tasks::V2beta3::Task Task} will be returned.
1107
+ #
1108
+ # By default response_view is
1109
+ # {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all information is
1110
+ # retrieved by default because some data, such as payloads, might be
1111
+ # desirable to return only when needed because of its large size or because
1112
+ # of the sensitivity of data that it contains.
1113
+ #
1114
+ # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL}
1115
+ # requires `cloudtasks.tasks.fullView` [Google
1116
+ # IAM](https://cloud.google.com/iam/) permission on the
1117
+ # {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1092
1118
  # @param page_size [::Integer]
1093
1119
  # Maximum page size.
1094
1120
  #
1095
1121
  # Fewer tasks than requested might be returned, even if more tasks exist; use
1096
- # {::Google::Cloud::Tasks::V2beta3::ListTasksResponse#next_page_token next_page_token} in the response to
1097
- # determine if more tasks exist.
1122
+ # {::Google::Cloud::Tasks::V2beta3::ListTasksResponse#next_page_token next_page_token}
1123
+ # in the response to determine if more tasks exist.
1098
1124
  #
1099
1125
  # The maximum page size is 1000. If unspecified, the page size will be the
1100
1126
  # maximum.
@@ -1103,9 +1129,9 @@ module Google
1103
1129
  #
1104
1130
  # To request the first page results, page_token must be empty. To
1105
1131
  # request the next page of results, page_token must be the value of
1106
- # {::Google::Cloud::Tasks::V2beta3::ListTasksResponse#next_page_token next_page_token} returned
1107
- # from the previous call to {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#list_tasks ListTasks}
1108
- # method.
1132
+ # {::Google::Cloud::Tasks::V2beta3::ListTasksResponse#next_page_token next_page_token}
1133
+ # returned from the previous call to
1134
+ # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#list_tasks ListTasks} method.
1109
1135
  #
1110
1136
  # The page token is valid for only 2 hours.
1111
1137
  # @yield [result, operation] Access the result along with the TransportOperation object
@@ -1173,18 +1199,19 @@ module Google
1173
1199
  # Required. The task name. For example:
1174
1200
  # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1175
1201
  # @param response_view [::Google::Cloud::Tasks::V2beta3::Task::View]
1176
- # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta3::Task Task} will be
1177
- # returned.
1178
- #
1179
- # By default response_view is {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all
1180
- # information is retrieved by default because some data, such as
1181
- # payloads, might be desirable to return only when needed because
1182
- # of its large size or because of the sensitivity of data that it
1183
- # contains.
1184
- #
1185
- # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL} requires
1186
- # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1187
- # permission on the {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1202
+ # The response_view specifies which subset of the
1203
+ # {::Google::Cloud::Tasks::V2beta3::Task Task} will be returned.
1204
+ #
1205
+ # By default response_view is
1206
+ # {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all information is
1207
+ # retrieved by default because some data, such as payloads, might be
1208
+ # desirable to return only when needed because of its large size or because
1209
+ # of the sensitivity of data that it contains.
1210
+ #
1211
+ # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL}
1212
+ # requires `cloudtasks.tasks.fullView` [Google
1213
+ # IAM](https://cloud.google.com/iam/) permission on the
1214
+ # {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1188
1215
  # @yield [result, operation] Access the result along with the TransportOperation object
1189
1216
  # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Task]
1190
1217
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1259,13 +1286,13 @@ module Google
1259
1286
  #
1260
1287
  # Task names have the following format:
1261
1288
  # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
1262
- # The user can optionally specify a task {::Google::Cloud::Tasks::V2beta3::Task#name name}. If a
1263
- # name is not specified then the system will generate a random
1264
- # unique task id, which will be set in the task returned in the
1265
- # {::Google::Cloud::Tasks::V2beta3::Task#name response}.
1289
+ # The user can optionally specify a task
1290
+ # {::Google::Cloud::Tasks::V2beta3::Task#name name}. If a name is not specified
1291
+ # then the system will generate a random unique task id, which will be set in
1292
+ # the task returned in the {::Google::Cloud::Tasks::V2beta3::Task#name response}.
1266
1293
  #
1267
- # If {::Google::Cloud::Tasks::V2beta3::Task#schedule_time schedule_time} is not set or is in the
1268
- # past then Cloud Tasks will set it to the current time.
1294
+ # If {::Google::Cloud::Tasks::V2beta3::Task#schedule_time schedule_time} is not
1295
+ # set or is in the past then Cloud Tasks will set it to the current time.
1269
1296
  #
1270
1297
  # Task De-duplication:
1271
1298
  #
@@ -1274,33 +1301,34 @@ module Google
1274
1301
  # that was deleted or executed recently then the call will fail
1275
1302
  # with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
1276
1303
  # If the task's queue was created using Cloud Tasks, then another task with
1277
- # the same name can't be created for ~1hour after the original task was
1304
+ # the same name can't be created for ~1 hour after the original task was
1278
1305
  # deleted or executed. If the task's queue was created using queue.yaml or
1279
1306
  # queue.xml, then another task with the same name can't be created
1280
- # for ~9days after the original task was deleted or executed.
1307
+ # for ~9 days after the original task was deleted or executed.
1281
1308
  #
1282
1309
  # Because there is an extra lookup cost to identify duplicate task
1283
- # names, these {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#create_task CreateTask} calls have significantly
1284
- # increased latency. Using hashed strings for the task id or for
1285
- # the prefix of the task id is recommended. Choosing task ids that
1286
- # are sequential or have sequential prefixes, for example using a
1310
+ # names, these {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#create_task CreateTask}
1311
+ # calls have significantly increased latency. Using hashed strings for the
1312
+ # task id or for the prefix of the task id is recommended. Choosing task ids
1313
+ # that are sequential or have sequential prefixes, for example using a
1287
1314
  # timestamp, causes an increase in latency and error rates in all
1288
1315
  # task commands. The infrastructure relies on an approximately
1289
1316
  # uniform distribution of task ids to store and serve tasks
1290
1317
  # efficiently.
1291
1318
  # @param response_view [::Google::Cloud::Tasks::V2beta3::Task::View]
1292
- # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta3::Task Task} will be
1293
- # returned.
1294
- #
1295
- # By default response_view is {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all
1296
- # information is retrieved by default because some data, such as
1297
- # payloads, might be desirable to return only when needed because
1298
- # of its large size or because of the sensitivity of data that it
1299
- # contains.
1300
- #
1301
- # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL} requires
1302
- # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1303
- # permission on the {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1319
+ # The response_view specifies which subset of the
1320
+ # {::Google::Cloud::Tasks::V2beta3::Task Task} will be returned.
1321
+ #
1322
+ # By default response_view is
1323
+ # {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all information is
1324
+ # retrieved by default because some data, such as payloads, might be
1325
+ # desirable to return only when needed because of its large size or because
1326
+ # of the sensitivity of data that it contains.
1327
+ #
1328
+ # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL}
1329
+ # requires `cloudtasks.tasks.fullView` [Google
1330
+ # IAM](https://cloud.google.com/iam/) permission on the
1331
+ # {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1304
1332
  # @yield [result, operation] Access the result along with the TransportOperation object
1305
1333
  # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Task]
1306
1334
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1414,13 +1442,14 @@ module Google
1414
1442
  # Forces a task to run now.
1415
1443
  #
1416
1444
  # When this method is called, Cloud Tasks will dispatch the task, even if
1417
- # the task is already running, the queue has reached its {::Google::Cloud::Tasks::V2beta3::RateLimits RateLimits} or
1418
- # is {::Google::Cloud::Tasks::V2beta3::Queue::State::PAUSED PAUSED}.
1445
+ # the task is already running, the queue has reached its
1446
+ # {::Google::Cloud::Tasks::V2beta3::RateLimits RateLimits} or is
1447
+ # {::Google::Cloud::Tasks::V2beta3::Queue::State::PAUSED PAUSED}.
1419
1448
  #
1420
1449
  # This command is meant to be used for manual debugging. For
1421
- # example, {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#run_task RunTask} can be used to retry a failed
1422
- # task after a fix has been made or to manually force a task to be
1423
- # dispatched now.
1450
+ # example, {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#run_task RunTask} can be
1451
+ # used to retry a failed task after a fix has been made or to manually force
1452
+ # a task to be dispatched now.
1424
1453
  #
1425
1454
  # The dispatched task is returned. That is, the task that is returned
1426
1455
  # contains the [status][Task.status] after the task is dispatched but
@@ -1428,9 +1457,11 @@ module Google
1428
1457
  #
1429
1458
  # If Cloud Tasks receives a successful response from the task's
1430
1459
  # target, then the task will be deleted; otherwise the task's
1431
- # {::Google::Cloud::Tasks::V2beta3::Task#schedule_time schedule_time} will be reset to the time that
1432
- # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#run_task RunTask} was called plus the retry delay specified
1433
- # in the queue's {::Google::Cloud::Tasks::V2beta3::RetryConfig RetryConfig}.
1460
+ # {::Google::Cloud::Tasks::V2beta3::Task#schedule_time schedule_time} will be
1461
+ # reset to the time that
1462
+ # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#run_task RunTask} was called plus
1463
+ # the retry delay specified in the queue's
1464
+ # {::Google::Cloud::Tasks::V2beta3::RetryConfig RetryConfig}.
1434
1465
  #
1435
1466
  # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#run_task RunTask} returns
1436
1467
  # [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a
@@ -1455,18 +1486,19 @@ module Google
1455
1486
  # Required. The task name. For example:
1456
1487
  # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1457
1488
  # @param response_view [::Google::Cloud::Tasks::V2beta3::Task::View]
1458
- # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta3::Task Task} will be
1459
- # returned.
1460
- #
1461
- # By default response_view is {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all
1462
- # information is retrieved by default because some data, such as
1463
- # payloads, might be desirable to return only when needed because
1464
- # of its large size or because of the sensitivity of data that it
1465
- # contains.
1466
- #
1467
- # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL} requires
1468
- # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1469
- # permission on the {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1489
+ # The response_view specifies which subset of the
1490
+ # {::Google::Cloud::Tasks::V2beta3::Task Task} will be returned.
1491
+ #
1492
+ # By default response_view is
1493
+ # {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all information is
1494
+ # retrieved by default because some data, such as payloads, might be
1495
+ # desirable to return only when needed because of its large size or because
1496
+ # of the sensitivity of data that it contains.
1497
+ #
1498
+ # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL}
1499
+ # requires `cloudtasks.tasks.fullView` [Google
1500
+ # IAM](https://cloud.google.com/iam/) permission on the
1501
+ # {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1470
1502
  # @yield [result, operation] Access the result along with the TransportOperation object
1471
1503
  # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Task]
1472
1504
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1509,6 +1541,89 @@ module Google
1509
1541
  raise ::Google::Cloud::Error.from_error(e)
1510
1542
  end
1511
1543
 
1544
+ ##
1545
+ # Creates and buffers a new task without the need to explicitly define a Task
1546
+ # message. The queue must have [HTTP
1547
+ # target][google.cloud.tasks.v2beta3.HttpTarget]. To create the task with a
1548
+ # custom ID, use the following format and set TASK_ID to your desired ID:
1549
+ # projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer
1550
+ # To create the task with an automatically generated ID, use the following
1551
+ # format:
1552
+ # projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.
1553
+ # Note: This feature is in its experimental stage. You must request access to
1554
+ # the API through the [Cloud Tasks BufferTask Experiment Signup
1555
+ # form](https://forms.gle/X8Zr5hiXH5tTGFqh8).
1556
+ #
1557
+ # @overload buffer_task(request, options = nil)
1558
+ # Pass arguments to `buffer_task` via a request object, either of type
1559
+ # {::Google::Cloud::Tasks::V2beta3::BufferTaskRequest} or an equivalent Hash.
1560
+ #
1561
+ # @param request [::Google::Cloud::Tasks::V2beta3::BufferTaskRequest, ::Hash]
1562
+ # A request object representing the call parameters. Required. To specify no
1563
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1564
+ # @param options [::Gapic::CallOptions, ::Hash]
1565
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1566
+ #
1567
+ # @overload buffer_task(queue: nil, task_id: nil, body: nil)
1568
+ # Pass arguments to `buffer_task` via keyword arguments. Note that at
1569
+ # least one keyword argument is required. To specify no parameters, or to keep all
1570
+ # the default parameter values, pass an empty Hash as a request object (see above).
1571
+ #
1572
+ # @param queue [::String]
1573
+ # Required. The parent queue name. For example:
1574
+ # projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1575
+ #
1576
+ # The queue must already exist.
1577
+ # @param task_id [::String]
1578
+ # Optional. Task ID for the task being created. If not provided, a random
1579
+ # task ID is assigned to the task.
1580
+ # @param body [::Google::Api::HttpBody, ::Hash]
1581
+ # Optional. Body of the HTTP request.
1582
+ #
1583
+ # The body can take any generic value. The value is written to the
1584
+ # [HttpRequest][payload] of the [Task].
1585
+ # @yield [result, operation] Access the result along with the TransportOperation object
1586
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::BufferTaskResponse]
1587
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1588
+ #
1589
+ # @return [::Google::Cloud::Tasks::V2beta3::BufferTaskResponse]
1590
+ #
1591
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1592
+ def buffer_task request, options = nil
1593
+ raise ::ArgumentError, "request must be provided" if request.nil?
1594
+
1595
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::BufferTaskRequest
1596
+
1597
+ # Converts hash and nil to an options object
1598
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1599
+
1600
+ # Customize the options with defaults
1601
+ call_metadata = @config.rpcs.buffer_task.metadata.to_h
1602
+
1603
+ # Set x-goog-api-client and x-goog-user-project headers
1604
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1605
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1606
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
1607
+ transports_version_send: [:rest]
1608
+
1609
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1610
+
1611
+ options.apply_defaults timeout: @config.rpcs.buffer_task.timeout,
1612
+ metadata: call_metadata,
1613
+ retry_policy: @config.rpcs.buffer_task.retry_policy
1614
+
1615
+ options.apply_defaults timeout: @config.timeout,
1616
+ metadata: @config.metadata,
1617
+ retry_policy: @config.retry_policy
1618
+
1619
+ @cloud_tasks_stub.buffer_task request, options do |result, operation|
1620
+ yield result, operation if block_given?
1621
+ return result
1622
+ end
1623
+ rescue ::Gapic::Rest::Error => e
1624
+ raise ::Google::Cloud::Error.from_error(e)
1625
+ end
1626
+
1512
1627
  ##
1513
1628
  # Configuration class for the CloudTasks REST API.
1514
1629
  #
@@ -1582,7 +1697,9 @@ module Google
1582
1697
  class Configuration
1583
1698
  extend ::Gapic::Config
1584
1699
 
1585
- config_attr :endpoint, "cloudtasks.googleapis.com", ::String
1700
+ DEFAULT_ENDPOINT = "cloudtasks.googleapis.com"
1701
+
1702
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1586
1703
  config_attr :credentials, nil do |value|
1587
1704
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1588
1705
  allowed.any? { |klass| klass === value }
@@ -1595,6 +1712,13 @@ module Google
1595
1712
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1596
1713
  config_attr :quota_project, nil, ::String, nil
1597
1714
 
1715
+ # @private
1716
+ # Overrides for http bindings for the RPCs of this service
1717
+ # are only used when this service is used as mixin, and only
1718
+ # by the host service.
1719
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1720
+ config_attr :bindings_override, {}, ::Hash, nil
1721
+
1598
1722
  # @private
1599
1723
  def initialize parent_config = nil
1600
1724
  @parent_config = parent_config unless parent_config.nil?
@@ -1712,6 +1836,11 @@ module Google
1712
1836
  # @return [::Gapic::Config::Method]
1713
1837
  #
1714
1838
  attr_reader :run_task
1839
+ ##
1840
+ # RPC-specific configuration for `buffer_task`
1841
+ # @return [::Gapic::Config::Method]
1842
+ #
1843
+ attr_reader :buffer_task
1715
1844
 
1716
1845
  # @private
1717
1846
  def initialize parent_rpcs = nil
@@ -1747,6 +1876,8 @@ module Google
1747
1876
  @delete_task = ::Gapic::Config::Method.new delete_task_config
1748
1877
  run_task_config = parent_rpcs.run_task if parent_rpcs.respond_to? :run_task
1749
1878
  @run_task = ::Gapic::Config::Method.new run_task_config
1879
+ buffer_task_config = parent_rpcs.buffer_task if parent_rpcs.respond_to? :buffer_task
1880
+ @buffer_task = ::Gapic::Config::Method.new buffer_task_config
1750
1881
 
1751
1882
  yield self if block_given?
1752
1883
  end