@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
123 lines • 4.82 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.GitCredential = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource allows you to manage credentials for [Databricks Repos](https://docs.databricks.com/repos.html) using [Git Credentials API](https://docs.databricks.com/dev-tools/api/latest/gitcredentials.html).
*
* > This resource can only be used with a workspace-level provider!
*
* ## Example Usage
*
* ### Git credential that uses personal access token
*
* You can declare Pulumi-managed Git credential using following code:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const ado = new databricks.GitCredential("ado", {
* gitUsername: "myuser",
* gitProvider: "azureDevOpsServices",
* personalAccessToken: "sometoken",
* });
* ```
*
* ### Git credential configuration for Azure Service Principal and Azure DevOps
*
* Databricks now supports Azure service principal federation to Azure DevOps. Follow the [documentation](https://learn.microsoft.com/en-us/azure/databricks/repos/automate-with-ms-entra) on how to configure service principal federation, and after everything is configured, it could be used as simple as:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const ado = new databricks.GitCredential("ado", {gitProvider: "azureDevOpsServicesAad"});
* ```
*
* ## Related Resources
*
* The following resources are often used in the same context:
*
* * databricks.Repo to manage Databricks Repos.
*
* ## Import
*
* The resource cluster can be imported using ID of Git credential that could be obtained via REST API:
*
* hcl
*
* import {
*
* to = databricks_git_credential.this
*
* id = "<git-credential-id>"
*
* }
*
* Alternatively, when using `terraform` version 1.4 or earlier, import using the `pulumi import` command:
*
* bash
*
* ```sh
* $ pulumi import databricks:index/gitCredential:GitCredential this <git-credential-id>
* ```
*/
class GitCredential extends pulumi.CustomResource {
/**
* Get an existing GitCredential 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 GitCredential(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of GitCredential. 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'] === GitCredential.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["force"] = state?.force;
resourceInputs["gitProvider"] = state?.gitProvider;
resourceInputs["gitUsername"] = state?.gitUsername;
resourceInputs["isDefaultForProvider"] = state?.isDefaultForProvider;
resourceInputs["name"] = state?.name;
resourceInputs["personalAccessToken"] = state?.personalAccessToken;
}
else {
const args = argsOrState;
if (args?.gitProvider === undefined && !opts.urn) {
throw new Error("Missing required property 'gitProvider'");
}
resourceInputs["force"] = args?.force;
resourceInputs["gitProvider"] = args?.gitProvider;
resourceInputs["gitUsername"] = args?.gitUsername;
resourceInputs["isDefaultForProvider"] = args?.isDefaultForProvider;
resourceInputs["name"] = args?.name;
resourceInputs["personalAccessToken"] = args?.personalAccessToken;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GitCredential.__pulumiType, name, resourceInputs, opts);
}
}
exports.GitCredential = GitCredential;
/** @internal */
GitCredential.__pulumiType = 'databricks:index/gitCredential:GitCredential';
//# sourceMappingURL=gitCredential.js.map