Пример #1
0
 /// <summary>
 /// Delete management group.
 /// If a management group contains child resources, the request will fail.
 /// .
 /// </summary>
 /// <param name="cacheControl"> Indicates whether the request should utilize any caches. Populate the header with &apos;no-cache&apos; value to bypass existing caches. </param>
 /// <param name="cancellationToken"> The cancellation token to use. </param>
 public virtual ManagementGroupsDeleteOperation StartDelete(string cacheControl = null, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("ManagementGroupOperations.StartDelete");
     scope.Start();
     try
     {
         var originalResponse = _restClient.Delete(Id.Name, cacheControl, cancellationToken);
         return(new ManagementGroupsDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.Name, cacheControl).Request, originalResponse));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Пример #2
0
        public virtual async Task <ArmOperation> DeleteAsync(WaitUntil waitUntil, string cacheControl = null, CancellationToken cancellationToken = default)
        {
            using var scope = _managementGroupClientDiagnostics.CreateScope("ManagementGroup.Delete");
            scope.Start();
            try
            {
                var response = await _managementGroupRestClient.DeleteAsync(Id.Name, cacheControl, cancellationToken).ConfigureAwait(false);

                var operation = new ManagementArmOperation(_managementGroupClientDiagnostics, Pipeline, _managementGroupRestClient.CreateDeleteRequest(Id.Name, cacheControl).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Пример #3
0
 /// <summary>
 /// Delete management group.
 /// If a management group contains child resources, the request will fail.
 /// .
 /// </summary>
 /// <param name="cacheControl"> Indicates whether the request should utilize any caches. Populate the header with &apos;no-cache&apos; value to bypass existing caches. </param>
 /// <param name="waitForCompletion"> Waits for the completion of the long running operations. </param>
 /// <param name="cancellationToken"> The cancellation token to use. </param>
 public virtual ManagementGroupDeleteOperation Delete(string cacheControl = null, bool waitForCompletion = true, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("ManagementGroup.Delete");
     scope.Start();
     try
     {
         var originalResponse = _restClient.Delete(Id.Name, cacheControl, cancellationToken);
         var operation        = new ManagementGroupDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.Name, cacheControl).Request, originalResponse);
         if (waitForCompletion)
         {
             operation.WaitForCompletion(cancellationToken);
         }
         return(operation);
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }