Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.
Performance
Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.
Thread Safety
Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.
Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.run.v2.GetTaskRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
Required. The Execution from which the Tasks should be listed. To list all Tasks across Executions of a Job, use "-" instead of Execution name. To list all Tasks across Jobs, use "-" instead of Job name. Format: projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
Returns
Type
Description
StreamRange< google::cloud::run::v2::Task >
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.run.v2.Task, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.
Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.run.v2.ListTasksRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
Returns
Type
Description
StreamRange< google::cloud::run::v2::Task >
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.run.v2.Task, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.
Lists operations that match the specified filter in the request.
If the server doesn't support this method, it returns UNIMPLEMENTED.
Parameters
Name
Description
name
std::string const &
The name of the operation's parent resource.
filter
std::string const &
The standard list filter.
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
Returns
Type
Description
StreamRange< google::longrunning::Operation >
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.longrunning.Operation, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.
Lists operations that match the specified filter in the request.
If the server doesn't support this method, it returns UNIMPLEMENTED.
Parameters
Name
Description
request
google::longrunning::ListOperationsRequest
Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.longrunning.ListOperationsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
Returns
Type
Description
StreamRange< google::longrunning::Operation >
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.longrunning.Operation, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.
GetOperation(std::string const &, Options)
Gets the latest state of a long-running operation.
Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters
Name
Description
name
std::string const &
The name of the operation resource.
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
Gets the latest state of a long-running operation.
Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters
Name
Description
request
google::longrunning::GetOperationRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.longrunning.GetOperationRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.
Parameters
Name
Description
name
std::string const &
The name of the operation resource to be deleted.
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
Returns
Type
Description
Status
a Status object. If the request failed, the status contains the details of the failure.
This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.
Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.longrunning.DeleteOperationRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
Returns
Type
Description
Status
a Status object. If the request failed, the status contains the details of the failure.
Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state.
If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns google.rpc.Code.UNIMPLEMENTED. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.
Parameters
Name
Description
request
google::longrunning::WaitOperationRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.longrunning.WaitOperationRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.
opts
Options
Optional. Override the class-level options, such as retry and backoff policies.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis page details the \u003ccode\u003eTasksClient\u003c/code\u003e class for the Cloud Run Task Control Plane API, providing a range of versions from 2.11.0 up to the latest release candidate, 2.37.0-rc.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTasksClient\u003c/code\u003e class facilitates management and interaction with tasks, offering functions like \u003ccode\u003eGetTask\u003c/code\u003e for retrieving task information and \u003ccode\u003eListTasks\u003c/code\u003e for enumerating tasks within an execution or job.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTasksClient\u003c/code\u003e instances are designed to be thread-safe for concurrent access across different instances, and efficiently supports copy and move operations for performance.\u003c/p\u003e\n"],["\u003cp\u003eThe class also supports long-running operations via functions like \u003ccode\u003eGetOperation\u003c/code\u003e, \u003ccode\u003eListOperations\u003c/code\u003e, \u003ccode\u003eDeleteOperation\u003c/code\u003e and \u003ccode\u003eWaitOperation\u003c/code\u003e, allowing for comprehensive management of asynchronous tasks.\u003c/p\u003e\n"],["\u003cp\u003eThe class uses the \u003ccode\u003eStatusOr\u003c/code\u003e and \u003ccode\u003eStreamRange\u003c/code\u003e classes which are crucial for error handling and iterating over results respectively.\u003c/p\u003e\n"]]],[],null,["# Class TasksClient (2.42.0-rc)\n\nVersion latestkeyboard_arrow_down\n\n- [2.42.0-rc (latest)](/cpp/docs/reference/run/latest/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.41.0](/cpp/docs/reference/run/2.41.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.40.0](/cpp/docs/reference/run/2.40.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.39.0](/cpp/docs/reference/run/2.39.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.38.0](/cpp/docs/reference/run/2.38.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.37.0](/cpp/docs/reference/run/2.37.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.36.0](/cpp/docs/reference/run/2.36.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.35.0](/cpp/docs/reference/run/2.35.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.34.0](/cpp/docs/reference/run/2.34.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.33.0](/cpp/docs/reference/run/2.33.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.32.0](/cpp/docs/reference/run/2.32.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.31.0](/cpp/docs/reference/run/2.31.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.30.0](/cpp/docs/reference/run/2.30.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.29.0](/cpp/docs/reference/run/2.29.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.28.0](/cpp/docs/reference/run/2.28.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.27.0](/cpp/docs/reference/run/2.27.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.26.0](/cpp/docs/reference/run/2.26.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.25.1](/cpp/docs/reference/run/2.25.1/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.24.0](/cpp/docs/reference/run/2.24.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.23.0](/cpp/docs/reference/run/2.23.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.22.1](/cpp/docs/reference/run/2.22.1/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.21.0](/cpp/docs/reference/run/2.21.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.20.0](/cpp/docs/reference/run/2.20.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.19.0](/cpp/docs/reference/run/2.19.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.18.0](/cpp/docs/reference/run/2.18.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.17.0](/cpp/docs/reference/run/2.17.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.16.0](/cpp/docs/reference/run/2.16.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.15.1](/cpp/docs/reference/run/2.15.1/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.14.0](/cpp/docs/reference/run/2.14.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.13.0](/cpp/docs/reference/run/2.13.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.12.0](/cpp/docs/reference/run/2.12.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient)\n- [2.11.0](/cpp/docs/reference/run/2.11.0/classgoogle_1_1cloud_1_1run__v2_1_1TasksClient) \nCloud Run Task Control Plane API. \n\n###### Equality\n\nInstances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal `std::shared_ptr\u003c*Connection\u003e` objects compare equal. Objects that compare equal share the same underlying resources.\n\n###### Performance\n\nCreating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.\n\n###### Thread Safety\n\nConcurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.\n\nConstructors\n------------\n\n### TasksClient(TasksClient const \\&)\n\nCopy and move support\n\n### TasksClient(TasksClient \\&\\&)\n\nCopy and move support\n\n### TasksClient(std::shared_ptr\\\u003c TasksConnection \\\u003e, Options)\n\nOperators\n---------\n\n### operator=(TasksClient const \\&)\n\nCopy and move support\n\n### operator=(TasksClient \\&\\&)\n\nCopy and move support\n\nFunctions\n---------\n\n### GetTask(std::string const \\&, Options)\n\nGets information about a Task.\n\n### GetTask(google::cloud::run::v2::GetTaskRequest const \\&, Options)\n\nGets information about a Task.\n\n### ListTasks(std::string const \\&, Options)\n\nLists Tasks from an Execution of a Job.\n\n### ListTasks(google::cloud::run::v2::ListTasksRequest, Options)\n\nLists Tasks from an Execution of a Job.\n\n### ListOperations(std::string const \\&, std::string const \\&, Options)\n\nLists operations that match the specified filter in the request. \nIf the server doesn't support this method, it returns `UNIMPLEMENTED`.\n\n### ListOperations(google::longrunning::ListOperationsRequest, Options)\n\nLists operations that match the specified filter in the request. \nIf the server doesn't support this method, it returns `UNIMPLEMENTED`.\n\n### GetOperation(std::string const \\&, Options)\n\nGets the latest state of a long-running operation. \nClients can use this method to poll the operation result at intervals as recommended by the API service.\n\n### GetOperation(google::longrunning::GetOperationRequest const \\&, Options)\n\nGets the latest state of a long-running operation. \nClients can use this method to poll the operation result at intervals as recommended by the API service.\n\n### DeleteOperation(std::string const \\&, Options)\n\nDeletes a long-running operation. \nThis method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.\n\n### DeleteOperation(google::longrunning::DeleteOperationRequest const \\&, Options)\n\nDeletes a long-running operation. \nThis method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.\n\n### WaitOperation(google::longrunning::WaitOperationRequest const \\&, Options)\n\nWaits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. \nIf the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done."]]