@muhlba91/pulumi-proxmoxve
Version:
A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.
102 lines • 4.13 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.Token = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* User API tokens.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* // if creating a user token, the user must be created first
* const user = new proxmoxve.permission.User("user", {
* comment: "Managed by Pulumi",
* email: "user@pve",
* enabled: true,
* expirationDate: "2034-01-01T22:00:00Z",
* userId: "user@pve",
* });
* const userToken = new proxmoxve.user.Token("userToken", {
* comment: "Managed by Pulumi",
* expirationDate: "2033-01-01T22:00:00Z",
* tokenName: "tk1",
* userId: user.userId,
* });
* ```
*
* ## Import
*
* #!/usr/bin/env sh
*
* #Tokens can be imported using they identifiers in format `user_id!token_name` format, e.g.:
*
* ```sh
* $ pulumi import proxmoxve:User/token:Token token1 user@pve!token1
* ```
*/
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["expirationDate"] = state ? state.expirationDate : undefined;
resourceInputs["privilegesSeparation"] = state ? state.privilegesSeparation : undefined;
resourceInputs["tokenName"] = state ? state.tokenName : undefined;
resourceInputs["userId"] = state ? state.userId : undefined;
resourceInputs["value"] = state ? state.value : undefined;
}
else {
const args = argsOrState;
if ((!args || args.tokenName === undefined) && !opts.urn) {
throw new Error("Missing required property 'tokenName'");
}
if ((!args || args.userId === undefined) && !opts.urn) {
throw new Error("Missing required property 'userId'");
}
resourceInputs["comment"] = args ? args.comment : undefined;
resourceInputs["expirationDate"] = args ? args.expirationDate : undefined;
resourceInputs["privilegesSeparation"] = args ? args.privilegesSeparation : undefined;
resourceInputs["tokenName"] = args ? args.tokenName : undefined;
resourceInputs["userId"] = args ? args.userId : undefined;
resourceInputs["value"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["value"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Token.__pulumiType, name, resourceInputs, opts);
}
}
exports.Token = Token;
/** @internal */
Token.__pulumiType = 'proxmoxve:User/token:Token';
//# sourceMappingURL=token.js.map