/// <summary> /// Asynchronously creates a new instance reflecting the most recent state of the operation with the specified name. /// </summary> /// <param name="name">The name of the operation, as returned when it was created. Must not be null.</param> /// <param name="client">The client to make the RPC call.</param> /// <param name="cancellationToken">A cancellation token for the "fetch" operation.</param> /// <returns>A task representing the asynchronous "fetch" operation. The result of the task is /// the current state of the operation identified by <paramref name="name"/>.</returns> public static Task <Operation <TResponse, TMetadata> > PollOnceFromNameAsync(string name, OperationsClient client, CancellationToken cancellationToken) => PollOnceFromNameAsync(name, client, CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Asynchronously creates a new instance reflecting the most recent state of the operation with the specified name. /// </summary> /// <param name="name">The name of the operation, as returned when it was created. Must not be null.</param> /// <param name="client">The client to make the RPC call.</param> /// <param name="callSettings">Any overriding call settings to apply to the RPC. May be null, in which case /// the default settings are used.</param> /// <returns>A task representing the asynchronous "fetch" operation. The result of the task is /// the current state of the operation identified by <paramref name="name"/>.</returns> public static async Task <Operation <TResponse, TMetadata> > PollOnceFromNameAsync(string name, OperationsClient client, CallSettings callSettings = null) { GaxPreconditions.CheckNotNull(name, nameof(name)); GaxPreconditions.CheckNotNull(client, nameof(client)); var operation = await client.GetOperationAsync(name, callSettings).ConfigureAwait(false); return(new Operation <TResponse, TMetadata>(operation, client)); }