@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
201 lines (200 loc) • 6.89 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* 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.
*/
export declare function getJobs(args?: GetJobsArgs, opts?: pulumi.InvokeOptions): Promise<GetJobsResult>;
/**
* A collection of arguments for invoking getJobs.
*/
export interface GetJobsArgs {
/**
* map of databricks.Job names to ids
*/
ids?: {
[key: string]: string;
};
/**
* Only return databricks.Job ids that match the given name string (case-insensitive).
*/
jobNameContains?: string;
/**
* Attribute to use for keys in the returned map of databricks.Job ids by. Possible values are `name` (default) or `id`. Setting to `id` uses the job ID as the map key, allowing duplicate job names.
*/
key?: string;
}
/**
* A collection of values returned by getJobs.
*/
export interface GetJobsResult {
/**
* The provider-assigned unique ID for this managed resource.
*/
readonly id: string;
/**
* map of databricks.Job names to ids
*/
readonly ids: {
[key: string]: string;
};
readonly jobNameContains?: string;
readonly key?: string;
}
/**
* 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.
*/
export declare function getJobsOutput(args?: GetJobsOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetJobsResult>;
/**
* A collection of arguments for invoking getJobs.
*/
export interface GetJobsOutputArgs {
/**
* map of databricks.Job names to ids
*/
ids?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Only return databricks.Job ids that match the given name string (case-insensitive).
*/
jobNameContains?: pulumi.Input<string>;
/**
* Attribute to use for keys in the returned map of databricks.Job ids by. Possible values are `name` (default) or `id`. Setting to `id` uses the job ID as the map key, allowing duplicate job names.
*/
key?: pulumi.Input<string>;
}