Exemple #1
0
        /// <summary>
        /// Delete tags with the resource.
        /// </summary>
        /// <param name="waitForCompletion"> Waits for the completion of the long running operations. </param>
        /// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param>
        /// <returns> The delete response. </returns>
        public virtual TagDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("TagResource.DeleteAtScope");
            scope.Start();

            try
            {
                var response  = _restClient.DeleteAtScope(Id, cancellationToken);
                var operation = new TagDeleteOperation(response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #2
0
        /// <summary>
        /// Delete tags with the resource.
        /// </summary>
        /// <param name="waitForCompletion"> Waits for the completion of the long running operations. </param>
        /// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param>
        /// <returns> The delete response. </returns>
        public virtual async Task <TagDeleteOperation> DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("TagResource.DeleteAtScope");
            scope.Start();

            try
            {
                var response = await _restClient.DeleteAtScopeAsync(Id, cancellationToken).ConfigureAwait(false);

                var operation = new TagDeleteOperation(response);
                if (waitForCompletion)
                {
                    await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }