"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.Server = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Microsoft SQL Azure Database Server.
 *
 * ## 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 exampleServer = new azure.mssql.Server("example", {
 *     name: "mssqlserver",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     version: "12.0",
 *     administratorLogin: "missadministrator",
 *     administratorLoginPassword: "thisIsKat11",
 *     minimumTlsVersion: "1.2",
 *     azureadAdministrator: {
 *         loginUsername: "AzureAD Admin",
 *         objectId: "00000000-0000-0000-0000-000000000000",
 *     },
 *     tags: {
 *         environment: "production",
 *     },
 * });
 * ```
 *
 * ### Transparent Data Encryption (TDE) With A Customer Managed Key (CMK) During Create
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const current = azure.core.getClientConfig({});
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
 *     name: "example-admin",
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * // Create a key vault with access policies which allow for the current user to get, list, create, delete, update, recover, purge and getRotationPolicy for the key vault key and also add a key vault access policy for the Microsoft Sql Server instance User Managed Identity to get, wrap, and unwrap key(s)
 * const exampleKeyVault = new azure.keyvault.KeyVault("example", {
 *     name: "mssqltdeexample",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     enabledForDiskEncryption: true,
 *     tenantId: exampleUserAssignedIdentity.tenantId,
 *     softDeleteRetentionDays: 7,
 *     purgeProtectionEnabled: true,
 *     skuName: "standard",
 *     accessPolicies: [
 *         {
 *             tenantId: current.then(current => current.tenantId),
 *             objectId: current.then(current => current.objectId),
 *             keyPermissions: [
 *                 "Get",
 *                 "List",
 *                 "Create",
 *                 "Delete",
 *                 "Update",
 *                 "Recover",
 *                 "Purge",
 *                 "GetRotationPolicy",
 *             ],
 *         },
 *         {
 *             tenantId: exampleUserAssignedIdentity.tenantId,
 *             objectId: exampleUserAssignedIdentity.principalId,
 *             keyPermissions: [
 *                 "Get",
 *                 "WrapKey",
 *                 "UnwrapKey",
 *             ],
 *         },
 *     ],
 * });
 * const exampleKey = new azure.keyvault.Key("example", {
 *     name: "example-key",
 *     keyVaultId: exampleKeyVault.id,
 *     keyType: "RSA",
 *     keySize: 2048,
 *     keyOpts: [
 *         "unwrapKey",
 *         "wrapKey",
 *     ],
 * }, {
 *     dependsOn: [exampleKeyVault],
 * });
 * const exampleServer = new azure.mssql.Server("example", {
 *     name: "example-resource",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     version: "12.0",
 *     administratorLogin: "Example-Administrator",
 *     administratorLoginPassword: "Example_Password!",
 *     minimumTlsVersion: "1.2",
 *     azureadAdministrator: {
 *         loginUsername: exampleUserAssignedIdentity.name,
 *         objectId: exampleUserAssignedIdentity.principalId,
 *     },
 *     identity: {
 *         type: "UserAssigned",
 *         identityIds: [exampleUserAssignedIdentity.id],
 *     },
 *     primaryUserAssignedIdentityId: exampleUserAssignedIdentity.id,
 *     transparentDataEncryptionKeyVaultKeyId: exampleKey.id,
 * });
 * ```
 *
 * ## 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
 *
 * SQL Servers can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:mssql/server:Server example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver
 * ```
 */
class Server extends pulumi.CustomResource {
    /**
     * Get an existing Server 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 Server(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:mssql/server:Server';
    /**
     * Returns true if the given object is an instance of Server.  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'] === Server.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["administratorLogin"] = state?.administratorLogin;
            resourceInputs["administratorLoginPassword"] = state?.administratorLoginPassword;
            resourceInputs["administratorLoginPasswordWoVersion"] = state?.administratorLoginPasswordWoVersion;
            resourceInputs["azureadAdministrator"] = state?.azureadAdministrator;
            resourceInputs["connectionPolicy"] = state?.connectionPolicy;
            resourceInputs["expressVulnerabilityAssessmentEnabled"] = state?.expressVulnerabilityAssessmentEnabled;
            resourceInputs["fullyQualifiedDomainName"] = state?.fullyQualifiedDomainName;
            resourceInputs["identity"] = state?.identity;
            resourceInputs["location"] = state?.location;
            resourceInputs["minimumTlsVersion"] = state?.minimumTlsVersion;
            resourceInputs["name"] = state?.name;
            resourceInputs["outboundNetworkRestrictionEnabled"] = state?.outboundNetworkRestrictionEnabled;
            resourceInputs["primaryUserAssignedIdentityId"] = state?.primaryUserAssignedIdentityId;
            resourceInputs["publicNetworkAccessEnabled"] = state?.publicNetworkAccessEnabled;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["restorableDroppedDatabaseIds"] = state?.restorableDroppedDatabaseIds;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["transparentDataEncryptionKeyVaultKeyId"] = state?.transparentDataEncryptionKeyVaultKeyId;
            resourceInputs["version"] = state?.version;
        }
        else {
            const args = argsOrState;
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            if (args?.version === undefined && !opts.urn) {
                throw new Error("Missing required property 'version'");
            }
            resourceInputs["administratorLogin"] = args?.administratorLogin;
            resourceInputs["administratorLoginPassword"] = args?.administratorLoginPassword ? pulumi.secret(args.administratorLoginPassword) : undefined;
            resourceInputs["administratorLoginPasswordWoVersion"] = args?.administratorLoginPasswordWoVersion;
            resourceInputs["azureadAdministrator"] = args?.azureadAdministrator;
            resourceInputs["connectionPolicy"] = args?.connectionPolicy;
            resourceInputs["expressVulnerabilityAssessmentEnabled"] = args?.expressVulnerabilityAssessmentEnabled;
            resourceInputs["identity"] = args?.identity;
            resourceInputs["location"] = args?.location;
            resourceInputs["minimumTlsVersion"] = args?.minimumTlsVersion;
            resourceInputs["name"] = args?.name;
            resourceInputs["outboundNetworkRestrictionEnabled"] = args?.outboundNetworkRestrictionEnabled;
            resourceInputs["primaryUserAssignedIdentityId"] = args?.primaryUserAssignedIdentityId;
            resourceInputs["publicNetworkAccessEnabled"] = args?.publicNetworkAccessEnabled;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["transparentDataEncryptionKeyVaultKeyId"] = args?.transparentDataEncryptionKeyVaultKeyId;
            resourceInputs["version"] = args?.version;
            resourceInputs["fullyQualifiedDomainName"] = undefined /*out*/;
            resourceInputs["restorableDroppedDatabaseIds"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const aliasOpts = { aliases: [{ type: "azure:sql/sqlServer:SqlServer" }] };
        opts = pulumi.mergeOptions(opts, aliasOpts);
        const secretOpts = { additionalSecretOutputs: ["administratorLoginPassword"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(Server.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Server = Server;
//# sourceMappingURL=server.js.map