"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.FallbackRoute = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages an IotHub Fallback Route
 *
 * ## Disclaimers
 *
 * > **Note:** Fallback route can be defined either directly on the `azure.iot.IoTHub` resource, or using the `azure.iot.FallbackRoute` resource - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur.
 *
 * > **Note:** Since this resource is provisioned by default, the Azure Provider will not check for the presence of an existing resource prior to attempting to create it.
 *
 * ## 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 exampleAccount = new azure.storage.Account("example", {
 *     name: "examplestorageaccount",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleContainer = new azure.storage.Container("example", {
 *     name: "example",
 *     storageAccountName: exampleAccount.name,
 *     containerAccessType: "private",
 * });
 * const exampleIoTHub = new azure.iot.IoTHub("example", {
 *     name: "exampleIothub",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: {
 *         name: "S1",
 *         capacity: 1,
 *     },
 *     tags: {
 *         purpose: "testing",
 *     },
 * });
 * const exampleEndpointStorageContainer = new azure.iot.EndpointStorageContainer("example", {
 *     resourceGroupName: example.name,
 *     iothubId: exampleIoTHub.id,
 *     name: "example",
 *     connectionString: exampleAccount.primaryBlobConnectionString,
 *     batchFrequencyInSeconds: 60,
 *     maxChunkSizeInBytes: 10485760,
 *     containerName: exampleContainer.name,
 *     encoding: "Avro",
 *     fileNameFormat: "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}",
 * });
 * const exampleFallbackRoute = new azure.iot.FallbackRoute("example", {
 *     resourceGroupName: example.name,
 *     iothubName: exampleIoTHub.name,
 *     condition: "true",
 *     endpointNames: exampleEndpointStorageContainer.name,
 *     enabled: true,
 * });
 * ```
 *
 * ## Import
 *
 * IoTHub Fallback Route can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:iot/fallbackRoute:FallbackRoute route1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1/fallbackRoute/default
 * ```
 *
 * > **Note:** As there may only be a single fallback route per IoTHub, the id always ends with `/fallbackRoute/default`.
 */
class FallbackRoute extends pulumi.CustomResource {
    /**
     * Get an existing FallbackRoute 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 FallbackRoute(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:iot/fallbackRoute:FallbackRoute';
    /**
     * Returns true if the given object is an instance of FallbackRoute.  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'] === FallbackRoute.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["condition"] = state?.condition;
            resourceInputs["enabled"] = state?.enabled;
            resourceInputs["endpointNames"] = state?.endpointNames;
            resourceInputs["iothubName"] = state?.iothubName;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["source"] = state?.source;
        }
        else {
            const args = argsOrState;
            if (args?.enabled === undefined && !opts.urn) {
                throw new Error("Missing required property 'enabled'");
            }
            if (args?.endpointNames === undefined && !opts.urn) {
                throw new Error("Missing required property 'endpointNames'");
            }
            if (args?.iothubName === undefined && !opts.urn) {
                throw new Error("Missing required property 'iothubName'");
            }
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            resourceInputs["condition"] = args?.condition;
            resourceInputs["enabled"] = args?.enabled;
            resourceInputs["endpointNames"] = args?.endpointNames;
            resourceInputs["iothubName"] = args?.iothubName;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["source"] = args?.source;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(FallbackRoute.__pulumiType, name, resourceInputs, opts);
    }
}
exports.FallbackRoute = FallbackRoute;
//# sourceMappingURL=fallbackRoute.js.map