@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
98 lines • 4.53 kB
JavaScript
// *** 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.Token = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* > This resource can only be used with a workspace-level provider!
*
* This resource creates [Personal Access Tokens](https://docs.databricks.com/sql/user/security/personal-access-tokens.html) for the same user that is authenticated with the provider. Most likely you should use databricks.OboToken to create [On-Behalf-Of tokens](https://docs.databricks.com/administration-guide/users-groups/service-principals.html#manage-personal-access-tokens-for-a-service-principal) for a databricks.ServicePrincipal in Databricks workspaces on AWS. Databricks workspaces on other clouds use their own native OAuth token flows.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* // create PAT token to provision entities within workspace
* const pat = new databricks.Token("pat", {
* comment: "Pulumi Provisioning",
* lifetimeSeconds: 8640000,
* });
* export const databricksToken = pat.tokenValue;
* ```
*
* A token can be automatically rotated by taking a dependency on the `timeRotating` resource:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
* import * as time from "@pulumiverse/time";
*
* const _this = new time.Rotating("this", {rotationDays: 30});
* const pat = new databricks.Token("pat", {
* comment: pulumi.interpolate`Pulumi (created: ${_this.rfc3339})`,
* lifetimeSeconds: 60 * 24 * 60 * 60,
* });
* ```
*
* ## Import
*
* !> Importing this resource is not currently supported.
*/
class Token extends pulumi.CustomResource {
/**
* Get an existing Token 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 Token(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Token. 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'] === Token.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["comment"] = state ? state.comment : undefined;
resourceInputs["creationTime"] = state ? state.creationTime : undefined;
resourceInputs["expiryTime"] = state ? state.expiryTime : undefined;
resourceInputs["lifetimeSeconds"] = state ? state.lifetimeSeconds : undefined;
resourceInputs["tokenId"] = state ? state.tokenId : undefined;
resourceInputs["tokenValue"] = state ? state.tokenValue : undefined;
}
else {
const args = argsOrState;
resourceInputs["comment"] = args ? args.comment : undefined;
resourceInputs["creationTime"] = args ? args.creationTime : undefined;
resourceInputs["expiryTime"] = args ? args.expiryTime : undefined;
resourceInputs["lifetimeSeconds"] = args ? args.lifetimeSeconds : undefined;
resourceInputs["tokenId"] = args ? args.tokenId : undefined;
resourceInputs["tokenValue"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["tokenValue"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Token.__pulumiType, name, resourceInputs, opts);
}
}
exports.Token = Token;
/** @internal */
Token.__pulumiType = 'databricks:index/token:Token';
//# sourceMappingURL=token.js.map
;