UNPKG

@pulumi/databricks

Version:

A Pulumi package for creating and managing databricks cloud resources.

170 lines 7.33 kB
"use strict"; // *** 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.Share = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * > This resource can only be used with a workspace-level provider! * * 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. * * 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. * * 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, Object.assign(Object.assign({}, 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 ? state.comment : undefined; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["createdBy"] = state ? state.createdBy : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["objects"] = state ? state.objects : undefined; resourceInputs["owner"] = state ? state.owner : undefined; resourceInputs["storageLocation"] = state ? state.storageLocation : undefined; resourceInputs["storageRoot"] = state ? state.storageRoot : undefined; resourceInputs["updatedAt"] = state ? state.updatedAt : undefined; resourceInputs["updatedBy"] = state ? state.updatedBy : undefined; } else { const args = argsOrState; resourceInputs["comment"] = args ? args.comment : undefined; resourceInputs["createdAt"] = args ? args.createdAt : undefined; resourceInputs["createdBy"] = args ? args.createdBy : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["objects"] = args ? args.objects : undefined; resourceInputs["owner"] = args ? args.owner : undefined; resourceInputs["storageLocation"] = args ? args.storageLocation : undefined; resourceInputs["storageRoot"] = args ? args.storageRoot : undefined; resourceInputs["updatedAt"] = args ? args.updatedAt : undefined; resourceInputs["updatedBy"] = args ? args.updatedBy : undefined; } 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