CloudTasksClient(*, credentials: google.auth.credentials.Credentials = None, transport: Union[str, google.cloud.tasks_v2beta2.services.cloud_tasks.transports.base.CloudTasksTransport] = None, client_options: <module 'google.api_core.client_options' from '/workspace/python-tasks/.nox/docfx/lib/python3.9/site-packages/google/api_core/client_options.py'> = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Cloud Tasks allows developers to manage the execution of background work in their applications.
Methods
CloudTasksClient
CloudTasksClient(*, credentials: google.auth.credentials.Credentials = None, transport: Union[str, google.cloud.tasks_v2beta2.services.cloud_tasks.transports.base.CloudTasksTransport] = None, client_options: <module 'google.api_core.client_options' from '/workspace/python-tasks/.nox/docfx/lib/python3.9/site-packages/google/api_core/client_options.py'> = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Instantiate the cloud tasks client.
Name | Description |
credentials |
Optional[google.auth.credentials.Credentials]
The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. |
transport |
Union[str,
The transport to use. If set to None, a transport is chosen automatically. |
client_options |
ClientOptions
Custom options for the client. It won't take effect if a |
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 |
Type | Description |
google.auth.exceptions.MutualTLSChannelError | If mutual TLS transport creation failed for any reason. |
acknowledge_task
acknowledge_task(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.AcknowledgeTaskRequest] = None, *, name: Optional[str] = None, schedule_time: Optional[google.protobuf.timestamp_pb2.Timestamp] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Acknowledges a pull task.
The worker, that is, the entity that xref_leased this task must call this method to indicate that the work associated with the task has finished.
The worker must acknowledge a task within the xref_lease_duration or the lease will expire and the task will become available to be leased again. After the task is acknowledged, it will not be returned by a later xref_LeaseTasks, xref_GetTask, or xref_ListTasks.
Name | Description |
request |
The request object. Request message for acknowledging a task using AcknowledgeTask. |
name |
Required. The task name. For example: |
schedule_time |
Required. The task's current schedule time, available in the schedule_time returned by LeaseTasks response or RenewLease response. This restriction is to ensure that your worker currently holds the lease. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
cancel_lease
cancel_lease(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.CancelLeaseRequest] = None, *, name: Optional[str] = None, schedule_time: Optional[google.protobuf.timestamp_pb2.Timestamp] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Cancel a pull task's lease.
The worker can use this method to cancel a task's lease by setting its xref_schedule_time to now. This will make the task available to be leased to the next caller of xref_LeaseTasks.
Name | Description |
request |
The request object. Request message for canceling a lease using CancelLease. |
name |
Required. The task name. For example: |
schedule_time |
Required. The task's current schedule time, available in the schedule_time returned by LeaseTasks response or RenewLease response. This restriction is to ensure that your worker currently holds the lease. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| A unit of scheduled work. |
create_queue
create_queue(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.CreateQueueRequest] = None, *, parent: Optional[str] = None, queue: Optional[google.cloud.tasks_v2beta2.types.queue.Queue] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
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.
Name | Description |
request |
The request object. Request message for CreateQueue. |
parent |
Required. The location name in which the queue will be created. For example: |
queue |
Required. The queue to create. [Queue's name][google.cloud.tasks.v2beta2.Queue.name] cannot be the same as an existing queue. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| 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, target types, and others. |
create_task
create_task(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.CreateTaskRequest] = None, *, parent: Optional[str] = None, task: Optional[google.cloud.tasks_v2beta2.types.task.Task] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
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.v2beta2.AppEngineHttpTarget], the maximum task size is 100KB.
- For xref_pull queues, the maximum task size is 1MB.
Name | Description |
request |
The request object. Request message for CreateTask. |
parent |
Required. The queue name. For example: |
task |
Required. The task to add. Task names have the following format: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| A unit of scheduled work. |
delete_queue
delete_queue(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.DeleteQueueRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
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.
Name | Description |
request |
The request object. Request message for DeleteQueue. |
name |
Required. The queue name. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
delete_task
delete_task(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.DeleteTaskRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Deletes a task. A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has completed successfully or permanently failed.
Name | Description |
request |
The request object. Request message for deleting a task using DeleteTask. |
name |
Required. The task name. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
from_service_account_file
from_service_account_file(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
{@api.name} | The constructed client. |
from_service_account_json
from_service_account_json(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
{@api.name} | The constructed client. |
get_iam_policy
get_iam_policy(request: Optional[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest] = None, *, resource: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Gets the access control policy for a xref_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
Name | Description |
request |
The request object. Request message for |
resource |
REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A Policy is a collection of bindings . A binding binds one or more members to a single role . Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions (defined by IAM or configured by users). A binding can optionally specify a condition , which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource. **JSON Example** :: { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": ["user:eve@example.com"], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01t00:00:00.000z')",="" }="" }="" ]="" }="" **yaml="" example**="" ::="" bindings:="" -="" members:="" -="" user:mike@example.com="" -="" group:admins@example.com="" -="" domain:google.com="" -="" serviceaccount:my-project-id@appspot.gserviceaccount.com="" role:="" roles/resourcemanager.organizationadmin="" -="" members:="" -="" user:eve@example.com="" role:="" roles/resourcemanager.organizationviewer="" condition:="" title:="" expirable="" access="" description:="" does="" not="" grant="" access="" after="" sep="" 2020="" expression:="" request.time="">< timestamp('2020-10-01t00:00:00.000z')="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="">IAM developer's guide __. |
get_queue
get_queue(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.GetQueueRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Gets a queue.
Name | Description |
request |
The request object. Request message for GetQueue. |
name |
Required. The resource name of the queue. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| 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, target types, and others. |
get_task
get_task(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.GetTaskRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Gets a task.
Name | Description |
request |
The request object. Request message for getting a task using GetTask. |
name |
Required. The task name. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| A unit of scheduled work. |
lease_tasks
lease_tasks(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.LeaseTasksRequest] = None, *, parent: Optional[str] = None, lease_duration: Optional[google.protobuf.duration_pb2.Duration] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Leases tasks from a pull queue for xref_lease_duration.
This method is invoked by the worker to obtain a lease. The worker must acknowledge the task via xref_AcknowledgeTask after they have performed the work associated with the task.
The xref_payload is intended to store data that the worker needs to perform the work associated with the task. To return the payloads in the xref_response, set xref_response_view to xref_FULL.
A maximum of 10 qps of
xref_LeaseTasks
requests are allowed per queue.
RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]
is
returned when this limit is exceeded.
RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]
is also
returned when
xref_max_tasks_dispatched_per_second
is exceeded.
Name | Description |
request |
The request object. Request message for leasing tasks using LeaseTasks. |
parent |
Required. The queue name. For example: |
lease_duration |
Required. The duration of the lease. Each task returned in the response will have its schedule_time set to the current time plus the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Response message for leasing tasks using LeaseTasks. |
list_queues
list_queues(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.ListQueuesRequest] = None, *, parent: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Lists queues. Queues are returned in lexicographical order.
Name | Description |
request |
The request object. Request message for ListQueues. |
parent |
Required. The location name. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Response message for ListQueues. Iterating over this object will yield results and resolve additional pages automatically. |
list_tasks
list_tasks(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.ListTasksRequest] = None, *, parent: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Lists the tasks in a queue.
By default, only the xref_BASIC view is retrieved due to performance considerations; xref_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.
Name | Description |
request |
The request object. Request message for listing tasks using ListTasks. |
parent |
Required. The queue name. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Response message for listing tasks using ListTasks. Iterating over this object will yield results and resolve additional pages automatically. |
parse_queue_path
parse_queue_path(path: str)
Parse a queue path into its component segments.
parse_task_path
parse_task_path(path: str)
Parse a task path into its component segments.
pause_queue
pause_queue(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.PauseQueueRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Pauses the queue.
If a queue is paused then the system will stop dispatching tasks until the queue is resumed via xref_ResumeQueue. Tasks can still be added when the queue is paused. A queue is paused if its xref_state is xref_PAUSED.
Name | Description |
request |
The request object. Request message for PauseQueue. |
name |
Required. The queue name. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| 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, target types, and others. |
purge_queue
purge_queue(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.PurgeQueueRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
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.
Name | Description |
request |
The request object. Request message for PurgeQueue. |
name |
Required. The queue name. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| 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, target types, and others. |
queue_path
queue_path(project: str, location: str, queue: str)
Return a fully-qualified queue string.
renew_lease
renew_lease(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.RenewLeaseRequest] = None, *, name: Optional[str] = None, schedule_time: Optional[google.protobuf.timestamp_pb2.Timestamp] = None, lease_duration: Optional[google.protobuf.duration_pb2.Duration] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Renew the current lease of a pull task.
The worker can use this method to extend the lease by a new duration, starting from now. The new task lease will be returned in the task's xref_schedule_time.
Name | Description |
request |
The request object. Request message for renewing a lease using RenewLease. |
name |
Required. The task name. For example: |
schedule_time |
Required. The task's current schedule time, available in the schedule_time returned by LeaseTasks response or RenewLease response. This restriction is to ensure that your worker currently holds the lease. This corresponds to the |
lease_duration |
Required. The desired new lease duration, starting from now. The maximum lease duration is 1 week. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| A unit of scheduled work. |
resume_queue
resume_queue(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.ResumeQueueRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Resume a queue.
This method resumes a queue after it has been xref_PAUSED or xref_DISABLED. The state of a queue is stored in the queue's xref_state; after calling this method it will be set to xref_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>
__.
Name | Description |
request |
The request object. Request message for ResumeQueue. |
name |
Required. The queue name. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| 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, target types, and others. |
run_task
run_task(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.RunTaskRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
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 xref_RateLimits or is xref_PAUSED.
This command is meant to be used for manual debugging. For example, xref_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 xref_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 xref_schedule_time will be reset to the time that xref_RunTask was called plus the retry delay specified in the queue's xref_RetryConfig.
xref_RunTask returns
NOT_FOUND][google.rpc.Code.NOT_FOUND]
when it is called on a
task that has already succeeded or permanently failed.
xref_RunTask cannot be called on a [pull task][google.cloud.tasks.v2beta2.PullMessage].
Name | Description |
request |
The request object. Request message for forcing a task to run now using RunTask. |
name |
Required. The task name. For example: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| A unit of scheduled work. |
set_iam_policy
set_iam_policy(request: Optional[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest] = None, *, resource: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Sets the access control policy for a xref_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
Name | Description |
request |
The request object. Request message for |
resource |
REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A Policy is a collection of bindings . A binding binds one or more members to a single role . Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions (defined by IAM or configured by users). A binding can optionally specify a condition , which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource. **JSON Example** :: { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": ["user:eve@example.com"], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01t00:00:00.000z')",="" }="" }="" ]="" }="" **yaml="" example**="" ::="" bindings:="" -="" members:="" -="" user:mike@example.com="" -="" group:admins@example.com="" -="" domain:google.com="" -="" serviceaccount:my-project-id@appspot.gserviceaccount.com="" role:="" roles/resourcemanager.organizationadmin="" -="" members:="" -="" user:eve@example.com="" role:="" roles/resourcemanager.organizationviewer="" condition:="" title:="" expirable="" access="" description:="" does="" not="" grant="" access="" after="" sep="" 2020="" expression:="" request.time="">< timestamp('2020-10-01t00:00:00.000z')="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="">IAM developer's guide __. |
task_path
task_path(project: str, location: str, queue: str, task: str)
Return a fully-qualified task string.
test_iam_permissions
test_iam_permissions(request: Optional[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest] = None, *, resource: Optional[str] = None, permissions: Optional[Sequence[str]] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Returns permissions that a caller has on a
xref_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.
Name | Description |
request |
The request object. Request message for |
resource |
REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. This corresponds to the |
permissions |
:class:
The set of permissions to check for the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Response message for TestIamPermissions method. |
update_queue
update_queue(request: Optional[google.cloud.tasks_v2beta2.types.cloudtasks.UpdateQueueRequest] = None, *, queue: Optional[google.cloud.tasks_v2beta2.types.queue.Queue] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
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.
Name | Description |
request |
The request object. Request message for UpdateQueue. |
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. This corresponds to the |
update_mask |
A mask used to specify which fields of the queue are being updated. If empty, then all fields will be updated. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| 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, target types, and others. |