"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.Script = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Kusto Script.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "example",
 *     location: "West Europe",
 * });
 * const exampleCluster = new azure.kusto.Cluster("example", {
 *     name: "example",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     sku: {
 *         name: "Dev(No SLA)_Standard_D11_v2",
 *         capacity: 1,
 *     },
 * });
 * const exampleDatabase = new azure.kusto.Database("example", {
 *     name: "example",
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     clusterName: exampleCluster.name,
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "example",
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleContainer = new azure.storage.Container("example", {
 *     name: "setup-files",
 *     storageAccountName: exampleAccount.name,
 *     containerAccessType: "private",
 * });
 * const exampleBlob = new azure.storage.Blob("example", {
 *     name: "script.txt",
 *     storageAccountName: exampleAccount.name,
 *     storageContainerName: exampleContainer.name,
 *     type: "Block",
 *     sourceContent: ".create table MyTable (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)",
 * });
 * const example = azure.storage.getAccountBlobContainerSASOutput({
 *     connectionString: exampleAccount.primaryConnectionString,
 *     containerName: exampleContainer.name,
 *     httpsOnly: true,
 *     start: "2017-03-21",
 *     expiry: "2022-03-21",
 *     permissions: {
 *         read: true,
 *         add: false,
 *         create: false,
 *         write: true,
 *         "delete": false,
 *         list: true,
 *     },
 * });
 * const exampleScript = new azure.kusto.Script("example", {
 *     name: "example",
 *     databaseId: exampleDatabase.id,
 *     url: exampleBlob.id,
 *     sasToken: example.apply(example => example.sas),
 *     continueOnErrorsEnabled: true,
 *     forceAnUpdateWhenValueChanged: "first",
 *     scriptLevel: "Database",
 *     principalPermissionsAction: "RemovePermissionOnScriptCompletion",
 * });
 * ```
 *
 * ## 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 Scripts can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:kusto/script:Script example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/clusters/cluster1/databases/database1/scripts/script1
 * ```
 */
class Script extends pulumi.CustomResource {
    /**
     * Get an existing Script 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 Script(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:kusto/script:Script';
    /**
     * Returns true if the given object is an instance of Script.  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'] === Script.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["continueOnErrorsEnabled"] = state?.continueOnErrorsEnabled;
            resourceInputs["databaseId"] = state?.databaseId;
            resourceInputs["forceAnUpdateWhenValueChanged"] = state?.forceAnUpdateWhenValueChanged;
            resourceInputs["name"] = state?.name;
            resourceInputs["principalPermissionsAction"] = state?.principalPermissionsAction;
            resourceInputs["sasToken"] = state?.sasToken;
            resourceInputs["scriptContent"] = state?.scriptContent;
            resourceInputs["scriptLevel"] = state?.scriptLevel;
            resourceInputs["url"] = state?.url;
        }
        else {
            const args = argsOrState;
            if (args?.databaseId === undefined && !opts.urn) {
                throw new Error("Missing required property 'databaseId'");
            }
            resourceInputs["continueOnErrorsEnabled"] = args?.continueOnErrorsEnabled;
            resourceInputs["databaseId"] = args?.databaseId;
            resourceInputs["forceAnUpdateWhenValueChanged"] = args?.forceAnUpdateWhenValueChanged;
            resourceInputs["name"] = args?.name;
            resourceInputs["principalPermissionsAction"] = args?.principalPermissionsAction;
            resourceInputs["sasToken"] = args?.sasToken ? pulumi.secret(args.sasToken) : undefined;
            resourceInputs["scriptContent"] = args?.scriptContent ? pulumi.secret(args.scriptContent) : undefined;
            resourceInputs["scriptLevel"] = args?.scriptLevel;
            resourceInputs["url"] = args?.url;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["sasToken", "scriptContent"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(Script.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Script = Script;
//# sourceMappingURL=script.js.map