google-cloud-tasks 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,329 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Cloud
17
+ module Tasks
18
+ module V2beta2
19
+ # A queue is a container of related tasks. Queues are configured to manage
20
+ # how those tasks are dispatched. Configurable properties include rate limits,
21
+ # retry options, target types, and others.
22
+ # @!attribute [rw] name
23
+ # @return [String]
24
+ # The queue name.
25
+ #
26
+ # The queue name must have the following format:
27
+ # +projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID+
28
+ #
29
+ # * +PROJECT_ID+ can contain letters ([A-Za-z]), numbers ([0-9]),
30
+ # hyphens (-), colons (:), or periods (.).
31
+ # For more information, see
32
+ # [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
33
+ # * +LOCATION_ID+ is the canonical ID for the queue's location.
34
+ # The list of available locations can be obtained by calling
35
+ # {Google::Cloud::Location::Locations::ListLocations ListLocations}.
36
+ # For more information, see https://cloud.google.com/about/locations/.
37
+ # * +QUEUE_ID+ can contain letters ([A-Za-z]), numbers ([0-9]), or
38
+ # hyphens (-). The maximum length is 100 characters.
39
+ #
40
+ # Caller-specified and required in {Google::Cloud::Tasks::V2beta2::CloudTasks::CreateQueue CreateQueue},
41
+ # after which it becomes output only.
42
+ # @!attribute [rw] app_engine_http_target
43
+ # @return [Google::Cloud::Tasks::V2beta2::AppEngineHttpTarget]
44
+ # App Engine HTTP target.
45
+ #
46
+ # An App Engine queue is a queue that has an {Google::Cloud::Tasks::V2beta2::AppEngineHttpTarget AppEngineHttpTarget}.
47
+ # @!attribute [rw] pull_target
48
+ # @return [Google::Cloud::Tasks::V2beta2::PullTarget]
49
+ # Pull target.
50
+ #
51
+ # A pull queue is a queue that has a {Google::Cloud::Tasks::V2beta2::PullTarget PullTarget}.
52
+ # @!attribute [rw] rate_limits
53
+ # @return [Google::Cloud::Tasks::V2beta2::RateLimits]
54
+ # Rate limits for task dispatches.
55
+ #
56
+ # {Google::Cloud::Tasks::V2beta2::Queue#rate_limits rate_limits} and
57
+ # {Google::Cloud::Tasks::V2beta2::Queue#retry_config retry_config} are related because they both
58
+ # control task attempts however they control how tasks are
59
+ # attempted in different ways:
60
+ #
61
+ # * {Google::Cloud::Tasks::V2beta2::Queue#rate_limits rate_limits} controls the total rate of
62
+ # dispatches from a queue (i.e. all traffic dispatched from the
63
+ # queue, regardless of whether the dispatch is from a first
64
+ # attempt or a retry).
65
+ # * {Google::Cloud::Tasks::V2beta2::Queue#retry_config retry_config} controls what happens to
66
+ # particular a task after its first attempt fails. That is,
67
+ # {Google::Cloud::Tasks::V2beta2::Queue#retry_config retry_config} controls task retries (the
68
+ # second attempt, third attempt, etc).
69
+ # @!attribute [rw] retry_config
70
+ # @return [Google::Cloud::Tasks::V2beta2::RetryConfig]
71
+ # Settings that determine the retry behavior.
72
+ #
73
+ # * For tasks created using Cloud Tasks: the queue-level retry settings
74
+ # apply to all tasks in the queue that were created using Cloud Tasks.
75
+ # Retry settings cannot be set on individual tasks.
76
+ # * For tasks created using the App Engine SDK: the queue-level retry
77
+ # settings apply to all tasks in the queue which do not have retry settings
78
+ # explicitly set on the task and were created by the App Engine SDK. See
79
+ # [App Engine documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks).
80
+ # @!attribute [rw] state
81
+ # @return [Google::Cloud::Tasks::V2beta2::Queue::State]
82
+ # Output only. The state of the queue.
83
+ #
84
+ # +state+ can only be changed by called
85
+ # {Google::Cloud::Tasks::V2beta2::CloudTasks::PauseQueue PauseQueue},
86
+ # {Google::Cloud::Tasks::V2beta2::CloudTasks::ResumeQueue ResumeQueue}, or uploading
87
+ # [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref).
88
+ # {Google::Cloud::Tasks::V2beta2::CloudTasks::UpdateQueue UpdateQueue} cannot be used to change +state+.
89
+ # @!attribute [rw] purge_time
90
+ # @return [Google::Protobuf::Timestamp]
91
+ # Output only. The last time this queue was purged.
92
+ #
93
+ # All tasks that were {Google::Cloud::Tasks::V2beta2::Task#create_time created} before this time
94
+ # were purged.
95
+ #
96
+ # A queue can be purged using {Google::Cloud::Tasks::V2beta2::CloudTasks::PurgeQueue PurgeQueue}, the
97
+ # [App Engine Task Queue SDK, or the Cloud Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue).
98
+ #
99
+ # Purge time will be truncated to the nearest microsecond. Purge
100
+ # time will be unset if the queue has never been purged.
101
+ class Queue
102
+ # State of the queue.
103
+ module State
104
+ # Unspecified state.
105
+ STATE_UNSPECIFIED = 0
106
+
107
+ # The queue is running. Tasks can be dispatched.
108
+ #
109
+ # If the queue was created using Cloud Tasks and the queue has
110
+ # had no activity (method calls or task dispatches) for 30 days,
111
+ # the queue may take a few minutes to re-activate. Some method
112
+ # calls may return {Google::Rpc::Code::NOT_FOUND NOT_FOUND} and
113
+ # tasks may not be dispatched for a few minutes until the queue
114
+ # has been re-activated.
115
+ RUNNING = 1
116
+
117
+ # Tasks are paused by the user. If the queue is paused then Cloud
118
+ # Tasks will stop delivering tasks from it, but more tasks can
119
+ # still be added to it by the user. When a pull queue is paused,
120
+ # all {Google::Cloud::Tasks::V2beta2::CloudTasks::LeaseTasks LeaseTasks} calls will return a
121
+ # {Google::Rpc::Code::FAILED_PRECONDITION FAILED_PRECONDITION}.
122
+ PAUSED = 2
123
+
124
+ # The queue is disabled.
125
+ #
126
+ # A queue becomes +DISABLED+ when
127
+ # [queue.yaml](https://cloud.google.com/appengine/docs/python/config/queueref) or
128
+ # [queue.xml](https://cloud.google.comappengine/docs/standard/java/config/queueref) is uploaded
129
+ # which does not contain the queue. You cannot directly disable a queue.
130
+ #
131
+ # When a queue is disabled, tasks can still be added to a queue
132
+ # but the tasks are not dispatched and
133
+ # {Google::Cloud::Tasks::V2beta2::CloudTasks::LeaseTasks LeaseTasks} calls return a
134
+ # +FAILED_PRECONDITION+ error.
135
+ #
136
+ # To permanently delete this queue and all of its tasks, call
137
+ # {Google::Cloud::Tasks::V2beta2::CloudTasks::DeleteQueue DeleteQueue}.
138
+ DISABLED = 3
139
+ end
140
+ end
141
+
142
+ # Rate limits.
143
+ #
144
+ # This message determines the maximum rate that tasks can be dispatched by a
145
+ # queue, regardless of whether the dispatch is a first task attempt or a retry.
146
+ #
147
+ # Note: The debugging command, {Google::Cloud::Tasks::V2beta2::CloudTasks::RunTask RunTask}, will run a task
148
+ # even if the queue has reached its {Google::Cloud::Tasks::V2beta2::RateLimits RateLimits}.
149
+ # @!attribute [rw] max_tasks_dispatched_per_second
150
+ # @return [Float]
151
+ # The maximum rate at which tasks are dispatched from this queue.
152
+ #
153
+ # If unspecified when the queue is created, Cloud Tasks will pick the
154
+ # default.
155
+ #
156
+ # * For App Engine queues, the maximum allowed value is 500.
157
+ # * This field is output only for [pull queues](https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget). In
158
+ # addition to the +max_tasks_dispatched_per_second+ limit, a
159
+ # maximum of 10 QPS of {Google::Cloud::Tasks::V2beta2::CloudTasks::LeaseTasks LeaseTasks}
160
+ # requests are allowed per pull queue.
161
+ #
162
+ #
163
+ # This field has the same meaning as
164
+ # [rate in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate).
165
+ # @!attribute [rw] max_burst_size
166
+ # @return [Integer]
167
+ # Output only. The max burst size.
168
+ #
169
+ # Max burst size limits how fast tasks in queue are processed when
170
+ # many tasks are in the queue and the rate is high. This field
171
+ # allows the queue to have a high rate so processing starts shortly
172
+ # after a task is enqueued, but still limits resource usage when
173
+ # many tasks are enqueued in a short period of time.
174
+ #
175
+ # The [token bucket](https://wikipedia.org/wiki/Token_Bucket)
176
+ # algorithm is used to control the rate of task dispatches. Each
177
+ # queue has a token bucket that holds tokens, up to the maximum
178
+ # specified by +max_burst_size+. Each time a task is dispatched, a
179
+ # token is removed from the bucket. Tasks will be dispatched until
180
+ # the queue's bucket runs out of tokens. The bucket will be
181
+ # continuously refilled with new tokens based on
182
+ # {Google::Cloud::Tasks::V2beta2::RateLimits#max_tasks_dispatched_per_second max_tasks_dispatched_per_second}.
183
+ #
184
+ # Cloud Tasks will pick the value of +max_burst_size+ based on the
185
+ # value of
186
+ # {Google::Cloud::Tasks::V2beta2::RateLimits#max_tasks_dispatched_per_second max_tasks_dispatched_per_second}.
187
+ #
188
+ # For App Engine queues that were created or updated using
189
+ # +queue.yaml/xml+, +max_burst_size+ is equal to
190
+ # [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size).
191
+ # Since +max_burst_size+ is output only, if
192
+ # {Google::Cloud::Tasks::V2beta2::CloudTasks::UpdateQueue UpdateQueue} is called on a queue
193
+ # created by +queue.yaml/xml+, +max_burst_size+ will be reset based
194
+ # on the value of
195
+ # {Google::Cloud::Tasks::V2beta2::RateLimits#max_tasks_dispatched_per_second max_tasks_dispatched_per_second},
196
+ # regardless of whether
197
+ # {Google::Cloud::Tasks::V2beta2::RateLimits#max_tasks_dispatched_per_second max_tasks_dispatched_per_second}
198
+ # is updated.
199
+ # @!attribute [rw] max_concurrent_tasks
200
+ # @return [Integer]
201
+ # The maximum number of concurrent tasks that Cloud Tasks allows
202
+ # to be dispatched for this queue. After this threshold has been
203
+ # reached, Cloud Tasks stops dispatching tasks until the number of
204
+ # concurrent requests decreases.
205
+ #
206
+ # If unspecified when the queue is created, Cloud Tasks will pick the
207
+ # default.
208
+ #
209
+ #
210
+ # The maximum allowed value is 5,000.
211
+ #
212
+ # This field is output only for
213
+ # [pull queues](https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget) and always -1, which
214
+ # indicates no limit. No other queue types can have +max_concurrent_tasks+
215
+ # set to -1.
216
+ #
217
+ #
218
+ # This field has the same meaning as
219
+ # [max_concurrent_requests in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests).
220
+ class RateLimits; end
221
+
222
+ # Retry config.
223
+ #
224
+ # These settings determine how a failed task attempt is retried.
225
+ # @!attribute [rw] max_attempts
226
+ # @return [Integer]
227
+ # The maximum number of attempts for a task.
228
+ #
229
+ # Cloud Tasks will attempt the task +max_attempts+ times (that
230
+ # is, if the first attempt fails, then there will be
231
+ # +max_attempts - 1+ retries). Must be > 0.
232
+ # @!attribute [rw] unlimited_attempts
233
+ # @return [true, false]
234
+ # If true, then the number of attempts is unlimited.
235
+ # @!attribute [rw] max_retry_duration
236
+ # @return [Google::Protobuf::Duration]
237
+ # If positive, +max_retry_duration+ specifies the time limit for
238
+ # retrying a failed task, measured from when the task was first
239
+ # attempted. Once +max_retry_duration+ time has passed *and* the
240
+ # task has been attempted {Google::Cloud::Tasks::V2beta2::RetryConfig#max_attempts max_attempts}
241
+ # times, no further attempts will be made and the task will be
242
+ # deleted.
243
+ #
244
+ # If zero, then the task age is unlimited.
245
+ #
246
+ # If unspecified when the queue is created, Cloud Tasks will pick the
247
+ # default.
248
+ #
249
+ # This field is output only for
250
+ # [pull queues](https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget).
251
+ #
252
+ #
253
+ # +max_retry_duration+ will be truncated to the nearest second.
254
+ #
255
+ # This field has the same meaning as
256
+ # [task_age_limit in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
257
+ # @!attribute [rw] min_backoff
258
+ # @return [Google::Protobuf::Duration]
259
+ # A task will be [scheduled](https://cloud.google.comTask.schedule_time) for retry between
260
+ # {Google::Cloud::Tasks::V2beta2::RetryConfig#min_backoff min_backoff} and
261
+ # {Google::Cloud::Tasks::V2beta2::RetryConfig#max_backoff max_backoff} duration after it fails,
262
+ # if the queue's {Google::Cloud::Tasks::V2beta2::RetryConfig RetryConfig} specifies that the task should be
263
+ # retried.
264
+ #
265
+ # If unspecified when the queue is created, Cloud Tasks will pick the
266
+ # default.
267
+ #
268
+ # This field is output only for
269
+ # [pull queues](https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget).
270
+ #
271
+ #
272
+ # +min_backoff+ will be truncated to the nearest second.
273
+ #
274
+ # This field has the same meaning as
275
+ # [min_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
276
+ # @!attribute [rw] max_backoff
277
+ # @return [Google::Protobuf::Duration]
278
+ # A task will be [scheduled](https://cloud.google.comTask.schedule_time) for retry between
279
+ # {Google::Cloud::Tasks::V2beta2::RetryConfig#min_backoff min_backoff} and
280
+ # {Google::Cloud::Tasks::V2beta2::RetryConfig#max_backoff max_backoff} duration after it fails,
281
+ # if the queue's {Google::Cloud::Tasks::V2beta2::RetryConfig RetryConfig} specifies that the task should be
282
+ # retried.
283
+ #
284
+ # If unspecified when the queue is created, Cloud Tasks will pick the
285
+ # default.
286
+ #
287
+ # This field is output only for
288
+ # [pull queues](https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget).
289
+ #
290
+ #
291
+ # +max_backoff+ will be truncated to the nearest second.
292
+ #
293
+ # This field has the same meaning as
294
+ # [max_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
295
+ # @!attribute [rw] max_doublings
296
+ # @return [Integer]
297
+ # The time between retries will double +max_doublings+ times.
298
+ #
299
+ # A task's retry interval starts at
300
+ # {Google::Cloud::Tasks::V2beta2::RetryConfig#min_backoff min_backoff}, then doubles
301
+ # +max_doublings+ times, then increases linearly, and finally
302
+ # retries retries at intervals of
303
+ # {Google::Cloud::Tasks::V2beta2::RetryConfig#max_backoff max_backoff} up to
304
+ # {Google::Cloud::Tasks::V2beta2::RetryConfig#max_attempts max_attempts} times.
305
+ #
306
+ # For example, if {Google::Cloud::Tasks::V2beta2::RetryConfig#min_backoff min_backoff} is 10s,
307
+ # {Google::Cloud::Tasks::V2beta2::RetryConfig#max_backoff max_backoff} is 300s, and
308
+ # +max_doublings+ is 3, then the a task will first be retried in
309
+ # 10s. The retry interval will double three times, and then
310
+ # increase linearly by 2^3 * 10s. Finally, the task will retry at
311
+ # intervals of {Google::Cloud::Tasks::V2beta2::RetryConfig#max_backoff max_backoff} until the
312
+ # task has been attempted {Google::Cloud::Tasks::V2beta2::RetryConfig#max_attempts max_attempts}
313
+ # times. Thus, the requests will retry at 10s, 20s, 40s, 80s, 160s,
314
+ # 240s, 300s, 300s, ....
315
+ #
316
+ # If unspecified when the queue is created, Cloud Tasks will pick the
317
+ # default.
318
+ #
319
+ # This field is output only for
320
+ # [pull queues](https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget).
321
+ #
322
+ #
323
+ # This field has the same meaning as
324
+ # [max_doublings in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
325
+ class RetryConfig; end
326
+ end
327
+ end
328
+ end
329
+ end
@@ -0,0 +1,346 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Cloud
17
+ module Tasks
18
+ module V2beta2
19
+ # Pull target.
20
+ class PullTarget; end
21
+
22
+ # The pull message contains data that can be used by the caller of
23
+ # {Google::Cloud::Tasks::V2beta2::CloudTasks::LeaseTasks LeaseTasks} to process the task.
24
+ #
25
+ # This proto can only be used for tasks in a queue which has
26
+ # {Google::Cloud::Tasks::V2beta2::Queue#pull_target pull_target} set.
27
+ # @!attribute [rw] payload
28
+ # @return [String]
29
+ # A data payload consumed by the worker to execute the task.
30
+ # @!attribute [rw] tag
31
+ # @return [String]
32
+ # The task's tag.
33
+ #
34
+ # Tags allow similar tasks to be processed in a batch. If you label
35
+ # tasks with a tag, your worker can
36
+ # {Google::Cloud::Tasks::V2beta2::CloudTasks::LeaseTasks lease tasks} with the same tag using
37
+ # {Google::Cloud::Tasks::V2beta2::LeaseTasksRequest#filter filter}. For example, if you want to
38
+ # aggregate the events associated with a specific user once a day,
39
+ # you could tag tasks with the user ID.
40
+ #
41
+ # The task's tag can only be set when the
42
+ # {Google::Cloud::Tasks::V2beta2::CloudTasks::CreateTask task is created}.
43
+ #
44
+ # The tag must be less than 500 characters.
45
+ #
46
+ # SDK compatibility: Although the SDK allows tags to be either
47
+ # string or [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
48
+ # only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8
49
+ # encoded, the tag will be empty when the task is returned by Cloud Tasks.
50
+ class PullMessage; end
51
+
52
+ # App Engine HTTP target.
53
+ #
54
+ # The task will be delivered to the App Engine application hostname
55
+ # specified by its {Google::Cloud::Tasks::V2beta2::AppEngineHttpTarget AppEngineHttpTarget} and {Google::Cloud::Tasks::V2beta2::AppEngineHttpRequest AppEngineHttpRequest}.
56
+ # The documentation for {Google::Cloud::Tasks::V2beta2::AppEngineHttpRequest AppEngineHttpRequest} explains how the
57
+ # task's host URL is constructed.
58
+ #
59
+ # Using {Google::Cloud::Tasks::V2beta2::AppEngineHttpTarget AppEngineHttpTarget} requires
60
+ # [+appengine.applications.get+](https://cloud.google.com/appengine/docs/admin-api/access-control)
61
+ # Google IAM permission for the project
62
+ # and the following scope:
63
+ #
64
+ # +https://www.googleapis.com/auth/cloud-platform+
65
+ # @!attribute [rw] app_engine_routing_override
66
+ # @return [Google::Cloud::Tasks::V2beta2::AppEngineRouting]
67
+ # Overrides for the
68
+ # {Google::Cloud::Tasks::V2beta2::AppEngineHttpRequest#app_engine_routing task-level app_engine_routing}.
69
+ #
70
+ # If set, +app_engine_routing_override+ is used for all tasks in
71
+ # the queue, no matter what the setting is for the
72
+ # {Google::Cloud::Tasks::V2beta2::AppEngineHttpRequest#app_engine_routing task-level app_engine_routing}.
73
+ class AppEngineHttpTarget; end
74
+
75
+ # App Engine HTTP request.
76
+ #
77
+ # The message defines the HTTP request that is sent to an App Engine app when
78
+ # the task is dispatched.
79
+ #
80
+ # This proto can only be used for tasks in a queue which has
81
+ # {Google::Cloud::Tasks::V2beta2::Queue#app_engine_http_target app_engine_http_target} set.
82
+ #
83
+ # Using {Google::Cloud::Tasks::V2beta2::AppEngineHttpRequest AppEngineHttpRequest} requires
84
+ # [+appengine.applications.get+](https://cloud.google.com/appengine/docs/admin-api/access-control)
85
+ # Google IAM permission for the project
86
+ # and the following scope:
87
+ #
88
+ # +https://www.googleapis.com/auth/cloud-platform+
89
+ #
90
+ # The task will be delivered to the App Engine app which belongs to the same
91
+ # project as the queue. For more information, see
92
+ # [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
93
+ # and how routing is affected by
94
+ # [dispatch files](https://cloud.google.com/appengine/docs/python/config/dispatchref).
95
+ #
96
+ # The {Google::Cloud::Tasks::V2beta2::AppEngineRouting AppEngineRouting} used to construct the URL that the task is
97
+ # delivered to can be set at the queue-level or task-level:
98
+ #
99
+ # * If set,
100
+ # {Google::Cloud::Tasks::V2beta2::AppEngineHttpTarget#app_engine_routing_override app_engine_routing_override}
101
+ # is used for all tasks in the queue, no matter what the setting
102
+ # is for the
103
+ # {Google::Cloud::Tasks::V2beta2::AppEngineHttpRequest#app_engine_routing task-level app_engine_routing}.
104
+ #
105
+ #
106
+ # The +url+ that the task will be sent to is:
107
+ #
108
+ # * +url =+ {Google::Cloud::Tasks::V2beta2::AppEngineRouting#host host} +++
109
+ # {Google::Cloud::Tasks::V2beta2::AppEngineHttpRequest#relative_url relative_url}
110
+ #
111
+ # The task attempt has succeeded if the app's request handler returns
112
+ # an HTTP response code in the range [+200+ - +299+]. +503+ is
113
+ # considered an App Engine system error instead of an application
114
+ # error. Requests returning error +503+ will be retried regardless of
115
+ # retry configuration and not counted against retry counts.
116
+ # Any other response code or a failure to receive a response before the
117
+ # deadline is a failed attempt.
118
+ # @!attribute [rw] http_method
119
+ # @return [Google::Cloud::Tasks::V2beta2::HttpMethod]
120
+ # The HTTP method to use for the request. The default is POST.
121
+ #
122
+ # The app's request handler for the task's target URL must be able to handle
123
+ # HTTP requests with this http_method, otherwise the task attempt will fail
124
+ # with error code 405 (Method Not Allowed). See
125
+ # [Writing a push task request handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
126
+ # and the documentation for the request handlers in the language your app is
127
+ # written in e.g.
128
+ # [Python Request Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
129
+ # @!attribute [rw] app_engine_routing
130
+ # @return [Google::Cloud::Tasks::V2beta2::AppEngineRouting]
131
+ # Task-level setting for App Engine routing.
132
+ #
133
+ # If set,
134
+ # {Google::Cloud::Tasks::V2beta2::AppEngineHttpTarget#app_engine_routing_override app_engine_routing_override}
135
+ # is used for all tasks in the queue, no matter what the setting is for the
136
+ # {Google::Cloud::Tasks::V2beta2::AppEngineHttpRequest#app_engine_routing task-level app_engine_routing}.
137
+ # @!attribute [rw] relative_url
138
+ # @return [String]
139
+ # The relative URL.
140
+ #
141
+ # The relative URL must begin with "/" and must be a valid HTTP relative URL.
142
+ # It can contain a path and query string arguments.
143
+ # If the relative URL is empty, then the root path "/" will be used.
144
+ # No spaces are allowed, and the maximum length allowed is 2083 characters.
145
+ # @!attribute [rw] headers
146
+ # @return [Hash{String => String}]
147
+ # HTTP request headers.
148
+ #
149
+ # This map contains the header field names and values.
150
+ # Headers can be set when the
151
+ # [task is created](https://cloud.google.comgoogle.cloud.tasks.v2beta2.CloudTasks.CreateTask).
152
+ # Repeated headers are not supported but a header value can contain commas.
153
+ #
154
+ # Cloud Tasks sets some headers to default values:
155
+ #
156
+ # * +User-Agent+: By default, this header is
157
+ # +"AppEngine-Google; (+http://code.google.com/appengine)"+.
158
+ # This header can be modified, but Cloud Tasks will append
159
+ # +"AppEngine-Google; (+http://code.google.com/appengine)"+ to the
160
+ # modified +User-Agent+.
161
+ #
162
+ # If the task has a {Google::Cloud::Tasks::V2beta2::AppEngineHttpRequest#payload payload}, Cloud
163
+ # Tasks sets the following headers:
164
+ #
165
+ # * +Content-Type+: By default, the +Content-Type+ header is set to
166
+ # +"application/octet-stream"+. The default can be overridden by explicitly
167
+ # setting +Content-Type+ to a particular media type when the
168
+ # [task is created](https://cloud.google.comgoogle.cloud.tasks.v2beta2.CloudTasks.CreateTask).
169
+ # For example, +Content-Type+ can be set to +"application/json"+.
170
+ # * +Content-Length+: This is computed by Cloud Tasks. This value is
171
+ # output only. It cannot be changed.
172
+ #
173
+ # The headers below cannot be set or overridden:
174
+ #
175
+ # * +Host+
176
+ # * +X-Google-*+
177
+ # * +X-AppEngine-*+
178
+ #
179
+ # In addition, Cloud Tasks sets some headers when the task is dispatched,
180
+ # such as headers containing information about the task; see
181
+ # [request headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
182
+ # These headers are set only when the task is dispatched, so they are not
183
+ # visible when the task is returned in a Cloud Tasks response.
184
+ #
185
+ # Although there is no specific limit for the maximum number of headers or
186
+ # the size, there is a limit on the maximum size of the {Google::Cloud::Tasks::V2beta2::Task Task}. For more
187
+ # information, see the {Google::Cloud::Tasks::V2beta2::CloudTasks::CreateTask CreateTask} documentation.
188
+ # @!attribute [rw] payload
189
+ # @return [String]
190
+ # Payload.
191
+ #
192
+ # The payload will be sent as the HTTP message body. A message
193
+ # body, and thus a payload, is allowed only if the HTTP method is
194
+ # POST or PUT. It is an error to set a data payload on a task with
195
+ # an incompatible {Google::Cloud::Tasks::V2beta2::HttpMethod HttpMethod}.
196
+ class AppEngineHttpRequest; end
197
+
198
+ # App Engine Routing.
199
+ #
200
+ # For more information about services, versions, and instances see
201
+ # [An Overview of App Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine),
202
+ # [Microservices Architecture on Google App Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine),
203
+ # [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed),
204
+ # and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
205
+ # @!attribute [rw] service
206
+ # @return [String]
207
+ # App service.
208
+ #
209
+ # By default, the task is sent to the service which is the default
210
+ # service when the task is attempted ("default").
211
+ #
212
+ # For some queues or tasks which were created using the App Engine
213
+ # Task Queue API, {Google::Cloud::Tasks::V2beta2::AppEngineRouting#host host} is not parsable
214
+ # into {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service},
215
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version}, and
216
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance}. For example, some tasks
217
+ # which were created using the App Engine SDK use a custom domain
218
+ # name; custom domains are not parsed by Cloud Tasks. If
219
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#host host} is not parsable, then
220
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service},
221
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version}, and
222
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance} are the empty string.
223
+ # @!attribute [rw] version
224
+ # @return [String]
225
+ # App version.
226
+ #
227
+ # By default, the task is sent to the version which is the default
228
+ # version when the task is attempted ("default").
229
+ #
230
+ # For some queues or tasks which were created using the App Engine
231
+ # Task Queue API, {Google::Cloud::Tasks::V2beta2::AppEngineRouting#host host} is not parsable
232
+ # into {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service},
233
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version}, and
234
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance}. For example, some tasks
235
+ # which were created using the App Engine SDK use a custom domain
236
+ # name; custom domains are not parsed by Cloud Tasks. If
237
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#host host} is not parsable, then
238
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service},
239
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version}, and
240
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance} are the empty string.
241
+ # @!attribute [rw] instance
242
+ # @return [String]
243
+ # App instance.
244
+ #
245
+ # By default, the task is sent to an instance which is available when
246
+ # the task is attempted.
247
+ #
248
+ # Requests can only be sent to a specific instance if
249
+ # [manual scaling is used in App Engine Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes).
250
+ # App Engine Flex does not support instances. For more information, see
251
+ # [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
252
+ # and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
253
+ # @!attribute [rw] host
254
+ # @return [String]
255
+ # Output only. The host that the task is sent to.
256
+ #
257
+ # For more information, see
258
+ # [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed).
259
+ #
260
+ # The host is constructed as:
261
+ #
262
+ #
263
+ # * +host = [application_domain_name]+</br>
264
+ # +| [service] + '.' + [application_domain_name]+</br>
265
+ # +| [version] + '.' + [application_domain_name]+</br>
266
+ # +| [version_dot_service]+ '.' + [application_domain_name]+</br>
267
+ # +| [instance] + '.' + [application_domain_name]+</br>
268
+ # +| [instance_dot_service] + '.' + [application_domain_name]+</br>
269
+ # +| [instance_dot_version] + '.' + [application_domain_name]+</br>
270
+ # +| [instance_dot_version_dot_service] + '.' + [application_domain_name]+
271
+ #
272
+ # * +application_domain_name+ = The domain name of the app, for
273
+ # example <app-id>.appspot.com, which is associated with the
274
+ # queue's project ID. Some tasks which were created using the App Engine
275
+ # SDK use a custom domain name.
276
+ #
277
+ # * +service =+ {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service}
278
+ #
279
+ # * +version =+ {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version}
280
+ #
281
+ # * +version_dot_service =+
282
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version} ++ '.' ++
283
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service}
284
+ #
285
+ # * +instance =+ {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance}
286
+ #
287
+ # * +instance_dot_service =+
288
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance} ++ '.' ++
289
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service}
290
+ #
291
+ # * +instance_dot_version =+
292
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance} ++ '.' ++
293
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version}
294
+ #
295
+ # * +instance_dot_version_dot_service =+
296
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance} ++ '.' ++
297
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version} ++ '.' ++
298
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service}
299
+ #
300
+ # If {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service} is empty, then the task will be sent
301
+ # to the service which is the default service when the task is attempted.
302
+ #
303
+ # If {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version} is empty, then the task will be sent
304
+ # to the version which is the default version when the task is attempted.
305
+ #
306
+ # If {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance} is empty, then the task
307
+ # will be sent to an instance which is available when the task is
308
+ # attempted.
309
+ #
310
+ # When {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service} is "default",
311
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version} is "default", and
312
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance} is empty,
313
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#host host} is shortened to just the
314
+ # +application_domain_name+.
315
+ #
316
+ # If {Google::Cloud::Tasks::V2beta2::AppEngineRouting#service service},
317
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#version version}, or
318
+ # {Google::Cloud::Tasks::V2beta2::AppEngineRouting#instance instance} is invalid, then the task
319
+ # will be sent to the default version of the default service when
320
+ # the task is attempted.
321
+ class AppEngineRouting; end
322
+
323
+ # The HTTP method used to execute the task.
324
+ module HttpMethod
325
+ # HTTP method unspecified
326
+ HTTP_METHOD_UNSPECIFIED = 0
327
+
328
+ # HTTP Post
329
+ POST = 1
330
+
331
+ # HTTP Get
332
+ GET = 2
333
+
334
+ # HTTP Head
335
+ HEAD = 3
336
+
337
+ # HTTP Put
338
+ PUT = 4
339
+
340
+ # HTTP Delete
341
+ DELETE = 5
342
+ end
343
+ end
344
+ end
345
+ end
346
+ end