@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
170 lines • 6.14 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.getJobsOutput = exports.getJobs = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Retrieves a list of databricks.Job ids, that were created by Pulumi or manually, so that special handling could be applied.
*
* > This data source can only be used with a workspace-level provider!
*
* > By default, this data resource will error in case of jobs with duplicate names. To support duplicate names, set `key = "id"` to map jobs by ID.
*
* ## Example Usage
*
* Granting view databricks.Permissions to all databricks.Job within the workspace:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* export = async () => {
* const _this = await databricks.getJobs({});
* const everyoneCanViewAllJobs: databricks.Permissions[] = [];
* for (const range of Object.entries(_this.ids).map(([k, v]) => ({key: k, value: v}))) {
* everyoneCanViewAllJobs.push(new databricks.Permissions(`everyone_can_view_all_jobs-${range.key}`, {
* jobId: range.value,
* accessControls: [{
* groupName: "users",
* permissionLevel: "CAN_VIEW",
* }],
* }));
* }
* }
* ```
*
* Getting ID of specific databricks.Job by name:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const _this = databricks.getJobs({
* jobNameContains: "test",
* });
* export const x = _this.then(_this => `ID of `x` job is ${_this.ids?.x}`);
* ```
*
* Getting IDs of databricks.Job mapped by ID, allowing duplicate job names:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* export = async () => {
* const _this = await databricks.getJobs({
* key: "id",
* });
* const everyoneCanViewAllJobs: databricks.Permissions[] = [];
* for (const range of Object.entries(_this.ids).map(([k, v]) => ({key: k, value: v}))) {
* everyoneCanViewAllJobs.push(new databricks.Permissions(`everyone_can_view_all_jobs-${range.key}`, {
* jobId: range.value,
* accessControls: [{
* groupName: "users",
* permissionLevel: "CAN_VIEW",
* }],
* }));
* }
* }
* ```
*
* ## Related Resources
*
* The following resources are used in the same context:
*
* * databricks.Job to manage [Databricks Jobs](https://docs.databricks.com/jobs.html) to run non-interactive code in a databricks_cluster.
*/
function getJobs(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invoke("databricks:index/getJobs:getJobs", {
"ids": args.ids,
"jobNameContains": args.jobNameContains,
"key": args.key,
}, opts);
}
exports.getJobs = getJobs;
/**
* Retrieves a list of databricks.Job ids, that were created by Pulumi or manually, so that special handling could be applied.
*
* > This data source can only be used with a workspace-level provider!
*
* > By default, this data resource will error in case of jobs with duplicate names. To support duplicate names, set `key = "id"` to map jobs by ID.
*
* ## Example Usage
*
* Granting view databricks.Permissions to all databricks.Job within the workspace:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* export = async () => {
* const _this = await databricks.getJobs({});
* const everyoneCanViewAllJobs: databricks.Permissions[] = [];
* for (const range of Object.entries(_this.ids).map(([k, v]) => ({key: k, value: v}))) {
* everyoneCanViewAllJobs.push(new databricks.Permissions(`everyone_can_view_all_jobs-${range.key}`, {
* jobId: range.value,
* accessControls: [{
* groupName: "users",
* permissionLevel: "CAN_VIEW",
* }],
* }));
* }
* }
* ```
*
* Getting ID of specific databricks.Job by name:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const _this = databricks.getJobs({
* jobNameContains: "test",
* });
* export const x = _this.then(_this => `ID of `x` job is ${_this.ids?.x}`);
* ```
*
* Getting IDs of databricks.Job mapped by ID, allowing duplicate job names:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* export = async () => {
* const _this = await databricks.getJobs({
* key: "id",
* });
* const everyoneCanViewAllJobs: databricks.Permissions[] = [];
* for (const range of Object.entries(_this.ids).map(([k, v]) => ({key: k, value: v}))) {
* everyoneCanViewAllJobs.push(new databricks.Permissions(`everyone_can_view_all_jobs-${range.key}`, {
* jobId: range.value,
* accessControls: [{
* groupName: "users",
* permissionLevel: "CAN_VIEW",
* }],
* }));
* }
* }
* ```
*
* ## Related Resources
*
* The following resources are used in the same context:
*
* * databricks.Job to manage [Databricks Jobs](https://docs.databricks.com/jobs.html) to run non-interactive code in a databricks_cluster.
*/
function getJobsOutput(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invokeOutput("databricks:index/getJobs:getJobs", {
"ids": args.ids,
"jobNameContains": args.jobNameContains,
"key": args.key,
}, opts);
}
exports.getJobsOutput = getJobsOutput;
//# sourceMappingURL=getJobs.js.map