diff --git a/tasks/README.rst b/tasks/README.rst index 64d96a405645..771cc9a4ceda 100644 --- a/tasks/README.rst +++ b/tasks/README.rst @@ -8,7 +8,7 @@ Python Client for Cloud Tasks API (`Alpha`_) .. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst .. _Cloud Tasks API: https://cloud.google.com/tasks -.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/tasks/index.html +.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/tasks/usage.html .. _Product Documentation: https://cloud.google.com/tasks Quick Start @@ -65,11 +65,11 @@ Next Steps ~~~~~~~~~~ - Read the `Client Library Documentation`_ for Cloud Tasks API - to see other available methods on the client. + API to see other available methods on the client. - Read the `Cloud Tasks API Product documentation`_ to learn more about the product and see How-to Guides. - View this `repository’s main README`_ to see the full list of Cloud APIs that we cover. .. _Cloud Tasks API Product documentation: https://cloud.google.com/tasks -.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst +.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst \ No newline at end of file diff --git a/tasks/docs/conf.py b/tasks/docs/conf.py index 3e262a48edee..cd822380a59e 100644 --- a/tasks/docs/conf.py +++ b/tasks/docs/conf.py @@ -276,7 +276,7 @@ texinfo_documents = [ (master_doc, 'google-cloud-tasks', u'google-cloud-tasks Documentation', author, 'google-cloud-tasks', - 'GAPIC library for the {metadata.shortName} v2beta2 service', 'APIs'), + 'GAPIC library for the {metadata.shortName} service', 'APIs'), ] # Documents to append as an appendix to all manuals. diff --git a/tasks/docs/gapic/v2beta3/api.rst b/tasks/docs/gapic/v2beta3/api.rst new file mode 100644 index 000000000000..17e911b7c38b --- /dev/null +++ b/tasks/docs/gapic/v2beta3/api.rst @@ -0,0 +1,6 @@ +Client for Cloud Tasks API +========================== + +.. automodule:: google.cloud.tasks_v2beta3 + :members: + :inherited-members: \ No newline at end of file diff --git a/tasks/docs/gapic/v2beta3/types.rst b/tasks/docs/gapic/v2beta3/types.rst new file mode 100644 index 000000000000..42bed0b59ae4 --- /dev/null +++ b/tasks/docs/gapic/v2beta3/types.rst @@ -0,0 +1,5 @@ +Types for Cloud Tasks API Client +================================ + +.. automodule:: google.cloud.tasks_v2beta3.types + :members: \ No newline at end of file diff --git a/tasks/docs/index.rst b/tasks/docs/index.rst index 1c93c21fde4d..8d908d3d2c1a 100644 --- a/tasks/docs/index.rst +++ b/tasks/docs/index.rst @@ -80,4 +80,6 @@ Api Reference :maxdepth: 2 gapic/v2beta2/api - gapic/v2beta2/types \ No newline at end of file + gapic/v2beta2/types + gapic/v2beta3/api + gapic/v2beta3/types \ No newline at end of file diff --git a/tasks/google/__init__.py b/tasks/google/__init__.py index 855a707300e1..f65701dd143f 100644 --- a/tasks/google/__init__.py +++ b/tasks/google/__init__.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,4 +19,4 @@ pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil - __path__ = pkgutil.extend_path(__path__, __name__) \ No newline at end of file + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/tasks/google/cloud/__init__.py b/tasks/google/cloud/__init__.py index 855a707300e1..f65701dd143f 100644 --- a/tasks/google/cloud/__init__.py +++ b/tasks/google/cloud/__init__.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,4 +19,4 @@ pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil - __path__ = pkgutil.extend_path(__path__, __name__) \ No newline at end of file + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/tasks/google/cloud/tasks.py b/tasks/google/cloud/tasks.py index 51985b958788..703766b0a86b 100644 --- a/tasks/google/cloud/tasks.py +++ b/tasks/google/cloud/tasks.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +16,9 @@ from __future__ import absolute_import -from google.cloud.tasks_v2beta2 import CloudTasksClient -from google.cloud.tasks_v2beta2 import enums -from google.cloud.tasks_v2beta2 import types +from google.cloud.tasks_v2beta3 import CloudTasksClient +from google.cloud.tasks_v2beta3 import enums +from google.cloud.tasks_v2beta3 import types __all__ = ( 'enums', diff --git a/tasks/google/cloud/tasks_v2beta2/__init__.py b/tasks/google/cloud/tasks_v2beta2/__init__.py index 00a035a4386c..a1dfc159ed27 100644 --- a/tasks/google/cloud/tasks_v2beta2/__init__.py +++ b/tasks/google/cloud/tasks_v2beta2/__init__.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py b/tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py index 51eac2aeb138..1173ea06779c 100644 --- a/tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py +++ b/tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tasks/google/cloud/tasks_v2beta2/gapic/enums.py b/tasks/google/cloud/tasks_v2beta2/gapic/enums.py index 05e3e864087b..f37eb08f63a8 100644 --- a/tasks/google/cloud/tasks_v2beta2/gapic/enums.py +++ b/tasks/google/cloud/tasks_v2beta2/gapic/enums.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tasks/google/cloud/tasks_v2beta2/gapic/transports/cloud_tasks_grpc_transport.py b/tasks/google/cloud/tasks_v2beta2/gapic/transports/cloud_tasks_grpc_transport.py index 7cdb6ef5e466..c65cae881343 100644 --- a/tasks/google/cloud/tasks_v2beta2/gapic/transports/cloud_tasks_grpc_transport.py +++ b/tasks/google/cloud/tasks_v2beta2/gapic/transports/cloud_tasks_grpc_transport.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tasks/google/cloud/tasks_v2beta2/types.py b/tasks/google/cloud/tasks_v2beta2/types.py index dff4df40479e..723e0865a568 100644 --- a/tasks/google/cloud/tasks_v2beta2/types.py +++ b/tasks/google/cloud/tasks_v2beta2/types.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tasks/google/cloud/tasks_v2beta3/__init__.py b/tasks/google/cloud/tasks_v2beta3/__init__.py new file mode 100644 index 000000000000..e83b3b1a3b08 --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2018 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. + +from __future__ import absolute_import + +from google.cloud.tasks_v2beta3 import types +from google.cloud.tasks_v2beta3.gapic import cloud_tasks_client +from google.cloud.tasks_v2beta3.gapic import enums + + +class CloudTasksClient(cloud_tasks_client.CloudTasksClient): + __doc__ = cloud_tasks_client.CloudTasksClient.__doc__ + enums = enums + + +__all__ = ( + 'enums', + 'types', + 'CloudTasksClient', +) diff --git a/tasks/google/cloud/tasks_v2beta3/gapic/__init__.py b/tasks/google/cloud/tasks_v2beta3/gapic/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tasks/google/cloud/tasks_v2beta3/gapic/cloud_tasks_client.py b/tasks/google/cloud/tasks_v2beta3/gapic/cloud_tasks_client.py new file mode 100644 index 000000000000..d353f9f0dc33 --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/gapic/cloud_tasks_client.py @@ -0,0 +1,1646 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2018 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. +"""Accesses the google.cloud.tasks.v2beta3 CloudTasks API.""" + +import functools +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 +import google.api_core.gapic_v1.routing_header +import google.api_core.grpc_helpers +import google.api_core.page_iterator +import google.api_core.path_template +import grpc + +from google.cloud.tasks_v2beta3.gapic import cloud_tasks_client_config +from google.cloud.tasks_v2beta3.gapic import enums +from google.cloud.tasks_v2beta3.gapic.transports import cloud_tasks_grpc_transport +from google.cloud.tasks_v2beta3.proto import cloudtasks_pb2 +from google.cloud.tasks_v2beta3.proto import cloudtasks_pb2_grpc +from google.cloud.tasks_v2beta3.proto import queue_pb2 +from google.cloud.tasks_v2beta3.proto import task_pb2 +from google.iam.v1 import iam_policy_pb2 +from google.iam.v1 import policy_pb2 +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 + +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( + 'google-cloud-tasks', ).version + + +class CloudTasksClient(object): + """ + Cloud Tasks allows developers to manage the execution of background + work in their applications. + """ + + SERVICE_ADDRESS = 'cloudtasks.googleapis.com:443' + """The default address of the service.""" + + # The name of the interface for this client. This is the key used to + # find the method configuration in the client_config dictionary. + _INTERFACE_NAME = 'google.cloud.tasks.v2beta3.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.""" + return google.api_core.path_template.expand( + 'projects/{project}', + project=project, + ) + + @classmethod + def location_path(cls, project, location): + """Return a fully-qualified location string.""" + return google.api_core.path_template.expand( + 'projects/{project}/locations/{location}', + project=project, + location=location, + ) + + @classmethod + def queue_path(cls, project, location, queue): + """Return a fully-qualified queue string.""" + return google.api_core.path_template.expand( + 'projects/{project}/locations/{location}/queues/{queue}', + project=project, + location=location, + queue=queue, + ) + + @classmethod + def task_path(cls, project, location, queue, task): + """Return a fully-qualified task string.""" + return google.api_core.path_template.expand( + 'projects/{project}/locations/{location}/queues/{queue}/tasks/{task}', + project=project, + location=location, + queue=queue, + task=task, + ) + + def __init__(self, + transport=None, + channel=None, + credentials=None, + client_config=cloud_tasks_client_config.config, + client_info=None): + """Constructor. + + Args: + transport (Union[~.CloudTasksGrpcTransport, + Callable[[~.Credentials, type], ~.CloudTasksGrpcTransport]): A transport + instance, responsible for actually making the API calls. + The default transport uses the gRPC protocol. + This argument may also be a callable which returns a + transport instance. Callables will be sent the credentials + as the first argument and the default transport class as + the second argument. + channel (grpc.Channel): DEPRECATED. A ``Channel`` instance + through which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is mutually exclusive with providing a + transport instance to ``transport``; doing so will raise + an exception. + client_config (dict): DEPRECATED. A dictionary of call options for + each method. If not specified, the default configuration is used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Raise deprecation warnings for things we want to go away. + if client_config: + warnings.warn('The `client_config` argument is deprecated.', + PendingDeprecationWarning) + if channel: + warnings.warn( + 'The `channel` argument is deprecated; use ' + '`transport` instead.', PendingDeprecationWarning) + + # Instantiate the transport. + # The transport is responsible for handling serialization and + # deserialization and actually sending data to the service. + if transport: + if callable(transport): + self.transport = transport( + credentials=credentials, + default_class=cloud_tasks_grpc_transport. + CloudTasksGrpcTransport, + ) + else: + if credentials: + raise ValueError( + 'Received both a transport instance and ' + 'credentials; these are mutually exclusive.') + self.transport = transport + else: + self.transport = cloud_tasks_grpc_transport.CloudTasksGrpcTransport( + address=self.SERVICE_ADDRESS, + channel=channel, + credentials=credentials, + ) + + if client_info is None: + client_info = ( + google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO) + client_info.gapic_version = _GAPIC_LIBRARY_VERSION + self._client_info = client_info + + # Parse out the default settings for retry and timeout for each RPC + # from the client configuration. + # (Ordinarily, these are the defaults specified in the `*_config.py` + # file next to this one.) + self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( + client_config['interfaces'][self._INTERFACE_NAME], ) + + # Save a dictionary of cached API call functions. + # These are the actual callables which invoke the proper + # transport methods, wrapped with `wrap_method` to add retry, + # timeout, and the like. + self._inner_api_calls = {} + + # Service calls + def list_queues(self, + parent, + filter_=None, + page_size=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Lists queues. + + Queues are returned in lexicographical order. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> # Iterate over all results + >>> for element in client.list_queues(parent): + ... # process element + ... pass + >>> + >>> + >>> # Alternatively: + >>> + >>> # Iterate over results one page at a time + >>> for page in client.list_queues(parent, options=CallOptions(page_token=INITIAL_PAGE)): + ... for element in page: + ... # process element + ... pass + + Args: + parent (str): Required. + + The location name. + For example: ``projects/PROJECT_ID/locations/LOCATION_ID`` + filter_ (str): ``filter`` can be used to specify a subset of queues. Any ``Queue`` + field can be used as a filter and several operators as supported. + For example: ``<=, <, >=, >, !=, =, :``. The filter syntax is the same as + described in + `Stackdriver's Advanced Logs Filters `_. + + Sample filter \"state: PAUSED\". + + Note that using filters might cause fewer queues than the + requested page_size to be returned. + 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 + streaming is performed per-page, this determines the maximum number + of resources in a page. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.gax.PageIterator` instance. By default, this + is an iterable of :class:`~google.cloud.tasks_v2beta3.types.Queue` instances. + This object can also be configured to iterate over the pages + of the response through the `options` parameter. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'list_queues' not in self._inner_api_calls: + self._inner_api_calls[ + 'list_queues'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_queues, + default_retry=self._method_configs['ListQueues'].retry, + default_timeout=self._method_configs['ListQueues'].timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.ListQueuesRequest( + parent=parent, + filter=filter_, + page_size=page_size, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('parent', parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + iterator = google.api_core.page_iterator.GRPCIterator( + client=None, + method=functools.partial( + self._inner_api_calls['list_queues'], + retry=retry, + timeout=timeout, + metadata=metadata), + request=request, + items_field='queues', + request_token_field='page_token', + response_token_field='next_page_token', + ) + return iterator + + def get_queue(self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Gets a queue. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> response = client.get_queue(name) + + Args: + name (str): Required. + + The resource name of the queue. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Queue` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'get_queue' not in self._inner_api_calls: + self._inner_api_calls[ + 'get_queue'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_queue, + default_retry=self._method_configs['GetQueue'].retry, + default_timeout=self._method_configs['GetQueue'].timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.GetQueueRequest(name=name, ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('name', name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['get_queue']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def create_queue(self, + parent, + queue, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Creates a queue. + + Queues created with this method allow tasks to live for a maximum of 31 + days. After a task is 31 days old, the task will be deleted regardless of whether + it was dispatched or not. + + 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 `_ + before using this method. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> # TODO: Initialize ``queue``: + >>> queue = {} + >>> + >>> response = client.create_queue(parent, queue) + + Args: + parent (str): Required. + + The location name in which the queue will be created. + For example: ``projects/PROJECT_ID/locations/LOCATION_ID`` + + The list of allowed locations can be obtained by calling Cloud + Tasks' implementation of + ``ListLocations``. + queue (Union[dict, ~google.cloud.tasks_v2beta3.types.Queue]): Required. + + The queue to create. + + ``Queue's name`` cannot be the same as an existing queue. + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.tasks_v2beta3.types.Queue` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Queue` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'create_queue' not in self._inner_api_calls: + self._inner_api_calls[ + 'create_queue'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.create_queue, + default_retry=self._method_configs['CreateQueue'].retry, + default_timeout=self._method_configs['CreateQueue'] + .timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.CreateQueueRequest( + parent=parent, + queue=queue, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('parent', parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['create_queue']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def update_queue(self, + queue, + update_mask=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Updates a queue. + + This method creates the queue if it does not exist and updates + the queue if it does exist. + + Queues created with this method allow tasks to live for a maximum of 31 + days. After a task is 31 days old, the task will be deleted regardless of whether + it was dispatched or not. + + 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 `_ + before using this method. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> # TODO: Initialize ``queue``: + >>> queue = {} + >>> + >>> response = client.update_queue(queue) + + Args: + queue (Union[dict, ~google.cloud.tasks_v2beta3.types.Queue]): Required. + + The queue to create or update. + + The queue's ``name`` must be specified. + + Output only fields cannot be modified using UpdateQueue. + Any value specified for an output only field will be ignored. + The queue's ``name`` cannot be changed. + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.tasks_v2beta3.types.Queue` + update_mask (Union[dict, ~google.cloud.tasks_v2beta3.types.FieldMask]): A mask used to specify which fields of the queue are being updated. + + If empty, then all fields will be updated. + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.tasks_v2beta3.types.FieldMask` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Queue` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'update_queue' not in self._inner_api_calls: + self._inner_api_calls[ + 'update_queue'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.update_queue, + default_retry=self._method_configs['UpdateQueue'].retry, + default_timeout=self._method_configs['UpdateQueue'] + .timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.UpdateQueueRequest( + queue=queue, + update_mask=update_mask, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('queue.name', queue.name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['update_queue']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def delete_queue(self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Deletes a queue. + + This command will delete the queue even if it has tasks in it. + + Note: If you delete a queue, a queue with the same name can't be created + for 7 days. + + 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 `_ + before using this method. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> client.delete_queue(name) + + Args: + name (str): Required. + + The queue name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'delete_queue' not in self._inner_api_calls: + self._inner_api_calls[ + 'delete_queue'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.delete_queue, + default_retry=self._method_configs['DeleteQueue'].retry, + default_timeout=self._method_configs['DeleteQueue'] + .timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.DeleteQueueRequest(name=name, ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('name', name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + self._inner_api_calls['delete_queue']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def purge_queue(self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Purges a queue by deleting all of its tasks. + + All tasks created before this method is called are permanently deleted. + + Purge operations can take up to one minute to take effect. Tasks + might be dispatched before the purge takes effect. A purge is irreversible. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> response = client.purge_queue(name) + + Args: + name (str): Required. + + The queue name. For example: + ``projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Queue` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'purge_queue' not in self._inner_api_calls: + self._inner_api_calls[ + 'purge_queue'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.purge_queue, + default_retry=self._method_configs['PurgeQueue'].retry, + default_timeout=self._method_configs['PurgeQueue'].timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.PurgeQueueRequest(name=name, ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('name', name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['purge_queue']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def pause_queue(self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Pauses the queue. + + If a queue is paused then the system will stop dispatching tasks + until the queue is resumed via + ``ResumeQueue``. Tasks can still be added + when the queue is paused. A queue is paused if its + ``state`` is ``PAUSED``. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> response = client.pause_queue(name) + + Args: + name (str): Required. + + The queue name. For example: + ``projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Queue` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'pause_queue' not in self._inner_api_calls: + self._inner_api_calls[ + 'pause_queue'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.pause_queue, + default_retry=self._method_configs['PauseQueue'].retry, + default_timeout=self._method_configs['PauseQueue'].timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.PauseQueueRequest(name=name, ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('name', name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['pause_queue']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def resume_queue(self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Resume a queue. + + This method resumes a queue after it has been + ``PAUSED`` or + ``DISABLED``. The state of a queue is stored + in the queue's ``state``; after calling this method it + will be set to ``RUNNING``. + + 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 `_. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> response = client.resume_queue(name) + + Args: + name (str): Required. + + The queue name. For example: + ``projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Queue` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'resume_queue' not in self._inner_api_calls: + self._inner_api_calls[ + 'resume_queue'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.resume_queue, + default_retry=self._method_configs['ResumeQueue'].retry, + default_timeout=self._method_configs['ResumeQueue'] + .timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.ResumeQueueRequest(name=name, ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('name', name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['resume_queue']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def get_iam_policy(self, + resource, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Gets the access control policy for a ``Queue``. + Returns an empty policy if the resource exists and does not have a policy + set. + + Authorization requires the following + `Google IAM `__ permission on the specified + resource parent: + + * ``cloudtasks.queues.getIamPolicy`` + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> resource = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> response = client.get_iam_policy(resource) + + Args: + resource (str): REQUIRED: The resource for which the policy is being requested. + ``resource`` is usually specified as a path. For example, a Project + resource is specified as ``projects/{project}``. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Policy` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'get_iam_policy' not in self._inner_api_calls: + self._inner_api_calls[ + 'get_iam_policy'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_iam_policy, + default_retry=self._method_configs['GetIamPolicy'].retry, + default_timeout=self._method_configs['GetIamPolicy'] + .timeout, + client_info=self._client_info, + ) + + request = iam_policy_pb2.GetIamPolicyRequest(resource=resource, ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('resource', resource)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['get_iam_policy']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def set_iam_policy(self, + resource, + policy, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Sets the access control policy for a ``Queue``. Replaces any existing + policy. + + 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 `__ permission on the specified + resource parent: + + * ``cloudtasks.queues.setIamPolicy`` + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> resource = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> # TODO: Initialize ``policy``: + >>> policy = {} + >>> + >>> response = client.set_iam_policy(resource, policy) + + Args: + resource (str): REQUIRED: The resource for which the policy is being specified. + ``resource`` is usually specified as a path. For example, a Project + resource is specified as ``projects/{project}``. + policy (Union[dict, ~google.cloud.tasks_v2beta3.types.Policy]): REQUIRED: The complete policy to be applied to the ``resource``. The size of + the policy is limited to a few 10s of KB. An empty policy is a + valid policy but certain Cloud Platform services (such as Projects) + might reject them. + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.tasks_v2beta3.types.Policy` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Policy` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'set_iam_policy' not in self._inner_api_calls: + self._inner_api_calls[ + 'set_iam_policy'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.set_iam_policy, + default_retry=self._method_configs['SetIamPolicy'].retry, + default_timeout=self._method_configs['SetIamPolicy'] + .timeout, + client_info=self._client_info, + ) + + request = iam_policy_pb2.SetIamPolicyRequest( + resource=resource, + policy=policy, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('resource', resource)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['set_iam_policy']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def test_iam_permissions(self, + resource, + permissions, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Returns permissions that a caller has on a ``Queue``. + If the resource does not exist, this will return an empty set of + permissions, not a ``NOT_FOUND`` error. + + Note: This operation is designed to be used for building permission-aware + UIs and command-line tools, not for authorization checking. This operation + may \"fail open\" without warning. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> resource = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> # TODO: Initialize ``permissions``: + >>> permissions = [] + >>> + >>> response = client.test_iam_permissions(resource, permissions) + + Args: + resource (str): REQUIRED: The resource for which the policy detail is being requested. + ``resource`` is usually specified as a path. For example, a Project + resource is specified as ``projects/{project}``. + permissions (list[str]): The set of permissions to check for the ``resource``. Permissions with + wildcards (such as '*' or 'storage.*') are not allowed. For more + information see + `IAM Overview `_. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.TestIamPermissionsResponse` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'test_iam_permissions' not in self._inner_api_calls: + self._inner_api_calls[ + 'test_iam_permissions'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.test_iam_permissions, + default_retry=self._method_configs[ + 'TestIamPermissions'].retry, + default_timeout=self._method_configs['TestIamPermissions'] + .timeout, + client_info=self._client_info, + ) + + request = iam_policy_pb2.TestIamPermissionsRequest( + resource=resource, + permissions=permissions, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('resource', resource)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['test_iam_permissions']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def list_tasks(self, + parent, + response_view=None, + page_size=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Lists the tasks in a queue. + + By default, only the ``BASIC`` view is retrieved + due to performance considerations; + ``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_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> parent = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> # Iterate over all results + >>> for element in client.list_tasks(parent): + ... # process element + ... pass + >>> + >>> + >>> # Alternatively: + >>> + >>> # Iterate over results one page at a time + >>> for page in client.list_tasks(parent, options=CallOptions(page_token=INITIAL_PAGE)): + ... for element in page: + ... # process element + ... pass + + Args: + parent (str): Required. + + The queue name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`` + response_view (~google.cloud.tasks_v2beta3.types.View): The response_view specifies which subset of the ``Task`` will be + returned. + + By default response_view is ``BASIC``; 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. + + Authorization for ``FULL`` requires + ``cloudtasks.tasks.fullView`` `Google 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 + streaming is performed per-page, this determines the maximum number + of resources in a page. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.gax.PageIterator` instance. By default, this + is an iterable of :class:`~google.cloud.tasks_v2beta3.types.Task` instances. + This object can also be configured to iterate over the pages + of the response through the `options` parameter. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'list_tasks' not in self._inner_api_calls: + self._inner_api_calls[ + 'list_tasks'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_tasks, + default_retry=self._method_configs['ListTasks'].retry, + default_timeout=self._method_configs['ListTasks'].timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.ListTasksRequest( + parent=parent, + response_view=response_view, + page_size=page_size, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('parent', parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + iterator = google.api_core.page_iterator.GRPCIterator( + client=None, + method=functools.partial( + self._inner_api_calls['list_tasks'], + retry=retry, + timeout=timeout, + metadata=metadata), + request=request, + items_field='tasks', + request_token_field='page_token', + response_token_field='next_page_token', + ) + return iterator + + def get_task(self, + name, + response_view=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Gets a task. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> name = client.task_path('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]') + >>> + >>> response = client.get_task(name) + + Args: + name (str): Required. + + The task name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`` + response_view (~google.cloud.tasks_v2beta3.types.View): The response_view specifies which subset of the ``Task`` will be + returned. + + By default response_view is ``BASIC``; 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. + + Authorization for ``FULL`` requires + ``cloudtasks.tasks.fullView`` `Google 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. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Task` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'get_task' not in self._inner_api_calls: + self._inner_api_calls[ + 'get_task'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_task, + default_retry=self._method_configs['GetTask'].retry, + default_timeout=self._method_configs['GetTask'].timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.GetTaskRequest( + name=name, + response_view=response_view, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('name', name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['get_task']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def create_task(self, + parent, + task, + response_view=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Creates a task and adds it to a queue. + + Tasks cannot be updated after creation; there is no UpdateTask command. + + * For ``App Engine queues``, the maximum task size is + 100KB. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> parent = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + >>> + >>> # TODO: Initialize ``task``: + >>> task = {} + >>> + >>> response = client.create_task(parent, task) + + Args: + parent (str): Required. + + The queue name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`` + + The queue must already exist. + task (Union[dict, ~google.cloud.tasks_v2beta3.types.Task]): Required. + + The task to add. + + Task names have the following format: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID``. + The user can optionally specify a task ``name``. If a + name is not specified then the system will generate a random + unique task id, which will be set in the task returned in the + ``response``. + + If ``schedule_time`` is not set or is in the + past then Cloud Tasks will set it to the current time. + + Task De-duplication: + + Explicitly specifying a task ID enables task de-duplication. If + a task's ID is identical to that of an existing task or a task + that was deleted or executed recently then the call will fail + with ``ALREADY_EXISTS``. + If the task's queue was created using Cloud Tasks, then another task with + the same name can't be created for ~1hour after the original task was + deleted or executed. If the task's queue was created using queue.yaml or + queue.xml, then another task with the same name can't be created + for ~9days after the original task was deleted or executed. + + Because there is an extra lookup cost to identify duplicate task + names, these ``CreateTask`` calls have significantly + increased latency. Using hashed strings for the task id or for + the prefix of the task id is recommended. Choosing task ids that + are sequential or have sequential prefixes, for example using a + timestamp, causes an increase in latency and error rates in all + task commands. The infrastructure relies on an approximately + uniform distribution of task ids to store and serve tasks + efficiently. + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.tasks_v2beta3.types.Task` + response_view (~google.cloud.tasks_v2beta3.types.View): The response_view specifies which subset of the ``Task`` will be + returned. + + By default response_view is ``BASIC``; 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. + + Authorization for ``FULL`` requires + ``cloudtasks.tasks.fullView`` `Google 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. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Task` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'create_task' not in self._inner_api_calls: + self._inner_api_calls[ + 'create_task'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.create_task, + default_retry=self._method_configs['CreateTask'].retry, + default_timeout=self._method_configs['CreateTask'].timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.CreateTaskRequest( + parent=parent, + task=task, + response_view=response_view, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('parent', parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['create_task']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def delete_task(self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Deletes a task. + + A task can be deleted if it is scheduled or dispatched. A task + cannot be deleted if it has executed successfully or permanently + failed. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> name = client.task_path('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]') + >>> + >>> client.delete_task(name) + + Args: + name (str): Required. + + The task name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'delete_task' not in self._inner_api_calls: + self._inner_api_calls[ + 'delete_task'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.delete_task, + default_retry=self._method_configs['DeleteTask'].retry, + default_timeout=self._method_configs['DeleteTask'].timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.DeleteTaskRequest(name=name, ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('name', name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + self._inner_api_calls['delete_task']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def run_task(self, + name, + response_view=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + Forces a task to run now. + + When this method is called, Cloud Tasks will dispatch the task, even if + the task is already running, the queue has reached its ``RateLimits`` or + is ``PAUSED``. + + This command is meant to be used for manual debugging. For + example, ``RunTask`` can be used to retry a failed + task after a fix has been made or to manually force a task to be + dispatched now. + + The dispatched task is returned. That is, the task that is returned + contains the ``status`` after the task is dispatched but + before the task is received by its target. + + If Cloud Tasks receives a successful response from the task's + target, then the task will be deleted; otherwise the task's + ``schedule_time`` will be reset to the time that + ``RunTask`` was called plus the retry delay specified + in the queue's ``RetryConfig``. + + ``RunTask`` returns + ``NOT_FOUND`` when it is called on a + task that has already succeeded or permanently failed. + + Example: + >>> from google.cloud import tasks_v2beta3 + >>> + >>> client = tasks_v2beta3.CloudTasksClient() + >>> + >>> name = client.task_path('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]') + >>> + >>> response = client.run_task(name) + + Args: + name (str): Required. + + The task name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`` + response_view (~google.cloud.tasks_v2beta3.types.View): The response_view specifies which subset of the ``Task`` will be + returned. + + By default response_view is ``BASIC``; 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. + + Authorization for ``FULL`` requires + ``cloudtasks.tasks.fullView`` `Google 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. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.tasks_v2beta3.types.Task` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if 'run_task' not in self._inner_api_calls: + self._inner_api_calls[ + 'run_task'] = google.api_core.gapic_v1.method.wrap_method( + self.transport.run_task, + default_retry=self._method_configs['RunTask'].retry, + default_timeout=self._method_configs['RunTask'].timeout, + client_info=self._client_info, + ) + + request = cloudtasks_pb2.RunTaskRequest( + name=name, + response_view=response_view, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [('name', name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header) + metadata.append(routing_metadata) + + return self._inner_api_calls['run_task']( + request, retry=retry, timeout=timeout, metadata=metadata) diff --git a/tasks/google/cloud/tasks_v2beta3/gapic/cloud_tasks_client_config.py b/tasks/google/cloud/tasks_v2beta3/gapic/cloud_tasks_client_config.py new file mode 100644 index 000000000000..2ace4e6c56ce --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/gapic/cloud_tasks_client_config.py @@ -0,0 +1,103 @@ +config = { + "interfaces": { + "google.cloud.tasks.v2beta3.CloudTasks": { + "retry_codes": { + "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], + "non_idempotent": [] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListQueues": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetQueue": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateQueue": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateQueue": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteQueue": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "PurgeQueue": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PauseQueue": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResumeQueue": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListTasks": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetTask": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateTask": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteTask": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RunTask": { + "timeout_millis": 10000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/tasks/google/cloud/tasks_v2beta3/gapic/enums.py b/tasks/google/cloud/tasks_v2beta3/gapic/enums.py new file mode 100644 index 000000000000..0c84280fc0e0 --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/gapic/enums.py @@ -0,0 +1,261 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2018 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 execute 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 + """ + HTTP_METHOD_UNSPECIFIED = 0 + POST = 1 + GET = 2 + HEAD = 3 + PUT = 4 + DELETE = 5 + + +class Code(enum.IntEnum): + """ + The canonical error codes for Google APIs. + + + Sometimes multiple error codes may apply. Services should return + the most specific error code that applies. For example, prefer + ``OUT_OF_RANGE`` over ``FAILED_PRECONDITION`` if both codes apply. + Similarly prefer ``NOT_FOUND`` or ``ALREADY_EXISTS`` over ``FAILED_PRECONDITION``. + + Attributes: + OK (int): Not an error; returned on success + + HTTP Mapping: 200 OK + CANCELLED (int): The operation was cancelled, typically by the caller. + + HTTP Mapping: 499 Client Closed Request + UNKNOWN (int): Unknown error. For example, this error may be returned when + a ``Status`` value received from another address space belongs to + an error space that is not known in this address space. Also + errors raised by APIs that do not return enough error information + may be converted to this error. + + HTTP Mapping: 500 Internal Server Error + INVALID_ARGUMENT (int): The client specified an invalid argument. Note that this differs + from ``FAILED_PRECONDITION``. ``INVALID_ARGUMENT`` indicates arguments + that are problematic regardless of the state of the system + (e.g., a malformed file name). + + HTTP Mapping: 400 Bad Request + DEADLINE_EXCEEDED (int): The deadline expired before the operation could complete. For operations + that change the state of the system, this error may be returned + even if the operation has completed successfully. For example, a + successful response from a server could have been delayed long + enough for the deadline to expire. + + HTTP Mapping: 504 Gateway Timeout + NOT_FOUND (int): Some requested entity (e.g., file or directory) was not found. + + Note to server developers: if a request is denied for an entire class + of users, such as gradual feature rollout or undocumented whitelist, + ``NOT_FOUND`` may be used. If a request is denied for some users within + a class of users, such as user-based access control, ``PERMISSION_DENIED`` + must be used. + + HTTP Mapping: 404 Not Found + ALREADY_EXISTS (int): The entity that a client attempted to create (e.g., file or directory) + already exists. + + HTTP Mapping: 409 Conflict + PERMISSION_DENIED (int): The caller does not have permission to execute the specified + operation. ``PERMISSION_DENIED`` must not be used for rejections + caused by exhausting some resource (use ``RESOURCE_EXHAUSTED`` + instead for those errors). ``PERMISSION_DENIED`` must not be + used if the caller can not be identified (use ``UNAUTHENTICATED`` + instead for those errors). This error code does not imply the + request is valid or the requested entity exists or satisfies + other pre-conditions. + + HTTP Mapping: 403 Forbidden + UNAUTHENTICATED (int): The request does not have valid authentication credentials for the + operation. + + HTTP Mapping: 401 Unauthorized + RESOURCE_EXHAUSTED (int): Some resource has been exhausted, perhaps a per-user quota, or + perhaps the entire file system is out of space. + + HTTP Mapping: 429 Too Many Requests + FAILED_PRECONDITION (int): The operation was rejected because the system is not in a state + required for the operation's execution. For example, the directory + to be deleted is non-empty, an rmdir operation is applied to + a non-directory, etc. + + Service implementors can use the following guidelines to decide + between ``FAILED_PRECONDITION``, ``ABORTED``, and ``UNAVAILABLE``: + (a) Use ``UNAVAILABLE`` if the client can retry just the failing call. + (b) Use ``ABORTED`` if the client should retry at a higher level + :: + + (e.g., when a client-specified test-and-set fails, indicating the + client should restart a read-modify-write sequence). + (c) Use ``FAILED_PRECONDITION`` if the client should not retry until + :: + + the system state has been explicitly fixed. E.g., if an \"rmdir\" + fails because the directory is non-empty, `FAILED_PRECONDITION` + should be returned since the client should not retry unless + the files are deleted from the directory. + + HTTP Mapping: 400 Bad Request + ABORTED (int): The operation was aborted, typically due to a concurrency issue such as + a sequencer check failure or transaction abort. + + See the guidelines above for deciding between ``FAILED_PRECONDITION``, + ``ABORTED``, and ``UNAVAILABLE``. + + HTTP Mapping: 409 Conflict + OUT_OF_RANGE (int): The operation was attempted past the valid range. E.g., seeking or + reading past end-of-file. + + Unlike ``INVALID_ARGUMENT``, this error indicates a problem that may + be fixed if the system state changes. For example, a 32-bit file + system will generate ``INVALID_ARGUMENT`` if asked to read at an + offset that is not in the range [0,2^32-1], but it will generate + ``OUT_OF_RANGE`` if asked to read from an offset past the current + file size. + + There is a fair bit of overlap between ``FAILED_PRECONDITION`` and + ``OUT_OF_RANGE``. We recommend using ``OUT_OF_RANGE`` (the more specific + error) when it applies so that callers who are iterating through + a space can easily look for an ``OUT_OF_RANGE`` error to detect when + they are done. + + HTTP Mapping: 400 Bad Request + UNIMPLEMENTED (int): The operation is not implemented or is not supported/enabled in this + service. + + HTTP Mapping: 501 Not Implemented + INTERNAL (int): Internal errors. This means that some invariants expected by the + underlying system have been broken. This error code is reserved + for serious errors. + + HTTP Mapping: 500 Internal Server Error + UNAVAILABLE (int): The service is currently unavailable. This is most likely a + transient condition, which can be corrected by retrying with + a backoff. + + See the guidelines above for deciding between ``FAILED_PRECONDITION``, + ``ABORTED``, and ``UNAVAILABLE``. + + HTTP Mapping: 503 Service Unavailable + DATA_LOSS (int): Unrecoverable data loss or corruption. + + HTTP Mapping: 500 Internal Server Error + """ + OK = 0 + CANCELLED = 1 + UNKNOWN = 2 + INVALID_ARGUMENT = 3 + DEADLINE_EXCEEDED = 4 + NOT_FOUND = 5 + ALREADY_EXISTS = 6 + PERMISSION_DENIED = 7 + UNAUTHENTICATED = 16 + RESOURCE_EXHAUSTED = 8 + FAILED_PRECONDITION = 9 + ABORTED = 10 + OUT_OF_RANGE = 11 + UNIMPLEMENTED = 12 + INTERNAL = 13 + UNAVAILABLE = 14 + DATA_LOSS = 15 + + +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 `_ or + `queue.xml `_ 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 `_ + permission on the ``Queue`` resource. + """ + VIEW_UNSPECIFIED = 0 + BASIC = 1 + FULL = 2 diff --git a/tasks/google/cloud/tasks_v2beta3/gapic/transports/__init__.py b/tasks/google/cloud/tasks_v2beta3/gapic/transports/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tasks/google/cloud/tasks_v2beta3/gapic/transports/cloud_tasks_grpc_transport.py b/tasks/google/cloud/tasks_v2beta3/gapic/transports/cloud_tasks_grpc_transport.py new file mode 100644 index 000000000000..fe8898a23f90 --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/gapic/transports/cloud_tasks_grpc_transport.py @@ -0,0 +1,422 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2018 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. + +import google.api_core.grpc_helpers + +from google.cloud.tasks_v2beta3.proto import cloudtasks_pb2_grpc + + +class CloudTasksGrpcTransport(object): + """gRPC transport class providing stubs for + google.cloud.tasks.v2beta3 CloudTasks API. + + The transport provides access to the raw gRPC stubs, + which can be used to take advantage of advanced + features of gRPC. + """ + # The scopes needed to make gRPC calls to all of the methods defined + # in this service. + _OAUTH_SCOPES = ('https://www.googleapis.com/auth/cloud-platform', ) + + def __init__(self, + channel=None, + credentials=None, + address='cloudtasks.googleapis.com:443'): + """Instantiate the transport class. + + Args: + channel (grpc.Channel): A ``Channel`` instance through + which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + address (str): The address where the service is hosted. + """ + # If both `channel` and `credentials` are specified, raise an + # exception (channels come with credentials baked in already). + if channel is not None and credentials is not None: + raise ValueError( + 'The `channel` and `credentials` arguments are mutually ' + 'exclusive.', ) + + # Create the channel. + if channel is None: + channel = self.create_channel( + address=address, + credentials=credentials, + ) + + # gRPC uses objects called "stubs" that are bound to the + # channel and provide a basic method for each RPC. + self._stubs = { + 'cloud_tasks_stub': cloudtasks_pb2_grpc.CloudTasksStub(channel), + } + + @classmethod + def create_channel(cls, + address='cloudtasks.googleapis.com:443', + credentials=None): + """Create and return a gRPC channel object. + + Args: + address (str): The host for the channel to use. + credentials (~.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return google.api_core.grpc_helpers.create_channel( + address, + credentials=credentials, + scopes=cls._OAUTH_SCOPES, + ) + + @property + def list_queues(self): + """Return the gRPC stub for {$apiMethod.name}. + + Lists queues. + + Queues are returned in lexicographical order. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].ListQueues + + @property + def get_queue(self): + """Return the gRPC stub for {$apiMethod.name}. + + Gets a queue. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].GetQueue + + @property + def create_queue(self): + """Return the gRPC stub for {$apiMethod.name}. + + Creates a queue. + + Queues created with this method allow tasks to live for a maximum of 31 + days. After a task is 31 days old, the task will be deleted regardless of whether + it was dispatched or not. + + 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 `_ + before using this method. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].CreateQueue + + @property + def update_queue(self): + """Return the gRPC stub for {$apiMethod.name}. + + Updates a queue. + + This method creates the queue if it does not exist and updates + the queue if it does exist. + + Queues created with this method allow tasks to live for a maximum of 31 + days. After a task is 31 days old, the task will be deleted regardless of whether + it was dispatched or not. + + 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 `_ + before using this method. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].UpdateQueue + + @property + def delete_queue(self): + """Return the gRPC stub for {$apiMethod.name}. + + Deletes a queue. + + This command will delete the queue even if it has tasks in it. + + Note: If you delete a queue, a queue with the same name can't be created + for 7 days. + + 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 `_ + before using this method. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].DeleteQueue + + @property + def purge_queue(self): + """Return the gRPC stub for {$apiMethod.name}. + + Purges a queue by deleting all of its tasks. + + All tasks created before this method is called are permanently deleted. + + Purge operations can take up to one minute to take effect. Tasks + might be dispatched before the purge takes effect. A purge is irreversible. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].PurgeQueue + + @property + def pause_queue(self): + """Return the gRPC stub for {$apiMethod.name}. + + Pauses the queue. + + If a queue is paused then the system will stop dispatching tasks + until the queue is resumed via + ``ResumeQueue``. Tasks can still be added + when the queue is paused. A queue is paused if its + ``state`` is ``PAUSED``. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].PauseQueue + + @property + def resume_queue(self): + """Return the gRPC stub for {$apiMethod.name}. + + Resume a queue. + + This method resumes a queue after it has been + ``PAUSED`` or + ``DISABLED``. The state of a queue is stored + in the queue's ``state``; after calling this method it + will be set to ``RUNNING``. + + 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 `_. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].ResumeQueue + + @property + def get_iam_policy(self): + """Return the gRPC stub for {$apiMethod.name}. + + Gets the access control policy for a ``Queue``. + Returns an empty policy if the resource exists and does not have a policy + set. + + Authorization requires the following + `Google IAM `_ permission on the specified + resource parent: + + * ``cloudtasks.queues.getIamPolicy`` + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].GetIamPolicy + + @property + def set_iam_policy(self): + """Return the gRPC stub for {$apiMethod.name}. + + Sets the access control policy for a ``Queue``. Replaces any existing + policy. + + 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 `_ permission on the specified + resource parent: + + * ``cloudtasks.queues.setIamPolicy`` + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].SetIamPolicy + + @property + def test_iam_permissions(self): + """Return the gRPC stub for {$apiMethod.name}. + + Returns permissions that a caller has on a ``Queue``. + If the resource does not exist, this will return an empty set of + permissions, not a ``NOT_FOUND`` error. + + Note: This operation is designed to be used for building permission-aware + UIs and command-line tools, not for authorization checking. This operation + may \"fail open\" without warning. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].TestIamPermissions + + @property + def list_tasks(self): + """Return the gRPC stub for {$apiMethod.name}. + + Lists the tasks in a queue. + + By default, only the ``BASIC`` view is retrieved + due to performance considerations; + ``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 + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].ListTasks + + @property + def get_task(self): + """Return the gRPC stub for {$apiMethod.name}. + + Gets a task. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].GetTask + + @property + def create_task(self): + """Return the gRPC stub for {$apiMethod.name}. + + Creates a task and adds it to a queue. + + Tasks cannot be updated after creation; there is no UpdateTask command. + + * For ``App Engine queues``, the maximum task size is + 100KB. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].CreateTask + + @property + def delete_task(self): + """Return the gRPC stub for {$apiMethod.name}. + + Deletes a task. + + A task can be deleted if it is scheduled or dispatched. A task + cannot be deleted if it has executed successfully or permanently + failed. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].DeleteTask + + @property + def run_task(self): + """Return the gRPC stub for {$apiMethod.name}. + + Forces a task to run now. + + When this method is called, Cloud Tasks will dispatch the task, even if + the task is already running, the queue has reached its ``RateLimits`` or + is ``PAUSED``. + + This command is meant to be used for manual debugging. For + example, ``RunTask`` can be used to retry a failed + task after a fix has been made or to manually force a task to be + dispatched now. + + The dispatched task is returned. That is, the task that is returned + contains the ``status`` after the task is dispatched but + before the task is received by its target. + + If Cloud Tasks receives a successful response from the task's + target, then the task will be deleted; otherwise the task's + ``schedule_time`` will be reset to the time that + ``RunTask`` was called plus the retry delay specified + in the queue's ``RetryConfig``. + + ``RunTask`` returns + ``NOT_FOUND`` when it is called on a + task that has already succeeded or permanently failed. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs['cloud_tasks_stub'].RunTask diff --git a/tasks/google/cloud/tasks_v2beta3/proto/__init__.py b/tasks/google/cloud/tasks_v2beta3/proto/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tasks/google/cloud/tasks_v2beta3/proto/cloudtasks_pb2.py b/tasks/google/cloud/tasks_v2beta3/proto/cloudtasks_pb2.py new file mode 100644 index 000000000000..e74dd705b8be --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/proto/cloudtasks_pb2.py @@ -0,0 +1,1196 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/tasks_v2beta3/proto/cloudtasks.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.cloud.tasks_v2beta3.proto import queue_pb2 as google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2 +from google.cloud.tasks_v2beta3.proto import task_pb2 as google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2 +from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2 +from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2 +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 +from google.rpc import code_pb2 as google_dot_rpc_dot_code__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='google/cloud/tasks_v2beta3/proto/cloudtasks.proto', + package='google.cloud.tasks.v2beta3', + syntax='proto3', + serialized_pb=_b('\n1google/cloud/tasks_v2beta3/proto/cloudtasks.proto\x12\x1agoogle.cloud.tasks.v2beta3\x1a\x1cgoogle/api/annotations.proto\x1a,google/cloud/tasks_v2beta3/proto/queue.proto\x1a+google/cloud/tasks_v2beta3/proto/task.proto\x1a\x1egoogle/iam/v1/iam_policy.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x15google/rpc/code.proto\"Z\n\x11ListQueuesRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t\"`\n\x12ListQueuesResponse\x12\x31\n\x06queues\x18\x01 \x03(\x0b\x32!.google.cloud.tasks.v2beta3.Queue\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\x1f\n\x0fGetQueueRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"V\n\x12\x43reateQueueRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x30\n\x05queue\x18\x02 \x01(\x0b\x32!.google.cloud.tasks.v2beta3.Queue\"w\n\x12UpdateQueueRequest\x12\x30\n\x05queue\x18\x01 \x01(\x0b\x32!.google.cloud.tasks.v2beta3.Queue\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"\"\n\x12\x44\x65leteQueueRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"!\n\x11PurgeQueueRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"!\n\x11PauseQueueRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"\"\n\x12ResumeQueueRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"\x87\x01\n\x10ListTasksRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12<\n\rresponse_view\x18\x02 \x01(\x0e\x32%.google.cloud.tasks.v2beta3.Task.View\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t\"]\n\x11ListTasksResponse\x12/\n\x05tasks\x18\x01 \x03(\x0b\x32 .google.cloud.tasks.v2beta3.Task\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\\\n\x0eGetTaskRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12<\n\rresponse_view\x18\x02 \x01(\x0e\x32%.google.cloud.tasks.v2beta3.Task.View\"\x91\x01\n\x11\x43reateTaskRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12.\n\x04task\x18\x02 \x01(\x0b\x32 .google.cloud.tasks.v2beta3.Task\x12<\n\rresponse_view\x18\x03 \x01(\x0e\x32%.google.cloud.tasks.v2beta3.Task.View\"!\n\x11\x44\x65leteTaskRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"\\\n\x0eRunTaskRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12<\n\rresponse_view\x18\x02 \x01(\x0e\x32%.google.cloud.tasks.v2beta3.Task.View2\xa7\x14\n\nCloudTasks\x12\xa4\x01\n\nListQueues\x12-.google.cloud.tasks.v2beta3.ListQueuesRequest\x1a..google.cloud.tasks.v2beta3.ListQueuesResponse\"7\x82\xd3\xe4\x93\x02\x31\x12//v2beta3/{parent=projects/*/locations/*}/queues\x12\x93\x01\n\x08GetQueue\x12+.google.cloud.tasks.v2beta3.GetQueueRequest\x1a!.google.cloud.tasks.v2beta3.Queue\"7\x82\xd3\xe4\x93\x02\x31\x12//v2beta3/{name=projects/*/locations/*/queues/*}\x12\xa0\x01\n\x0b\x43reateQueue\x12..google.cloud.tasks.v2beta3.CreateQueueRequest\x1a!.google.cloud.tasks.v2beta3.Queue\">\x82\xd3\xe4\x93\x02\x38\"//v2beta3/{parent=projects/*/locations/*}/queues:\x05queue\x12\xa6\x01\n\x0bUpdateQueue\x12..google.cloud.tasks.v2beta3.UpdateQueueRequest\x1a!.google.cloud.tasks.v2beta3.Queue\"D\x82\xd3\xe4\x93\x02>25/v2beta3/{queue.name=projects/*/locations/*/queues/*}:\x05queue\x12\x8e\x01\n\x0b\x44\x65leteQueue\x12..google.cloud.tasks.v2beta3.DeleteQueueRequest\x1a\x16.google.protobuf.Empty\"7\x82\xd3\xe4\x93\x02\x31*//v2beta3/{name=projects/*/locations/*/queues/*}\x12\xa0\x01\n\nPurgeQueue\x12-.google.cloud.tasks.v2beta3.PurgeQueueRequest\x1a!.google.cloud.tasks.v2beta3.Queue\"@\x82\xd3\xe4\x93\x02:\"5/v2beta3/{name=projects/*/locations/*/queues/*}:purge:\x01*\x12\xa0\x01\n\nPauseQueue\x12-.google.cloud.tasks.v2beta3.PauseQueueRequest\x1a!.google.cloud.tasks.v2beta3.Queue\"@\x82\xd3\xe4\x93\x02:\"5/v2beta3/{name=projects/*/locations/*/queues/*}:pause:\x01*\x12\xa3\x01\n\x0bResumeQueue\x12..google.cloud.tasks.v2beta3.ResumeQueueRequest\x1a!.google.cloud.tasks.v2beta3.Queue\"A\x82\xd3\xe4\x93\x02;\"6/v2beta3/{name=projects/*/locations/*/queues/*}:resume:\x01*\x12\x96\x01\n\x0cGetIamPolicy\x12\".google.iam.v1.GetIamPolicyRequest\x1a\x15.google.iam.v1.Policy\"K\x82\xd3\xe4\x93\x02\x45\"@/v2beta3/{resource=projects/*/locations/*/queues/*}:getIamPolicy:\x01*\x12\x96\x01\n\x0cSetIamPolicy\x12\".google.iam.v1.SetIamPolicyRequest\x1a\x15.google.iam.v1.Policy\"K\x82\xd3\xe4\x93\x02\x45\"@/v2beta3/{resource=projects/*/locations/*/queues/*}:setIamPolicy:\x01*\x12\xbc\x01\n\x12TestIamPermissions\x12(.google.iam.v1.TestIamPermissionsRequest\x1a).google.iam.v1.TestIamPermissionsResponse\"Q\x82\xd3\xe4\x93\x02K\"F/v2beta3/{resource=projects/*/locations/*/queues/*}:testIamPermissions:\x01*\x12\xa9\x01\n\tListTasks\x12,.google.cloud.tasks.v2beta3.ListTasksRequest\x1a-.google.cloud.tasks.v2beta3.ListTasksResponse\"?\x82\xd3\xe4\x93\x02\x39\x12\x37/v2beta3/{parent=projects/*/locations/*/queues/*}/tasks\x12\x98\x01\n\x07GetTask\x12*.google.cloud.tasks.v2beta3.GetTaskRequest\x1a .google.cloud.tasks.v2beta3.Task\"?\x82\xd3\xe4\x93\x02\x39\x12\x37/v2beta3/{name=projects/*/locations/*/queues/*/tasks/*}\x12\xa1\x01\n\nCreateTask\x12-.google.cloud.tasks.v2beta3.CreateTaskRequest\x1a .google.cloud.tasks.v2beta3.Task\"B\x82\xd3\xe4\x93\x02<\"7/v2beta3/{parent=projects/*/locations/*/queues/*}/tasks:\x01*\x12\x94\x01\n\nDeleteTask\x12-.google.cloud.tasks.v2beta3.DeleteTaskRequest\x1a\x16.google.protobuf.Empty\"?\x82\xd3\xe4\x93\x02\x39*7/v2beta3/{name=projects/*/locations/*/queues/*/tasks/*}\x12\x9f\x01\n\x07RunTask\x12*.google.cloud.tasks.v2beta3.RunTaskRequest\x1a .google.cloud.tasks.v2beta3.Task\"F\x82\xd3\xe4\x93\x02@\";/v2beta3/{name=projects/*/locations/*/queues/*/tasks/*}:run:\x01*B|\n\x1e\x63om.google.cloud.tasks.v2beta3B\x0f\x43loudTasksProtoP\x01Z?google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks\xa2\x02\x05TASKSb\x06proto3') + , + dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.DESCRIPTOR,google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2.DESCRIPTOR,google_dot_iam_dot_v1_dot_iam__policy__pb2.DESCRIPTOR,google_dot_iam_dot_v1_dot_policy__pb2.DESCRIPTOR,google_dot_protobuf_dot_empty__pb2.DESCRIPTOR,google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR,google_dot_rpc_dot_code__pb2.DESCRIPTOR,]) + + + + +_LISTQUEUESREQUEST = _descriptor.Descriptor( + name='ListQueuesRequest', + full_name='google.cloud.tasks.v2beta3.ListQueuesRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='parent', full_name='google.cloud.tasks.v2beta3.ListQueuesRequest.parent', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='filter', full_name='google.cloud.tasks.v2beta3.ListQueuesRequest.filter', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='page_size', full_name='google.cloud.tasks.v2beta3.ListQueuesRequest.page_size', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='page_token', full_name='google.cloud.tasks.v2beta3.ListQueuesRequest.page_token', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=348, + serialized_end=438, +) + + +_LISTQUEUESRESPONSE = _descriptor.Descriptor( + name='ListQueuesResponse', + full_name='google.cloud.tasks.v2beta3.ListQueuesResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='queues', full_name='google.cloud.tasks.v2beta3.ListQueuesResponse.queues', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='next_page_token', full_name='google.cloud.tasks.v2beta3.ListQueuesResponse.next_page_token', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=440, + serialized_end=536, +) + + +_GETQUEUEREQUEST = _descriptor.Descriptor( + name='GetQueueRequest', + full_name='google.cloud.tasks.v2beta3.GetQueueRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.GetQueueRequest.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=538, + serialized_end=569, +) + + +_CREATEQUEUEREQUEST = _descriptor.Descriptor( + name='CreateQueueRequest', + full_name='google.cloud.tasks.v2beta3.CreateQueueRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='parent', full_name='google.cloud.tasks.v2beta3.CreateQueueRequest.parent', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='queue', full_name='google.cloud.tasks.v2beta3.CreateQueueRequest.queue', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=571, + serialized_end=657, +) + + +_UPDATEQUEUEREQUEST = _descriptor.Descriptor( + name='UpdateQueueRequest', + full_name='google.cloud.tasks.v2beta3.UpdateQueueRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='queue', full_name='google.cloud.tasks.v2beta3.UpdateQueueRequest.queue', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='update_mask', full_name='google.cloud.tasks.v2beta3.UpdateQueueRequest.update_mask', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=659, + serialized_end=778, +) + + +_DELETEQUEUEREQUEST = _descriptor.Descriptor( + name='DeleteQueueRequest', + full_name='google.cloud.tasks.v2beta3.DeleteQueueRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.DeleteQueueRequest.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=780, + serialized_end=814, +) + + +_PURGEQUEUEREQUEST = _descriptor.Descriptor( + name='PurgeQueueRequest', + full_name='google.cloud.tasks.v2beta3.PurgeQueueRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.PurgeQueueRequest.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=816, + serialized_end=849, +) + + +_PAUSEQUEUEREQUEST = _descriptor.Descriptor( + name='PauseQueueRequest', + full_name='google.cloud.tasks.v2beta3.PauseQueueRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.PauseQueueRequest.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=851, + serialized_end=884, +) + + +_RESUMEQUEUEREQUEST = _descriptor.Descriptor( + name='ResumeQueueRequest', + full_name='google.cloud.tasks.v2beta3.ResumeQueueRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.ResumeQueueRequest.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=886, + serialized_end=920, +) + + +_LISTTASKSREQUEST = _descriptor.Descriptor( + name='ListTasksRequest', + full_name='google.cloud.tasks.v2beta3.ListTasksRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='parent', full_name='google.cloud.tasks.v2beta3.ListTasksRequest.parent', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='response_view', full_name='google.cloud.tasks.v2beta3.ListTasksRequest.response_view', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='page_size', full_name='google.cloud.tasks.v2beta3.ListTasksRequest.page_size', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='page_token', full_name='google.cloud.tasks.v2beta3.ListTasksRequest.page_token', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=923, + serialized_end=1058, +) + + +_LISTTASKSRESPONSE = _descriptor.Descriptor( + name='ListTasksResponse', + full_name='google.cloud.tasks.v2beta3.ListTasksResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='tasks', full_name='google.cloud.tasks.v2beta3.ListTasksResponse.tasks', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='next_page_token', full_name='google.cloud.tasks.v2beta3.ListTasksResponse.next_page_token', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1060, + serialized_end=1153, +) + + +_GETTASKREQUEST = _descriptor.Descriptor( + name='GetTaskRequest', + full_name='google.cloud.tasks.v2beta3.GetTaskRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.GetTaskRequest.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='response_view', full_name='google.cloud.tasks.v2beta3.GetTaskRequest.response_view', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1155, + serialized_end=1247, +) + + +_CREATETASKREQUEST = _descriptor.Descriptor( + name='CreateTaskRequest', + full_name='google.cloud.tasks.v2beta3.CreateTaskRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='parent', full_name='google.cloud.tasks.v2beta3.CreateTaskRequest.parent', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='task', full_name='google.cloud.tasks.v2beta3.CreateTaskRequest.task', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='response_view', full_name='google.cloud.tasks.v2beta3.CreateTaskRequest.response_view', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1250, + serialized_end=1395, +) + + +_DELETETASKREQUEST = _descriptor.Descriptor( + name='DeleteTaskRequest', + full_name='google.cloud.tasks.v2beta3.DeleteTaskRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.DeleteTaskRequest.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1397, + serialized_end=1430, +) + + +_RUNTASKREQUEST = _descriptor.Descriptor( + name='RunTaskRequest', + full_name='google.cloud.tasks.v2beta3.RunTaskRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.RunTaskRequest.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='response_view', full_name='google.cloud.tasks.v2beta3.RunTaskRequest.response_view', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1432, + serialized_end=1524, +) + +_LISTQUEUESRESPONSE.fields_by_name['queues'].message_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2._QUEUE +_CREATEQUEUEREQUEST.fields_by_name['queue'].message_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2._QUEUE +_UPDATEQUEUEREQUEST.fields_by_name['queue'].message_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2._QUEUE +_UPDATEQUEUEREQUEST.fields_by_name['update_mask'].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK +_LISTTASKSREQUEST.fields_by_name['response_view'].enum_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2._TASK_VIEW +_LISTTASKSRESPONSE.fields_by_name['tasks'].message_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2._TASK +_GETTASKREQUEST.fields_by_name['response_view'].enum_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2._TASK_VIEW +_CREATETASKREQUEST.fields_by_name['task'].message_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2._TASK +_CREATETASKREQUEST.fields_by_name['response_view'].enum_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2._TASK_VIEW +_RUNTASKREQUEST.fields_by_name['response_view'].enum_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2._TASK_VIEW +DESCRIPTOR.message_types_by_name['ListQueuesRequest'] = _LISTQUEUESREQUEST +DESCRIPTOR.message_types_by_name['ListQueuesResponse'] = _LISTQUEUESRESPONSE +DESCRIPTOR.message_types_by_name['GetQueueRequest'] = _GETQUEUEREQUEST +DESCRIPTOR.message_types_by_name['CreateQueueRequest'] = _CREATEQUEUEREQUEST +DESCRIPTOR.message_types_by_name['UpdateQueueRequest'] = _UPDATEQUEUEREQUEST +DESCRIPTOR.message_types_by_name['DeleteQueueRequest'] = _DELETEQUEUEREQUEST +DESCRIPTOR.message_types_by_name['PurgeQueueRequest'] = _PURGEQUEUEREQUEST +DESCRIPTOR.message_types_by_name['PauseQueueRequest'] = _PAUSEQUEUEREQUEST +DESCRIPTOR.message_types_by_name['ResumeQueueRequest'] = _RESUMEQUEUEREQUEST +DESCRIPTOR.message_types_by_name['ListTasksRequest'] = _LISTTASKSREQUEST +DESCRIPTOR.message_types_by_name['ListTasksResponse'] = _LISTTASKSRESPONSE +DESCRIPTOR.message_types_by_name['GetTaskRequest'] = _GETTASKREQUEST +DESCRIPTOR.message_types_by_name['CreateTaskRequest'] = _CREATETASKREQUEST +DESCRIPTOR.message_types_by_name['DeleteTaskRequest'] = _DELETETASKREQUEST +DESCRIPTOR.message_types_by_name['RunTaskRequest'] = _RUNTASKREQUEST +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +ListQueuesRequest = _reflection.GeneratedProtocolMessageType('ListQueuesRequest', (_message.Message,), dict( + DESCRIPTOR = _LISTQUEUESREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for + [ListQueues][google.cloud.tasks.v2beta3.CloudTasks.ListQueues]. + + + Attributes: + parent: + Required. The location name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID`` + filter: + ``filter`` can be used to specify a subset of queues. Any + [Queue][google.cloud.tasks.v2beta3.Queue] field can be used as + a filter and several operators as supported. For example: + ``<=, <, >=, >, !=, =, :``. The filter syntax is the same as + described in `Stackdriver's Advanced Logs Filters `_. Sample + filter "state: PAUSED". Note that using filters might cause + fewer queues than the requested page\_size to be returned. + page_size: + Requested page size. The maximum page size is 9800. If + unspecified, the page size will be the maximum. Fewer queues + than requested might be returned, even if more queues exist; + use the [next\_page\_token][google.cloud.tasks.v2beta3.ListQue + uesResponse.next\_page\_token] in the response to determine if + more queues exist. + page_token: + A token identifying the page of results to return. To request + the first page results, page\_token must be empty. To request + the next page of results, page\_token must be the value of [ne + xt\_page\_token][google.cloud.tasks.v2beta3.ListQueuesResponse + .next\_page\_token] returned from the previous call to + [ListQueues][google.cloud.tasks.v2beta3.CloudTasks.ListQueues] + method. It is an error to switch the value of the + [filter][google.cloud.tasks.v2beta3.ListQueuesRequest.filter] + while iterating through pages. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.ListQueuesRequest) + )) +_sym_db.RegisterMessage(ListQueuesRequest) + +ListQueuesResponse = _reflection.GeneratedProtocolMessageType('ListQueuesResponse', (_message.Message,), dict( + DESCRIPTOR = _LISTQUEUESRESPONSE, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Response message for + [ListQueues][google.cloud.tasks.v2beta3.CloudTasks.ListQueues]. + + + Attributes: + queues: + The list of queues. + next_page_token: + A token to retrieve next page of results. To return the next + page of results, call + [ListQueues][google.cloud.tasks.v2beta3.CloudTasks.ListQueues] + with this value as the [page\_token][google.cloud.tasks.v2beta + 3.ListQueuesRequest.page\_token]. If the next\_page\_token is + empty, there are no more results. The page token is valid for + only 2 hours. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.ListQueuesResponse) + )) +_sym_db.RegisterMessage(ListQueuesResponse) + +GetQueueRequest = _reflection.GeneratedProtocolMessageType('GetQueueRequest', (_message.Message,), dict( + DESCRIPTOR = _GETQUEUEREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for + [GetQueue][google.cloud.tasks.v2beta3.CloudTasks.GetQueue]. + + + Attributes: + name: + Required. The resource name of the queue. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`` + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.GetQueueRequest) + )) +_sym_db.RegisterMessage(GetQueueRequest) + +CreateQueueRequest = _reflection.GeneratedProtocolMessageType('CreateQueueRequest', (_message.Message,), dict( + DESCRIPTOR = _CREATEQUEUEREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for + [CreateQueue][google.cloud.tasks.v2beta3.CloudTasks.CreateQueue]. + + + Attributes: + parent: + Required. The location name in which the queue will be + created. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID`` The list of + allowed locations can be obtained by calling Cloud Tasks' + implementation of [ListLocations][google.cloud.location.Locati + ons.ListLocations]. + queue: + Required. The queue to create. [Queue's + name][google.cloud.tasks.v2beta3.Queue.name] cannot be the + same as an existing queue. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.CreateQueueRequest) + )) +_sym_db.RegisterMessage(CreateQueueRequest) + +UpdateQueueRequest = _reflection.GeneratedProtocolMessageType('UpdateQueueRequest', (_message.Message,), dict( + DESCRIPTOR = _UPDATEQUEUEREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for + [UpdateQueue][google.cloud.tasks.v2beta3.CloudTasks.UpdateQueue]. + + + Attributes: + queue: + Required. The queue to create or update. The queue's + [name][google.cloud.tasks.v2beta3.Queue.name] must be + specified. Output only fields cannot be modified using + UpdateQueue. Any value specified for an output only field will + be ignored. The queue's + [name][google.cloud.tasks.v2beta3.Queue.name] cannot be + changed. + update_mask: + A mask used to specify which fields of the queue are being + updated. If empty, then all fields will be updated. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.UpdateQueueRequest) + )) +_sym_db.RegisterMessage(UpdateQueueRequest) + +DeleteQueueRequest = _reflection.GeneratedProtocolMessageType('DeleteQueueRequest', (_message.Message,), dict( + DESCRIPTOR = _DELETEQUEUEREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for + [DeleteQueue][google.cloud.tasks.v2beta3.CloudTasks.DeleteQueue]. + + + Attributes: + name: + Required. The queue name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`` + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.DeleteQueueRequest) + )) +_sym_db.RegisterMessage(DeleteQueueRequest) + +PurgeQueueRequest = _reflection.GeneratedProtocolMessageType('PurgeQueueRequest', (_message.Message,), dict( + DESCRIPTOR = _PURGEQUEUEREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for + [PurgeQueue][google.cloud.tasks.v2beta3.CloudTasks.PurgeQueue]. + + + Attributes: + name: + Required. The queue name. For example: + ``projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`` + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.PurgeQueueRequest) + )) +_sym_db.RegisterMessage(PurgeQueueRequest) + +PauseQueueRequest = _reflection.GeneratedProtocolMessageType('PauseQueueRequest', (_message.Message,), dict( + DESCRIPTOR = _PAUSEQUEUEREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for + [PauseQueue][google.cloud.tasks.v2beta3.CloudTasks.PauseQueue]. + + + Attributes: + name: + Required. The queue name. For example: + ``projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`` + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.PauseQueueRequest) + )) +_sym_db.RegisterMessage(PauseQueueRequest) + +ResumeQueueRequest = _reflection.GeneratedProtocolMessageType('ResumeQueueRequest', (_message.Message,), dict( + DESCRIPTOR = _RESUMEQUEUEREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for + [ResumeQueue][google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue]. + + + Attributes: + name: + Required. The queue name. For example: + ``projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`` + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.ResumeQueueRequest) + )) +_sym_db.RegisterMessage(ResumeQueueRequest) + +ListTasksRequest = _reflection.GeneratedProtocolMessageType('ListTasksRequest', (_message.Message,), dict( + DESCRIPTOR = _LISTTASKSREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for listing tasks using + [ListTasks][google.cloud.tasks.v2beta3.CloudTasks.ListTasks]. + + + Attributes: + parent: + Required. The queue name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`` + response_view: + The response\_view specifies which subset of the + [Task][google.cloud.tasks.v2beta3.Task] will be returned. By + default response\_view is + [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]; 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. Authorization for + [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires + ``cloudtasks.tasks.fullView`` `Google IAM + `_ permission on the + [Task][google.cloud.tasks.v2beta3.Task] resource. + page_size: + Requested page size. Fewer tasks than requested might be + returned. The maximum page size is 1000. If unspecified, the + page size will be the maximum. Fewer tasks than requested + might be returned, even if more tasks exist; use [next\_page\_ + token][google.cloud.tasks.v2beta3.ListTasksResponse.next\_page + \_token] in the response to determine if more tasks exist. + page_token: + A token identifying the page of results to return. To request + the first page results, page\_token must be empty. To request + the next page of results, page\_token must be the value of [ne + xt\_page\_token][google.cloud.tasks.v2beta3.ListTasksResponse. + next\_page\_token] returned from the previous call to + [ListTasks][google.cloud.tasks.v2beta3.CloudTasks.ListTasks] + method. The page token is valid for only 2 hours. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.ListTasksRequest) + )) +_sym_db.RegisterMessage(ListTasksRequest) + +ListTasksResponse = _reflection.GeneratedProtocolMessageType('ListTasksResponse', (_message.Message,), dict( + DESCRIPTOR = _LISTTASKSRESPONSE, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Response message for listing tasks using + [ListTasks][google.cloud.tasks.v2beta3.CloudTasks.ListTasks]. + + + Attributes: + tasks: + The list of tasks. + next_page_token: + A token to retrieve next page of results. To return the next + page of results, call + [ListTasks][google.cloud.tasks.v2beta3.CloudTasks.ListTasks] + with this value as the [page\_token][google.cloud.tasks.v2beta + 3.ListTasksRequest.page\_token]. If the next\_page\_token is + empty, there are no more results. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.ListTasksResponse) + )) +_sym_db.RegisterMessage(ListTasksResponse) + +GetTaskRequest = _reflection.GeneratedProtocolMessageType('GetTaskRequest', (_message.Message,), dict( + DESCRIPTOR = _GETTASKREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for getting a task using + [GetTask][google.cloud.tasks.v2beta3.CloudTasks.GetTask]. + + + Attributes: + name: + Required. The task name. For example: ``projects/PROJECT_ID/l + ocations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`` + response_view: + The response\_view specifies which subset of the + [Task][google.cloud.tasks.v2beta3.Task] will be returned. By + default response\_view is + [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]; 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. Authorization for + [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires + ``cloudtasks.tasks.fullView`` `Google IAM + `_ permission on the + [Task][google.cloud.tasks.v2beta3.Task] resource. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.GetTaskRequest) + )) +_sym_db.RegisterMessage(GetTaskRequest) + +CreateTaskRequest = _reflection.GeneratedProtocolMessageType('CreateTaskRequest', (_message.Message,), dict( + DESCRIPTOR = _CREATETASKREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for + [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. + + + Attributes: + parent: + Required. The queue name. For example: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`` + The queue must already exist. + task: + Required. The task to add. Task names have the following + format: ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUE + UE_ID/tasks/TASK_ID``. The user can optionally specify a task + [name][google.cloud.tasks.v2beta3.Task.name]. If a name is not + specified then the system will generate a random unique task + id, which will be set in the task returned in the + [response][google.cloud.tasks.v2beta3.Task.name]. If [schedul + e\_time][google.cloud.tasks.v2beta3.Task.schedule\_time] is + not set or is in the past then Cloud Tasks will set it to the + current time. Task De-duplication: Explicitly specifying a + task ID enables task de-duplication. If a task's ID is + identical to that of an existing task or a task that was + deleted or executed recently then the call will fail with + [ALREADY\_EXISTS][google.rpc.Code.ALREADY\_EXISTS]. If the + task's queue was created using Cloud Tasks, then another task + with the same name can't be created for ~1hour after the + original task was deleted or executed. If the task's queue was + created using queue.yaml or queue.xml, then another task with + the same name can't be created for ~9days after the original + task was deleted or executed. Because there is an extra + lookup cost to identify duplicate task names, these + [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask] + calls have significantly increased latency. Using hashed + strings for the task id or for the prefix of the task id is + recommended. Choosing task ids that are sequential or have + sequential prefixes, for example using a timestamp, causes an + increase in latency and error rates in all task commands. The + infrastructure relies on an approximately uniform distribution + of task ids to store and serve tasks efficiently. + response_view: + The response\_view specifies which subset of the + [Task][google.cloud.tasks.v2beta3.Task] will be returned. By + default response\_view is + [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]; 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. Authorization for + [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires + ``cloudtasks.tasks.fullView`` `Google IAM + `_ permission on the + [Task][google.cloud.tasks.v2beta3.Task] resource. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.CreateTaskRequest) + )) +_sym_db.RegisterMessage(CreateTaskRequest) + +DeleteTaskRequest = _reflection.GeneratedProtocolMessageType('DeleteTaskRequest', (_message.Message,), dict( + DESCRIPTOR = _DELETETASKREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for deleting a task using + [DeleteTask][google.cloud.tasks.v2beta3.CloudTasks.DeleteTask]. + + + Attributes: + name: + Required. The task name. For example: ``projects/PROJECT_ID/l + ocations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`` + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.DeleteTaskRequest) + )) +_sym_db.RegisterMessage(DeleteTaskRequest) + +RunTaskRequest = _reflection.GeneratedProtocolMessageType('RunTaskRequest', (_message.Message,), dict( + DESCRIPTOR = _RUNTASKREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.cloudtasks_pb2' + , + __doc__ = """Request message for forcing a task to run now using + [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask]. + + + Attributes: + name: + Required. The task name. For example: ``projects/PROJECT_ID/l + ocations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`` + response_view: + The response\_view specifies which subset of the + [Task][google.cloud.tasks.v2beta3.Task] will be returned. By + default response\_view is + [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]; 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. Authorization for + [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires + ``cloudtasks.tasks.fullView`` `Google IAM + `_ permission on the + [Task][google.cloud.tasks.v2beta3.Task] resource. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.RunTaskRequest) + )) +_sym_db.RegisterMessage(RunTaskRequest) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\036com.google.cloud.tasks.v2beta3B\017CloudTasksProtoP\001Z?google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks\242\002\005TASKS')) + +_CLOUDTASKS = _descriptor.ServiceDescriptor( + name='CloudTasks', + full_name='google.cloud.tasks.v2beta3.CloudTasks', + file=DESCRIPTOR, + index=0, + options=None, + serialized_start=1527, + serialized_end=4126, + methods=[ + _descriptor.MethodDescriptor( + name='ListQueues', + full_name='google.cloud.tasks.v2beta3.CloudTasks.ListQueues', + index=0, + containing_service=None, + input_type=_LISTQUEUESREQUEST, + output_type=_LISTQUEUESRESPONSE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\0021\022//v2beta3/{parent=projects/*/locations/*}/queues')), + ), + _descriptor.MethodDescriptor( + name='GetQueue', + full_name='google.cloud.tasks.v2beta3.CloudTasks.GetQueue', + index=1, + containing_service=None, + input_type=_GETQUEUEREQUEST, + output_type=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2._QUEUE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\0021\022//v2beta3/{name=projects/*/locations/*/queues/*}')), + ), + _descriptor.MethodDescriptor( + name='CreateQueue', + full_name='google.cloud.tasks.v2beta3.CloudTasks.CreateQueue', + index=2, + containing_service=None, + input_type=_CREATEQUEUEREQUEST, + output_type=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2._QUEUE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\0028\"//v2beta3/{parent=projects/*/locations/*}/queues:\005queue')), + ), + _descriptor.MethodDescriptor( + name='UpdateQueue', + full_name='google.cloud.tasks.v2beta3.CloudTasks.UpdateQueue', + index=3, + containing_service=None, + input_type=_UPDATEQUEUEREQUEST, + output_type=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2._QUEUE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002>25/v2beta3/{queue.name=projects/*/locations/*/queues/*}:\005queue')), + ), + _descriptor.MethodDescriptor( + name='DeleteQueue', + full_name='google.cloud.tasks.v2beta3.CloudTasks.DeleteQueue', + index=4, + containing_service=None, + input_type=_DELETEQUEUEREQUEST, + output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\0021*//v2beta3/{name=projects/*/locations/*/queues/*}')), + ), + _descriptor.MethodDescriptor( + name='PurgeQueue', + full_name='google.cloud.tasks.v2beta3.CloudTasks.PurgeQueue', + index=5, + containing_service=None, + input_type=_PURGEQUEUEREQUEST, + output_type=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2._QUEUE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002:\"5/v2beta3/{name=projects/*/locations/*/queues/*}:purge:\001*')), + ), + _descriptor.MethodDescriptor( + name='PauseQueue', + full_name='google.cloud.tasks.v2beta3.CloudTasks.PauseQueue', + index=6, + containing_service=None, + input_type=_PAUSEQUEUEREQUEST, + output_type=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2._QUEUE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002:\"5/v2beta3/{name=projects/*/locations/*/queues/*}:pause:\001*')), + ), + _descriptor.MethodDescriptor( + name='ResumeQueue', + full_name='google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue', + index=7, + containing_service=None, + input_type=_RESUMEQUEUEREQUEST, + output_type=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2._QUEUE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002;\"6/v2beta3/{name=projects/*/locations/*/queues/*}:resume:\001*')), + ), + _descriptor.MethodDescriptor( + name='GetIamPolicy', + full_name='google.cloud.tasks.v2beta3.CloudTasks.GetIamPolicy', + index=8, + containing_service=None, + input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._GETIAMPOLICYREQUEST, + output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002E\"@/v2beta3/{resource=projects/*/locations/*/queues/*}:getIamPolicy:\001*')), + ), + _descriptor.MethodDescriptor( + name='SetIamPolicy', + full_name='google.cloud.tasks.v2beta3.CloudTasks.SetIamPolicy', + index=9, + containing_service=None, + input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._SETIAMPOLICYREQUEST, + output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002E\"@/v2beta3/{resource=projects/*/locations/*/queues/*}:setIamPolicy:\001*')), + ), + _descriptor.MethodDescriptor( + name='TestIamPermissions', + full_name='google.cloud.tasks.v2beta3.CloudTasks.TestIamPermissions', + index=10, + containing_service=None, + input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSREQUEST, + output_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSRESPONSE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002K\"F/v2beta3/{resource=projects/*/locations/*/queues/*}:testIamPermissions:\001*')), + ), + _descriptor.MethodDescriptor( + name='ListTasks', + full_name='google.cloud.tasks.v2beta3.CloudTasks.ListTasks', + index=11, + containing_service=None, + input_type=_LISTTASKSREQUEST, + output_type=_LISTTASKSRESPONSE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\0029\0227/v2beta3/{parent=projects/*/locations/*/queues/*}/tasks')), + ), + _descriptor.MethodDescriptor( + name='GetTask', + full_name='google.cloud.tasks.v2beta3.CloudTasks.GetTask', + index=12, + containing_service=None, + input_type=_GETTASKREQUEST, + output_type=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2._TASK, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\0029\0227/v2beta3/{name=projects/*/locations/*/queues/*/tasks/*}')), + ), + _descriptor.MethodDescriptor( + name='CreateTask', + full_name='google.cloud.tasks.v2beta3.CloudTasks.CreateTask', + index=13, + containing_service=None, + input_type=_CREATETASKREQUEST, + output_type=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2._TASK, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002<\"7/v2beta3/{parent=projects/*/locations/*/queues/*}/tasks:\001*')), + ), + _descriptor.MethodDescriptor( + name='DeleteTask', + full_name='google.cloud.tasks.v2beta3.CloudTasks.DeleteTask', + index=14, + containing_service=None, + input_type=_DELETETASKREQUEST, + output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\0029*7/v2beta3/{name=projects/*/locations/*/queues/*/tasks/*}')), + ), + _descriptor.MethodDescriptor( + name='RunTask', + full_name='google.cloud.tasks.v2beta3.CloudTasks.RunTask', + index=15, + containing_service=None, + input_type=_RUNTASKREQUEST, + output_type=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2._TASK, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002@\";/v2beta3/{name=projects/*/locations/*/queues/*/tasks/*}:run:\001*')), + ), +]) +_sym_db.RegisterServiceDescriptor(_CLOUDTASKS) + +DESCRIPTOR.services_by_name['CloudTasks'] = _CLOUDTASKS + +# @@protoc_insertion_point(module_scope) diff --git a/tasks/google/cloud/tasks_v2beta3/proto/cloudtasks_pb2_grpc.py b/tasks/google/cloud/tasks_v2beta3/proto/cloudtasks_pb2_grpc.py new file mode 100644 index 000000000000..d69cf60e6211 --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/proto/cloudtasks_pb2_grpc.py @@ -0,0 +1,430 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + +from google.cloud.tasks_v2beta3.proto import cloudtasks_pb2 as google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2 +from google.cloud.tasks_v2beta3.proto import queue_pb2 as google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2 +from google.cloud.tasks_v2beta3.proto import task_pb2 as google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2 +from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2 +from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2 +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 + + +class CloudTasksStub(object): + """Cloud Tasks allows developers to manage the execution of background + work in their applications. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.ListQueues = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/ListQueues', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ListQueuesRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ListQueuesResponse.FromString, + ) + self.GetQueue = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/GetQueue', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.GetQueueRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.FromString, + ) + self.CreateQueue = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/CreateQueue', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.CreateQueueRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.FromString, + ) + self.UpdateQueue = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/UpdateQueue', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.UpdateQueueRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.FromString, + ) + self.DeleteQueue = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/DeleteQueue', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.DeleteQueueRequest.SerializeToString, + response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + ) + self.PurgeQueue = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/PurgeQueue', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.PurgeQueueRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.FromString, + ) + self.PauseQueue = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/PauseQueue', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.PauseQueueRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.FromString, + ) + self.ResumeQueue = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/ResumeQueue', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ResumeQueueRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.FromString, + ) + self.GetIamPolicy = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/GetIamPolicy', + request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.SerializeToString, + response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString, + ) + self.SetIamPolicy = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/SetIamPolicy', + request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.SerializeToString, + response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString, + ) + self.TestIamPermissions = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/TestIamPermissions', + request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.SerializeToString, + response_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.FromString, + ) + self.ListTasks = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/ListTasks', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ListTasksRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ListTasksResponse.FromString, + ) + self.GetTask = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/GetTask', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.GetTaskRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2.Task.FromString, + ) + self.CreateTask = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/CreateTask', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.CreateTaskRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2.Task.FromString, + ) + self.DeleteTask = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/DeleteTask', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.DeleteTaskRequest.SerializeToString, + response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + ) + self.RunTask = channel.unary_unary( + '/google.cloud.tasks.v2beta3.CloudTasks/RunTask', + request_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.RunTaskRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2.Task.FromString, + ) + + +class CloudTasksServicer(object): + """Cloud Tasks allows developers to manage the execution of background + work in their applications. + """ + + def ListQueues(self, request, context): + """Lists queues. + + Queues are returned in lexicographical order. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetQueue(self, request, context): + """Gets a queue. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def CreateQueue(self, request, context): + """Creates a queue. + + Queues created with this method allow tasks to live for a maximum of 31 + days. After a task is 31 days old, the task will be deleted regardless of whether + it was dispatched or not. + + 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/tasks/docs/queue-yaml) + before using this method. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def UpdateQueue(self, request, context): + """Updates a queue. + + This method creates the queue if it does not exist and updates + the queue if it does exist. + + Queues created with this method allow tasks to live for a maximum of 31 + days. After a task is 31 days old, the task will be deleted regardless of whether + it was dispatched or not. + + 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/tasks/docs/queue-yaml) + before using this method. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def DeleteQueue(self, request, context): + """Deletes a queue. + + This command will delete the queue even if it has tasks in it. + + Note: If you delete a queue, a queue with the same name can't be created + for 7 days. + + 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/tasks/docs/queue-yaml) + before using this method. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def PurgeQueue(self, request, context): + """Purges a queue by deleting all of its tasks. + + All tasks created before this method is called are permanently deleted. + + Purge operations can take up to one minute to take effect. Tasks + might be dispatched before the purge takes effect. A purge is irreversible. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def PauseQueue(self, request, context): + """Pauses the queue. + + If a queue is paused then the system will stop dispatching tasks + until the queue is resumed via + [ResumeQueue][google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue]. Tasks can still be added + when the queue is paused. A queue is paused if its + [state][google.cloud.tasks.v2beta3.Queue.state] is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED]. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ResumeQueue(self, request, context): + """Resume a queue. + + This method resumes a queue after it has been + [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED] or + [DISABLED][google.cloud.tasks.v2beta3.Queue.State.DISABLED]. The state of a queue is stored + in the queue's [state][google.cloud.tasks.v2beta3.Queue.state]; after calling this method it + will be set to [RUNNING][google.cloud.tasks.v2beta3.Queue.State.RUNNING]. + + 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/tasks/docs/manage-cloud-task-scaling). + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetIamPolicy(self, request, context): + """Gets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. + 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: + + * `cloudtasks.queues.getIamPolicy` + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetIamPolicy(self, request, context): + """Sets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. Replaces any existing + policy. + + 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: + + * `cloudtasks.queues.setIamPolicy` + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def TestIamPermissions(self, request, context): + """Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2beta3.Queue]. + If the resource does not exist, this will return an empty set of + permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. + + Note: This operation is designed to be used for building permission-aware + UIs and command-line tools, not for authorization checking. This operation + may "fail open" without warning. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ListTasks(self, request, context): + """Lists the tasks in a queue. + + By default, only the [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC] view is retrieved + due to performance considerations; + [response_view][google.cloud.tasks.v2beta3.ListTasksRequest.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. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetTask(self, request, context): + """Gets a task. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def CreateTask(self, request, context): + """Creates a task and adds it to a queue. + + Tasks cannot be updated after creation; there is no UpdateTask command. + + * For [App Engine queues][google.cloud.tasks.v2beta3.AppEngineHttpQueue], the maximum task size is + 100KB. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def DeleteTask(self, request, context): + """Deletes a task. + + A task can be deleted if it is scheduled or dispatched. A task + cannot be deleted if it has executed successfully or permanently + failed. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RunTask(self, request, context): + """Forces a task to run now. + + When this method is called, Cloud Tasks will dispatch the task, even if + the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2beta3.RateLimits] or + is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED]. + + This command is meant to be used for manual debugging. For + example, [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] can be used to retry a failed + task after a fix has been made or to manually force a task to be + dispatched now. + + The dispatched task is returned. That is, the task that is returned + contains the [status][Task.status] after the task is dispatched but + before the task is received by its target. + + If Cloud Tasks receives a successful response from the task's + target, then the task will be deleted; otherwise the task's + [schedule_time][google.cloud.tasks.v2beta3.Task.schedule_time] will be reset to the time that + [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] was called plus the retry delay specified + in the queue's [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig]. + + [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] returns + [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a + task that has already succeeded or permanently failed. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_CloudTasksServicer_to_server(servicer, server): + rpc_method_handlers = { + 'ListQueues': grpc.unary_unary_rpc_method_handler( + servicer.ListQueues, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ListQueuesRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ListQueuesResponse.SerializeToString, + ), + 'GetQueue': grpc.unary_unary_rpc_method_handler( + servicer.GetQueue, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.GetQueueRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.SerializeToString, + ), + 'CreateQueue': grpc.unary_unary_rpc_method_handler( + servicer.CreateQueue, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.CreateQueueRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.SerializeToString, + ), + 'UpdateQueue': grpc.unary_unary_rpc_method_handler( + servicer.UpdateQueue, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.UpdateQueueRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.SerializeToString, + ), + 'DeleteQueue': grpc.unary_unary_rpc_method_handler( + servicer.DeleteQueue, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.DeleteQueueRequest.FromString, + response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, + ), + 'PurgeQueue': grpc.unary_unary_rpc_method_handler( + servicer.PurgeQueue, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.PurgeQueueRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.SerializeToString, + ), + 'PauseQueue': grpc.unary_unary_rpc_method_handler( + servicer.PauseQueue, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.PauseQueueRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.SerializeToString, + ), + 'ResumeQueue': grpc.unary_unary_rpc_method_handler( + servicer.ResumeQueue, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ResumeQueueRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_queue__pb2.Queue.SerializeToString, + ), + 'GetIamPolicy': grpc.unary_unary_rpc_method_handler( + servicer.GetIamPolicy, + request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.FromString, + response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString, + ), + 'SetIamPolicy': grpc.unary_unary_rpc_method_handler( + servicer.SetIamPolicy, + request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.FromString, + response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString, + ), + 'TestIamPermissions': grpc.unary_unary_rpc_method_handler( + servicer.TestIamPermissions, + request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.FromString, + response_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.SerializeToString, + ), + 'ListTasks': grpc.unary_unary_rpc_method_handler( + servicer.ListTasks, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ListTasksRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.ListTasksResponse.SerializeToString, + ), + 'GetTask': grpc.unary_unary_rpc_method_handler( + servicer.GetTask, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.GetTaskRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2.Task.SerializeToString, + ), + 'CreateTask': grpc.unary_unary_rpc_method_handler( + servicer.CreateTask, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.CreateTaskRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2.Task.SerializeToString, + ), + 'DeleteTask': grpc.unary_unary_rpc_method_handler( + servicer.DeleteTask, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.DeleteTaskRequest.FromString, + response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, + ), + 'RunTask': grpc.unary_unary_rpc_method_handler( + servicer.RunTask, + request_deserializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_cloudtasks__pb2.RunTaskRequest.FromString, + response_serializer=google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_task__pb2.Task.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'google.cloud.tasks.v2beta3.CloudTasks', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/tasks/google/cloud/tasks_v2beta3/proto/queue_pb2.py b/tasks/google/cloud/tasks_v2beta3/proto/queue_pb2.py new file mode 100644 index 000000000000..10e83d8ad05f --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/proto/queue_pb2.py @@ -0,0 +1,502 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/tasks_v2beta3/proto/queue.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.cloud.tasks_v2beta3.proto import target_pb2 as google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_target__pb2 +from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='google/cloud/tasks_v2beta3/proto/queue.proto', + package='google.cloud.tasks.v2beta3', + syntax='proto3', + serialized_pb=_b('\n,google/cloud/tasks_v2beta3/proto/queue.proto\x12\x1agoogle.cloud.tasks.v2beta3\x1a\x1cgoogle/api/annotations.proto\x1a-google/cloud/tasks_v2beta3/proto/target.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x9f\x03\n\x05Queue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12O\n\x15\x61pp_engine_http_queue\x18\x03 \x01(\x0b\x32..google.cloud.tasks.v2beta3.AppEngineHttpQueueH\x00\x12;\n\x0brate_limits\x18\x04 \x01(\x0b\x32&.google.cloud.tasks.v2beta3.RateLimits\x12=\n\x0cretry_config\x18\x05 \x01(\x0b\x32\'.google.cloud.tasks.v2beta3.RetryConfig\x12\x36\n\x05state\x18\x06 \x01(\x0e\x32\'.google.cloud.tasks.v2beta3.Queue.State\x12.\n\npurge_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"E\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\n\n\x06PAUSED\x10\x02\x12\x0c\n\x08\x44ISABLED\x10\x03\x42\x0c\n\nqueue_type\"j\n\nRateLimits\x12!\n\x19max_dispatches_per_second\x18\x01 \x01(\x01\x12\x16\n\x0emax_burst_size\x18\x02 \x01(\x05\x12!\n\x19max_concurrent_dispatches\x18\x03 \x01(\x05\"\xd1\x01\n\x0bRetryConfig\x12\x14\n\x0cmax_attempts\x18\x01 \x01(\x05\x12\x35\n\x12max_retry_duration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12.\n\x0bmin_backoff\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\x12.\n\x0bmax_backoff\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x15\n\rmax_doublings\x18\x05 \x01(\x05\x42o\n\x1e\x63om.google.cloud.tasks.v2beta3B\nQueueProtoP\x01Z?google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasksb\x06proto3') + , + dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_target__pb2.DESCRIPTOR,google_dot_protobuf_dot_duration__pb2.DESCRIPTOR,google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) + + + +_QUEUE_STATE = _descriptor.EnumDescriptor( + name='State', + full_name='google.cloud.tasks.v2beta3.Queue.State', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='STATE_UNSPECIFIED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RUNNING', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PAUSED', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DISABLED', index=3, number=3, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=551, + serialized_end=620, +) +_sym_db.RegisterEnumDescriptor(_QUEUE_STATE) + + +_QUEUE = _descriptor.Descriptor( + name='Queue', + full_name='google.cloud.tasks.v2beta3.Queue', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.Queue.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='app_engine_http_queue', full_name='google.cloud.tasks.v2beta3.Queue.app_engine_http_queue', index=1, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='rate_limits', full_name='google.cloud.tasks.v2beta3.Queue.rate_limits', index=2, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='retry_config', full_name='google.cloud.tasks.v2beta3.Queue.retry_config', index=3, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='state', full_name='google.cloud.tasks.v2beta3.Queue.state', index=4, + number=6, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='purge_time', full_name='google.cloud.tasks.v2beta3.Queue.purge_time', index=5, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _QUEUE_STATE, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='queue_type', full_name='google.cloud.tasks.v2beta3.Queue.queue_type', + index=0, containing_type=None, fields=[]), + ], + serialized_start=219, + serialized_end=634, +) + + +_RATELIMITS = _descriptor.Descriptor( + name='RateLimits', + full_name='google.cloud.tasks.v2beta3.RateLimits', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='max_dispatches_per_second', full_name='google.cloud.tasks.v2beta3.RateLimits.max_dispatches_per_second', index=0, + number=1, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='max_burst_size', full_name='google.cloud.tasks.v2beta3.RateLimits.max_burst_size', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='max_concurrent_dispatches', full_name='google.cloud.tasks.v2beta3.RateLimits.max_concurrent_dispatches', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=636, + serialized_end=742, +) + + +_RETRYCONFIG = _descriptor.Descriptor( + name='RetryConfig', + full_name='google.cloud.tasks.v2beta3.RetryConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='max_attempts', full_name='google.cloud.tasks.v2beta3.RetryConfig.max_attempts', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='max_retry_duration', full_name='google.cloud.tasks.v2beta3.RetryConfig.max_retry_duration', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='min_backoff', full_name='google.cloud.tasks.v2beta3.RetryConfig.min_backoff', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='max_backoff', full_name='google.cloud.tasks.v2beta3.RetryConfig.max_backoff', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='max_doublings', full_name='google.cloud.tasks.v2beta3.RetryConfig.max_doublings', index=4, + number=5, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=745, + serialized_end=954, +) + +_QUEUE.fields_by_name['app_engine_http_queue'].message_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_target__pb2._APPENGINEHTTPQUEUE +_QUEUE.fields_by_name['rate_limits'].message_type = _RATELIMITS +_QUEUE.fields_by_name['retry_config'].message_type = _RETRYCONFIG +_QUEUE.fields_by_name['state'].enum_type = _QUEUE_STATE +_QUEUE.fields_by_name['purge_time'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_QUEUE_STATE.containing_type = _QUEUE +_QUEUE.oneofs_by_name['queue_type'].fields.append( + _QUEUE.fields_by_name['app_engine_http_queue']) +_QUEUE.fields_by_name['app_engine_http_queue'].containing_oneof = _QUEUE.oneofs_by_name['queue_type'] +_RETRYCONFIG.fields_by_name['max_retry_duration'].message_type = google_dot_protobuf_dot_duration__pb2._DURATION +_RETRYCONFIG.fields_by_name['min_backoff'].message_type = google_dot_protobuf_dot_duration__pb2._DURATION +_RETRYCONFIG.fields_by_name['max_backoff'].message_type = google_dot_protobuf_dot_duration__pb2._DURATION +DESCRIPTOR.message_types_by_name['Queue'] = _QUEUE +DESCRIPTOR.message_types_by_name['RateLimits'] = _RATELIMITS +DESCRIPTOR.message_types_by_name['RetryConfig'] = _RETRYCONFIG +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Queue = _reflection.GeneratedProtocolMessageType('Queue', (_message.Message,), dict( + DESCRIPTOR = _QUEUE, + __module__ = 'google.cloud.tasks_v2beta3.proto.queue_pb2' + , + __doc__ = """A queue is a container of related tasks. Queues are configured to manage + how those tasks are dispatched. Configurable properties include rate + limits, retry options, queue types, and others. + + + Attributes: + name: + Caller-specified and required in [CreateQueue][google.cloud.ta + sks.v2beta3.CloudTasks.CreateQueue], after which it becomes + output only. The queue name. The queue name must have the + following format: + ``projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`` + - ``PROJECT_ID`` can contain letters ([A-Za-z]), numbers + ([0-9]), hyphens (-), colons (:), or periods (.). For more + information, see `Identifying projects + `_ - ``LOCATION_ID`` + is the canonical ID for the queue's location. The list of + available locations can be obtained by calling [ListLocatio + ns][google.cloud.location.Locations.ListLocations]. For + more information, see + https://cloud.google.com/about/locations/. - ``QUEUE_ID`` can + contain letters ([A-Za-z]), numbers ([0-9]), or hyphens + (-). The maximum length is 100 characters. + queue_type: + Caller-specified and required in [CreateQueue][google.cloud.ta + sks.v2beta3.CloudTasks.CreateQueue][], after which the queue + config type becomes output only, though fields within the + config are mutable. The queue's type. The type applies to + all tasks in the queue. + app_engine_http_queue: + App Engine HTTP queue. An App Engine queue is a queue that + has an [AppEngineHttpQeueue][] type. + rate_limits: + Rate limits for task dispatches. + [rate\_limits][google.cloud.tasks.v2beta3.Queue.rate\_limits] + and [retry\_config][google.cloud.tasks.v2beta3.Queue.retry\_co + nfig] are related because they both control task attempts + however they control how tasks are attempted in different + ways: - + [rate\_limits][google.cloud.tasks.v2beta3.Queue.rate\_limits] + controls the total rate of dispatches from a queue (i.e. all + traffic dispatched from the queue, regardless of whether + the dispatch is from a first attempt or a retry). - [retry + \_config][google.cloud.tasks.v2beta3.Queue.retry\_config] + controls what happens to particular a task after its first + attempt fails. That is, [retry\_config][google.cloud.tas + ks.v2beta3.Queue.retry\_config] controls task retries (the + second attempt, third attempt, etc). + retry_config: + Settings that determine the retry behavior. - For tasks + created using Cloud Tasks: the queue-level retry settings + apply to all tasks in the queue that were created using Cloud + Tasks. Retry settings cannot be set on individual tasks. - + For tasks created using the App Engine SDK: the queue-level + retry settings apply to all tasks in the queue which do not + have retry settings explicitly set on the task and were + created by the App Engine SDK. See `App Engine + documentation `_. + state: + Output only. The state of the queue. ``state`` can only be + changed by called [PauseQueue][google.cloud.tasks.v2beta3.Clou + dTasks.PauseQueue], [ResumeQueue][google.cloud.tasks.v2beta3.C + loudTasks.ResumeQueue], or uploading `queue.yaml/xml `_. [U + pdateQueue][google.cloud.tasks.v2beta3.CloudTasks.UpdateQueue] + cannot be used to change ``state``. + purge_time: + Output only. The last time this queue was purged. All tasks + that were + [created][google.cloud.tasks.v2beta3.Task.create\_time] before + this time were purged. A queue can be purged using [PurgeQueu + e][google.cloud.tasks.v2beta3.CloudTasks.PurgeQueue], the `App + Engine Task Queue SDK, or the Cloud Console `_. Purge + time will be truncated to the nearest microsecond. Purge time + will be unset if the queue has never been purged. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.Queue) + )) +_sym_db.RegisterMessage(Queue) + +RateLimits = _reflection.GeneratedProtocolMessageType('RateLimits', (_message.Message,), dict( + DESCRIPTOR = _RATELIMITS, + __module__ = 'google.cloud.tasks_v2beta3.proto.queue_pb2' + , + __doc__ = """Rate limits. + + This message determines the maximum rate that tasks can be dispatched by + a queue, regardless of whether the dispatch is a first task attempt or a + retry. + + Note: The debugging command, + [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask], will run a + task even if the queue has reached its + [RateLimits][google.cloud.tasks.v2beta3.RateLimits]. + + + Attributes: + max_dispatches_per_second: + The maximum rate at which tasks are dispatched from this + queue. If unspecified when the queue is created, Cloud Tasks + will pick the default. - For [App Engine + queues][google.cloud.tasks.v2beta3.AppEngineHttpQueue], the + maximum allowed value is 500. This field has the same + meaning as `rate in queue.yaml/xml `_. + max_burst_size: + Output only. The max burst size. Max burst size limits how + fast tasks in queue are processed when many tasks are in the + queue and the rate is high. This field allows the queue to + have a high rate so processing starts shortly after a task is + enqueued, but still limits resource usage when many tasks are + enqueued in a short period of time. The `token bucket + `_ algorithm is used + to control the rate of task dispatches. Each queue has a token + bucket that holds tokens, up to the maximum specified by + ``max_burst_size``. Each time a task is dispatched, a token is + removed from the bucket. Tasks will be dispatched until the + queue's bucket runs out of tokens. The bucket will be + continuously refilled with new tokens based on [max\_dispatche + s\_per\_second][google.cloud.tasks.v2beta3.RateLimits.max\_dis + patches\_per\_second]. Cloud Tasks will pick the value of + ``max_burst_size`` based on the value of [max\_dispatches\_per + \_second][google.cloud.tasks.v2beta3.RateLimits.max\_dispatche + s\_per\_second]. For App Engine queues that were created or + updated using ``queue.yaml/xml``, ``max_burst_size`` is equal + to `bucket\_size `_. Since + ``max_burst_size`` is output only, if [UpdateQueue][google.clo + ud.tasks.v2beta3.CloudTasks.UpdateQueue] is called on a queue + created by ``queue.yaml/xml``, ``max_burst_size`` will be + reset based on the value of [max\_dispatches\_per\_second][goo + gle.cloud.tasks.v2beta3.RateLimits.max\_dispatches\_per\_secon + d], regardless of whether [max\_dispatches\_per\_second][googl + e.cloud.tasks.v2beta3.RateLimits.max\_dispatches\_per\_second] + is updated. + max_concurrent_dispatches: + The maximum number of concurrent tasks that Cloud Tasks allows + to be dispatched for this queue. After this threshold has been + reached, Cloud Tasks stops dispatching tasks until the number + of concurrent requests decreases. If unspecified when the + queue is created, Cloud Tasks will pick the default. The + maximum allowed value is 5,000. This field has the same + meaning as `max\_concurrent\_requests in queue.yaml/xml `_. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.RateLimits) + )) +_sym_db.RegisterMessage(RateLimits) + +RetryConfig = _reflection.GeneratedProtocolMessageType('RetryConfig', (_message.Message,), dict( + DESCRIPTOR = _RETRYCONFIG, + __module__ = 'google.cloud.tasks_v2beta3.proto.queue_pb2' + , + __doc__ = """Retry config. + + These settings determine when a failed task attempt is retried. + + + Attributes: + max_attempts: + Number of attempts per task. Cloud Tasks will attempt the + task ``max_attempts`` times (that is, if the first attempt + fails, then there will be ``max_attempts - 1`` retries). Must + be >= -1. If unspecified when the queue is created, Cloud + Tasks will pick the default. -1 indicates unlimited attempts. + This field has the same meaning as `task\_retry\_limit in + queue.yaml/xml `_. + max_retry_duration: + If positive, ``max_retry_duration`` specifies the time limit + for retrying a failed task, measured from when the task was + first attempted. Once ``max_retry_duration`` time has passed + *and* the task has been attempted [max\_attempts][google.cloud + .tasks.v2beta3.RetryConfig.max\_attempts] times, no further + attempts will be made and the task will be deleted. If zero, + then the task age is unlimited. If unspecified when the queue + is created, Cloud Tasks will pick the default. + ``max_retry_duration`` will be truncated to the nearest + second. This field has the same meaning as `task\_age\_limit + in queue.yaml/xml `_. + min_backoff: + A task will be + [scheduled][google.cloud.tasks.v2beta3.Task.schedule\_time] + for retry between [min\_backoff][google.cloud.tasks.v2beta3.Re + tryConfig.min\_backoff] and [max\_backoff][google.cloud.tasks. + v2beta3.RetryConfig.max\_backoff] duration after it fails, if + the queue's + [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig] + specifies that the task should be retried. If unspecified + when the queue is created, Cloud Tasks will pick the default. + ``min_backoff`` will be truncated to the nearest second. This + field has the same meaning as `min\_backoff\_seconds in + queue.yaml/xml `_. + max_backoff: + A task will be + [scheduled][google.cloud.tasks.v2beta3.Task.schedule\_time] + for retry between [min\_backoff][google.cloud.tasks.v2beta3.Re + tryConfig.min\_backoff] and [max\_backoff][google.cloud.tasks. + v2beta3.RetryConfig.max\_backoff] duration after it fails, if + the queue's + [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig] + specifies that the task should be retried. If unspecified + when the queue is created, Cloud Tasks will pick the default. + ``max_backoff`` will be truncated to the nearest second. This + field has the same meaning as `max\_backoff\_seconds in + queue.yaml/xml `_. + max_doublings: + The time between retries will double ``max_doublings`` times. + A task's retry interval starts at [min\_backoff][google.cloud. + tasks.v2beta3.RetryConfig.min\_backoff], then doubles + ``max_doublings`` times, then increases linearly, and finally + retries retries at intervals of [max\_backoff][google.cloud.ta + sks.v2beta3.RetryConfig.max\_backoff] up to [max\_attempts][go + ogle.cloud.tasks.v2beta3.RetryConfig.max\_attempts] times. + For example, if [min\_backoff][google.cloud.tasks.v2beta3.Retr + yConfig.min\_backoff] is 10s, [max\_backoff][google.cloud.task + s.v2beta3.RetryConfig.max\_backoff] is 300s, and + ``max_doublings`` is 3, then the a task will first be retried + in 10s. The retry interval will double three times, and then + increase linearly by 2^3 \* 10s. Finally, the task will retry + at intervals of [max\_backoff][google.cloud.tasks.v2beta3.Retr + yConfig.max\_backoff] until the task has been attempted [max\_ + attempts][google.cloud.tasks.v2beta3.RetryConfig.max\_attempts + ] times. Thus, the requests will retry at 10s, 20s, 40s, 80s, + 160s, 240s, 300s, 300s, .... If unspecified when the queue is + created, Cloud Tasks will pick the default. This field has + the same meaning as `max\_doublings in queue.yaml/xml `_. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.RetryConfig) + )) +_sym_db.RegisterMessage(RetryConfig) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\036com.google.cloud.tasks.v2beta3B\nQueueProtoP\001Z?google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks')) +# @@protoc_insertion_point(module_scope) diff --git a/tasks/google/cloud/tasks_v2beta3/proto/queue_pb2_grpc.py b/tasks/google/cloud/tasks_v2beta3/proto/queue_pb2_grpc.py new file mode 100644 index 000000000000..a89435267cb2 --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/proto/queue_pb2_grpc.py @@ -0,0 +1,3 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + diff --git a/tasks/google/cloud/tasks_v2beta3/proto/target_pb2.py b/tasks/google/cloud/tasks_v2beta3/proto/target_pb2.py new file mode 100644 index 000000000000..e9c6e0223a3a --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/proto/target_pb2.py @@ -0,0 +1,529 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/tasks_v2beta3/proto/target.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='google/cloud/tasks_v2beta3/proto/target.proto', + package='google.cloud.tasks.v2beta3', + syntax='proto3', + serialized_pb=_b('\n-google/cloud/tasks_v2beta3/proto/target.proto\x12\x1agoogle.cloud.tasks.v2beta3\x1a\x1cgoogle/api/annotations.proto\"g\n\x12\x41ppEngineHttpQueue\x12Q\n\x1b\x61pp_engine_routing_override\x18\x01 \x01(\x0b\x32,.google.cloud.tasks.v2beta3.AppEngineRouting\"\xc1\x02\n\x14\x41ppEngineHttpRequest\x12;\n\x0bhttp_method\x18\x01 \x01(\x0e\x32&.google.cloud.tasks.v2beta3.HttpMethod\x12H\n\x12\x61pp_engine_routing\x18\x02 \x01(\x0b\x32,.google.cloud.tasks.v2beta3.AppEngineRouting\x12\x14\n\x0crelative_uri\x18\x03 \x01(\t\x12N\n\x07headers\x18\x04 \x03(\x0b\x32=.google.cloud.tasks.v2beta3.AppEngineHttpRequest.HeadersEntry\x12\x0c\n\x04\x62ody\x18\x05 \x01(\x0c\x1a.\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"T\n\x10\x41ppEngineRouting\x12\x0f\n\x07service\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x10\n\x08instance\x18\x03 \x01(\t\x12\x0c\n\x04host\x18\x04 \x01(\t*[\n\nHttpMethod\x12\x1b\n\x17HTTP_METHOD_UNSPECIFIED\x10\x00\x12\x08\n\x04POST\x10\x01\x12\x07\n\x03GET\x10\x02\x12\x08\n\x04HEAD\x10\x03\x12\x07\n\x03PUT\x10\x04\x12\n\n\x06\x44\x45LETE\x10\x05\x42p\n\x1e\x63om.google.cloud.tasks.v2beta3B\x0bTargetProtoP\x01Z?google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasksb\x06proto3') + , + dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,]) + +_HTTPMETHOD = _descriptor.EnumDescriptor( + name='HttpMethod', + full_name='google.cloud.tasks.v2beta3.HttpMethod', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='HTTP_METHOD_UNSPECIFIED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='POST', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='HEAD', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PUT', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DELETE', index=5, number=5, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=622, + serialized_end=713, +) +_sym_db.RegisterEnumDescriptor(_HTTPMETHOD) + +HttpMethod = enum_type_wrapper.EnumTypeWrapper(_HTTPMETHOD) +HTTP_METHOD_UNSPECIFIED = 0 +POST = 1 +GET = 2 +HEAD = 3 +PUT = 4 +DELETE = 5 + + + +_APPENGINEHTTPQUEUE = _descriptor.Descriptor( + name='AppEngineHttpQueue', + full_name='google.cloud.tasks.v2beta3.AppEngineHttpQueue', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='app_engine_routing_override', full_name='google.cloud.tasks.v2beta3.AppEngineHttpQueue.app_engine_routing_override', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=107, + serialized_end=210, +) + + +_APPENGINEHTTPREQUEST_HEADERSENTRY = _descriptor.Descriptor( + name='HeadersEntry', + full_name='google.cloud.tasks.v2beta3.AppEngineHttpRequest.HeadersEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='google.cloud.tasks.v2beta3.AppEngineHttpRequest.HeadersEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='value', full_name='google.cloud.tasks.v2beta3.AppEngineHttpRequest.HeadersEntry.value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=_descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')), + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=488, + serialized_end=534, +) + +_APPENGINEHTTPREQUEST = _descriptor.Descriptor( + name='AppEngineHttpRequest', + full_name='google.cloud.tasks.v2beta3.AppEngineHttpRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='http_method', full_name='google.cloud.tasks.v2beta3.AppEngineHttpRequest.http_method', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='app_engine_routing', full_name='google.cloud.tasks.v2beta3.AppEngineHttpRequest.app_engine_routing', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='relative_uri', full_name='google.cloud.tasks.v2beta3.AppEngineHttpRequest.relative_uri', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='headers', full_name='google.cloud.tasks.v2beta3.AppEngineHttpRequest.headers', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='body', full_name='google.cloud.tasks.v2beta3.AppEngineHttpRequest.body', index=4, + number=5, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[_APPENGINEHTTPREQUEST_HEADERSENTRY, ], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=213, + serialized_end=534, +) + + +_APPENGINEROUTING = _descriptor.Descriptor( + name='AppEngineRouting', + full_name='google.cloud.tasks.v2beta3.AppEngineRouting', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='service', full_name='google.cloud.tasks.v2beta3.AppEngineRouting.service', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='version', full_name='google.cloud.tasks.v2beta3.AppEngineRouting.version', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='instance', full_name='google.cloud.tasks.v2beta3.AppEngineRouting.instance', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='host', full_name='google.cloud.tasks.v2beta3.AppEngineRouting.host', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=536, + serialized_end=620, +) + +_APPENGINEHTTPQUEUE.fields_by_name['app_engine_routing_override'].message_type = _APPENGINEROUTING +_APPENGINEHTTPREQUEST_HEADERSENTRY.containing_type = _APPENGINEHTTPREQUEST +_APPENGINEHTTPREQUEST.fields_by_name['http_method'].enum_type = _HTTPMETHOD +_APPENGINEHTTPREQUEST.fields_by_name['app_engine_routing'].message_type = _APPENGINEROUTING +_APPENGINEHTTPREQUEST.fields_by_name['headers'].message_type = _APPENGINEHTTPREQUEST_HEADERSENTRY +DESCRIPTOR.message_types_by_name['AppEngineHttpQueue'] = _APPENGINEHTTPQUEUE +DESCRIPTOR.message_types_by_name['AppEngineHttpRequest'] = _APPENGINEHTTPREQUEST +DESCRIPTOR.message_types_by_name['AppEngineRouting'] = _APPENGINEROUTING +DESCRIPTOR.enum_types_by_name['HttpMethod'] = _HTTPMETHOD +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +AppEngineHttpQueue = _reflection.GeneratedProtocolMessageType('AppEngineHttpQueue', (_message.Message,), dict( + DESCRIPTOR = _APPENGINEHTTPQUEUE, + __module__ = 'google.cloud.tasks_v2beta3.proto.target_pb2' + , + __doc__ = """App Engine HTTP queue. + + The task will be delivered to the App Engine application hostname + specified by its + [AppEngineHttpQueue][google.cloud.tasks.v2beta3.AppEngineHttpQueue] and + [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest]. + The documentation for + [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] + explains how the task's host URL is constructed. + + Using + [AppEngineHttpQueue][google.cloud.tasks.v2beta3.AppEngineHttpQueue] + requires + ```appengine.applications.get`` `_ + Google IAM permission for the project and the following scope: + + ``https://www.googleapis.com/auth/cloud-platform`` + + + Attributes: + app_engine_routing_override: + Overrides for the [task-level app\_engine\_routing][google.clo + ud.tasks.v2beta3.AppEngineHttpRequest.app\_engine\_routing]. + If set, ``app_engine_routing_override`` is used for all tasks + in the queue, no matter what the setting is for the [task- + level app\_engine\_routing][google.cloud.tasks.v2beta3.AppEngi + neHttpRequest.app\_engine\_routing]. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.AppEngineHttpQueue) + )) +_sym_db.RegisterMessage(AppEngineHttpQueue) + +AppEngineHttpRequest = _reflection.GeneratedProtocolMessageType('AppEngineHttpRequest', (_message.Message,), dict( + + HeadersEntry = _reflection.GeneratedProtocolMessageType('HeadersEntry', (_message.Message,), dict( + DESCRIPTOR = _APPENGINEHTTPREQUEST_HEADERSENTRY, + __module__ = 'google.cloud.tasks_v2beta3.proto.target_pb2' + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.AppEngineHttpRequest.HeadersEntry) + )) + , + DESCRIPTOR = _APPENGINEHTTPREQUEST, + __module__ = 'google.cloud.tasks_v2beta3.proto.target_pb2' + , + __doc__ = """App Engine HTTP request. + + The message defines the HTTP request that is sent to an App Engine app + when the task is dispatched. + + This proto can only be used for tasks in a queue which has + [app\_engine\_http\_queue][google.cloud.tasks.v2beta3.Queue.app\_engine\_http\_queue] + set. + + Using + [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] + requires + ```appengine.applications.get`` `_ + Google IAM permission for the project and the following scope: + + ``https://www.googleapis.com/auth/cloud-platform`` + + The task will be delivered to the App Engine app which belongs to the + same project as the queue. For more information, see `How Requests are + Routed `_ + and how routing is affected by `dispatch + files `_. + + The [AppEngineRouting][google.cloud.tasks.v2beta3.AppEngineRouting] used + to construct the URL that the task is delivered to can be set at the + queue-level or task-level: + + - If set, + [app\_engine\_routing\_override][google.cloud.tasks.v2beta3.AppEngineHttpQueue.app\_engine\_routing\_override] + is used for all tasks in the queue, no matter what the setting is for + the [task-level + app\_engine\_routing][google.cloud.tasks.v2beta3.AppEngineHttpRequest.app\_engine\_routing]. + + The ``url`` that the task will be sent to is: + + - ``url =`` [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] + ``+`` + [relative\_uri][google.cloud.tasks.v2beta3.AppEngineHttpRequest.relative\_uri] + + The task attempt has succeeded if the app's request handler returns an + HTTP response code in the range [``200`` - ``299``]. ``503`` is + considered an App Engine system error instead of an application error. + Requests returning error ``503`` will be retried regardless of retry + configuration and not counted against retry counts. Any other response + code or a failure to receive a response before the deadline is a failed + attempt. + + + Attributes: + http_method: + The HTTP method to use for the request. The default is POST. + The app's request handler for the task's target URL must be + able to handle HTTP requests with this http\_method, otherwise + the task attempt will fail with error code 405 (Method Not + Allowed). See `Writing a push task request handler `_ and the + documentation for the request handlers in the language your + app is written in e.g. `Python Request Handler `_. + app_engine_routing: + Task-level setting for App Engine routing. If set, [app\_engi + ne\_routing\_override][google.cloud.tasks.v2beta3.AppEngineHtt + pQueue.app\_engine\_routing\_override] is used for all tasks + in the queue, no matter what the setting is for the [task- + level app\_engine\_routing][google.cloud.tasks.v2beta3.AppEngi + neHttpRequest.app\_engine\_routing]. + relative_uri: + The relative URI. The relative URI must begin with "/" and + must be a valid HTTP relative URI. It can contain a path and + query string arguments. If the relative URI is empty, then the + root path "/" will be used. No spaces are allowed, and the + maximum length allowed is 2083 characters. + headers: + HTTP request headers. This map contains the header field + names and values. Headers can be set when the [task is + created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. + Repeated headers are not supported but a header value can + contain commas. Cloud Tasks sets some headers to default + values: - ``User-Agent``: By default, this header is + ``"AppEngine-Google; (+http://code.google.com/appengine)"``. + This header can be modified, but Cloud Tasks will append + ``"AppEngine-Google; (+http://code.google.com/appengine)"`` to + the modified ``User-Agent``. If the task has a + [body][google.cloud.tasks.v2beta3.AppEngineHttpRequest.body], + Cloud Tasks sets the following headers: - ``Content-Type``: + By default, the ``Content-Type`` header is set to + ``"application/octet-stream"``. The default can be overridden + by explicitly setting ``Content-Type`` to a particular + media type when the [task is + created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. + For example, ``Content-Type`` can be set to + ``"application/json"``. - ``Content-Length``: This is + computed by Cloud Tasks. This value is output only. It + cannot be changed. The headers below cannot be set or + overridden: - ``Host`` - ``X-Google-*`` - + ``X-AppEngine-*`` In addition, Cloud Tasks sets some headers + when the task is dispatched, such as headers containing + information about the task; see `request headers `_. These headers are set + only when the task is dispatched, so they are not visible when + the task is returned in a Cloud Tasks response. Although + there is no specific limit for the maximum number of headers + or the size, there is a limit on the maximum size of the + [Task][google.cloud.tasks.v2beta3.Task]. For more information, + see the + [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask] + documentation. + body: + HTTP request body. A request body is allowed only if the HTTP + method is POST or PUT. It is an error to set a body on a task + with an incompatible + [HttpMethod][google.cloud.tasks.v2beta3.HttpMethod]. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.AppEngineHttpRequest) + )) +_sym_db.RegisterMessage(AppEngineHttpRequest) +_sym_db.RegisterMessage(AppEngineHttpRequest.HeadersEntry) + +AppEngineRouting = _reflection.GeneratedProtocolMessageType('AppEngineRouting', (_message.Message,), dict( + DESCRIPTOR = _APPENGINEROUTING, + __module__ = 'google.cloud.tasks_v2beta3.proto.target_pb2' + , + __doc__ = """App Engine Routing. + + Specifies the target URI. Since this target type dispatches tasks to + secure app handlers, unsecure app handlers, and URIs restricted with + ```login: admin`` `_ + the protocol (for example, HTTP or HTTPS) cannot be explictly specified. + Task dispatches do not follow redirects and cannot target URI paths + restricted with + ```login: required`` `_ + because tasks are not run as any user. + + For more information about services, versions, and instances see `An + Overview of App + Engine `_, + `Microservices Architecture on Google App + Engine `_, + `App Engine Standard request + routing `_, + and `App Engine Flex request + routing `_. + + + Attributes: + service: + App service. By default, the task is sent to the service + which is the default service when the task is attempted. For + some queues or tasks which were created using the App Engine + Task Queue API, + [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is + not parsable into [service][google.cloud.tasks.v2beta3.AppEngi + neRouting.service], [version][google.cloud.tasks.v2beta3.AppEn + gineRouting.version], and [instance][google.cloud.tasks.v2beta + 3.AppEngineRouting.instance]. For example, some tasks which + were created using the App Engine SDK use a custom domain + name; custom domains are not parsed by Cloud Tasks. If + [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is + not parsable, then [service][google.cloud.tasks.v2beta3.AppEng + ineRouting.service], [version][google.cloud.tasks.v2beta3.AppE + ngineRouting.version], and [instance][google.cloud.tasks.v2bet + a3.AppEngineRouting.instance] are the empty string. + version: + App version. By default, the task is sent to the version + which is the default version when the task is attempted. For + some queues or tasks which were created using the App Engine + Task Queue API, + [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is + not parsable into [service][google.cloud.tasks.v2beta3.AppEngi + neRouting.service], [version][google.cloud.tasks.v2beta3.AppEn + gineRouting.version], and [instance][google.cloud.tasks.v2beta + 3.AppEngineRouting.instance]. For example, some tasks which + were created using the App Engine SDK use a custom domain + name; custom domains are not parsed by Cloud Tasks. If + [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is + not parsable, then [service][google.cloud.tasks.v2beta3.AppEng + ineRouting.service], [version][google.cloud.tasks.v2beta3.AppE + ngineRouting.version], and [instance][google.cloud.tasks.v2bet + a3.AppEngineRouting.instance] are the empty string. + instance: + App instance. By default, the task is sent to an instance + which is available when the task is attempted. Requests can + only be sent to a specific instance if `manual scaling is used + in App Engine Standard + `_. + App Engine Flex does not support instances. For more + information, see `App Engine Standard request routing + `_ and `App Engine Flex request routing + `_. + host: + Output only. The host that the task is sent to. The host is + constructed from the domain name of the app associated with + the queue's project ID (for example .appspot.com), and the [se + rvice][google.cloud.tasks.v2beta3.AppEngineRouting.service], [ + version][google.cloud.tasks.v2beta3.AppEngineRouting.version], + and [instance][google.cloud.tasks.v2beta3.AppEngineRouting.ins + tance]. Tasks which were created using the App Engine SDK + might have a custom domain name. For more information, see + `How Requests are Routed + `_. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.AppEngineRouting) + )) +_sym_db.RegisterMessage(AppEngineRouting) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\036com.google.cloud.tasks.v2beta3B\013TargetProtoP\001Z?google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks')) +_APPENGINEHTTPREQUEST_HEADERSENTRY.has_options = True +_APPENGINEHTTPREQUEST_HEADERSENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')) +# @@protoc_insertion_point(module_scope) diff --git a/tasks/google/cloud/tasks_v2beta3/proto/target_pb2_grpc.py b/tasks/google/cloud/tasks_v2beta3/proto/target_pb2_grpc.py new file mode 100644 index 000000000000..a89435267cb2 --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/proto/target_pb2_grpc.py @@ -0,0 +1,3 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + diff --git a/tasks/google/cloud/tasks_v2beta3/proto/task_pb2.py b/tasks/google/cloud/tasks_v2beta3/proto/task_pb2.py new file mode 100644 index 000000000000..65bc29c8462f --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/proto/task_pb2.py @@ -0,0 +1,321 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/tasks_v2beta3/proto/task.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.cloud.tasks_v2beta3.proto import target_pb2 as google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_target__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 +from google.rpc import status_pb2 as google_dot_rpc_dot_status__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='google/cloud/tasks_v2beta3/proto/task.proto', + package='google.cloud.tasks.v2beta3', + syntax='proto3', + serialized_pb=_b('\n+google/cloud/tasks_v2beta3/proto/task.proto\x12\x1agoogle.cloud.tasks.v2beta3\x1a\x1cgoogle/api/annotations.proto\x1a-google/cloud/tasks_v2beta3/proto/target.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\"\xec\x03\n\x04Task\x12\x0c\n\x04name\x18\x01 \x01(\t\x12S\n\x17\x61pp_engine_http_request\x18\x03 \x01(\x0b\x32\x30.google.cloud.tasks.v2beta3.AppEngineHttpRequestH\x00\x12\x31\n\rschedule_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x63reate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x16\n\x0e\x64ispatch_count\x18\x06 \x01(\x05\x12\x16\n\x0eresponse_count\x18\x07 \x01(\x05\x12:\n\rfirst_attempt\x18\x08 \x01(\x0b\x32#.google.cloud.tasks.v2beta3.Attempt\x12\x39\n\x0clast_attempt\x18\t \x01(\x0b\x32#.google.cloud.tasks.v2beta3.Attempt\x12\x33\n\x04view\x18\n \x01(\x0e\x32%.google.cloud.tasks.v2beta3.Task.View\"1\n\x04View\x12\x14\n\x10VIEW_UNSPECIFIED\x10\x00\x12\t\n\x05\x42\x41SIC\x10\x01\x12\x08\n\x04\x46ULL\x10\x02\x42\x0e\n\x0cpayload_type\"\xcf\x01\n\x07\x41ttempt\x12\x31\n\rschedule_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x31\n\rdispatch_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x31\n\rresponse_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\x0fresponse_status\x18\x04 \x01(\x0b\x32\x12.google.rpc.StatusBn\n\x1e\x63om.google.cloud.tasks.v2beta3B\tTaskProtoP\x01Z?google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasksb\x06proto3') + , + dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_target__pb2.DESCRIPTOR,google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,google_dot_rpc_dot_status__pb2.DESCRIPTOR,]) + + + +_TASK_VIEW = _descriptor.EnumDescriptor( + name='View', + full_name='google.cloud.tasks.v2beta3.Task.View', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='VIEW_UNSPECIFIED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BASIC', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FULL', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=638, + serialized_end=687, +) +_sym_db.RegisterEnumDescriptor(_TASK_VIEW) + + +_TASK = _descriptor.Descriptor( + name='Task', + full_name='google.cloud.tasks.v2beta3.Task', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='google.cloud.tasks.v2beta3.Task.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='app_engine_http_request', full_name='google.cloud.tasks.v2beta3.Task.app_engine_http_request', index=1, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='schedule_time', full_name='google.cloud.tasks.v2beta3.Task.schedule_time', index=2, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='create_time', full_name='google.cloud.tasks.v2beta3.Task.create_time', index=3, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='dispatch_count', full_name='google.cloud.tasks.v2beta3.Task.dispatch_count', index=4, + number=6, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='response_count', full_name='google.cloud.tasks.v2beta3.Task.response_count', index=5, + number=7, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='first_attempt', full_name='google.cloud.tasks.v2beta3.Task.first_attempt', index=6, + number=8, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='last_attempt', full_name='google.cloud.tasks.v2beta3.Task.last_attempt', index=7, + number=9, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='view', full_name='google.cloud.tasks.v2beta3.Task.view', index=8, + number=10, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _TASK_VIEW, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='payload_type', full_name='google.cloud.tasks.v2beta3.Task.payload_type', + index=0, containing_type=None, fields=[]), + ], + serialized_start=211, + serialized_end=703, +) + + +_ATTEMPT = _descriptor.Descriptor( + name='Attempt', + full_name='google.cloud.tasks.v2beta3.Attempt', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='schedule_time', full_name='google.cloud.tasks.v2beta3.Attempt.schedule_time', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='dispatch_time', full_name='google.cloud.tasks.v2beta3.Attempt.dispatch_time', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='response_time', full_name='google.cloud.tasks.v2beta3.Attempt.response_time', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='response_status', full_name='google.cloud.tasks.v2beta3.Attempt.response_status', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=706, + serialized_end=913, +) + +_TASK.fields_by_name['app_engine_http_request'].message_type = google_dot_cloud_dot_tasks__v2beta3_dot_proto_dot_target__pb2._APPENGINEHTTPREQUEST +_TASK.fields_by_name['schedule_time'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TASK.fields_by_name['create_time'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TASK.fields_by_name['first_attempt'].message_type = _ATTEMPT +_TASK.fields_by_name['last_attempt'].message_type = _ATTEMPT +_TASK.fields_by_name['view'].enum_type = _TASK_VIEW +_TASK_VIEW.containing_type = _TASK +_TASK.oneofs_by_name['payload_type'].fields.append( + _TASK.fields_by_name['app_engine_http_request']) +_TASK.fields_by_name['app_engine_http_request'].containing_oneof = _TASK.oneofs_by_name['payload_type'] +_ATTEMPT.fields_by_name['schedule_time'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_ATTEMPT.fields_by_name['dispatch_time'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_ATTEMPT.fields_by_name['response_time'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_ATTEMPT.fields_by_name['response_status'].message_type = google_dot_rpc_dot_status__pb2._STATUS +DESCRIPTOR.message_types_by_name['Task'] = _TASK +DESCRIPTOR.message_types_by_name['Attempt'] = _ATTEMPT +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Task = _reflection.GeneratedProtocolMessageType('Task', (_message.Message,), dict( + DESCRIPTOR = _TASK, + __module__ = 'google.cloud.tasks_v2beta3.proto.task_pb2' + , + __doc__ = """A unit of scheduled work. + + + Attributes: + name: + Optionally caller-specified in [CreateTask][google.cloud.tasks + .v2beta3.CloudTasks.CreateTask]. The task name. The task + name must have the following format: ``projects/PROJECT_ID/loc + ations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`` - + ``PROJECT_ID`` can contain letters ([A-Za-z]), numbers + ([0-9]), hyphens (-), colons (:), or periods (.). For more + information, see `Identifying projects + `_ - ``LOCATION_ID`` + is the canonical ID for the task's location. The list of + available locations can be obtained by calling [ListLocatio + ns][google.cloud.location.Locations.ListLocations]. For + more information, see + https://cloud.google.com/about/locations/. - ``QUEUE_ID`` can + contain letters ([A-Za-z]), numbers ([0-9]), or hyphens + (-). The maximum length is 100 characters. - ``TASK_ID`` can + contain only letters ([A-Za-z]), numbers ([0-9]), hyphens + (-), or underscores (\_). The maximum length is 500 + characters. + payload_type: + Required. The task's payload is used by the task's target to + process the task. A payload is valid only if it is compatible + with the queue's target. + app_engine_http_request: + App Engine HTTP request that is sent to the task's target. Can + be set only if [app\_engine\_http\_queue][google.cloud.tasks.v + 2beta3.Queue.app\_engine\_http\_queue] is set on the queue. + An App Engine task is a task that has [AppEngineHttpRequest][g + oogle.cloud.tasks.v2beta3.AppEngineHttpRequest] set. + schedule_time: + The time when the task is scheduled to be attempted. For App + Engine queues, this is when the task will be attempted or + retried. ``schedule_time`` will be truncated to the nearest + microsecond. + create_time: + Output only. The time that the task was created. + ``create_time`` will be truncated to the nearest second. + dispatch_count: + Output only. The number of attempts dispatched. This count + includes tasks which have been dispatched but haven't received + a response. + response_count: + Output only. The number of attempts which have received a + response. + first_attempt: + Output only. The status of the task's first attempt. Only [di + spatch\_time][google.cloud.tasks.v2beta3.Attempt.dispatch\_tim + e] will be set. The other + [Attempt][google.cloud.tasks.v2beta3.Attempt] information is + not retained by Cloud Tasks. + last_attempt: + Output only. The status of the task's last attempt. + view: + Output only. The view specifies which subset of the + [Task][google.cloud.tasks.v2beta3.Task] has been returned. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.Task) + )) +_sym_db.RegisterMessage(Task) + +Attempt = _reflection.GeneratedProtocolMessageType('Attempt', (_message.Message,), dict( + DESCRIPTOR = _ATTEMPT, + __module__ = 'google.cloud.tasks_v2beta3.proto.task_pb2' + , + __doc__ = """The status of a task attempt. + + + Attributes: + schedule_time: + Output only. The time that this attempt was scheduled. + ``schedule_time`` will be truncated to the nearest + microsecond. + dispatch_time: + Output only. The time that this attempt was dispatched. + ``dispatch_time`` will be truncated to the nearest + microsecond. + response_time: + Output only. The time that this attempt response was received. + ``response_time`` will be truncated to the nearest + microsecond. + response_status: + Output only. The response from the target for this attempt. + If ``response_time`` is unset, then the task has not been + attempted or is currently running and the ``response_status`` + field is meaningless. + """, + # @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta3.Attempt) + )) +_sym_db.RegisterMessage(Attempt) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\036com.google.cloud.tasks.v2beta3B\tTaskProtoP\001Z?google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks')) +# @@protoc_insertion_point(module_scope) diff --git a/tasks/google/cloud/tasks_v2beta3/proto/task_pb2_grpc.py b/tasks/google/cloud/tasks_v2beta3/proto/task_pb2_grpc.py new file mode 100644 index 000000000000..a89435267cb2 --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/proto/task_pb2_grpc.py @@ -0,0 +1,3 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + diff --git a/tasks/google/cloud/tasks_v2beta3/types.py b/tasks/google/cloud/tasks_v2beta3/types.py new file mode 100644 index 000000000000..b75a2ef354d7 --- /dev/null +++ b/tasks/google/cloud/tasks_v2beta3/types.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2018 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. + +from __future__ import absolute_import +import sys + +from google.api_core.protobuf_helpers import get_messages + +from google.api import http_pb2 +from google.cloud.tasks_v2beta3.proto import cloudtasks_pb2 +from google.cloud.tasks_v2beta3.proto import queue_pb2 +from google.cloud.tasks_v2beta3.proto import target_pb2 +from google.cloud.tasks_v2beta3.proto import task_pb2 +from google.iam.v1 import iam_policy_pb2 +from google.iam.v1 import policy_pb2 +from google.protobuf import any_pb2 +from google.protobuf import descriptor_pb2 +from google.protobuf import duration_pb2 +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 +from google.protobuf import timestamp_pb2 +from google.rpc import status_pb2 + +_shared_modules = [ + http_pb2, + iam_policy_pb2, + policy_pb2, + any_pb2, + descriptor_pb2, + duration_pb2, + empty_pb2, + field_mask_pb2, + timestamp_pb2, + status_pb2, +] + +_local_modules = [ + cloudtasks_pb2, + queue_pb2, + target_pb2, + task_pb2, +] + +names = [] + +for module in _shared_modules: + for name, message in get_messages(module).items(): + setattr(sys.modules[__name__], name, message) + names.append(name) +for module in _local_modules: + for name, message in get_messages(module).items(): + message.__module__ = 'google.cloud.tasks_v2beta3.types' + setattr(sys.modules[__name__], name, message) + names.append(name) + +__all__ = tuple(sorted(names)) diff --git a/tasks/nox.py b/tasks/nox.py index 58f8c2b507ce..884edf60d671 100644 --- a/tasks/nox.py +++ b/tasks/nox.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tasks/setup.py b/tasks/setup.py index 644b4067da59..856d201b88a6 100644 --- a/tasks/setup.py +++ b/tasks/setup.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tasks/synth.py b/tasks/synth.py index 1105101d1bf7..1cc4e4eda1e2 100644 --- a/tasks/synth.py +++ b/tasks/synth.py @@ -23,12 +23,40 @@ gapic = gcp.GAPICGenerator() common = gcp.CommonTemplates() -# tasks has two product names, and a poorly named artman yaml -v2beta2_library = gapic.py_library( - 'tasks', 'v2beta2', - config_path='artman_cloudtasks.yaml') - -s.copy(v2beta2_library) +for version in ['v2beta2', 'v2beta3']: + library = gapic.py_library( + 'tasks', version, + config_path=f'artman_cloudtasks_{version}.yaml') + + s.copy(library, excludes=['docs/conf.py', 'docs/index.rst']) + + # Fix unindentation of bullet list second line + s.replace( + f'google/cloud/tasks_{version}/gapic/cloud_tasks_client.py', + '( \* .*\n )([^\s*])', + '\g<1> \g<2>') + + s.replace( + f'google/cloud/tasks_{version}/gapic/cloud_tasks_client.py', + '(Google IAM .*?_) ', + '\g<1>_ ') + + s.replace( + f'google/cloud/tasks_{version}/gapic/cloud_tasks_client.py', + r'(Sample filter \\"app_engine_http_target: )\*\\".', + '\g<1>\\*\\".') + + # Issues with Anonymous ('__') links. Change to named. + s.replace( + f"google/cloud/tasks_{version}/proto/*.py", + ">`__", + ">`_") + + # Wrapped link fails due ot space in link + s.replace( + f"google/cloud/tasks_{version}/proto/queue_pb2.py", + '(uests in queue.yaml/xml) <\n\s+', + '\g<1>\n <') # Set Release Status release_status = 'Development Status :: 3 - Alpha' @@ -41,50 +69,9 @@ 'dependencies = \[\n*(^.*,\n)+', "\\g<0> 'grpc-google-iam-v1<0.12dev,>=0.11.4',\n") -# Correct Naming of package -s.replace('**/*.rst', - 'google-cloud-cloud-tasks', - 'google-cloud-tasks') -s.replace('**/*.py', - 'google-cloud-cloud-tasks', - 'google-cloud-tasks') -s.replace('README.rst', - '/cloud-tasks', - '/tasks') - # Fix the enable API link s.replace( 'README.rst', r'.. _Enable the Cloud Tasks API.: https://cloud.google.com/tasks', '.. _Enable the Cloud Tasks API.: https://console.cloud.google.com/apis/' - 'library/cloudtasks.googleapis.com') - -# Fix unindentation of bullet list second line -s.replace( - 'google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py', - '( \* .*\n )([^\s*])', - '\g<1> \g<2>') - -s.replace( - 'google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py', - '(Google IAM .*?_) ', - '\g<1>_ ') - -s.replace( - 'google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py', - r'(Sample filter \\"app_engine_http_target: )\*\\".', - '\g<1>\\*\\".') - -s.replace("google/cloud/**/*.py", "`[.\s\n]+ `__", "") - -# Issues with Anonymous ('__') links. Change to named. -s.replace( - "google/cloud/tasks_v2beta2/proto/*.py", - ">`__", - ">`_") - -# Wrapped link fails due ot space in link -s.replace( - "google/cloud/tasks_v2beta2/proto/queue_pb2.py", - '(uests in queue.yaml/xml) <\n\s+', - '\g<1>\n <') + 'library/cloudtasks.googleapis.com') \ No newline at end of file diff --git a/tasks/tests/unit/gapic/v2beta2/test_cloud_tasks_client_v2beta2.py b/tasks/tests/unit/gapic/v2beta2/test_cloud_tasks_client_v2beta2.py index 80bf606ceee7..59407a23f742 100644 --- a/tasks/tests/unit/gapic/v2beta2/test_cloud_tasks_client_v2beta2.py +++ b/tasks/tests/unit/gapic/v2beta2/test_cloud_tasks_client_v2beta2.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tasks/tests/unit/gapic/v2beta3/test_cloud_tasks_client_v2beta3.py b/tasks/tests/unit/gapic/v2beta3/test_cloud_tasks_client_v2beta3.py new file mode 100644 index 000000000000..05c6cff8fd0b --- /dev/null +++ b/tasks/tests/unit/gapic/v2beta3/test_cloud_tasks_client_v2beta3.py @@ -0,0 +1,616 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2018 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. +"""Unit tests.""" + +import pytest + +from google.cloud import tasks_v2beta3 +from google.cloud.tasks_v2beta3.proto import cloudtasks_pb2 +from google.cloud.tasks_v2beta3.proto import queue_pb2 +from google.cloud.tasks_v2beta3.proto import task_pb2 +from google.iam.v1 import iam_policy_pb2 +from google.iam.v1 import policy_pb2 +from google.protobuf import empty_pb2 + + +class MultiCallableStub(object): + """Stub for the grpc.UnaryUnaryMultiCallable interface.""" + + def __init__(self, method, channel_stub): + self.method = method + self.channel_stub = channel_stub + + def __call__(self, request, timeout=None, metadata=None, credentials=None): + self.channel_stub.requests.append((self.method, request)) + + response = None + if self.channel_stub.responses: + response = self.channel_stub.responses.pop() + + if isinstance(response, Exception): + raise response + + if response: + return response + + +class ChannelStub(object): + """Stub for the grpc.Channel interface.""" + + def __init__(self, responses=[]): + self.responses = responses + self.requests = [] + + def unary_unary(self, + method, + request_serializer=None, + response_deserializer=None): + return MultiCallableStub(method, self) + + +class CustomException(Exception): + pass + + +class TestCloudTasksClient(object): + def test_list_queues(self): + # Setup Expected Response + next_page_token = '' + queues_element = {} + queues = [queues_element] + expected_response = { + 'next_page_token': next_page_token, + 'queues': queues + } + expected_response = cloudtasks_pb2.ListQueuesResponse( + **expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + parent = client.location_path('[PROJECT]', '[LOCATION]') + + paged_list_response = client.list_queues(parent) + resources = list(paged_list_response) + assert len(resources) == 1 + + assert expected_response.queues[0] == resources[0] + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.ListQueuesRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_queues_exception(self): + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + parent = client.location_path('[PROJECT]', '[LOCATION]') + + paged_list_response = client.list_queues(parent) + with pytest.raises(CustomException): + list(paged_list_response) + + def test_get_queue(self): + # Setup Expected Response + name_2 = 'name2-1052831874' + expected_response = {'name': name_2} + expected_response = queue_pb2.Queue(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + response = client.get_queue(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.GetQueueRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_queue_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + with pytest.raises(CustomException): + client.get_queue(name) + + def test_create_queue(self): + # Setup Expected Response + name = 'name3373707' + expected_response = {'name': name} + expected_response = queue_pb2.Queue(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + parent = client.location_path('[PROJECT]', '[LOCATION]') + queue = {} + + response = client.create_queue(parent, queue) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.CreateQueueRequest( + parent=parent, queue=queue) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_create_queue_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + parent = client.location_path('[PROJECT]', '[LOCATION]') + queue = {} + + with pytest.raises(CustomException): + client.create_queue(parent, queue) + + def test_update_queue(self): + # Setup Expected Response + name = 'name3373707' + expected_response = {'name': name} + expected_response = queue_pb2.Queue(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + queue = {} + + response = client.update_queue(queue) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.UpdateQueueRequest(queue=queue) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_update_queue_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + queue = {} + + with pytest.raises(CustomException): + client.update_queue(queue) + + def test_delete_queue(self): + channel = ChannelStub() + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + client.delete_queue(name) + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.DeleteQueueRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_delete_queue_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + with pytest.raises(CustomException): + client.delete_queue(name) + + def test_purge_queue(self): + # Setup Expected Response + name_2 = 'name2-1052831874' + expected_response = {'name': name_2} + expected_response = queue_pb2.Queue(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + response = client.purge_queue(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.PurgeQueueRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_purge_queue_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + with pytest.raises(CustomException): + client.purge_queue(name) + + def test_pause_queue(self): + # Setup Expected Response + name_2 = 'name2-1052831874' + expected_response = {'name': name_2} + expected_response = queue_pb2.Queue(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + response = client.pause_queue(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.PauseQueueRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_pause_queue_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + with pytest.raises(CustomException): + client.pause_queue(name) + + def test_resume_queue(self): + # Setup Expected Response + name_2 = 'name2-1052831874' + expected_response = {'name': name_2} + expected_response = queue_pb2.Queue(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + response = client.resume_queue(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.ResumeQueueRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_resume_queue_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + name = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + with pytest.raises(CustomException): + client.resume_queue(name) + + def test_get_iam_policy(self): + # Setup Expected Response + version = 351608024 + etag = b'21' + expected_response = {'version': version, 'etag': etag} + expected_response = policy_pb2.Policy(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + resource = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + response = client.get_iam_policy(resource) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = iam_policy_pb2.GetIamPolicyRequest( + resource=resource) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_iam_policy_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + resource = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + with pytest.raises(CustomException): + client.get_iam_policy(resource) + + def test_set_iam_policy(self): + # Setup Expected Response + version = 351608024 + etag = b'21' + expected_response = {'version': version, 'etag': etag} + expected_response = policy_pb2.Policy(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + resource = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + policy = {} + + response = client.set_iam_policy(resource, policy) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = iam_policy_pb2.SetIamPolicyRequest( + resource=resource, policy=policy) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_set_iam_policy_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + resource = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + policy = {} + + with pytest.raises(CustomException): + client.set_iam_policy(resource, policy) + + def test_test_iam_permissions(self): + # Setup Expected Response + expected_response = {} + expected_response = iam_policy_pb2.TestIamPermissionsResponse( + **expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + resource = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + permissions = [] + + response = client.test_iam_permissions(resource, permissions) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = iam_policy_pb2.TestIamPermissionsRequest( + resource=resource, permissions=permissions) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_test_iam_permissions_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + resource = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + permissions = [] + + with pytest.raises(CustomException): + client.test_iam_permissions(resource, permissions) + + def test_list_tasks(self): + # Setup Expected Response + next_page_token = '' + tasks_element = {} + tasks = [tasks_element] + expected_response = { + 'next_page_token': next_page_token, + 'tasks': tasks + } + expected_response = cloudtasks_pb2.ListTasksResponse( + **expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + parent = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + paged_list_response = client.list_tasks(parent) + resources = list(paged_list_response) + assert len(resources) == 1 + + assert expected_response.tasks[0] == resources[0] + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.ListTasksRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_tasks_exception(self): + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + parent = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + + paged_list_response = client.list_tasks(parent) + with pytest.raises(CustomException): + list(paged_list_response) + + def test_get_task(self): + # Setup Expected Response + name_2 = 'name2-1052831874' + dispatch_count = 1217252086 + response_count = 424727441 + expected_response = { + 'name': name_2, + 'dispatch_count': dispatch_count, + 'response_count': response_count + } + expected_response = task_pb2.Task(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + name = client.task_path('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]') + + response = client.get_task(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.GetTaskRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_task_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + name = client.task_path('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]') + + with pytest.raises(CustomException): + client.get_task(name) + + def test_create_task(self): + # Setup Expected Response + name = 'name3373707' + dispatch_count = 1217252086 + response_count = 424727441 + expected_response = { + 'name': name, + 'dispatch_count': dispatch_count, + 'response_count': response_count + } + expected_response = task_pb2.Task(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + parent = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + task = {} + + response = client.create_task(parent, task) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.CreateTaskRequest( + parent=parent, task=task) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_create_task_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + parent = client.queue_path('[PROJECT]', '[LOCATION]', '[QUEUE]') + task = {} + + with pytest.raises(CustomException): + client.create_task(parent, task) + + def test_delete_task(self): + channel = ChannelStub() + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + name = client.task_path('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]') + + client.delete_task(name) + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.DeleteTaskRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_delete_task_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + name = client.task_path('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]') + + with pytest.raises(CustomException): + client.delete_task(name) + + def test_run_task(self): + # Setup Expected Response + name_2 = 'name2-1052831874' + dispatch_count = 1217252086 + response_count = 424727441 + expected_response = { + 'name': name_2, + 'dispatch_count': dispatch_count, + 'response_count': response_count + } + expected_response = task_pb2.Task(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup Request + name = client.task_path('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]') + + response = client.run_task(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = cloudtasks_pb2.RunTaskRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_run_task_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + client = tasks_v2beta3.CloudTasksClient(channel=channel) + + # Setup request + name = client.task_path('[PROJECT]', '[LOCATION]', '[QUEUE]', '[TASK]') + + with pytest.raises(CustomException): + client.run_task(name)