"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.CosmosdbDataConnection = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Kusto / Cosmos Database Data Connection.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const current = azure.core.getClientConfig({});
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "exampleRG",
 *     location: "West Europe",
 * });
 * const builtin = azure.authorization.getRoleDefinition({
 *     roleDefinitionId: "fbdf93bf-df7d-467e-a4d2-9458aa1360c8",
 * });
 * const exampleCluster = new azure.kusto.Cluster("example", {
 *     name: "examplekc",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     sku: {
 *         name: "Dev(No SLA)_Standard_D11_v2",
 *         capacity: 1,
 *     },
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 * });
 * const exampleAssignment = new azure.authorization.Assignment("example", {
 *     scope: exampleResourceGroup.id,
 *     roleDefinitionName: builtin.then(builtin => builtin.name),
 *     principalId: exampleCluster.identity.apply(identity => identity?.principalId),
 * });
 * const exampleAccount = new azure.cosmosdb.Account("example", {
 *     name: "example-ca",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     offerType: "Standard",
 *     kind: "GlobalDocumentDB",
 *     consistencyPolicy: {
 *         consistencyLevel: "Session",
 *         maxIntervalInSeconds: 5,
 *         maxStalenessPrefix: 100,
 *     },
 *     geoLocations: [{
 *         location: exampleResourceGroup.location,
 *         failoverPriority: 0,
 *     }],
 * });
 * const exampleSqlDatabase = new azure.cosmosdb.SqlDatabase("example", {
 *     name: "examplecosmosdbsqldb",
 *     resourceGroupName: exampleAccount.resourceGroupName,
 *     accountName: exampleAccount.name,
 * });
 * const exampleSqlContainer = new azure.cosmosdb.SqlContainer("example", {
 *     name: "examplecosmosdbsqlcon",
 *     resourceGroupName: exampleAccount.resourceGroupName,
 *     accountName: exampleAccount.name,
 *     databaseName: exampleSqlDatabase.name,
 *     partitionKeyPath: "/part",
 *     throughput: 400,
 * });
 * const example = azure.cosmosdb.getSqlRoleDefinitionOutput({
 *     roleDefinitionId: "00000000-0000-0000-0000-000000000001",
 *     resourceGroupName: exampleResourceGroup.name,
 *     accountName: exampleAccount.name,
 * });
 * const exampleSqlRoleAssignment = new azure.cosmosdb.SqlRoleAssignment("example", {
 *     resourceGroupName: exampleResourceGroup.name,
 *     accountName: exampleAccount.name,
 *     roleDefinitionId: example.apply(example => example.id),
 *     principalId: exampleCluster.identity.apply(identity => identity?.principalId),
 *     scope: exampleAccount.id,
 * });
 * const exampleDatabase = new azure.kusto.Database("example", {
 *     name: "examplekd",
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     clusterName: exampleCluster.name,
 * });
 * const exampleScript = new azure.kusto.Script("example", {
 *     name: "create-table-script",
 *     databaseId: exampleDatabase.id,
 *     scriptContent: `.create table TestTable(Id:string, Name:string, _ts:long, _timestamp:datetime)
 * .create table TestTable ingestion json mapping \\"TestMapping\\"
 * '['
 * '    {\\"column\\":\\"Id\\",\\"path\\":\\".id\\"},'
 * '    {\\"column\\":\\"Name\\",\\"path\\":\\".name\\"},'
 * '    {\\"column\\":\\"_ts\\",\\"path\\":\\"._ts\\"},'
 * '    {\\"column\\":\\"_timestamp\\",\\"path\\":\\"._ts\\", \\"transform\\":\\"DateTimeFromUnixSeconds\\"}'
 * ']'
 * .alter table TestTable policy ingestionbatching \\"{'MaximumBatchingTimeSpan': '0:0:10', 'MaximumNumberOfItems': 10000}\\"
 * `,
 * });
 * const exampleCosmosdbDataConnection = new azure.kusto.CosmosdbDataConnection("example", {
 *     name: "examplekcdcd",
 *     location: exampleResourceGroup.location,
 *     cosmosdbContainerId: exampleSqlContainer.id,
 *     kustoDatabaseId: exampleDatabase.id,
 *     managedIdentityId: exampleCluster.id,
 *     tableName: "TestTable",
 *     mappingRuleName: "TestMapping",
 *     retrievalStartDate: "2023-06-26T12:00:00.6554616Z",
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Kusto` - 2024-04-13
 *
 * ## Import
 *
 * Kusto / Cosmos Database Data Connection can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:kusto/cosmosdbDataConnection:CosmosdbDataConnection example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Kusto/clusters/cluster1/databases/database1/dataConnections/dataConnection1
 * ```
 */
class CosmosdbDataConnection extends pulumi.CustomResource {
    /**
     * Get an existing CosmosdbDataConnection 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 CosmosdbDataConnection(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:kusto/cosmosdbDataConnection:CosmosdbDataConnection';
    /**
     * Returns true if the given object is an instance of CosmosdbDataConnection.  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'] === CosmosdbDataConnection.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["cosmosdbContainerId"] = state?.cosmosdbContainerId;
            resourceInputs["kustoDatabaseId"] = state?.kustoDatabaseId;
            resourceInputs["location"] = state?.location;
            resourceInputs["managedIdentityId"] = state?.managedIdentityId;
            resourceInputs["mappingRuleName"] = state?.mappingRuleName;
            resourceInputs["name"] = state?.name;
            resourceInputs["retrievalStartDate"] = state?.retrievalStartDate;
            resourceInputs["tableName"] = state?.tableName;
        }
        else {
            const args = argsOrState;
            if (args?.cosmosdbContainerId === undefined && !opts.urn) {
                throw new Error("Missing required property 'cosmosdbContainerId'");
            }
            if (args?.kustoDatabaseId === undefined && !opts.urn) {
                throw new Error("Missing required property 'kustoDatabaseId'");
            }
            if (args?.managedIdentityId === undefined && !opts.urn) {
                throw new Error("Missing required property 'managedIdentityId'");
            }
            if (args?.tableName === undefined && !opts.urn) {
                throw new Error("Missing required property 'tableName'");
            }
            resourceInputs["cosmosdbContainerId"] = args?.cosmosdbContainerId;
            resourceInputs["kustoDatabaseId"] = args?.kustoDatabaseId;
            resourceInputs["location"] = args?.location;
            resourceInputs["managedIdentityId"] = args?.managedIdentityId;
            resourceInputs["mappingRuleName"] = args?.mappingRuleName;
            resourceInputs["name"] = args?.name;
            resourceInputs["retrievalStartDate"] = args?.retrievalStartDate;
            resourceInputs["tableName"] = args?.tableName;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(CosmosdbDataConnection.__pulumiType, name, resourceInputs, opts);
    }
}
exports.CosmosdbDataConnection = CosmosdbDataConnection;
//# sourceMappingURL=cosmosdbDataConnection.js.map