@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
157 lines • 5.48 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.File = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource allows uploading and downloading files in databricks_volume.
*
* > This resource can only be used with a workspace-level provider!
*
* > Currently the limit is 5GiB in octet-stream.
*
* > Currently, only UC volumes are supported. The list of destinations may change.
*
* ## Example Usage
*
* In order to manage a file on Unity Catalog Volumes with Pulumi, you must specify the `source` attribute containing the full path to the file on the local filesystem.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const sandbox = new databricks.Catalog("sandbox", {
* metastoreId: thisDatabricksMetastore.id,
* name: "sandbox",
* comment: "this catalog is managed by terraform",
* properties: {
* purpose: "testing",
* },
* });
* const things = new databricks.Schema("things", {
* catalogName: sandbox.name,
* name: "things",
* comment: "this schema is managed by terraform",
* properties: {
* kind: "various",
* },
* });
* const _this = new databricks.Volume("this", {
* name: "quickstart_volume",
* catalogName: sandbox.name,
* schemaName: things.name,
* volumeType: "MANAGED",
* comment: "this volume is managed by terraform",
* });
* const thisFile = new databricks.File("this", {
* source: "/full/path/on/local/system",
* path: pulumi.interpolate`${_this.volumePath}/fileName`,
* });
* ```
*
* You can also inline sources through `contentBase64` attribute.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
* import * as std from "@pulumi/std";
*
* const initScript = new databricks.File("init_script", {
* contentBase64: std.base64encode({
* input: `#!/bin/bash
* echo "Hello World"
* `,
* }).then(invoke => invoke.result),
* path: `${_this.volumePath}/fileName`,
* });
* ```
*
* ## Related Resources
*
* The following resources are often used in the same context:
*
* * databricks.WorkspaceFile
* * End to end workspace management guide.
* * databricks.Volume to manage [volumes within Unity Catalog](https://docs.databricks.com/en/connect/unity-catalog/volumes.html).
*
* ## Import
*
* The resource `databricks_file` can be imported using the path of the file:
*
* hcl
*
* import {
*
* to = databricks_file.this
*
* id = "<path>"
*
* }
*
* Alternatively, when using `terraform` version 1.4 or earlier, import using the `pulumi import` command:
*
* bash
*
* ```sh
* $ pulumi import databricks:index/file:File this <path>
* ```
*/
class File extends pulumi.CustomResource {
/**
* Get an existing File 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 File(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of File. 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'] === File.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["contentBase64"] = state?.contentBase64;
resourceInputs["fileSize"] = state?.fileSize;
resourceInputs["md5"] = state?.md5;
resourceInputs["modificationTime"] = state?.modificationTime;
resourceInputs["path"] = state?.path;
resourceInputs["remoteFileModified"] = state?.remoteFileModified;
resourceInputs["source"] = state?.source;
}
else {
const args = argsOrState;
if (args?.path === undefined && !opts.urn) {
throw new Error("Missing required property 'path'");
}
resourceInputs["contentBase64"] = args?.contentBase64;
resourceInputs["md5"] = args?.md5;
resourceInputs["path"] = args?.path;
resourceInputs["remoteFileModified"] = args?.remoteFileModified;
resourceInputs["source"] = args?.source;
resourceInputs["fileSize"] = undefined /*out*/;
resourceInputs["modificationTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(File.__pulumiType, name, resourceInputs, opts);
}
}
exports.File = File;
/** @internal */
File.__pulumiType = 'databricks:index/file:File';
//# sourceMappingURL=file.js.map