"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.SqlManagementClient = void 0;
const tslib_1 = require("tslib");
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
const coreClient = tslib_1.__importStar(require("@azure/core-client"));
const coreRestPipeline = tslib_1.__importStar(require("@azure/core-rest-pipeline"));
const index_js_1 = require("./operations/index.js");
class SqlManagementClient extends coreClient.ServiceClient {
    $host;
    subscriptionId;
    /**
     * Initializes a new instance of the SqlManagementClient class.
     * @param credentials Subscription credentials which uniquely identify client subscription.
     * @param subscriptionId The subscription ID that identifies an Azure subscription.
     * @param options The parameter options
     */
    constructor(credentials, subscriptionId, options) {
        if (credentials === undefined) {
            throw new Error("'credentials' cannot be null");
        }
        if (subscriptionId === undefined) {
            throw new Error("'subscriptionId' cannot be null");
        }
        // Initializing default values for options
        if (!options) {
            options = {};
        }
        const defaults = {
            requestContentType: "application/json; charset=utf-8",
            credential: credentials,
        };
        const packageDetails = `azsdk-js-arm-sql/11.0.0-beta.4`;
        const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
            ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
            : `${packageDetails}`;
        const optionsWithDefaults = {
            ...defaults,
            ...options,
            userAgentOptions: {
                userAgentPrefix,
            },
            endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com",
        };
        super(optionsWithDefaults);
        let bearerTokenAuthenticationPolicyFound = false;
        if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
            const pipelinePolicies = options.pipeline.getOrderedPolicies();
            bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name === coreRestPipeline.bearerTokenAuthenticationPolicyName);
        }
        if (!options ||
            !options.pipeline ||
            options.pipeline.getOrderedPolicies().length == 0 ||
            !bearerTokenAuthenticationPolicyFound) {
            this.pipeline.removePolicy({
                name: coreRestPipeline.bearerTokenAuthenticationPolicyName,
            });
            this.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
                credential: credentials,
                scopes: optionsWithDefaults.credentialScopes ?? `${optionsWithDefaults.endpoint}/.default`,
                challengeCallbacks: {
                    authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge,
                },
            }));
        }
        // Parameter assignments
        this.subscriptionId = subscriptionId;
        // Assigning values to Constant parameters
        this.$host = options.$host || "https://management.azure.com";
        this.dataMaskingPolicies = new index_js_1.DataMaskingPoliciesImpl(this);
        this.dataMaskingRules = new index_js_1.DataMaskingRulesImpl(this);
        this.geoBackupPolicies = new index_js_1.GeoBackupPoliciesImpl(this);
        this.databases = new index_js_1.DatabasesImpl(this);
        this.elasticPools = new index_js_1.ElasticPoolsImpl(this);
        this.serverCommunicationLinks = new index_js_1.ServerCommunicationLinksImpl(this);
        this.serviceObjectives = new index_js_1.ServiceObjectivesImpl(this);
        this.elasticPoolActivities = new index_js_1.ElasticPoolActivitiesImpl(this);
        this.elasticPoolDatabaseActivities = new index_js_1.ElasticPoolDatabaseActivitiesImpl(this);
        this.serverUsages = new index_js_1.ServerUsagesImpl(this);
        this.databaseAdvisors = new index_js_1.DatabaseAdvisorsImpl(this);
        this.databaseAutomaticTuningOperations = new index_js_1.DatabaseAutomaticTuningOperationsImpl(this);
        this.databaseColumns = new index_js_1.DatabaseColumnsImpl(this);
        this.databaseRecommendedActions = new index_js_1.DatabaseRecommendedActionsImpl(this);
        this.databaseSchemas = new index_js_1.DatabaseSchemasImpl(this);
        this.databaseSecurityAlertPolicies = new index_js_1.DatabaseSecurityAlertPoliciesImpl(this);
        this.databaseTables = new index_js_1.DatabaseTablesImpl(this);
        this.databaseVulnerabilityAssessmentRuleBaselines =
            new index_js_1.DatabaseVulnerabilityAssessmentRuleBaselinesImpl(this);
        this.databaseVulnerabilityAssessments = new index_js_1.DatabaseVulnerabilityAssessmentsImpl(this);
        this.databaseVulnerabilityAssessmentScans = new index_js_1.DatabaseVulnerabilityAssessmentScansImpl(this);
        this.dataWarehouseUserActivitiesOperations = new index_js_1.DataWarehouseUserActivitiesOperationsImpl(this);
        this.deletedServers = new index_js_1.DeletedServersImpl(this);
        this.elasticPoolOperations = new index_js_1.ElasticPoolOperationsImpl(this);
        this.encryptionProtectors = new index_js_1.EncryptionProtectorsImpl(this);
        this.firewallRules = new index_js_1.FirewallRulesImpl(this);
        this.jobAgents = new index_js_1.JobAgentsImpl(this);
        this.jobCredentials = new index_js_1.JobCredentialsImpl(this);
        this.jobExecutions = new index_js_1.JobExecutionsImpl(this);
        this.jobPrivateEndpoints = new index_js_1.JobPrivateEndpointsImpl(this);
        this.jobs = new index_js_1.JobsImpl(this);
        this.jobStepExecutions = new index_js_1.JobStepExecutionsImpl(this);
        this.jobSteps = new index_js_1.JobStepsImpl(this);
        this.jobTargetExecutions = new index_js_1.JobTargetExecutionsImpl(this);
        this.jobTargetGroups = new index_js_1.JobTargetGroupsImpl(this);
        this.jobVersions = new index_js_1.JobVersionsImpl(this);
        this.capabilities = new index_js_1.CapabilitiesImpl(this);
        this.maintenanceWindowOptionsOperations = new index_js_1.MaintenanceWindowOptionsOperationsImpl(this);
        this.maintenanceWindowsOperations = new index_js_1.MaintenanceWindowsOperationsImpl(this);
        this.managedBackupShortTermRetentionPolicies = new index_js_1.ManagedBackupShortTermRetentionPoliciesImpl(this);
        this.managedDatabaseColumns = new index_js_1.ManagedDatabaseColumnsImpl(this);
        this.managedDatabaseQueries = new index_js_1.ManagedDatabaseQueriesImpl(this);
        this.managedDatabaseSchemas = new index_js_1.ManagedDatabaseSchemasImpl(this);
        this.managedDatabaseSecurityAlertPolicies = new index_js_1.ManagedDatabaseSecurityAlertPoliciesImpl(this);
        this.managedDatabaseSecurityEvents = new index_js_1.ManagedDatabaseSecurityEventsImpl(this);
        this.managedDatabaseTables = new index_js_1.ManagedDatabaseTablesImpl(this);
        this.managedDatabaseTransparentDataEncryption =
            new index_js_1.ManagedDatabaseTransparentDataEncryptionImpl(this);
        this.managedDatabaseVulnerabilityAssessmentRuleBaselines =
            new index_js_1.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl(this);
        this.managedDatabaseVulnerabilityAssessments = new index_js_1.ManagedDatabaseVulnerabilityAssessmentsImpl(this);
        this.managedDatabaseVulnerabilityAssessmentScans =
            new index_js_1.ManagedDatabaseVulnerabilityAssessmentScansImpl(this);
        this.managedInstanceAdministrators = new index_js_1.ManagedInstanceAdministratorsImpl(this);
        this.managedInstanceAzureADOnlyAuthentications =
            new index_js_1.ManagedInstanceAzureADOnlyAuthenticationsImpl(this);
        this.managedInstanceEncryptionProtectors = new index_js_1.ManagedInstanceEncryptionProtectorsImpl(this);
        this.managedInstanceKeys = new index_js_1.ManagedInstanceKeysImpl(this);
        this.managedInstanceLongTermRetentionPolicies =
            new index_js_1.ManagedInstanceLongTermRetentionPoliciesImpl(this);
        this.managedInstanceOperations = new index_js_1.ManagedInstanceOperationsImpl(this);
        this.managedInstancePrivateEndpointConnections =
            new index_js_1.ManagedInstancePrivateEndpointConnectionsImpl(this);
        this.managedInstancePrivateLinkResources = new index_js_1.ManagedInstancePrivateLinkResourcesImpl(this);
        this.managedInstanceTdeCertificates = new index_js_1.ManagedInstanceTdeCertificatesImpl(this);
        this.managedInstanceVulnerabilityAssessments = new index_js_1.ManagedInstanceVulnerabilityAssessmentsImpl(this);
        this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies =
            new index_js_1.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl(this);
        this.managedServerSecurityAlertPolicies = new index_js_1.ManagedServerSecurityAlertPoliciesImpl(this);
        this.operations = new index_js_1.OperationsImpl(this);
        this.privateEndpointConnections = new index_js_1.PrivateEndpointConnectionsImpl(this);
        this.privateLinkResources = new index_js_1.PrivateLinkResourcesImpl(this);
        this.recoverableManagedDatabases = new index_js_1.RecoverableManagedDatabasesImpl(this);
        this.restorePoints = new index_js_1.RestorePointsImpl(this);
        this.serverAdvisors = new index_js_1.ServerAdvisorsImpl(this);
        this.serverAutomaticTuningOperations = new index_js_1.ServerAutomaticTuningOperationsImpl(this);
        this.serverAzureADAdministrators = new index_js_1.ServerAzureADAdministratorsImpl(this);
        this.serverAzureADOnlyAuthentications = new index_js_1.ServerAzureADOnlyAuthenticationsImpl(this);
        this.serverDevOpsAuditSettings = new index_js_1.ServerDevOpsAuditSettingsImpl(this);
        this.serverDnsAliases = new index_js_1.ServerDnsAliasesImpl(this);
        this.serverKeys = new index_js_1.ServerKeysImpl(this);
        this.serverOperations = new index_js_1.ServerOperationsImpl(this);
        this.serverSecurityAlertPolicies = new index_js_1.ServerSecurityAlertPoliciesImpl(this);
        this.serverTrustGroups = new index_js_1.ServerTrustGroupsImpl(this);
        this.serverVulnerabilityAssessments = new index_js_1.ServerVulnerabilityAssessmentsImpl(this);
        this.sqlAgent = new index_js_1.SqlAgentImpl(this);
        this.subscriptionUsages = new index_js_1.SubscriptionUsagesImpl(this);
        this.syncAgents = new index_js_1.SyncAgentsImpl(this);
        this.syncGroups = new index_js_1.SyncGroupsImpl(this);
        this.syncMembers = new index_js_1.SyncMembersImpl(this);
        this.tdeCertificates = new index_js_1.TdeCertificatesImpl(this);
        this.timeZones = new index_js_1.TimeZonesImpl(this);
        this.virtualNetworkRules = new index_js_1.VirtualNetworkRulesImpl(this);
        this.workloadClassifiers = new index_js_1.WorkloadClassifiersImpl(this);
        this.workloadGroups = new index_js_1.WorkloadGroupsImpl(this);
        this.backupShortTermRetentionPolicies = new index_js_1.BackupShortTermRetentionPoliciesImpl(this);
        this.databaseExtensionsOperations = new index_js_1.DatabaseExtensionsOperationsImpl(this);
        this.databaseUsages = new index_js_1.DatabaseUsagesImpl(this);
        this.ledgerDigestUploadsOperations = new index_js_1.LedgerDigestUploadsOperationsImpl(this);
        this.outboundFirewallRules = new index_js_1.OutboundFirewallRulesImpl(this);
        this.usages = new index_js_1.UsagesImpl(this);
        this.longTermRetentionManagedInstanceBackups = new index_js_1.LongTermRetentionManagedInstanceBackupsImpl(this);
        this.restorableDroppedManagedDatabases = new index_js_1.RestorableDroppedManagedDatabasesImpl(this);
        this.serverConnectionPolicies = new index_js_1.ServerConnectionPoliciesImpl(this);
        this.serverTrustCertificates = new index_js_1.ServerTrustCertificatesImpl(this);
        this.endpointCertificates = new index_js_1.EndpointCertificatesImpl(this);
        this.managedDatabaseSensitivityLabels = new index_js_1.ManagedDatabaseSensitivityLabelsImpl(this);
        this.managedDatabaseRecommendedSensitivityLabels =
            new index_js_1.ManagedDatabaseRecommendedSensitivityLabelsImpl(this);
        this.sensitivityLabels = new index_js_1.SensitivityLabelsImpl(this);
        this.recommendedSensitivityLabels = new index_js_1.RecommendedSensitivityLabelsImpl(this);
        this.serverBlobAuditingPolicies = new index_js_1.ServerBlobAuditingPoliciesImpl(this);
        this.databaseBlobAuditingPolicies = new index_js_1.DatabaseBlobAuditingPoliciesImpl(this);
        this.extendedDatabaseBlobAuditingPolicies = new index_js_1.ExtendedDatabaseBlobAuditingPoliciesImpl(this);
        this.extendedServerBlobAuditingPolicies = new index_js_1.ExtendedServerBlobAuditingPoliciesImpl(this);
        this.databaseAdvancedThreatProtectionSettings =
            new index_js_1.DatabaseAdvancedThreatProtectionSettingsImpl(this);
        this.serverAdvancedThreatProtectionSettings = new index_js_1.ServerAdvancedThreatProtectionSettingsImpl(this);
        this.managedServerDnsAliases = new index_js_1.ManagedServerDnsAliasesImpl(this);
        this.managedDatabaseAdvancedThreatProtectionSettings =
            new index_js_1.ManagedDatabaseAdvancedThreatProtectionSettingsImpl(this);
        this.managedInstanceAdvancedThreatProtectionSettings =
            new index_js_1.ManagedInstanceAdvancedThreatProtectionSettingsImpl(this);
        this.managedDatabaseMoveOperations = new index_js_1.ManagedDatabaseMoveOperationsImpl(this);
        this.managedInstanceDtcs = new index_js_1.ManagedInstanceDtcsImpl(this);
        this.synapseLinkWorkspaces = new index_js_1.SynapseLinkWorkspacesImpl(this);
        this.virtualClusters = new index_js_1.VirtualClustersImpl(this);
        this.instanceFailoverGroups = new index_js_1.InstanceFailoverGroupsImpl(this);
        this.managedDatabaseRestoreDetails = new index_js_1.ManagedDatabaseRestoreDetailsImpl(this);
        this.databaseEncryptionProtectors = new index_js_1.DatabaseEncryptionProtectorsImpl(this);
        this.managedDatabases = new index_js_1.ManagedDatabasesImpl(this);
        this.managedLedgerDigestUploadsOperations = new index_js_1.ManagedLedgerDigestUploadsOperationsImpl(this);
        this.recoverableDatabases = new index_js_1.RecoverableDatabasesImpl(this);
        this.restorableDroppedDatabases = new index_js_1.RestorableDroppedDatabasesImpl(this);
        this.serverConfigurationOptions = new index_js_1.ServerConfigurationOptionsImpl(this);
        this.startStopManagedInstanceSchedules = new index_js_1.StartStopManagedInstanceSchedulesImpl(this);
        this.transparentDataEncryptions = new index_js_1.TransparentDataEncryptionsImpl(this);
        this.iPv6FirewallRules = new index_js_1.IPv6FirewallRulesImpl(this);
        this.sqlVulnerabilityAssessmentBaseline = new index_js_1.SqlVulnerabilityAssessmentBaselineImpl(this);
        this.sqlVulnerabilityAssessmentBaselines = new index_js_1.SqlVulnerabilityAssessmentBaselinesImpl(this);
        this.sqlVulnerabilityAssessmentExecuteScan = new index_js_1.SqlVulnerabilityAssessmentExecuteScanImpl(this);
        this.sqlVulnerabilityAssessmentRuleBaseline = new index_js_1.SqlVulnerabilityAssessmentRuleBaselineImpl(this);
        this.sqlVulnerabilityAssessmentRuleBaselines = new index_js_1.SqlVulnerabilityAssessmentRuleBaselinesImpl(this);
        this.sqlVulnerabilityAssessmentScanResult = new index_js_1.SqlVulnerabilityAssessmentScanResultImpl(this);
        this.sqlVulnerabilityAssessmentScans = new index_js_1.SqlVulnerabilityAssessmentScansImpl(this);
        this.sqlVulnerabilityAssessmentsSettings = new index_js_1.SqlVulnerabilityAssessmentsSettingsImpl(this);
        this.sqlVulnerabilityAssessments = new index_js_1.SqlVulnerabilityAssessmentsImpl(this);
        this.databaseSqlVulnerabilityAssessmentBaselines =
            new index_js_1.DatabaseSqlVulnerabilityAssessmentBaselinesImpl(this);
        this.databaseSqlVulnerabilityAssessmentExecuteScan =
            new index_js_1.DatabaseSqlVulnerabilityAssessmentExecuteScanImpl(this);
        this.databaseSqlVulnerabilityAssessmentRuleBaselines =
            new index_js_1.DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl(this);
        this.databaseSqlVulnerabilityAssessmentScanResult =
            new index_js_1.DatabaseSqlVulnerabilityAssessmentScanResultImpl(this);
        this.databaseSqlVulnerabilityAssessmentScans = new index_js_1.DatabaseSqlVulnerabilityAssessmentScansImpl(this);
        this.databaseSqlVulnerabilityAssessmentsSettings =
            new index_js_1.DatabaseSqlVulnerabilityAssessmentsSettingsImpl(this);
        this.failoverGroups = new index_js_1.FailoverGroupsImpl(this);
        this.instancePools = new index_js_1.InstancePoolsImpl(this);
        this.managedInstances = new index_js_1.ManagedInstancesImpl(this);
        this.replicationLinks = new index_js_1.ReplicationLinksImpl(this);
        this.distributedAvailabilityGroups = new index_js_1.DistributedAvailabilityGroupsImpl(this);
        this.servers = new index_js_1.ServersImpl(this);
        this.longTermRetentionBackups = new index_js_1.LongTermRetentionBackupsImpl(this);
        this.longTermRetentionPolicies = new index_js_1.LongTermRetentionPoliciesImpl(this);
        this.databaseOperations = new index_js_1.DatabaseOperationsImpl(this);
    }
    dataMaskingPolicies;
    dataMaskingRules;
    geoBackupPolicies;
    databases;
    elasticPools;
    serverCommunicationLinks;
    serviceObjectives;
    elasticPoolActivities;
    elasticPoolDatabaseActivities;
    serverUsages;
    databaseAdvisors;
    databaseAutomaticTuningOperations;
    databaseColumns;
    databaseRecommendedActions;
    databaseSchemas;
    databaseSecurityAlertPolicies;
    databaseTables;
    databaseVulnerabilityAssessmentRuleBaselines;
    databaseVulnerabilityAssessments;
    databaseVulnerabilityAssessmentScans;
    dataWarehouseUserActivitiesOperations;
    deletedServers;
    elasticPoolOperations;
    encryptionProtectors;
    firewallRules;
    jobAgents;
    jobCredentials;
    jobExecutions;
    jobPrivateEndpoints;
    jobs;
    jobStepExecutions;
    jobSteps;
    jobTargetExecutions;
    jobTargetGroups;
    jobVersions;
    capabilities;
    maintenanceWindowOptionsOperations;
    maintenanceWindowsOperations;
    managedBackupShortTermRetentionPolicies;
    managedDatabaseColumns;
    managedDatabaseQueries;
    managedDatabaseSchemas;
    managedDatabaseSecurityAlertPolicies;
    managedDatabaseSecurityEvents;
    managedDatabaseTables;
    managedDatabaseTransparentDataEncryption;
    managedDatabaseVulnerabilityAssessmentRuleBaselines;
    managedDatabaseVulnerabilityAssessments;
    managedDatabaseVulnerabilityAssessmentScans;
    managedInstanceAdministrators;
    managedInstanceAzureADOnlyAuthentications;
    managedInstanceEncryptionProtectors;
    managedInstanceKeys;
    managedInstanceLongTermRetentionPolicies;
    managedInstanceOperations;
    managedInstancePrivateEndpointConnections;
    managedInstancePrivateLinkResources;
    managedInstanceTdeCertificates;
    managedInstanceVulnerabilityAssessments;
    managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies;
    managedServerSecurityAlertPolicies;
    operations;
    privateEndpointConnections;
    privateLinkResources;
    recoverableManagedDatabases;
    restorePoints;
    serverAdvisors;
    serverAutomaticTuningOperations;
    serverAzureADAdministrators;
    serverAzureADOnlyAuthentications;
    serverDevOpsAuditSettings;
    serverDnsAliases;
    serverKeys;
    serverOperations;
    serverSecurityAlertPolicies;
    serverTrustGroups;
    serverVulnerabilityAssessments;
    sqlAgent;
    subscriptionUsages;
    syncAgents;
    syncGroups;
    syncMembers;
    tdeCertificates;
    timeZones;
    virtualNetworkRules;
    workloadClassifiers;
    workloadGroups;
    backupShortTermRetentionPolicies;
    databaseExtensionsOperations;
    databaseUsages;
    ledgerDigestUploadsOperations;
    outboundFirewallRules;
    usages;
    longTermRetentionManagedInstanceBackups;
    restorableDroppedManagedDatabases;
    serverConnectionPolicies;
    serverTrustCertificates;
    endpointCertificates;
    managedDatabaseSensitivityLabels;
    managedDatabaseRecommendedSensitivityLabels;
    sensitivityLabels;
    recommendedSensitivityLabels;
    serverBlobAuditingPolicies;
    databaseBlobAuditingPolicies;
    extendedDatabaseBlobAuditingPolicies;
    extendedServerBlobAuditingPolicies;
    databaseAdvancedThreatProtectionSettings;
    serverAdvancedThreatProtectionSettings;
    managedServerDnsAliases;
    managedDatabaseAdvancedThreatProtectionSettings;
    managedInstanceAdvancedThreatProtectionSettings;
    managedDatabaseMoveOperations;
    managedInstanceDtcs;
    synapseLinkWorkspaces;
    virtualClusters;
    instanceFailoverGroups;
    managedDatabaseRestoreDetails;
    databaseEncryptionProtectors;
    managedDatabases;
    managedLedgerDigestUploadsOperations;
    recoverableDatabases;
    restorableDroppedDatabases;
    serverConfigurationOptions;
    startStopManagedInstanceSchedules;
    transparentDataEncryptions;
    iPv6FirewallRules;
    sqlVulnerabilityAssessmentBaseline;
    sqlVulnerabilityAssessmentBaselines;
    sqlVulnerabilityAssessmentExecuteScan;
    sqlVulnerabilityAssessmentRuleBaseline;
    sqlVulnerabilityAssessmentRuleBaselines;
    sqlVulnerabilityAssessmentScanResult;
    sqlVulnerabilityAssessmentScans;
    sqlVulnerabilityAssessmentsSettings;
    sqlVulnerabilityAssessments;
    databaseSqlVulnerabilityAssessmentBaselines;
    databaseSqlVulnerabilityAssessmentExecuteScan;
    databaseSqlVulnerabilityAssessmentRuleBaselines;
    databaseSqlVulnerabilityAssessmentScanResult;
    databaseSqlVulnerabilityAssessmentScans;
    databaseSqlVulnerabilityAssessmentsSettings;
    failoverGroups;
    instancePools;
    managedInstances;
    replicationLinks;
    distributedAvailabilityGroups;
    servers;
    longTermRetentionBackups;
    longTermRetentionPolicies;
    databaseOperations;
}
exports.SqlManagementClient = SqlManagementClient;
//# sourceMappingURL=sqlManagementClient.js.map