@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
182 lines • 7.11 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.Share = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* In Delta Sharing, a share is a read-only collection of tables and table partitions that a provider wants to share with one or more recipients. If your recipient uses a Unity Catalog-enabled Databricks workspace, you can also include notebook files, views (including dynamic views that restrict access at the row and column level), Unity Catalog volumes, and Unity Catalog models in a share.
*
* > This resource can only be used with a workspace-level provider!
*
* In a Unity Catalog-enabled Databricks workspace, a share is a securable object registered in Unity Catalog. A `databricks.Share` is contained within a databricks_metastore. If you remove a share from your Unity Catalog metastore, all recipients of that share lose the ability to access it.
*
* ## Example Usage
*
* > In Pulumi configuration, it is recommended to define objects in alphabetical order of their `name` arguments, so that you get consistent and readable diff. Whenever objects are added or removed, or `name` is renamed, you'll observe a change in the majority of tasks. It's related to the fact that the current version of the provider treats `object` blocks as an ordered list. Alternatively, `object` block could have been an unordered set, though end-users would see the entire block replaced upon a change in single property of the task.
*
* Creating a Delta Sharing share and add some existing tables to it
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const things = databricks.getTables({
* catalogName: "sandbox",
* schemaName: "things",
* });
* const some = new databricks.Share("some", {
* objects: .map(entry => ({
* name: entry.value,
* dataObjectType: "TABLE",
* })),
* name: "my_share",
* });
* ```
*
* Creating a Delta Sharing share and add a schema to it(including all current and future tables).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const schemaShare = new databricks.Share("schema_share", {
* name: "schema_share",
* objects: [{
* name: "catalog_name.schema_name",
* dataObjectType: "SCHEMA",
* historyDataSharingStatus: "ENABLED",
* }],
* });
* ```
*
* Creating a Delta Sharing share and share a table with partitions spec and history
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const some = new databricks.Share("some", {
* name: "my_share",
* objects: [{
* name: "my_catalog.my_schema.my_table",
* dataObjectType: "TABLE",
* historyDataSharingStatus: "ENABLED",
* partitions: [
* {
* values: [
* {
* name: "year",
* op: "EQUAL",
* value: "2009",
* },
* {
* name: "month",
* op: "EQUAL",
* value: "12",
* },
* ],
* },
* {
* values: [{
* name: "year",
* op: "EQUAL",
* value: "2010",
* }],
* },
* ],
* }],
* });
* ```
*
* ## Related Resources
*
* The following resources are often used in the same context:
*
* * databricks.Recipient to create Delta Sharing recipients.
* * databricks.Grants to manage Delta Sharing permissions.
* * databricks.getShares to read existing Delta Sharing shares.
*
* ## Import
*
* The share resource can be imported using the name of the share.
*
* hcl
*
* import {
*
* to = databricks_share.this
*
* id = "<share_name>"
*
* }
*
* Alternatively, when using `terraform` version 1.4 or earlier, import using the `pulumi import` command:
*
* bash
*
* ```sh
* $ pulumi import databricks:index/share:Share this <share_name>
* ```
*/
class Share extends pulumi.CustomResource {
/**
* Get an existing Share 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 Share(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Share. 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'] === Share.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["comment"] = state?.comment;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["createdBy"] = state?.createdBy;
resourceInputs["name"] = state?.name;
resourceInputs["objects"] = state?.objects;
resourceInputs["owner"] = state?.owner;
resourceInputs["storageLocation"] = state?.storageLocation;
resourceInputs["storageRoot"] = state?.storageRoot;
resourceInputs["updatedAt"] = state?.updatedAt;
resourceInputs["updatedBy"] = state?.updatedBy;
}
else {
const args = argsOrState;
resourceInputs["comment"] = args?.comment;
resourceInputs["createdAt"] = args?.createdAt;
resourceInputs["createdBy"] = args?.createdBy;
resourceInputs["name"] = args?.name;
resourceInputs["objects"] = args?.objects;
resourceInputs["owner"] = args?.owner;
resourceInputs["storageLocation"] = args?.storageLocation;
resourceInputs["storageRoot"] = args?.storageRoot;
resourceInputs["updatedAt"] = args?.updatedAt;
resourceInputs["updatedBy"] = args?.updatedBy;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Share.__pulumiType, name, resourceInputs, opts);
}
}
exports.Share = Share;
/** @internal */
Share.__pulumiType = 'databricks:index/share:Share';
//# sourceMappingURL=share.js.map