// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.sql.generated;

import com.azure.core.util.Context;
import com.azure.resourcemanager.sql.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner;
import com.azure.resourcemanager.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineItem;
import com.azure.resourcemanager.sql.models.VulnerabilityAssessmentName;
import com.azure.resourcemanager.sql.models.VulnerabilityAssessmentPolicyBaselineName;
import java.util.Arrays;

/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */
public final class DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/DatabaseVulnerabilityAssessmentRuleBaselineCreate.json
     */
    /**
     * Sample code: Creates or updates a database's vulnerability assessment rule baseline.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline(
        com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getDatabaseVulnerabilityAssessmentRuleBaselines()
            .createOrUpdateWithResponse(
                "vulnerabilityaseessmenttest-4799",
                "vulnerabilityaseessmenttest-6440",
                "testdb",
                VulnerabilityAssessmentName.DEFAULT,
                "VA1001",
                VulnerabilityAssessmentPolicyBaselineName.DEFAULT,
                new DatabaseVulnerabilityAssessmentRuleBaselineInner()
                    .withBaselineResults(
                        Arrays
                            .asList(
                                new DatabaseVulnerabilityAssessmentRuleBaselineItem()
                                    .withResult(Arrays.asList("userA", "SELECT")),
                                new DatabaseVulnerabilityAssessmentRuleBaselineItem()
                                    .withResult(Arrays.asList("userB", "SELECT")),
                                new DatabaseVulnerabilityAssessmentRuleBaselineItem()
                                    .withResult(Arrays.asList("userC", "SELECT", "tableId_4")))),
                Context.NONE);
    }
}
