public virtual ManagedDatabaseVulnerabilityAssessmentRuleBaselineCreateOrUpdateOperation CreateOrUpdate(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, DatabaseVulnerabilityAssessmentRuleBaselineData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default)
        {
            if (ruleId == null)
            {
                throw new ArgumentNullException(nameof(ruleId));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            using var scope = _clientDiagnostics.CreateScope("ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaselineCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response  = _managedDatabaseVulnerabilityAssessmentRuleBaselinesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, parameters, cancellationToken);
                var operation = new ManagedDatabaseVulnerabilityAssessmentRuleBaselineCreateOrUpdateOperation(Parent, response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
示例#2
0
        public virtual ArmOperation <ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaselineResource> Update(WaitUntil waitUntil, DatabaseVulnerabilityAssessmentRuleBaselineData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _managedInstanceDatabaseVulnerabilityAssessmentRuleBaselineManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaselineResource.Update");
            scope.Start();
            try
            {
                var response  = _managedInstanceDatabaseVulnerabilityAssessmentRuleBaselineManagedDatabaseVulnerabilityAssessmentRuleBaselinesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name.ToVulnerabilityAssessmentPolicyBaselineName(), data, cancellationToken);
                var operation = new SqlArmOperation <ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaselineResource>(Response.FromValue(new ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaselineResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual ArmOperation <ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaseline> CreateOrUpdate(bool waitForCompletion, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, DatabaseVulnerabilityAssessmentRuleBaselineData parameters, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId));
            Argument.AssertNotNull(parameters, nameof(parameters));

            using var scope = _managedInstanceDatabaseVulnerabilityAssessmentRuleBaselineManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaselineCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response  = _managedInstanceDatabaseVulnerabilityAssessmentRuleBaselineManagedDatabaseVulnerabilityAssessmentRuleBaselinesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, parameters, cancellationToken);
                var operation = new SqlArmOperation <ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaseline>(Response.FromValue(new ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaseline(Client, response), response.GetRawResponse()));
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }