"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.ScaleSet = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a virtual machine scale set.
 *
 * ## Example Usage
 *
 * ### With Managed Disks (Recommended)
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "acctvn",
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "acctsub",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 * });
 * const examplePublicIp = new azure.network.PublicIp("example", {
 *     name: "test",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     allocationMethod: "Static",
 *     domainNameLabel: example.name,
 *     tags: {
 *         environment: "staging",
 *     },
 * });
 * const exampleLoadBalancer = new azure.lb.LoadBalancer("example", {
 *     name: "test",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     frontendIpConfigurations: [{
 *         name: "PublicIPAddress",
 *         publicIpAddressId: examplePublicIp.id,
 *     }],
 * });
 * const bpepool = new azure.lb.BackendAddressPool("bpepool", {
 *     loadbalancerId: exampleLoadBalancer.id,
 *     name: "BackEndAddressPool",
 * });
 * const lbnatpool = new azure.lb.NatPool("lbnatpool", {
 *     resourceGroupName: example.name,
 *     name: "ssh",
 *     loadbalancerId: exampleLoadBalancer.id,
 *     protocol: "Tcp",
 *     frontendPortStart: 50000,
 *     frontendPortEnd: 50119,
 *     backendPort: 22,
 *     frontendIpConfigurationName: "PublicIPAddress",
 * });
 * const exampleProbe = new azure.lb.Probe("example", {
 *     loadbalancerId: exampleLoadBalancer.id,
 *     name: "http-probe",
 *     protocol: "Http",
 *     requestPath: "/health",
 *     port: 8080,
 * });
 * const exampleScaleSet = new azure.compute.ScaleSet("example", {
 *     name: "mytestscaleset-1",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     automaticOsUpgrade: true,
 *     upgradePolicyMode: "Rolling",
 *     rollingUpgradePolicy: {
 *         maxBatchInstancePercent: 20,
 *         maxUnhealthyInstancePercent: 20,
 *         maxUnhealthyUpgradedInstancePercent: 5,
 *         pauseTimeBetweenBatches: "PT0S",
 *     },
 *     healthProbeId: exampleProbe.id,
 *     sku: {
 *         name: "Standard_F2",
 *         tier: "Standard",
 *         capacity: 2,
 *     },
 *     storageProfileImageReference: {
 *         publisher: "Canonical",
 *         offer: "0001-com-ubuntu-server-jammy",
 *         sku: "22_04-lts",
 *         version: "latest",
 *     },
 *     storageProfileOsDisk: {
 *         name: "",
 *         caching: "ReadWrite",
 *         createOption: "FromImage",
 *         managedDiskType: "Standard_LRS",
 *     },
 *     storageProfileDataDisks: [{
 *         lun: 0,
 *         caching: "ReadWrite",
 *         createOption: "Empty",
 *         diskSizeGb: 10,
 *     }],
 *     osProfile: {
 *         computerNamePrefix: "testvm",
 *         adminUsername: "myadmin",
 *     },
 *     osProfileLinuxConfig: {
 *         disablePasswordAuthentication: true,
 *         sshKeys: [{
 *             path: "/home/myadmin/.ssh/authorized_keys",
 *             keyData: std.file({
 *                 input: "~/.ssh/demo_key.pub",
 *             }).then(invoke => invoke.result),
 *         }],
 *     },
 *     networkProfiles: [{
 *         name: "mynetworkprofile",
 *         primary: true,
 *         ipConfigurations: [{
 *             name: "TestIPConfiguration",
 *             primary: true,
 *             subnetId: exampleSubnet.id,
 *             loadBalancerBackendAddressPoolIds: [bpepool.id],
 *             loadBalancerInboundNatRulesIds: [lbnatpool.id],
 *         }],
 *     }],
 *     tags: {
 *         environment: "staging",
 *     },
 * });
 * ```
 *
 * ### With Unmanaged Disks
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "acctvn",
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "acctsub",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "accsa",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 *     tags: {
 *         environment: "staging",
 *     },
 * });
 * const exampleContainer = new azure.storage.Container("example", {
 *     name: "vhds",
 *     storageAccountName: exampleAccount.name,
 *     containerAccessType: "private",
 * });
 * const exampleScaleSet = new azure.compute.ScaleSet("example", {
 *     name: "mytestscaleset-1",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     upgradePolicyMode: "Manual",
 *     sku: {
 *         name: "Standard_F2",
 *         tier: "Standard",
 *         capacity: 2,
 *     },
 *     osProfile: {
 *         computerNamePrefix: "testvm",
 *         adminUsername: "myadmin",
 *     },
 *     osProfileLinuxConfig: {
 *         disablePasswordAuthentication: true,
 *         sshKeys: [{
 *             path: "/home/myadmin/.ssh/authorized_keys",
 *             keyData: std.file({
 *                 input: "~/.ssh/demo_key.pub",
 *             }).then(invoke => invoke.result),
 *         }],
 *     },
 *     networkProfiles: [{
 *         name: "TestNetworkProfile",
 *         primary: true,
 *         ipConfigurations: [{
 *             name: "TestIPConfiguration",
 *             primary: true,
 *             subnetId: exampleSubnet.id,
 *         }],
 *     }],
 *     storageProfileOsDisk: {
 *         name: "osDiskProfile",
 *         caching: "ReadWrite",
 *         createOption: "FromImage",
 *         vhdContainers: [pulumi.interpolate`${exampleAccount.primaryBlobEndpoint}${exampleContainer.name}`],
 *     },
 *     storageProfileImageReference: {
 *         publisher: "Canonical",
 *         offer: "0001-com-ubuntu-server-jammy",
 *         sku: "22_04-lts",
 *         version: "latest",
 *     },
 * });
 * ```
 *
 * ## Example of storageProfileImageReference with id
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.compute.Image("example", {name: "test"});
 * const exampleScaleSet = new azure.compute.ScaleSet("example", {
 *     name: "test",
 *     storageProfileImageReference: {
 *         id: example.id,
 *     },
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Compute` - 2024-11-01
 *
 * ## Import
 *
 * Virtual Machine Scale Sets can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:compute/scaleSet:ScaleSet scaleset1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachineScaleSets/scaleset1
 * ```
 */
class ScaleSet extends pulumi.CustomResource {
    /**
     * Get an existing ScaleSet 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 ScaleSet(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:compute/scaleSet:ScaleSet';
    /**
     * Returns true if the given object is an instance of ScaleSet.  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'] === ScaleSet.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["automaticOsUpgrade"] = state?.automaticOsUpgrade;
            resourceInputs["bootDiagnostics"] = state?.bootDiagnostics;
            resourceInputs["evictionPolicy"] = state?.evictionPolicy;
            resourceInputs["extensions"] = state?.extensions;
            resourceInputs["healthProbeId"] = state?.healthProbeId;
            resourceInputs["identity"] = state?.identity;
            resourceInputs["licenseType"] = state?.licenseType;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["networkProfiles"] = state?.networkProfiles;
            resourceInputs["osProfile"] = state?.osProfile;
            resourceInputs["osProfileLinuxConfig"] = state?.osProfileLinuxConfig;
            resourceInputs["osProfileSecrets"] = state?.osProfileSecrets;
            resourceInputs["osProfileWindowsConfig"] = state?.osProfileWindowsConfig;
            resourceInputs["overprovision"] = state?.overprovision;
            resourceInputs["plan"] = state?.plan;
            resourceInputs["priority"] = state?.priority;
            resourceInputs["proximityPlacementGroupId"] = state?.proximityPlacementGroupId;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["rollingUpgradePolicy"] = state?.rollingUpgradePolicy;
            resourceInputs["singlePlacementGroup"] = state?.singlePlacementGroup;
            resourceInputs["sku"] = state?.sku;
            resourceInputs["storageProfileDataDisks"] = state?.storageProfileDataDisks;
            resourceInputs["storageProfileImageReference"] = state?.storageProfileImageReference;
            resourceInputs["storageProfileOsDisk"] = state?.storageProfileOsDisk;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["upgradePolicyMode"] = state?.upgradePolicyMode;
            resourceInputs["zones"] = state?.zones;
        }
        else {
            const args = argsOrState;
            if (args?.networkProfiles === undefined && !opts.urn) {
                throw new Error("Missing required property 'networkProfiles'");
            }
            if (args?.osProfile === undefined && !opts.urn) {
                throw new Error("Missing required property 'osProfile'");
            }
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            if (args?.sku === undefined && !opts.urn) {
                throw new Error("Missing required property 'sku'");
            }
            if (args?.storageProfileOsDisk === undefined && !opts.urn) {
                throw new Error("Missing required property 'storageProfileOsDisk'");
            }
            if (args?.upgradePolicyMode === undefined && !opts.urn) {
                throw new Error("Missing required property 'upgradePolicyMode'");
            }
            resourceInputs["automaticOsUpgrade"] = args?.automaticOsUpgrade;
            resourceInputs["bootDiagnostics"] = args?.bootDiagnostics;
            resourceInputs["evictionPolicy"] = args?.evictionPolicy;
            resourceInputs["extensions"] = args?.extensions;
            resourceInputs["healthProbeId"] = args?.healthProbeId;
            resourceInputs["identity"] = args?.identity;
            resourceInputs["licenseType"] = args?.licenseType;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["networkProfiles"] = args?.networkProfiles;
            resourceInputs["osProfile"] = args?.osProfile;
            resourceInputs["osProfileLinuxConfig"] = args?.osProfileLinuxConfig;
            resourceInputs["osProfileSecrets"] = args?.osProfileSecrets;
            resourceInputs["osProfileWindowsConfig"] = args?.osProfileWindowsConfig;
            resourceInputs["overprovision"] = args?.overprovision;
            resourceInputs["plan"] = args?.plan;
            resourceInputs["priority"] = args?.priority;
            resourceInputs["proximityPlacementGroupId"] = args?.proximityPlacementGroupId;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["rollingUpgradePolicy"] = args?.rollingUpgradePolicy;
            resourceInputs["singlePlacementGroup"] = args?.singlePlacementGroup;
            resourceInputs["sku"] = args?.sku;
            resourceInputs["storageProfileDataDisks"] = args?.storageProfileDataDisks;
            resourceInputs["storageProfileImageReference"] = args?.storageProfileImageReference;
            resourceInputs["storageProfileOsDisk"] = args?.storageProfileOsDisk;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["upgradePolicyMode"] = args?.upgradePolicyMode;
            resourceInputs["zones"] = args?.zones;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(ScaleSet.__pulumiType, name, resourceInputs, opts);
    }
}
exports.ScaleSet = ScaleSet;
//# sourceMappingURL=scaleSet.js.map