private static void RetryAfter(NamespaceLongRunningOperation longrunningResponse, int longRunningOperationInitialTimeout) { if (longRunningOperationInitialTimeout >= 0) { //longrunningResponse.RetryAfter = longRunningOperationInitialTimeout; } }
public NamespaceLongRunningOperation BeginDeleteNamespace(string resourceGroupName, string namespaceName) { NamespaceLongRunningResponse response = Client.Namespaces.Delete(resourceGroupName, namespaceName); RetryAfter(response, Client.LongRunningOperationInitialTimeout); return(NamespaceLongRunningOperation.CreateLongRunningOperation(NamespaceLongRunningOperation.DeleteOperation, response)); }
internal NamespaceLongRunningOperation GetLongRunningOperationStatus(NamespaceLongRunningOperation longRunningOperation) { var response = Client.Namespaces.GetLongRunningOperationStatus(longRunningOperation.OperationLink); RetryAfter(response, Client.LongRunningOperationInitialTimeout); var result = NamespaceLongRunningOperation.CreateLongRunningOperation(longRunningOperation.OperationName, response as NamespaceLongRunningResponse); return(result); }
protected NamespaceLongRunningOperation WaitForOperationToComplete(NamespaceLongRunningOperation longRunningOperation) { WriteProgress(longRunningOperation); while (longRunningOperation.Status == OperationStatus.InProgress) { var retryAfter = longRunningOperation.RetryAfter ?? LongRunningOperationDefaultTimeout; Thread.Sleep(retryAfter); WriteProgress(longRunningOperation); } return(longRunningOperation); }
protected void WriteProgress(NamespaceLongRunningOperation operation) { WriteProgress(new ProgressRecord(0, operation.OperationName, operation.Status.ToString())); }