<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.12" />

Microsoft.Rest.ClientRuntime.Azure.LRO.AzureLRO<TResourceBody, TRequestHeaders>

abstract class AzureLRO<TResourceBody, TRequestHeaders> : IAzureLRO<TResourceBody, TRequestHeaders>, IRestLRO
Base class for driving Azure LRO operation

protected LROPollState<TResourceBody, TRequestHeaders> CurrentPollingState

protected Dictionary<string, List<string>> CustomHeaders

protected AzureOperationResponse<TResourceBody, TRequestHeaders> InitialResponse

protected bool IsLROTaskCompleted { get; protected set; }

public abstract string RESTOperationVerb { get; }

protected AzureLRO(IAzureClient client, AzureOperationResponse<TResourceBody, TRequestHeaders> initialResponse, Dictionary<string, List<string>> customHeaders, CancellationToken cancellationToken)

Constructor for creating Azure LRO LRO starts after the first response is returned to Azure ClientRuntime. This will validate the initial response for missing data.

public virtual Task BeginLROAsync()

Begin polling This will drive the entire LRO process of polling and checking for error during LRO

protected virtual void CheckFinalErrors()

Check for errors at the end of LRO operation Last chance to check any final errors

protected virtual void CheckForErrors()

Check for error codition during LRO Each verb can participate in deciding if certain response results in error

public virtual Task<AzureOperationResponse<TResourceBody, TRequestHeaders>> GetLROResults()

Return results from LRO operation

protected virtual string GetValidAbsoluteUri(string url, bool throwForInvalidUri = false)

Validate passed URL

protected virtual void InitializeAsyncHeadersToUse()

Initialize pollingUrl to use depending upon the headers passed back from RP This function will be called after each response received during LRO Each REST verb will override for specific requirements

protected virtual bool IsCheckingProvisioningStateApplicable()

Each verb will override to define if checking provisioning state is applicable

protected virtual Task PostPollingAsync()

Each verb will override depending upon the requirements

protected virtual Task StartPollingAsync()

Performs polling Workflow: Depends on an internal structure CurrentPollingState for driving the LRO operation 1) Depending upon the initial response status (starts/exits polling) 2) Reson for making Poll function part of CurrentPollingState because there can be scenario we might have to enabled to serialize polling state (user can save and drive polling operation) 3) Update polling state after each polling iteration 4) Check for errors on each reponse we recieve during LRO 5) Initialize polling URL to use based on the headers received in each polling response

protected virtual void UpdatePollingState()

Updates polling state strcture

protected virtual void ValidateInitialResponse()

Does basic validation on initial response from RP, prior to start LRO process