"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ManagedInstanceSecurityAlertPolicy = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Security Alert Policy for an MS SQL Managed Instance.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "database-rg",
 *     location: "West Europe",
 * });
 * const exampleNetworkSecurityGroup = new azure.network.NetworkSecurityGroup("example", {
 *     name: "mi-security-group",
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const allowManagementInbound = new azure.network.NetworkSecurityRule("allow_management_inbound", {
 *     name: "allow_management_inbound",
 *     priority: 106,
 *     direction: "Inbound",
 *     access: "Allow",
 *     protocol: "Tcp",
 *     sourcePortRange: "*",
 *     destinationPortRanges: [
 *         "9000",
 *         "9003",
 *         "1438",
 *         "1440",
 *         "1452",
 *     ],
 *     sourceAddressPrefix: "*",
 *     destinationAddressPrefix: "*",
 *     resourceGroupName: example.name,
 *     networkSecurityGroupName: exampleNetworkSecurityGroup.name,
 * });
 * const allowMisubnetInbound = new azure.network.NetworkSecurityRule("allow_misubnet_inbound", {
 *     name: "allow_misubnet_inbound",
 *     priority: 200,
 *     direction: "Inbound",
 *     access: "Allow",
 *     protocol: "*",
 *     sourcePortRange: "*",
 *     destinationPortRange: "*",
 *     sourceAddressPrefix: "10.0.0.0/24",
 *     destinationAddressPrefix: "*",
 *     resourceGroupName: example.name,
 *     networkSecurityGroupName: exampleNetworkSecurityGroup.name,
 * });
 * const allowHealthProbeInbound = new azure.network.NetworkSecurityRule("allow_health_probe_inbound", {
 *     name: "allow_health_probe_inbound",
 *     priority: 300,
 *     direction: "Inbound",
 *     access: "Allow",
 *     protocol: "*",
 *     sourcePortRange: "*",
 *     destinationPortRange: "*",
 *     sourceAddressPrefix: "AzureLoadBalancer",
 *     destinationAddressPrefix: "*",
 *     resourceGroupName: example.name,
 *     networkSecurityGroupName: exampleNetworkSecurityGroup.name,
 * });
 * const allowTdsInbound = new azure.network.NetworkSecurityRule("allow_tds_inbound", {
 *     name: "allow_tds_inbound",
 *     priority: 1000,
 *     direction: "Inbound",
 *     access: "Allow",
 *     protocol: "Tcp",
 *     sourcePortRange: "*",
 *     destinationPortRange: "1433",
 *     sourceAddressPrefix: "VirtualNetwork",
 *     destinationAddressPrefix: "*",
 *     resourceGroupName: example.name,
 *     networkSecurityGroupName: exampleNetworkSecurityGroup.name,
 * });
 * const denyAllInbound = new azure.network.NetworkSecurityRule("deny_all_inbound", {
 *     name: "deny_all_inbound",
 *     priority: 4096,
 *     direction: "Inbound",
 *     access: "Deny",
 *     protocol: "*",
 *     sourcePortRange: "*",
 *     destinationPortRange: "*",
 *     sourceAddressPrefix: "*",
 *     destinationAddressPrefix: "*",
 *     resourceGroupName: example.name,
 *     networkSecurityGroupName: exampleNetworkSecurityGroup.name,
 * });
 * const allowManagementOutbound = new azure.network.NetworkSecurityRule("allow_management_outbound", {
 *     name: "allow_management_outbound",
 *     priority: 102,
 *     direction: "Outbound",
 *     access: "Allow",
 *     protocol: "Tcp",
 *     sourcePortRange: "*",
 *     destinationPortRanges: [
 *         "80",
 *         "443",
 *         "12000",
 *     ],
 *     sourceAddressPrefix: "*",
 *     destinationAddressPrefix: "*",
 *     resourceGroupName: example.name,
 *     networkSecurityGroupName: exampleNetworkSecurityGroup.name,
 * });
 * const allowMisubnetOutbound = new azure.network.NetworkSecurityRule("allow_misubnet_outbound", {
 *     name: "allow_misubnet_outbound",
 *     priority: 200,
 *     direction: "Outbound",
 *     access: "Allow",
 *     protocol: "*",
 *     sourcePortRange: "*",
 *     destinationPortRange: "*",
 *     sourceAddressPrefix: "10.0.0.0/24",
 *     destinationAddressPrefix: "*",
 *     resourceGroupName: example.name,
 *     networkSecurityGroupName: exampleNetworkSecurityGroup.name,
 * });
 * const denyAllOutbound = new azure.network.NetworkSecurityRule("deny_all_outbound", {
 *     name: "deny_all_outbound",
 *     priority: 4096,
 *     direction: "Outbound",
 *     access: "Deny",
 *     protocol: "*",
 *     sourcePortRange: "*",
 *     destinationPortRange: "*",
 *     sourceAddressPrefix: "*",
 *     destinationAddressPrefix: "*",
 *     resourceGroupName: example.name,
 *     networkSecurityGroupName: exampleNetworkSecurityGroup.name,
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "vnet-mi",
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "subnet-mi",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.0.0/24"],
 *     delegations: [{
 *         name: "managedinstancedelegation",
 *         serviceDelegation: {
 *             name: "Microsoft.Sql/managedInstances",
 *             actions: [
 *                 "Microsoft.Network/virtualNetworks/subnets/join/action",
 *                 "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
 *                 "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
 *             ],
 *         },
 *     }],
 * });
 * const exampleSubnetNetworkSecurityGroupAssociation = new azure.network.SubnetNetworkSecurityGroupAssociation("example", {
 *     subnetId: exampleSubnet.id,
 *     networkSecurityGroupId: exampleNetworkSecurityGroup.id,
 * });
 * const exampleRouteTable = new azure.network.RouteTable("example", {
 *     name: "routetable-mi",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     disableBgpRoutePropagation: false,
 * }, {
 *     dependsOn: [exampleSubnet],
 * });
 * const exampleSubnetRouteTableAssociation = new azure.network.SubnetRouteTableAssociation("example", {
 *     subnetId: exampleSubnet.id,
 *     routeTableId: exampleRouteTable.id,
 * });
 * const exampleManagedInstance = new azure.mssql.ManagedInstance("example", {
 *     name: "managedsqlinstance",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     licenseType: "BasePrice",
 *     skuName: "GP_Gen5",
 *     storageSizeInGb: 32,
 *     subnetId: exampleSubnet.id,
 *     vcores: 4,
 *     administratorLogin: "mradministrator",
 *     administratorLoginPassword: "thisIsDog11",
 * }, {
 *     dependsOn: [
 *         exampleSubnetNetworkSecurityGroupAssociation,
 *         exampleSubnetRouteTableAssociation,
 *     ],
 * });
 * const exampleManagedInstanceSecurityAlertPolicy = new azure.mssql.ManagedInstanceSecurityAlertPolicy("example", {
 *     resourceGroupName: example.name,
 *     managedInstanceName: exampleManagedInstance.name,
 *     enabled: true,
 *     storageEndpoint: exampleAzurermStorageAccount.primaryBlobEndpoint,
 *     storageAccountAccessKey: exampleAzurermStorageAccount.primaryAccessKey,
 *     disabledAlerts: [
 *         "Sql_Injection",
 *         "Data_Exfiltration",
 *     ],
 *     retentionDays: 20,
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Sql` - 2023-08-01-preview
 *
 * ## Import
 *
 * MS SQL Managed Instance Security Alert Policy can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:mssql/managedInstanceSecurityAlertPolicy:ManagedInstanceSecurityAlertPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acceptanceTestResourceGroup1/providers/Microsoft.Sql/managedInstances/instance1/securityAlertPolicies/Default
 * ```
 */
class ManagedInstanceSecurityAlertPolicy extends pulumi.CustomResource {
    /**
     * Get an existing ManagedInstanceSecurityAlertPolicy resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new ManagedInstanceSecurityAlertPolicy(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:mssql/managedInstanceSecurityAlertPolicy:ManagedInstanceSecurityAlertPolicy';
    /**
     * Returns true if the given object is an instance of ManagedInstanceSecurityAlertPolicy.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === ManagedInstanceSecurityAlertPolicy.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["disabledAlerts"] = state?.disabledAlerts;
            resourceInputs["emailAccountAdminsEnabled"] = state?.emailAccountAdminsEnabled;
            resourceInputs["emailAddresses"] = state?.emailAddresses;
            resourceInputs["enabled"] = state?.enabled;
            resourceInputs["managedInstanceName"] = state?.managedInstanceName;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["retentionDays"] = state?.retentionDays;
            resourceInputs["storageAccountAccessKey"] = state?.storageAccountAccessKey;
            resourceInputs["storageEndpoint"] = state?.storageEndpoint;
        }
        else {
            const args = argsOrState;
            if (args?.managedInstanceName === undefined && !opts.urn) {
                throw new Error("Missing required property 'managedInstanceName'");
            }
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            resourceInputs["disabledAlerts"] = args?.disabledAlerts;
            resourceInputs["emailAccountAdminsEnabled"] = args?.emailAccountAdminsEnabled;
            resourceInputs["emailAddresses"] = args?.emailAddresses;
            resourceInputs["enabled"] = args?.enabled;
            resourceInputs["managedInstanceName"] = args?.managedInstanceName;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["retentionDays"] = args?.retentionDays;
            resourceInputs["storageAccountAccessKey"] = args?.storageAccountAccessKey ? pulumi.secret(args.storageAccountAccessKey) : undefined;
            resourceInputs["storageEndpoint"] = args?.storageEndpoint;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["storageAccountAccessKey"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(ManagedInstanceSecurityAlertPolicy.__pulumiType, name, resourceInputs, opts);
    }
}
exports.ManagedInstanceSecurityAlertPolicy = ManagedInstanceSecurityAlertPolicy;
//# sourceMappingURL=managedInstanceSecurityAlertPolicy.js.map