Ejemplo n.º 1
0
        public async virtual Task <ArmOperation <PolicyAssignment> > DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default)
        {
            using var scope = _policyAssignmentClientDiagnostics.CreateScope("PolicyAssignment.Delete");
            scope.Start();
            try
            {
                var response = await _policyAssignmentRestClient.DeleteAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false);

                var operation = new ResourcesArmOperation <PolicyAssignment>(Response.FromValue(new PolicyAssignment(Client, response), response.GetRawResponse()));
                if (waitForCompletion)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }