Beispiel #1
0
 public virtual RestorePointDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("RestorePoint.Delete");
     scope.Start();
     try
     {
         var response = _restorePointsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         var operation = new RestorePointDeleteOperation(_clientDiagnostics, Pipeline, _restorePointsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response);
         if (waitForCompletion)
             operation.WaitForCompletion(cancellationToken);
         return operation;
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Beispiel #2
0
        public async virtual Task <RestorePointDeleteOperation> DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("RestorePoint.Delete");
            scope.Start();
            try
            {
                var response = await _restorePointsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);

                var operation = new RestorePointDeleteOperation(_clientDiagnostics, Pipeline, _restorePointsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response);
                if (waitForCompletion)
                {
                    await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }