"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatabaseVulnerabilityAssessmentRuleBaselinesImpl = void 0;
const tslib_1 = require("tslib");
const coreClient = tslib_1.__importStar(require("@azure/core-client"));
const Mappers = tslib_1.__importStar(require("../models/mappers.js"));
const Parameters = tslib_1.__importStar(require("../models/parameters.js"));
/** Class containing DatabaseVulnerabilityAssessmentRuleBaselines operations. */
class DatabaseVulnerabilityAssessmentRuleBaselinesImpl {
    client;
    /**
     * Initialize a new instance of the class DatabaseVulnerabilityAssessmentRuleBaselines class.
     * @param client Reference to the service client
     */
    constructor(client) {
        this.client = client;
    }
    /**
     * Gets a database's vulnerability assessment rule baseline.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param serverName The name of the server.
     * @param databaseName The name of the database for which the vulnerability assessment rule baseline is
     *                     defined.
     * @param vulnerabilityAssessmentName The name of the vulnerability assessment.
     * @param ruleId The vulnerability assessment rule ID.
     * @param baselineName The name of the vulnerability assessment rule baseline (default implies a
     *                     baseline on a database level rule and master for server level rule).
     * @param options The options parameters.
     */
    get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, options) {
        return this.client.sendOperationRequest({
            resourceGroupName,
            serverName,
            databaseName,
            vulnerabilityAssessmentName,
            ruleId,
            baselineName,
            options,
        }, getOperationSpec);
    }
    /**
     * Creates or updates a database's vulnerability assessment rule baseline.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param serverName The name of the server.
     * @param databaseName The name of the database for which the vulnerability assessment rule baseline is
     *                     defined.
     * @param vulnerabilityAssessmentName The name of the vulnerability assessment.
     * @param ruleId The vulnerability assessment rule ID.
     * @param baselineName The name of the vulnerability assessment rule baseline (default implies a
     *                     baseline on a database level rule and master for server level rule).
     * @param parameters The requested rule baseline resource.
     * @param options The options parameters.
     */
    createOrUpdate(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, parameters, options) {
        return this.client.sendOperationRequest({
            resourceGroupName,
            serverName,
            databaseName,
            vulnerabilityAssessmentName,
            ruleId,
            baselineName,
            parameters,
            options,
        }, createOrUpdateOperationSpec);
    }
    /**
     * Removes the database's vulnerability assessment rule baseline.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain
     *                          this value from the Azure Resource Manager API or the portal.
     * @param serverName The name of the server.
     * @param databaseName The name of the database for which the vulnerability assessment rule baseline is
     *                     defined.
     * @param vulnerabilityAssessmentName The name of the vulnerability assessment.
     * @param ruleId The vulnerability assessment rule ID.
     * @param baselineName The name of the vulnerability assessment rule baseline (default implies a
     *                     baseline on a database level rule and master for server level rule).
     * @param options The options parameters.
     */
    delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, options) {
        return this.client.sendOperationRequest({
            resourceGroupName,
            serverName,
            databaseName,
            vulnerabilityAssessmentName,
            ruleId,
            baselineName,
            options,
        }, deleteOperationSpec);
    }
}
exports.DatabaseVulnerabilityAssessmentRuleBaselinesImpl = DatabaseVulnerabilityAssessmentRuleBaselinesImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}",
    httpMethod: "GET",
    responses: {
        200: {
            bodyMapper: Mappers.DatabaseVulnerabilityAssessmentRuleBaseline,
        },
        default: {},
    },
    queryParameters: [Parameters.apiVersion3],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
        Parameters.databaseName,
        Parameters.vulnerabilityAssessmentName,
        Parameters.ruleId,
        Parameters.baselineName,
    ],
    headerParameters: [Parameters.accept],
    serializer,
};
const createOrUpdateOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}",
    httpMethod: "PUT",
    responses: {
        200: {
            bodyMapper: Mappers.DatabaseVulnerabilityAssessmentRuleBaseline,
        },
        default: {},
    },
    requestBody: Parameters.parameters15,
    queryParameters: [Parameters.apiVersion3],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
        Parameters.databaseName,
        Parameters.vulnerabilityAssessmentName,
        Parameters.ruleId,
        Parameters.baselineName,
    ],
    headerParameters: [Parameters.contentType, Parameters.accept],
    mediaType: "json",
    serializer,
};
const deleteOperationSpec = {
    path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}",
    httpMethod: "DELETE",
    responses: { 200: {}, default: {} },
    queryParameters: [Parameters.apiVersion3],
    urlParameters: [
        Parameters.$host,
        Parameters.subscriptionId,
        Parameters.resourceGroupName,
        Parameters.serverName,
        Parameters.databaseName,
        Parameters.vulnerabilityAssessmentName,
        Parameters.ruleId,
        Parameters.baselineName,
    ],
    serializer,
};
//# sourceMappingURL=databaseVulnerabilityAssessmentRuleBaselines.js.map