"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.FailoverGroup = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Microsoft Azure SQL Failover Group.
 *
 * ## 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 primary = new azure.mssql.Server("primary", {
 *     name: "mssqlserver-primary",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     version: "12.0",
 *     administratorLogin: "missadministrator",
 *     administratorLoginPassword: "thisIsKat11",
 * });
 * const secondary = new azure.mssql.Server("secondary", {
 *     name: "mssqlserver-secondary",
 *     resourceGroupName: example.name,
 *     location: "North Europe",
 *     version: "12.0",
 *     administratorLogin: "missadministrator",
 *     administratorLoginPassword: "thisIsKat12",
 * });
 * const exampleDatabase = new azure.mssql.Database("example", {
 *     name: "exampledb",
 *     serverId: primary.id,
 *     skuName: "S1",
 *     collation: "SQL_Latin1_General_CP1_CI_AS",
 *     maxSizeGb: 200,
 * });
 * const exampleFailoverGroup = new azure.mssql.FailoverGroup("example", {
 *     name: "example",
 *     serverId: primary.id,
 *     databases: [exampleDatabase.id],
 *     partnerServers: [{
 *         id: secondary.id,
 *     }],
 *     readWriteEndpointFailoverPolicy: {
 *         mode: "Automatic",
 *         graceMinutes: 80,
 *     },
 *     tags: {
 *         environment: "prod",
 *         database: "example",
 *     },
 * });
 * ```
 *
 * ## 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
 *
 * Failover Groups can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:mssql/failoverGroup:FailoverGroup example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Sql/servers/server1/failoverGroups/failoverGroup1
 * ```
 */
class FailoverGroup extends pulumi.CustomResource {
    /**
     * Get an existing FailoverGroup 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 FailoverGroup(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:mssql/failoverGroup:FailoverGroup';
    /**
     * Returns true if the given object is an instance of FailoverGroup.  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'] === FailoverGroup.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["databases"] = state?.databases;
            resourceInputs["name"] = state?.name;
            resourceInputs["partnerServers"] = state?.partnerServers;
            resourceInputs["readWriteEndpointFailoverPolicy"] = state?.readWriteEndpointFailoverPolicy;
            resourceInputs["readonlyEndpointFailoverPolicyEnabled"] = state?.readonlyEndpointFailoverPolicyEnabled;
            resourceInputs["serverId"] = state?.serverId;
            resourceInputs["tags"] = state?.tags;
        }
        else {
            const args = argsOrState;
            if (args?.partnerServers === undefined && !opts.urn) {
                throw new Error("Missing required property 'partnerServers'");
            }
            if (args?.readWriteEndpointFailoverPolicy === undefined && !opts.urn) {
                throw new Error("Missing required property 'readWriteEndpointFailoverPolicy'");
            }
            if (args?.serverId === undefined && !opts.urn) {
                throw new Error("Missing required property 'serverId'");
            }
            resourceInputs["databases"] = args?.databases;
            resourceInputs["name"] = args?.name;
            resourceInputs["partnerServers"] = args?.partnerServers;
            resourceInputs["readWriteEndpointFailoverPolicy"] = args?.readWriteEndpointFailoverPolicy;
            resourceInputs["readonlyEndpointFailoverPolicyEnabled"] = args?.readonlyEndpointFailoverPolicyEnabled;
            resourceInputs["serverId"] = args?.serverId;
            resourceInputs["tags"] = args?.tags;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const aliasOpts = { aliases: [{ type: "azure:sql/failoverGroup:FailoverGroup" }] };
        opts = pulumi.mergeOptions(opts, aliasOpts);
        super(FailoverGroup.__pulumiType, name, resourceInputs, opts);
    }
}
exports.FailoverGroup = FailoverGroup;
//# sourceMappingURL=failoverGroup.js.map