"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.FlexibleServer = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a PostgreSQL Flexible Server.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "example-vn",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.0.0.0/16"],
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "example-sn",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 *     serviceEndpoints: ["Microsoft.Storage"],
 *     delegations: [{
 *         name: "fs",
 *         serviceDelegation: {
 *             name: "Microsoft.DBforPostgreSQL/flexibleServers",
 *             actions: ["Microsoft.Network/virtualNetworks/subnets/join/action"],
 *         },
 *     }],
 * });
 * const exampleZone = new azure.privatedns.Zone("example", {
 *     name: "example.postgres.database.azure.com",
 *     resourceGroupName: example.name,
 * });
 * const exampleZoneVirtualNetworkLink = new azure.privatedns.ZoneVirtualNetworkLink("example", {
 *     name: "exampleVnetZone.com",
 *     privateDnsZoneName: exampleZone.name,
 *     virtualNetworkId: exampleVirtualNetwork.id,
 *     resourceGroupName: example.name,
 * }, {
 *     dependsOn: [exampleSubnet],
 * });
 * const exampleFlexibleServer = new azure.postgresql.FlexibleServer("example", {
 *     name: "example-psqlflexibleserver",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     version: "12",
 *     delegatedSubnetId: exampleSubnet.id,
 *     privateDnsZoneId: exampleZone.id,
 *     publicNetworkAccessEnabled: false,
 *     administratorLogin: "psqladmin",
 *     administratorPassword: "H@Sh1CoR3!",
 *     zone: "1",
 *     storageMb: 32768,
 *     storageTier: "P4",
 *     skuName: "B_Standard_B1ms",
 * }, {
 *     dependsOn: [exampleZoneVirtualNetworkLink],
 * });
 * ```
 *
 * ## `storageTier` defaults based on `storageMb`
 *
 * | `storageMb` | GiB   | TiB | Default | Supported `storageTier`'s           | Provisioned `IOPS`  |
 * |:------------:|:-----:|:---:|:-------:|:------------------------------------:|:-------------------:|
 * | 32768        | 32    |  -  | P4      | P4, P6, P10, P15, P20, P30, P40, P50 | 120                 |
 * | 65536        | 64    |  -  | P6      | P6, P10, P15, P20, P30, P40, P50     | 240                 |
 * | 131072       | 128   |  -  | P10     | P10, P15, P20, P30, P40, P50         | 500                 |
 * | 262144       | 256   |  -  | P15     | P15, P20, P30, P40, P50              | 1,100               |
 * | 524288       | 512   |  -  | P20     | P20, P30, P40, P50                   | 2,300               |
 * | 1048576      | 1024  |  1  | P30     | P30, P40, P50                        | 5,000               |
 * | 2097152      | 2048  |  2  | P40     | P40, P50                             | 7,500               |
 * | 4193280      | 4095  |  4  | P50     | P50                                  | 7,500               |
 * | 4194304      | 4096  |  4  | P50     | P50                                  | 7,500               |
 * | 8388608      | 8192  |  8  | P60     | P60, P70                             | 16,000              |
 * | 16777216     | 16384 |  16 | P70     | P70, P80                             | 18,000              |
 * | 33553408     | 32767 |  32 | P80     | P80                                  | 20,000              |
 *
 * > **Note:** Host Caching (ReadOnly and Read/Write) is supported on disk sizes less than 4194304 MiB. This means any disk that is provisioned up to 4193280 MiB can take advantage of Host Caching. Host caching is not supported for disk sizes larger than 4193280 MiB. For example, a P50 premium disk provisioned at 4193280 GiB can take advantage of Host caching while a P50 disk provisioned at 4194304 MiB cannot. Moving from a smaller disk size to a larger disk size, greater than 4193280 MiB, will cause the disk to lose the disk caching ability.
 *
 * ***
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.DBforPostgreSQL` - 2025-08-01
 *
 * ## Import
 *
 * PostgreSQL Flexible Servers can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:postgresql/flexibleServer:FlexibleServer example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/server1
 * ```
 */
class FlexibleServer extends pulumi.CustomResource {
    /**
     * Get an existing FlexibleServer 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 FlexibleServer(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:postgresql/flexibleServer:FlexibleServer';
    /**
     * Returns true if the given object is an instance of FlexibleServer.  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'] === FlexibleServer.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["administratorLogin"] = state?.administratorLogin;
            resourceInputs["administratorPassword"] = state?.administratorPassword;
            resourceInputs["administratorPasswordWoVersion"] = state?.administratorPasswordWoVersion;
            resourceInputs["authentication"] = state?.authentication;
            resourceInputs["autoGrowEnabled"] = state?.autoGrowEnabled;
            resourceInputs["backupRetentionDays"] = state?.backupRetentionDays;
            resourceInputs["cluster"] = state?.cluster;
            resourceInputs["createMode"] = state?.createMode;
            resourceInputs["customerManagedKey"] = state?.customerManagedKey;
            resourceInputs["delegatedSubnetId"] = state?.delegatedSubnetId;
            resourceInputs["fqdn"] = state?.fqdn;
            resourceInputs["geoRedundantBackupEnabled"] = state?.geoRedundantBackupEnabled;
            resourceInputs["highAvailability"] = state?.highAvailability;
            resourceInputs["identity"] = state?.identity;
            resourceInputs["location"] = state?.location;
            resourceInputs["maintenanceWindow"] = state?.maintenanceWindow;
            resourceInputs["name"] = state?.name;
            resourceInputs["pointInTimeRestoreTimeInUtc"] = state?.pointInTimeRestoreTimeInUtc;
            resourceInputs["privateDnsZoneId"] = state?.privateDnsZoneId;
            resourceInputs["publicNetworkAccessEnabled"] = state?.publicNetworkAccessEnabled;
            resourceInputs["replicationRole"] = state?.replicationRole;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["skuName"] = state?.skuName;
            resourceInputs["sourceServerId"] = state?.sourceServerId;
            resourceInputs["storageMb"] = state?.storageMb;
            resourceInputs["storageTier"] = state?.storageTier;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["version"] = state?.version;
            resourceInputs["zone"] = state?.zone;
        }
        else {
            const args = argsOrState;
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            resourceInputs["administratorLogin"] = args?.administratorLogin;
            resourceInputs["administratorPassword"] = args?.administratorPassword ? pulumi.secret(args.administratorPassword) : undefined;
            resourceInputs["administratorPasswordWoVersion"] = args?.administratorPasswordWoVersion;
            resourceInputs["authentication"] = args?.authentication;
            resourceInputs["autoGrowEnabled"] = args?.autoGrowEnabled;
            resourceInputs["backupRetentionDays"] = args?.backupRetentionDays;
            resourceInputs["cluster"] = args?.cluster;
            resourceInputs["createMode"] = args?.createMode;
            resourceInputs["customerManagedKey"] = args?.customerManagedKey;
            resourceInputs["delegatedSubnetId"] = args?.delegatedSubnetId;
            resourceInputs["geoRedundantBackupEnabled"] = args?.geoRedundantBackupEnabled;
            resourceInputs["highAvailability"] = args?.highAvailability;
            resourceInputs["identity"] = args?.identity;
            resourceInputs["location"] = args?.location;
            resourceInputs["maintenanceWindow"] = args?.maintenanceWindow;
            resourceInputs["name"] = args?.name;
            resourceInputs["pointInTimeRestoreTimeInUtc"] = args?.pointInTimeRestoreTimeInUtc;
            resourceInputs["privateDnsZoneId"] = args?.privateDnsZoneId;
            resourceInputs["publicNetworkAccessEnabled"] = args?.publicNetworkAccessEnabled;
            resourceInputs["replicationRole"] = args?.replicationRole;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["skuName"] = args?.skuName;
            resourceInputs["sourceServerId"] = args?.sourceServerId;
            resourceInputs["storageMb"] = args?.storageMb;
            resourceInputs["storageTier"] = args?.storageTier;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["version"] = args?.version;
            resourceInputs["zone"] = args?.zone;
            resourceInputs["fqdn"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["administratorPassword"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(FlexibleServer.__pulumiType, name, resourceInputs, opts);
    }
}
exports.FlexibleServer = FlexibleServer;
//# sourceMappingURL=flexibleServer.js.map