public virtual ArmOperation <ServerDatabaseVulnerabilityAssessmentRuleBaselineResource> Update(WaitUntil waitUntil, DatabaseVulnerabilityAssessmentRuleBaselineData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _serverDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("ServerDatabaseVulnerabilityAssessmentRuleBaselineResource.Update");
            scope.Start();
            try
            {
                var response  = _serverDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesRestClient.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 <ServerDatabaseVulnerabilityAssessmentRuleBaselineResource>(Response.FromValue(new ServerDatabaseVulnerabilityAssessmentRuleBaselineResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #2
0
 internal ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaseline(ArmClient client, DatabaseVulnerabilityAssessmentRuleBaselineData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
コード例 #3
0
        public virtual ServerDatabaseVulnerabilityAssessmentRuleBaselineCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, DatabaseVulnerabilityAssessmentRuleBaselineData parameters, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId));
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            using var scope = _serverDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("ServerDatabaseVulnerabilityAssessmentRuleBaselineCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response  = _serverDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, parameters, cancellationToken);
                var operation = new ServerDatabaseVulnerabilityAssessmentRuleBaselineCreateOrUpdateOperation(ArmClient, response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #4
0
        public virtual async Task <ArmOperation <ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaseline> > CreateOrUpdateAsync(WaitUntil waitUntil, 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 = await _managedInstanceDatabaseVulnerabilityAssessmentRuleBaselineManagedDatabaseVulnerabilityAssessmentRuleBaselinesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, parameters, cancellationToken).ConfigureAwait(false);

                var operation = new SqlArmOperation <ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaseline>(Response.FromValue(new ManagedInstanceDatabaseVulnerabilityAssessmentRuleBaseline(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 internal ServerDatabaseVulnerabilityAssessmentRuleBaselineResource(ArmClient client, DatabaseVulnerabilityAssessmentRuleBaselineData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
 internal ServerDatabaseVulnerabilityAssessmentRuleBaseline(ArmResource options, DatabaseVulnerabilityAssessmentRuleBaselineData resource) : base(options, resource.Id)
 {
     HasData            = true;
     _data              = resource;
     _clientDiagnostics = new ClientDiagnostics(ClientOptions);
     _databaseVulnerabilityAssessmentRuleBaselinesRestClient = new DatabaseVulnerabilityAssessmentRuleBaselinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
 }