This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
/
enums.py
113 lines (92 loc) · 3.75 KB
/
enums.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Wrappers for protocol buffer enum types."""
import enum
class HttpMethod(enum.IntEnum):
"""
The HTTP method used to deliver the task.
Attributes:
HTTP_METHOD_UNSPECIFIED (int): HTTP method unspecified
POST (int): HTTP POST
GET (int): HTTP GET
HEAD (int): HTTP HEAD
PUT (int): HTTP PUT
DELETE (int): HTTP DELETE
PATCH (int): HTTP PATCH
OPTIONS (int): HTTP OPTIONS
"""
HTTP_METHOD_UNSPECIFIED = 0
POST = 1
GET = 2
HEAD = 3
PUT = 4
DELETE = 5
PATCH = 6
OPTIONS = 7
class Queue(object):
class State(enum.IntEnum):
"""
State of the queue.
Attributes:
STATE_UNSPECIFIED (int): Unspecified state.
RUNNING (int): The queue is running. Tasks can be dispatched.
If the queue was created using Cloud Tasks and the queue has had no
activity (method calls or task dispatches) for 30 days, the queue may
take a few minutes to re-activate. Some method calls may return
``NOT_FOUND`` and tasks may not be dispatched for a few minutes until
the queue has been re-activated.
PAUSED (int): Tasks are paused by the user. If the queue is paused then Cloud
Tasks will stop delivering tasks from it, but more tasks can
still be added to it by the user.
DISABLED (int): The queue is disabled.
A queue becomes ``DISABLED`` when
`queue.yaml <https://cloud.google.com/appengine/docs/python/config/queueref>`__
or
`queue.xml <https://cloud.google.com/appengine/docs/standard/java/config/queueref>`__
is uploaded which does not contain the queue. You cannot directly
disable a queue.
When a queue is disabled, tasks can still be added to a queue but the
tasks are not dispatched.
To permanently delete this queue and all of its tasks, call
``DeleteQueue``.
"""
STATE_UNSPECIFIED = 0
RUNNING = 1
PAUSED = 2
DISABLED = 3
class Task(object):
class View(enum.IntEnum):
"""
The view specifies a subset of ``Task`` data.
When a task is returned in a response, not all information is retrieved
by default because some data, such as payloads, might be desirable to
return only when needed because of its large size or because of the
sensitivity of data that it contains.
Attributes:
VIEW_UNSPECIFIED (int): Unspecified. Defaults to BASIC.
BASIC (int): The basic view omits fields which can be large or can contain sensitive
data.
This view does not include the ``body in AppEngineHttpRequest``. Bodies
are desirable to return only when needed, because they can be large and
because of the sensitivity of the data that you choose to store in it.
FULL (int): All information is returned.
Authorization for ``FULL`` requires ``cloudtasks.tasks.fullView``
`Google IAM <https://cloud.google.com/iam/>`__ permission on the
``Queue`` resource.
"""
VIEW_UNSPECIFIED = 0
BASIC = 1
FULL = 2