<PackageReference Include="Azure.Storage.Blobs" Version="12.25.1" />

OperationInternal<T>

A helper class used to build long-running operation instances. In order to use this helper: Make sure your LRO implements the IOperation<T> interface.Add a private OperationInternal<T> field to your LRO, and instantiate it during construction.Delegate method calls to the OperationInternal<T> implementations. Supported members: HasValue HasCompleted Value RawResponse, used for GetRawResponse UpdateStatus UpdateStatusAsync WaitForCompletionAsync WaitForCompletionAsync
public bool HasValue { get; }

Returns true if the long-running operation completed successfully and has produced a final result. Usage example: public bool HasValue => _operationInternal.HasValue;

public T Value { get; }

The final result of the long-running operation. Usage example: public T Value => _operationInternal.Value;

public OperationInternal(IOperation<T> operation, ClientDiagnostics clientDiagnostics, Response rawResponse, string operationTypeName = null, IEnumerable<KeyValuePair<string, string>> scopeAttributes = null, DelayStrategy fallbackStrategy = null)

Initializes a new instance of the OperationInternal<T> class.

public static OperationInternal<T> Failed(Response rawResponse, RequestFailedException operationFailedException)

Initializes a new instance of the OperationInternal class in a final failed state.

public static OperationInternal<T> Succeeded(Response rawResponse, T value)

Initializes a new instance of the OperationInternal class in a final successful state.

public Response<T> WaitForCompletion(CancellationToken cancellationToken)

Periodically calls UpdateStatus until the long-running operation completes. After each service call, a retry-after header may be returned to communicate that there is no reason to poll for status change until the specified time has passed. Headers supported are: "Retry-After", "retry-after-ms", and "x-ms-retry-after-ms", Usage example: public async ValueTask<Response<T>> WaitForCompletionAsync(CancellationToken cancellationToken) => await _operationInternal.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);

public Response<T> WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken)

Periodically calls UpdateStatus until the long-running operation completes. The interval between calls is defined by the FixedDelayWithNoJitterStrategy, which takes into account any retry-after header that is returned from the server. Usage example: public async ValueTask<Response<T>> WaitForCompletionAsync(CancellationToken cancellationToken) => await _operationInternal.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);

Periodically calls UpdateStatusAsync until the long-running operation completes. After each service call, a retry-after header may be returned to communicate that there is no reason to poll for status change until the specified time has passed. Headers supported are: "Retry-After", "retry-after-ms", and "x-ms-retry-after-ms", Usage example: public async ValueTask<Response<T>> WaitForCompletionAsync(CancellationToken cancellationToken) => await _operationInternal.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);

public ValueTask<Response<T>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken)

Periodically calls UpdateStatusAsync until the long-running operation completes. The interval between calls is defined by the parameter pollingInterval, but it can change based on information returned from the server. After each service call, a retry-after header may be returned to communicate that there is no reason to poll for status change until the specified time has passed. In this case, the maximum value between the pollingInterval parameter and the retry-after header is chosen as the wait interval. Headers supported are: "Retry-After", "retry-after-ms", and "x-ms-retry-after-ms". Usage example: public async ValueTask<Response<T>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => await _operationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false);