"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.VirtualMachineAvailabilityGroupListener = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Microsoft SQL Virtual Machine Availability Group Listener.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = azure.network.getSubnet({
 *     name: "examplesubnet",
 *     virtualNetworkName: "examplevnet",
 *     resourceGroupName: "example-resources",
 * });
 * const exampleGetLB = azure.lb.getLB({
 *     name: "example-lb",
 *     resourceGroupName: "example-resources",
 * });
 * const exampleGetVirtualMachine = (new Array(2)).map((_, i) => i).map(__index => (azure.compute.getVirtualMachine({
 *     name: "example-vm",
 *     resourceGroupName: "example-resources",
 * })));
 * const exampleVirtualMachineGroup = new azure.mssql.VirtualMachineGroup("example", {
 *     name: "examplegroup",
 *     resourceGroupName: "example-resources",
 *     location: "West Europe",
 *     sqlImageOffer: "SQL2017-WS2016",
 *     sqlImageSku: "Developer",
 *     wsfcDomainProfile: {
 *         fqdn: "testdomain.com",
 *         clusterSubnetType: "SingleSubnet",
 *     },
 * });
 * const exampleVirtualMachine: azure.mssql.VirtualMachine[] = [];
 * for (const range = {value: 0}; range.value < 2; range.value++) {
 *     exampleVirtualMachine.push(new azure.mssql.VirtualMachine(`example-${range.value}`, {
 *         virtualMachineId: exampleGetVirtualMachine[range.value].then(exampleGetVirtualMachine => exampleGetVirtualMachine.id),
 *         sqlLicenseType: "PAYG",
 *         sqlVirtualMachineGroupId: exampleVirtualMachineGroup.id,
 *         wsfcDomainCredential: {
 *             clusterBootstrapAccountPassword: "P@ssw0rd1234!",
 *             clusterOperatorAccountPassword: "P@ssw0rd1234!",
 *             sqlServiceAccountPassword: "P@ssw0rd1234!",
 *         },
 *     }));
 * }
 * const exampleVirtualMachineAvailabilityGroupListener = new azure.mssql.VirtualMachineAvailabilityGroupListener("example", {
 *     name: "listener1",
 *     availabilityGroupName: "availabilitygroup1",
 *     port: 1433,
 *     sqlVirtualMachineGroupId: exampleVirtualMachineGroup.id,
 *     loadBalancerConfiguration: {
 *         loadBalancerId: exampleGetLB.then(exampleGetLB => exampleGetLB.id),
 *         privateIpAddress: "10.0.2.11",
 *         probePort: 51572,
 *         subnetId: example.then(example => example.id),
 *         sqlVirtualMachineIds: [
 *             exampleVirtualMachine[0].id,
 *             exampleVirtualMachine[1].id,
 *         ],
 *     },
 *     replicas: [
 *         {
 *             sqlVirtualMachineId: exampleVirtualMachine[0].id,
 *             role: "Primary",
 *             commit: "Synchronous_Commit",
 *             failover: "Automatic",
 *             readableSecondary: "All",
 *         },
 *         {
 *             sqlVirtualMachineId: exampleVirtualMachine[1].id,
 *             role: "Secondary",
 *             commit: "Asynchronous_Commit",
 *             failover: "Manual",
 *             readableSecondary: "No",
 *         },
 *     ],
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.SqlVirtualMachine` - 2023-10-01
 *
 * ## Import
 *
 * Microsoft SQL Virtual Machine Availability Group Listeners can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:mssql/virtualMachineAvailabilityGroupListener:VirtualMachineAvailabilityGroupListener example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/vmgroup1/availabilityGroupListeners/listener1
 * ```
 */
class VirtualMachineAvailabilityGroupListener extends pulumi.CustomResource {
    /**
     * Get an existing VirtualMachineAvailabilityGroupListener 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 VirtualMachineAvailabilityGroupListener(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:mssql/virtualMachineAvailabilityGroupListener:VirtualMachineAvailabilityGroupListener';
    /**
     * Returns true if the given object is an instance of VirtualMachineAvailabilityGroupListener.  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'] === VirtualMachineAvailabilityGroupListener.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["availabilityGroupName"] = state?.availabilityGroupName;
            resourceInputs["loadBalancerConfiguration"] = state?.loadBalancerConfiguration;
            resourceInputs["multiSubnetIpConfigurations"] = state?.multiSubnetIpConfigurations;
            resourceInputs["name"] = state?.name;
            resourceInputs["port"] = state?.port;
            resourceInputs["replicas"] = state?.replicas;
            resourceInputs["sqlVirtualMachineGroupId"] = state?.sqlVirtualMachineGroupId;
        }
        else {
            const args = argsOrState;
            if (args?.replicas === undefined && !opts.urn) {
                throw new Error("Missing required property 'replicas'");
            }
            if (args?.sqlVirtualMachineGroupId === undefined && !opts.urn) {
                throw new Error("Missing required property 'sqlVirtualMachineGroupId'");
            }
            resourceInputs["availabilityGroupName"] = args?.availabilityGroupName;
            resourceInputs["loadBalancerConfiguration"] = args?.loadBalancerConfiguration;
            resourceInputs["multiSubnetIpConfigurations"] = args?.multiSubnetIpConfigurations;
            resourceInputs["name"] = args?.name;
            resourceInputs["port"] = args?.port;
            resourceInputs["replicas"] = args?.replicas;
            resourceInputs["sqlVirtualMachineGroupId"] = args?.sqlVirtualMachineGroupId;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(VirtualMachineAvailabilityGroupListener.__pulumiType, name, resourceInputs, opts);
    }
}
exports.VirtualMachineAvailabilityGroupListener = VirtualMachineAvailabilityGroupListener;
//# sourceMappingURL=virtualMachineAvailabilityGroupListener.js.map