@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
144 lines • 5.5 kB
JavaScript
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** 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.
*
* Notes:
*
* * 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:
*
* 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, Object.assign(Object.assign({}, 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 ? state.contentBase64 : undefined;
resourceInputs["fileSize"] = state ? state.fileSize : undefined;
resourceInputs["md5"] = state ? state.md5 : undefined;
resourceInputs["modificationTime"] = state ? state.modificationTime : undefined;
resourceInputs["path"] = state ? state.path : undefined;
resourceInputs["remoteFileModified"] = state ? state.remoteFileModified : undefined;
resourceInputs["source"] = state ? state.source : undefined;
}
else {
const args = argsOrState;
if ((!args || args.path === undefined) && !opts.urn) {
throw new Error("Missing required property 'path'");
}
resourceInputs["contentBase64"] = args ? args.contentBase64 : undefined;
resourceInputs["md5"] = args ? args.md5 : undefined;
resourceInputs["path"] = args ? args.path : undefined;
resourceInputs["remoteFileModified"] = args ? args.remoteFileModified : undefined;
resourceInputs["source"] = args ? args.source : undefined;
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
;