Skip to content

Commit 568779a

Browse files
authored
tasks missing from docs (#5656)
1 parent 141d5ad commit 568779a

12 files changed

Lines changed: 322 additions & 262 deletions

File tree

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
logging/usage
2727
redis/index
2828
storage/client
29+
tasks/index
2930
texttospeech/index
3031
translate/usage
3132
vision/index

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ resource_manager/
2727
runtimeconfig/
2828
spanner/
2929
speech/
30+
tasks/
3031
texttospeech/
3132
trace/
3233
translate/

docs/tasks

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../tasks/docs

tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import pkg_resources
1818
import warnings
1919

20+
from google.oauth2 import service_account
2021
import google.api_core.gapic_v1.client_info
2122
import google.api_core.gapic_v1.config
2223
import google.api_core.gapic_v1.method
@@ -57,6 +58,27 @@ class CloudTasksClient(object):
5758
# find the method configuration in the client_config dictionary.
5859
_INTERFACE_NAME = 'google.cloud.tasks.v2beta2.CloudTasks'
5960

61+
@classmethod
62+
def from_service_account_file(cls, filename, *args, **kwargs):
63+
"""Creates an instance of this client using the provided credentials
64+
file.
65+
66+
Args:
67+
filename (str): The path to the service account private key json
68+
file.
69+
args: Additional arguments to pass to the constructor.
70+
kwargs: Additional arguments to pass to the constructor.
71+
72+
Returns:
73+
CloudTasksClient: The constructed client.
74+
"""
75+
credentials = service_account.Credentials.from_service_account_file(
76+
filename)
77+
kwargs['credentials'] = credentials
78+
return cls(*args, **kwargs)
79+
80+
from_service_account_json = from_service_account_file
81+
6082
@classmethod
6183
def project_path(cls, project):
6284
"""Return a fully-qualified project string."""
@@ -156,11 +178,12 @@ def __init__(self,
156178
'Received both a transport instance and '
157179
'credentials; these are mutually exclusive.')
158180
self.transport = transport
159-
self.transport = cloud_tasks_grpc_transport.CloudTasksGrpcTransport(
160-
address=self.SERVICE_ADDRESS,
161-
channel=channel,
162-
credentials=credentials,
163-
)
181+
else:
182+
self.transport = cloud_tasks_grpc_transport.CloudTasksGrpcTransport(
183+
address=self.SERVICE_ADDRESS,
184+
channel=channel,
185+
credentials=credentials,
186+
)
164187

165188
if client_info is None:
166189
client_info = (
@@ -226,7 +249,7 @@ def list_queues(self,
226249
described in
227250
`Stackdriver's Advanced Logs Filters <https://cloud.google.com/logging/docs/view/advanced_filters>`_.
228251
229-
Sample filter \"app_engine_http_target: *\".
252+
Sample filter \"app_engine_http_target: \*\".
230253
231254
Note that using filters might cause fewer queues than the
232255
requested_page size to be returned.
@@ -381,7 +404,7 @@ def create_queue(self,
381404
WARNING: Using this method may have unintended side effects if you are
382405
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
383406
Read
384-
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
407+
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
385408
before using this method.
386409
387410
Example:
@@ -480,7 +503,7 @@ def update_queue(self,
480503
WARNING: Using this method may have unintended side effects if you are
481504
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
482505
Read
483-
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
506+
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
484507
before using this method.
485508
486509
Example:
@@ -575,7 +598,7 @@ def delete_queue(self,
575598
WARNING: Using this method may have unintended side effects if you are
576599
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
577600
Read
578-
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
601+
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
579602
before using this method.
580603
581604
Example:
@@ -797,7 +820,7 @@ def resume_queue(self,
797820
WARNING: Resuming many high-QPS queues at the same time can
798821
lead to target overloading. If you are resuming high-QPS
799822
queues, follow the 500/50/5 pattern described in
800-
`Managing Cloud Tasks Scaling Risks <https://cloud.google.com/cloud-tasks/pdfs/managing-cloud-tasks-scaling-risks-2017-06-05.pdf>`_.
823+
`Managing Cloud Tasks Scaling Risks <https://cloud.google.com/tasks/docs/manage-cloud-task-scaling>`_.
801824
802825
Example:
803826
>>> from google.cloud import tasks_v2beta2
@@ -869,8 +892,9 @@ def get_iam_policy(self,
869892
Returns an empty policy if the resource exists and does not have a policy
870893
set.
871894
872-
Authorization requires the following `Google IAM <https://cloud.google.com/iam>`_ permission on the
873-
specified resource parent:
895+
Authorization requires the following
896+
`Google IAM <https://cloud.google.com/iam>`__ permission on the specified
897+
resource parent:
874898
875899
* ``cloudtasks.queues.getIamPolicy``
876900
@@ -946,8 +970,9 @@ def set_iam_policy(self,
946970
Note: The Cloud Console does not check queue-level IAM permissions yet.
947971
Project-level permissions are required to use the Cloud Console.
948972
949-
Authorization requires the following `Google IAM <https://cloud.google.com/iam>`_ permission on the
950-
specified resource parent:
973+
Authorization requires the following
974+
`Google IAM <https://cloud.google.com/iam>`__ permission on the specified
975+
resource parent:
951976
952977
* ``cloudtasks.queues.setIamPolicy``
953978
@@ -1110,7 +1135,6 @@ def test_iam_permissions(self,
11101135
def list_tasks(self,
11111136
parent,
11121137
response_view=None,
1113-
order_by=None,
11141138
page_size=None,
11151139
retry=google.api_core.gapic_v1.method.DEFAULT,
11161140
timeout=google.api_core.gapic_v1.method.DEFAULT,
@@ -1123,6 +1147,9 @@ def list_tasks(self,
11231147
``response_view`` controls the
11241148
subset of information which is returned.
11251149
1150+
The tasks may be returned in any order. The ordering may change at any
1151+
time.
1152+
11261153
Example:
11271154
>>> from google.cloud import tasks_v2beta2
11281155
>>>
@@ -1159,12 +1186,8 @@ def list_tasks(self,
11591186
contains.
11601187
11611188
Authorization for ``FULL`` requires
1162-
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
1163-
``Task`` resource.
1164-
order_by (str): Sort order used for the query. The only fields supported for sorting
1165-
are ``schedule_time`` and ``pull_message.tag``. All results will be
1166-
returned in approximately ascending order. The default ordering is by
1167-
``schedule_time``.
1189+
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
1190+
permission on the ``Task`` resource.
11681191
page_size (int): The maximum number of resources contained in the
11691192
underlying API response. If page streaming is performed per-
11701193
resource, this parameter does not affect the return value. If page
@@ -1205,7 +1228,6 @@ def list_tasks(self,
12051228
request = cloudtasks_pb2.ListTasksRequest(
12061229
parent=parent,
12071230
response_view=response_view,
1208-
order_by=order_by,
12091231
page_size=page_size,
12101232
)
12111233
if metadata is None:
@@ -1267,8 +1289,8 @@ def get_task(self,
12671289
contains.
12681290
12691291
Authorization for ``FULL`` requires
1270-
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
1271-
``Task`` resource.
1292+
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
1293+
permission on the ``Task`` resource.
12721294
retry (Optional[google.api_core.retry.Retry]): A retry object used
12731295
to retry requests. If ``None`` is specified, requests will not
12741296
be retried.
@@ -1329,10 +1351,9 @@ def create_task(self,
13291351
13301352
Tasks cannot be updated after creation; there is no UpdateTask command.
13311353
1332-
* For `App Engine queues <https://cloud.google.comgoogle.cloud.tasks.v2beta2.AppEngineHttpTarget>`_,
1333-
the maximum task size is 100KB.
1334-
* For `pull queues <https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget>`_, this
1335-
the maximum task size is 1MB.
1354+
* For ``App Engine queues``, the maximum task size is
1355+
100KB.
1356+
* For ``pull queues``, the maximum task size is 1MB.
13361357
13371358
Example:
13381359
>>> from google.cloud import tasks_v2beta2
@@ -1400,8 +1421,8 @@ def create_task(self,
14001421
contains.
14011422
14021423
Authorization for ``FULL`` requires
1403-
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
1404-
``Task`` resource.
1424+
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
1425+
permission on the ``Task`` resource.
14051426
retry (Optional[google.api_core.retry.Retry]): A retry object used
14061427
to retry requests. If ``None`` is specified, requests will not
14071428
be retried.
@@ -1596,8 +1617,8 @@ def lease_tasks(self,
15961617
contains.
15971618
15981619
Authorization for ``FULL`` requires
1599-
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
1600-
``Task`` resource.
1620+
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
1621+
permission on the ``Task`` resource.
16011622
filter_ (str): ``filter`` can be used to specify a subset of tasks to lease.
16021623
16031624
When ``filter`` is set to ``tag=<my-tag>`` then the
@@ -1835,8 +1856,8 @@ def renew_lease(self,
18351856
contains.
18361857
18371858
Authorization for ``FULL`` requires
1838-
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
1839-
``Task`` resource.
1859+
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
1860+
permission on the ``Task`` resource.
18401861
retry (Optional[google.api_core.retry.Retry]): A retry object used
18411862
to retry requests. If ``None`` is specified, requests will not
18421863
be retried.
@@ -1938,8 +1959,8 @@ def cancel_lease(self,
19381959
contains.
19391960
19401961
Authorization for ``FULL`` requires
1941-
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
1942-
``Task`` resource.
1962+
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
1963+
permission on the ``Task`` resource.
19431964
retry (Optional[google.api_core.retry.Retry]): A retry object used
19441965
to retry requests. If ``None`` is specified, requests will not
19451966
be retried.
@@ -2049,8 +2070,8 @@ def run_task(self,
20492070
contains.
20502071
20512072
Authorization for ``FULL`` requires
2052-
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
2053-
``Task`` resource.
2073+
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
2074+
permission on the ``Task`` resource.
20542075
retry (Optional[google.api_core.retry.Retry]): A retry object used
20552076
to retry requests. If ``None`` is specified, requests will not
20562077
be retried.

tasks/google/cloud/tasks_v2beta2/gapic/enums.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ class HttpMethod(enum.IntEnum):
2222
2323
Attributes:
2424
HTTP_METHOD_UNSPECIFIED (int): HTTP method unspecified
25-
POST (int): HTTP Post
26-
GET (int): HTTP Get
27-
HEAD (int): HTTP Head
28-
PUT (int): HTTP Put
29-
DELETE (int): HTTP Delete
25+
POST (int): HTTP POST
26+
GET (int): HTTP GET
27+
HEAD (int): HTTP HEAD
28+
PUT (int): HTTP PUT
29+
DELETE (int): HTTP DELETE
3030
"""
3131
HTTP_METHOD_UNSPECIFIED = 0
3232
POST = 1
@@ -214,7 +214,7 @@ class State(enum.IntEnum):
214214
215215
A queue becomes ``DISABLED`` when
216216
`queue.yaml <https://cloud.google.com/appengine/docs/python/config/queueref>`_ or
217-
`queue.xml <https://cloud.google.comappengine/docs/standard/java/config/queueref>`_ is uploaded
217+
`queue.xml <https://cloud.google.com/appengine/docs/standard/java/config/queueref>`_ is uploaded
218218
which does not contain the queue. You cannot directly disable a queue.
219219
220220
When a queue is disabled, tasks can still be added to a queue

tasks/google/cloud/tasks_v2beta2/gapic/transports/cloud_tasks_grpc_transport.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def create_queue(self):
130130
WARNING: Using this method may have unintended side effects if you are
131131
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
132132
Read
133-
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
133+
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
134134
before using this method.
135135
136136
Returns:
@@ -156,7 +156,7 @@ def update_queue(self):
156156
WARNING: Using this method may have unintended side effects if you are
157157
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
158158
Read
159-
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
159+
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
160160
before using this method.
161161
162162
Returns:
@@ -180,7 +180,7 @@ def delete_queue(self):
180180
WARNING: Using this method may have unintended side effects if you are
181181
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
182182
Read
183-
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
183+
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
184184
before using this method.
185185
186186
Returns:
@@ -242,7 +242,7 @@ def resume_queue(self):
242242
WARNING: Resuming many high-QPS queues at the same time can
243243
lead to target overloading. If you are resuming high-QPS
244244
queues, follow the 500/50/5 pattern described in
245-
`Managing Cloud Tasks Scaling Risks <https://cloud.google.com/cloud-tasks/pdfs/managing-cloud-tasks-scaling-risks-2017-06-05.pdf>`_.
245+
`Managing Cloud Tasks Scaling Risks <https://cloud.google.com/tasks/docs/manage-cloud-task-scaling>`_.
246246
247247
Returns:
248248
Callable: A callable which accepts the appropriate
@@ -259,8 +259,9 @@ def get_iam_policy(self):
259259
Returns an empty policy if the resource exists and does not have a policy
260260
set.
261261
262-
Authorization requires the following `Google IAM <https://cloud.google.com/iam>`_ permission on the
263-
specified resource parent:
262+
Authorization requires the following
263+
`Google IAM <https://cloud.google.com/iam>`_ permission on the specified
264+
resource parent:
264265
265266
* ``cloudtasks.queues.getIamPolicy``
266267
@@ -281,8 +282,9 @@ def set_iam_policy(self):
281282
Note: The Cloud Console does not check queue-level IAM permissions yet.
282283
Project-level permissions are required to use the Cloud Console.
283284
284-
Authorization requires the following `Google IAM <https://cloud.google.com/iam>`_ permission on the
285-
specified resource parent:
285+
Authorization requires the following
286+
`Google IAM <https://cloud.google.com/iam>`_ permission on the specified
287+
resource parent:
286288
287289
* ``cloudtasks.queues.setIamPolicy``
288290
@@ -323,6 +325,9 @@ def list_tasks(self):
323325
``response_view`` controls the
324326
subset of information which is returned.
325327
328+
The tasks may be returned in any order. The ordering may change at any
329+
time.
330+
326331
Returns:
327332
Callable: A callable which accepts the appropriate
328333
deserialized request object and returns a
@@ -351,10 +356,9 @@ def create_task(self):
351356
352357
Tasks cannot be updated after creation; there is no UpdateTask command.
353358
354-
* For `App Engine queues <https://cloud.google.comgoogle.cloud.tasks.v2beta2.AppEngineHttpTarget>`_,
355-
the maximum task size is 100KB.
356-
* For `pull queues <https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget>`_, this
357-
the maximum task size is 1MB.
359+
* For ``App Engine queues``, the maximum task size is
360+
100KB.
361+
* For ``pull queues``, the maximum task size is 1MB.
358362
359363
Returns:
360364
Callable: A callable which accepts the appropriate

0 commit comments

Comments
 (0)