@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
93 lines • 4.4 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");
/**
* Provides a Linode Token resource. This can be used to create, modify, and delete Linode API Personal Access Tokens. Personal Access Tokens proxy user credentials for Linode API access. This is necessary for tools, such as Pulumi, to interact with Linode services on a user's behalf.
*
* It is common for the provider itself to be configured with broadly scoped Personal Access Tokens. Provisioning scripts or tools configured within a Linode Instance should follow the principle of least privilege to afford only the required roles for tools to perform their necessary tasks. The `linode.Token` resource allows for the management of Personal Access Tokens with scopes mirroring or narrowing the scope of the parent token.
*
* For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/get-personal-access-tokens).
*
* ## Example Usage
*
* The following example shows how one might use this resource to configure a token for use in another tool that needs access to Linode resources.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const foo = new linode.Token("foo", {
* label: "token",
* scopes: "linodes:read_only",
* expiry: "2100-01-02T03:04:05Z",
* });
* const fooInstance = new linode.Instance("foo", {});
* ```
*
* ## Import
*
* Linodes Tokens can be imported using the Linode Token `id`, e.g. The secret token will not be imported.
*
* ```sh
* $ pulumi import linode:index/token:Token mytoken 1234567
* ```
*/
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["created"] = state ? state.created : undefined;
resourceInputs["expiry"] = state ? state.expiry : undefined;
resourceInputs["label"] = state ? state.label : undefined;
resourceInputs["scopes"] = state ? state.scopes : undefined;
resourceInputs["token"] = state ? state.token : undefined;
}
else {
const args = argsOrState;
if ((!args || args.scopes === undefined) && !opts.urn) {
throw new Error("Missing required property 'scopes'");
}
resourceInputs["expiry"] = args ? args.expiry : undefined;
resourceInputs["label"] = args ? args.label : undefined;
resourceInputs["scopes"] = args ? args.scopes : undefined;
resourceInputs["created"] = undefined /*out*/;
resourceInputs["token"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["token"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Token.__pulumiType, name, resourceInputs, opts);
}
}
exports.Token = Token;
/** @internal */
Token.__pulumiType = 'linode:index/token:Token';
//# sourceMappingURL=token.js.map
;