Class OperationsClient
Operations client wrapper, for convenient use.
Inherited Members
Namespace: Google.LongRunning
Assembly: Google.LongRunning.dll
Syntax
public abstract class OperationsClient
Remarks
Manages long-running operations with an API service.
When an API method normally takes long time to complete, it can be designed
to return [Operation][google.longrunning.Operation] to the client, and the client can use this
interface to receive the real response asynchronously by polling the
operation resource, or pass the operation resource to another API (such as
Google Cloud Pub/Sub API) to receive the response. Any API service that
returns long-running operations should implement the Operations
interface
so developers can have a consistent client experience.
Properties
Clock
The clock used for timeouts, retries and polling.
Declaration
public virtual IClock Clock { get; }
Property Value
Type | Description |
---|---|
IClock |
DefaultEndpoint
The default endpoint for the Operations service, which is a host of "longrunning.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
Type | Description |
---|---|
System.String |
DefaultPollSettings
The poll settings used by default for repeated polling operations. May be null if no defaults have been set.
Declaration
public virtual PollSettings DefaultPollSettings { get; }
Property Value
Type | Description |
---|---|
PollSettings |
DefaultScopes
The default Operations scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<System.String> |
Remarks
The default Operations scopes are:
GrpcClient
The underlying gRPC Operations client
Declaration
public virtual Operations.OperationsClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
Operations.OperationsClient |
Scheduler
The scheduler used for timeouts, retries and polling.
Declaration
public virtual IScheduler Scheduler { get; }
Property Value
Type | Description |
---|---|
IScheduler |
Methods
CancelOperation(CancelOperationRequest, CallSettings)
Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
. Clients can use
[Operations.GetOperation][google.longrunning.Operations.GetOperation] or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
corresponding to Code.CANCELLED
.
Declaration
public virtual void CancelOperation(CancelOperationRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
CancelOperationRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
CancelOperation(String, CallSettings)
Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
. Clients can use
[Operations.GetOperation][google.longrunning.Operations.GetOperation] or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
corresponding to Code.CANCELLED
.
Declaration
public virtual void CancelOperation(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation resource to be cancelled. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
CancelOperationAsync(CancelOperationRequest, CallSettings)
Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
. Clients can use
[Operations.GetOperation][google.longrunning.Operations.GetOperation] or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
corresponding to Code.CANCELLED
.
Declaration
public virtual Task CancelOperationAsync(CancelOperationRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
CancelOperationRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task containing the RPC response. |
CancelOperationAsync(CancelOperationRequest, CancellationToken)
Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
. Clients can use
[Operations.GetOperation][google.longrunning.Operations.GetOperation] or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
corresponding to Code.CANCELLED
.
Declaration
public virtual Task CancelOperationAsync(CancelOperationRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancelOperationRequest | request | The request object containing all of the parameters for the API call. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task containing the RPC response. |
CancelOperationAsync(String, CallSettings)
Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
. Clients can use
[Operations.GetOperation][google.longrunning.Operations.GetOperation] or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
corresponding to Code.CANCELLED
.
Declaration
public virtual Task CancelOperationAsync(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation resource to be cancelled. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task containing the RPC response. |
CancelOperationAsync(String, CancellationToken)
Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
. Clients can use
[Operations.GetOperation][google.longrunning.Operations.GetOperation] or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
corresponding to Code.CANCELLED
.
Declaration
public virtual Task CancelOperationAsync(string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation resource to be cancelled. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task containing the RPC response. |
Create()
Synchronously creates a OperationsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use OperationsClientBuilder.
Declaration
public static OperationsClient Create()
Returns
Type | Description |
---|---|
OperationsClient | The created OperationsClient. |
CreateAsync(CancellationToken)
Asynchronously creates a OperationsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use OperationsClientBuilder.
Declaration
public static Task<OperationsClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | The System.Threading.CancellationToken to use while creating the client. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<OperationsClient> | The task representing the created OperationsClient. |
DeleteOperation(DeleteOperationRequest, CallSettings)
Deletes a long-running operation. 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
.
Declaration
public virtual void DeleteOperation(DeleteOperationRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteOperationRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
DeleteOperation(String, CallSettings)
Deletes a long-running operation. 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
.
Declaration
public virtual void DeleteOperation(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation resource to be deleted. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
DeleteOperationAsync(DeleteOperationRequest, CallSettings)
Deletes a long-running operation. 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
.
Declaration
public virtual Task DeleteOperationAsync(DeleteOperationRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteOperationRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task containing the RPC response. |
DeleteOperationAsync(DeleteOperationRequest, CancellationToken)
Deletes a long-running operation. 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
.
Declaration
public virtual Task DeleteOperationAsync(DeleteOperationRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
DeleteOperationRequest | request | The request object containing all of the parameters for the API call. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task containing the RPC response. |
DeleteOperationAsync(String, CallSettings)
Deletes a long-running operation. 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
.
Declaration
public virtual Task DeleteOperationAsync(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation resource to be deleted. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task containing the RPC response. |
DeleteOperationAsync(String, CancellationToken)
Deletes a long-running operation. 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
.
Declaration
public virtual Task DeleteOperationAsync(string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation resource to be deleted. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task containing the RPC response. |
GetEffectiveCallSettingsForGetOperation(CallSettings)
Return the CallSettings that would be used by a call to GetOperation(GetOperationRequest, CallSettings), using the base settings of this client and the specified per-call overrides.
Declaration
protected virtual CallSettings GetEffectiveCallSettingsForGetOperation(CallSettings callSettings)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | callSettings | The per-call override, if any. |
Returns
Type | Description |
---|---|
CallSettings | The effective call settings for a GetOperation RPC. |
Remarks
This method is used when polling, to determine the appropriate timeout and cancellation token to use for each call.
GetOperation(GetOperationRequest, CallSettings)
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.
Declaration
public virtual Operation GetOperation(GetOperationRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetOperationRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation | The RPC response. |
GetOperation(String, CallSettings)
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.
Declaration
public virtual Operation GetOperation(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation resource. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation | The RPC response. |
GetOperationAsync(GetOperationRequest, CallSettings)
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.
Declaration
public virtual Task<Operation> GetOperationAsync(GetOperationRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetOperationRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Operation> | A Task containing the RPC response. |
GetOperationAsync(GetOperationRequest, CancellationToken)
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.
Declaration
public virtual Task<Operation> GetOperationAsync(GetOperationRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GetOperationRequest | request | The request object containing all of the parameters for the API call. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Operation> | A Task containing the RPC response. |
GetOperationAsync(String, CallSettings)
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.
Declaration
public virtual Task<Operation> GetOperationAsync(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation resource. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Operation> | A Task containing the RPC response. |
GetOperationAsync(String, CancellationToken)
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.
Declaration
public virtual Task<Operation> GetOperationAsync(string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation resource. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Operation> | A Task containing the RPC response. |
ListOperations(ListOperationsRequest, CallSettings)
Lists operations that match the specified filter in the request. If the
server doesn't support this method, it returns UNIMPLEMENTED
.
NOTE: the name
binding allows API services to override the binding
to use different resource name schemes, such as users/*/operations
. To
override the binding, API services can add a binding such as
"/v1/{name=users/*}/operations"
to their service configuration.
For backwards compatibility, the default name includes the operations
collection id, however overriding users must ensure the name binding
is the parent resource, without the operations collection id.
Declaration
public virtual PagedEnumerable<ListOperationsResponse, Operation> ListOperations(ListOperationsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListOperationsRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListOperationsResponse, Operation> | A pageable sequence of Operation resources. |
ListOperations(String, String, String, Nullable<Int32>, CallSettings)
Lists operations that match the specified filter in the request. If the
server doesn't support this method, it returns UNIMPLEMENTED
.
NOTE: the name
binding allows API services to override the binding
to use different resource name schemes, such as users/*/operations
. To
override the binding, API services can add a binding such as
"/v1/{name=users/*}/operations"
to their service configuration.
For backwards compatibility, the default name includes the operations
collection id, however overriding users must ensure the name binding
is the parent resource, without the operations collection id.
Declaration
public virtual PagedEnumerable<ListOperationsResponse, Operation> ListOperations(string name, string filter, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation's parent resource. |
System.String | filter | The standard list filter. |
System.String | pageToken | The token returned from the previous request. A value of |
System.Nullable<System.Int32> | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListOperationsResponse, Operation> | A pageable sequence of Operation resources. |
ListOperationsAsync(ListOperationsRequest, CallSettings)
Lists operations that match the specified filter in the request. If the
server doesn't support this method, it returns UNIMPLEMENTED
.
NOTE: the name
binding allows API services to override the binding
to use different resource name schemes, such as users/*/operations
. To
override the binding, API services can add a binding such as
"/v1/{name=users/*}/operations"
to their service configuration.
For backwards compatibility, the default name includes the operations
collection id, however overriding users must ensure the name binding
is the parent resource, without the operations collection id.
Declaration
public virtual PagedAsyncEnumerable<ListOperationsResponse, Operation> ListOperationsAsync(ListOperationsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListOperationsRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListOperationsResponse, Operation> | A pageable asynchronous sequence of Operation resources. |
ListOperationsAsync(String, String, String, Nullable<Int32>, CallSettings)
Lists operations that match the specified filter in the request. If the
server doesn't support this method, it returns UNIMPLEMENTED
.
NOTE: the name
binding allows API services to override the binding
to use different resource name schemes, such as users/*/operations
. To
override the binding, API services can add a binding such as
"/v1/{name=users/*}/operations"
to their service configuration.
For backwards compatibility, the default name includes the operations
collection id, however overriding users must ensure the name binding
is the parent resource, without the operations collection id.
Declaration
public virtual PagedAsyncEnumerable<ListOperationsResponse, Operation> ListOperationsAsync(string name, string filter, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the operation's parent resource. |
System.String | filter | The standard list filter. |
System.String | pageToken | The token returned from the previous request. A value of |
System.Nullable<System.Int32> | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListOperationsResponse, Operation> | A pageable asynchronous sequence of Operation resources. |
ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Declaration
public static Task ShutdownDefaultChannelsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous shutdown operation. |
Remarks
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.
WaitOperation(WaitOperationRequest, CallSettings)
Waits for the specified long-running operation until it 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.
Declaration
public virtual Operation WaitOperation(WaitOperationRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
WaitOperationRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation | The RPC response. |
WaitOperationAsync(WaitOperationRequest, CallSettings)
Waits for the specified long-running operation until it 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.
Declaration
public virtual Task<Operation> WaitOperationAsync(WaitOperationRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
WaitOperationRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Operation> | A Task containing the RPC response. |
WaitOperationAsync(WaitOperationRequest, CancellationToken)
Waits for the specified long-running operation until it 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.
Declaration
public virtual Task<Operation> WaitOperationAsync(WaitOperationRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
WaitOperationRequest | request | The request object containing all of the parameters for the API call. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Operation> | A Task containing the RPC response. |