Skip to content

Commit

Permalink
tasks missing from docs (#5656)
Browse files Browse the repository at this point in the history
  • Loading branch information
crwilcox committed Jul 20, 2018
1 parent 141d5ad commit 568779a
Show file tree
Hide file tree
Showing 12 changed files with 322 additions and 262 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
logging/usage
redis/index
storage/client
tasks/index
texttospeech/index
translate/usage
vision/index
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ resource_manager/
runtimeconfig/
spanner/
speech/
tasks/
texttospeech/
trace/
translate/
Expand Down
1 change: 1 addition & 0 deletions docs/tasks
97 changes: 59 additions & 38 deletions tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import pkg_resources
import warnings

from google.oauth2 import service_account
import google.api_core.gapic_v1.client_info
import google.api_core.gapic_v1.config
import google.api_core.gapic_v1.method
Expand Down Expand Up @@ -57,6 +58,27 @@ class CloudTasksClient(object):
# find the method configuration in the client_config dictionary.
_INTERFACE_NAME = 'google.cloud.tasks.v2beta2.CloudTasks'

@classmethod
def from_service_account_file(cls, filename, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
CloudTasksClient: The constructed client.
"""
credentials = service_account.Credentials.from_service_account_file(
filename)
kwargs['credentials'] = credentials
return cls(*args, **kwargs)

from_service_account_json = from_service_account_file

@classmethod
def project_path(cls, project):
"""Return a fully-qualified project string."""
Expand Down Expand Up @@ -156,11 +178,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = cloud_tasks_grpc_transport.CloudTasksGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = cloud_tasks_grpc_transport.CloudTasksGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down Expand Up @@ -226,7 +249,7 @@ def list_queues(self,
described in
`Stackdriver's Advanced Logs Filters <https://cloud.google.com/logging/docs/view/advanced_filters>`_.
Sample filter \"app_engine_http_target: *\".
Sample filter \"app_engine_http_target: \*\".
Note that using filters might cause fewer queues than the
requested_page size to be returned.
Expand Down Expand Up @@ -381,7 +404,7 @@ def create_queue(self,
WARNING: Using this method may have unintended side effects if you are
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
Read
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
before using this method.
Example:
Expand Down Expand Up @@ -480,7 +503,7 @@ def update_queue(self,
WARNING: Using this method may have unintended side effects if you are
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
Read
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
before using this method.
Example:
Expand Down Expand Up @@ -575,7 +598,7 @@ def delete_queue(self,
WARNING: Using this method may have unintended side effects if you are
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
Read
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
before using this method.
Example:
Expand Down Expand Up @@ -797,7 +820,7 @@ def resume_queue(self,
WARNING: Resuming many high-QPS queues at the same time can
lead to target overloading. If you are resuming high-QPS
queues, follow the 500/50/5 pattern described in
`Managing Cloud Tasks Scaling Risks <https://cloud.google.com/cloud-tasks/pdfs/managing-cloud-tasks-scaling-risks-2017-06-05.pdf>`_.
`Managing Cloud Tasks Scaling Risks <https://cloud.google.com/tasks/docs/manage-cloud-task-scaling>`_.
Example:
>>> from google.cloud import tasks_v2beta2
Expand Down Expand Up @@ -869,8 +892,9 @@ def get_iam_policy(self,
Returns an empty policy if the resource exists and does not have a policy
set.
Authorization requires the following `Google IAM <https://cloud.google.com/iam>`_ permission on the
specified resource parent:
Authorization requires the following
`Google IAM <https://cloud.google.com/iam>`__ permission on the specified
resource parent:
* ``cloudtasks.queues.getIamPolicy``
Expand Down Expand Up @@ -946,8 +970,9 @@ def set_iam_policy(self,
Note: The Cloud Console does not check queue-level IAM permissions yet.
Project-level permissions are required to use the Cloud Console.
Authorization requires the following `Google IAM <https://cloud.google.com/iam>`_ permission on the
specified resource parent:
Authorization requires the following
`Google IAM <https://cloud.google.com/iam>`__ permission on the specified
resource parent:
* ``cloudtasks.queues.setIamPolicy``
Expand Down Expand Up @@ -1110,7 +1135,6 @@ def test_iam_permissions(self,
def list_tasks(self,
parent,
response_view=None,
order_by=None,
page_size=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
Expand All @@ -1123,6 +1147,9 @@ def list_tasks(self,
``response_view`` controls the
subset of information which is returned.
The tasks may be returned in any order. The ordering may change at any
time.
Example:
>>> from google.cloud import tasks_v2beta2
>>>
Expand Down Expand Up @@ -1159,12 +1186,8 @@ def list_tasks(self,
contains.
Authorization for ``FULL`` requires
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
``Task`` resource.
order_by (str): Sort order used for the query. The only fields supported for sorting
are ``schedule_time`` and ``pull_message.tag``. All results will be
returned in approximately ascending order. The default ordering is by
``schedule_time``.
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
permission on the ``Task`` resource.
page_size (int): The maximum number of resources contained in the
underlying API response. If page streaming is performed per-
resource, this parameter does not affect the return value. If page
Expand Down Expand Up @@ -1205,7 +1228,6 @@ def list_tasks(self,
request = cloudtasks_pb2.ListTasksRequest(
parent=parent,
response_view=response_view,
order_by=order_by,
page_size=page_size,
)
if metadata is None:
Expand Down Expand Up @@ -1267,8 +1289,8 @@ def get_task(self,
contains.
Authorization for ``FULL`` requires
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
``Task`` resource.
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
permission on the ``Task`` resource.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
be retried.
Expand Down Expand Up @@ -1329,10 +1351,9 @@ def create_task(self,
Tasks cannot be updated after creation; there is no UpdateTask command.
* For `App Engine queues <https://cloud.google.comgoogle.cloud.tasks.v2beta2.AppEngineHttpTarget>`_,
the maximum task size is 100KB.
* For `pull queues <https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget>`_, this
the maximum task size is 1MB.
* For ``App Engine queues``, the maximum task size is
100KB.
* For ``pull queues``, the maximum task size is 1MB.
Example:
>>> from google.cloud import tasks_v2beta2
Expand Down Expand Up @@ -1400,8 +1421,8 @@ def create_task(self,
contains.
Authorization for ``FULL`` requires
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
``Task`` resource.
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
permission on the ``Task`` resource.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
be retried.
Expand Down Expand Up @@ -1596,8 +1617,8 @@ def lease_tasks(self,
contains.
Authorization for ``FULL`` requires
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
``Task`` resource.
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
permission on the ``Task`` resource.
filter_ (str): ``filter`` can be used to specify a subset of tasks to lease.
When ``filter`` is set to ``tag=<my-tag>`` then the
Expand Down Expand Up @@ -1835,8 +1856,8 @@ def renew_lease(self,
contains.
Authorization for ``FULL`` requires
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
``Task`` resource.
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
permission on the ``Task`` resource.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
be retried.
Expand Down Expand Up @@ -1938,8 +1959,8 @@ def cancel_lease(self,
contains.
Authorization for ``FULL`` requires
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
``Task`` resource.
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
permission on the ``Task`` resource.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
be retried.
Expand Down Expand Up @@ -2049,8 +2070,8 @@ def run_task(self,
contains.
Authorization for ``FULL`` requires
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_ permission on the
``Task`` resource.
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
permission on the ``Task`` resource.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
be retried.
Expand Down
12 changes: 6 additions & 6 deletions tasks/google/cloud/tasks_v2beta2/gapic/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class HttpMethod(enum.IntEnum):
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
POST (int): HTTP POST
GET (int): HTTP GET
HEAD (int): HTTP HEAD
PUT (int): HTTP PUT
DELETE (int): HTTP DELETE
"""
HTTP_METHOD_UNSPECIFIED = 0
POST = 1
Expand Down Expand Up @@ -214,7 +214,7 @@ class State(enum.IntEnum):
A queue becomes ``DISABLED`` when
`queue.yaml <https://cloud.google.com/appengine/docs/python/config/queueref>`_ or
`queue.xml <https://cloud.google.comappengine/docs/standard/java/config/queueref>`_ is uploaded
`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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def create_queue(self):
WARNING: Using this method may have unintended side effects if you are
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
Read
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
before using this method.
Returns:
Expand All @@ -156,7 +156,7 @@ def update_queue(self):
WARNING: Using this method may have unintended side effects if you are
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
Read
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
before using this method.
Returns:
Expand All @@ -180,7 +180,7 @@ def delete_queue(self):
WARNING: Using this method may have unintended side effects if you are
using an App Engine ``queue.yaml`` or ``queue.xml`` file to manage your queues.
Read
`Overview of Queue Management and queue.yaml <https://cloud.google.com/cloud-tasks/docs/queue-yaml>`_
`Overview of Queue Management and queue.yaml <https://cloud.google.com/tasks/docs/queue-yaml>`_
before using this method.
Returns:
Expand Down Expand Up @@ -242,7 +242,7 @@ def resume_queue(self):
WARNING: Resuming many high-QPS queues at the same time can
lead to target overloading. If you are resuming high-QPS
queues, follow the 500/50/5 pattern described in
`Managing Cloud Tasks Scaling Risks <https://cloud.google.com/cloud-tasks/pdfs/managing-cloud-tasks-scaling-risks-2017-06-05.pdf>`_.
`Managing Cloud Tasks Scaling Risks <https://cloud.google.com/tasks/docs/manage-cloud-task-scaling>`_.
Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -259,8 +259,9 @@ def get_iam_policy(self):
Returns an empty policy if the resource exists and does not have a policy
set.
Authorization requires the following `Google IAM <https://cloud.google.com/iam>`_ permission on the
specified resource parent:
Authorization requires the following
`Google IAM <https://cloud.google.com/iam>`_ permission on the specified
resource parent:
* ``cloudtasks.queues.getIamPolicy``
Expand All @@ -281,8 +282,9 @@ def set_iam_policy(self):
Note: The Cloud Console does not check queue-level IAM permissions yet.
Project-level permissions are required to use the Cloud Console.
Authorization requires the following `Google IAM <https://cloud.google.com/iam>`_ permission on the
specified resource parent:
Authorization requires the following
`Google IAM <https://cloud.google.com/iam>`_ permission on the specified
resource parent:
* ``cloudtasks.queues.setIamPolicy``
Expand Down Expand Up @@ -323,6 +325,9 @@ def list_tasks(self):
``response_view`` controls the
subset of information which is returned.
The tasks may be returned in any order. The ordering may change at any
time.
Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
Expand Down Expand Up @@ -351,10 +356,9 @@ def create_task(self):
Tasks cannot be updated after creation; there is no UpdateTask command.
* For `App Engine queues <https://cloud.google.comgoogle.cloud.tasks.v2beta2.AppEngineHttpTarget>`_,
the maximum task size is 100KB.
* For `pull queues <https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget>`_, this
the maximum task size is 1MB.
* For ``App Engine queues``, the maximum task size is
100KB.
* For ``pull queues``, the maximum task size is 1MB.
Returns:
Callable: A callable which accepts the appropriate
Expand Down
Loading

0 comments on commit 568779a

Please sign in to comment.