Esempio n. 1
0
        public async virtual Task <Response <DataMaskingRule> > CreateOrUpdateDataMaskingRuleAsync(string dataMaskingRuleName, DataMaskingRule parameters, CancellationToken cancellationToken = default)
        {
            if (dataMaskingRuleName == null)
            {
                throw new ArgumentNullException(nameof(dataMaskingRuleName));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicy.CreateOrUpdateDataMaskingRule");
            scope.Start();
            try
            {
                var response = await _dataMaskingRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, dataMaskingRuleName, parameters, cancellationToken).ConfigureAwait(false);

                return(response);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Esempio n. 2
0
        public virtual async Task <Response <DataMaskingRule> > CreateOrUpdateDataMaskingRuleAsync(string dataMaskingRuleName, DataMaskingRule dataMaskingRule, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(dataMaskingRuleName, nameof(dataMaskingRuleName));
            Argument.AssertNotNull(dataMaskingRule, nameof(dataMaskingRule));

            using var scope = _dataMaskingRulesClientDiagnostics.CreateScope("DataMaskingPolicyResource.CreateOrUpdateDataMaskingRule");
            scope.Start();
            try
            {
                var response = await _dataMaskingRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, dataMaskingRuleName, dataMaskingRule, cancellationToken).ConfigureAwait(false);

                return(response);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }