"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.LinkedServer = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Redis Linked Server (ie Geo Location)
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example_primary = new azure.core.ResourceGroup("example-primary", {
 *     name: "example-resources-primary",
 *     location: "East US",
 * });
 * const example_primaryCache = new azure.redis.Cache("example-primary", {
 *     name: "example-cache1",
 *     location: example_primary.location,
 *     resourceGroupName: example_primary.name,
 *     capacity: 1,
 *     family: "P",
 *     skuName: "Premium",
 *     enableNonSslPort: false,
 *     redisConfiguration: {
 *         maxmemoryReserved: 2,
 *         maxmemoryDelta: 2,
 *         maxmemoryPolicy: "allkeys-lru",
 *     },
 * });
 * const example_secondary = new azure.core.ResourceGroup("example-secondary", {
 *     name: "example-resources-secondary",
 *     location: "West US",
 * });
 * const example_secondaryCache = new azure.redis.Cache("example-secondary", {
 *     name: "example-cache2",
 *     location: example_secondary.location,
 *     resourceGroupName: example_secondary.name,
 *     capacity: 1,
 *     family: "P",
 *     skuName: "Premium",
 *     enableNonSslPort: false,
 *     redisConfiguration: {
 *         maxmemoryReserved: 2,
 *         maxmemoryDelta: 2,
 *         maxmemoryPolicy: "allkeys-lru",
 *     },
 * });
 * const example_link = new azure.redis.LinkedServer("example-link", {
 *     targetRedisCacheName: example_primaryCache.name,
 *     resourceGroupName: example_primaryCache.resourceGroupName,
 *     linkedRedisCacheId: example_secondaryCache.id,
 *     linkedRedisCacheLocation: example_secondaryCache.location,
 *     serverRole: "Secondary",
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Cache` - 2024-11-01
 *
 * ## Import
 *
 * Redis can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:redis/linkedServer:LinkedServer example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1/linkedServers/cache2
 * ```
 */
class LinkedServer extends pulumi.CustomResource {
    /**
     * Get an existing LinkedServer 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 LinkedServer(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:redis/linkedServer:LinkedServer';
    /**
     * Returns true if the given object is an instance of LinkedServer.  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'] === LinkedServer.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["geoReplicatedPrimaryHostName"] = state?.geoReplicatedPrimaryHostName;
            resourceInputs["linkedRedisCacheId"] = state?.linkedRedisCacheId;
            resourceInputs["linkedRedisCacheLocation"] = state?.linkedRedisCacheLocation;
            resourceInputs["name"] = state?.name;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["serverRole"] = state?.serverRole;
            resourceInputs["targetRedisCacheName"] = state?.targetRedisCacheName;
        }
        else {
            const args = argsOrState;
            if (args?.linkedRedisCacheId === undefined && !opts.urn) {
                throw new Error("Missing required property 'linkedRedisCacheId'");
            }
            if (args?.linkedRedisCacheLocation === undefined && !opts.urn) {
                throw new Error("Missing required property 'linkedRedisCacheLocation'");
            }
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            if (args?.serverRole === undefined && !opts.urn) {
                throw new Error("Missing required property 'serverRole'");
            }
            if (args?.targetRedisCacheName === undefined && !opts.urn) {
                throw new Error("Missing required property 'targetRedisCacheName'");
            }
            resourceInputs["linkedRedisCacheId"] = args?.linkedRedisCacheId;
            resourceInputs["linkedRedisCacheLocation"] = args?.linkedRedisCacheLocation;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["serverRole"] = args?.serverRole;
            resourceInputs["targetRedisCacheName"] = args?.targetRedisCacheName;
            resourceInputs["geoReplicatedPrimaryHostName"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(LinkedServer.__pulumiType, name, resourceInputs, opts);
    }
}
exports.LinkedServer = LinkedServer;
//# sourceMappingURL=linkedServer.js.map