@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
120 lines (119 loc) • 6.07 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* 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
* ```
*/
export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: TokenState, opts?: pulumi.CustomResourceOptions): Token;
/**
* 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: any): obj is Token;
/**
* The date this Token was created.
*/
readonly created: pulumi.Output<string>;
/**
* When this token will expire. Personal Access Tokens cannot be renewed, so after this time the token will be completely unusable and a new token will need to be generated. Tokens may be created with 'null' as their expiry and will never expire unless revoked.
*/
readonly expiry: pulumi.Output<string>;
/**
* A label for the Token.
*/
readonly label: pulumi.Output<string | undefined>;
/**
* The scopes this token was created with. These define what parts of the Account the token can be used to access. Many command-line tools, such as the Linode CLI, require tokens with access to *. Tokens with more restrictive scopes are generally more secure. All scopes can be viewed in [the Linode API documentation](https://techdocs.akamai.com/linode-api/reference/get-started#oauth-reference).
*/
readonly scopes: pulumi.Output<string>;
/**
* The token used to access the API.
*/
readonly token: pulumi.Output<string>;
/**
* Create a Token resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: TokenArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Token resources.
*/
export interface TokenState {
/**
* The date this Token was created.
*/
created?: pulumi.Input<string>;
/**
* When this token will expire. Personal Access Tokens cannot be renewed, so after this time the token will be completely unusable and a new token will need to be generated. Tokens may be created with 'null' as their expiry and will never expire unless revoked.
*/
expiry?: pulumi.Input<string>;
/**
* A label for the Token.
*/
label?: pulumi.Input<string>;
/**
* The scopes this token was created with. These define what parts of the Account the token can be used to access. Many command-line tools, such as the Linode CLI, require tokens with access to *. Tokens with more restrictive scopes are generally more secure. All scopes can be viewed in [the Linode API documentation](https://techdocs.akamai.com/linode-api/reference/get-started#oauth-reference).
*/
scopes?: pulumi.Input<string>;
/**
* The token used to access the API.
*/
token?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a Token resource.
*/
export interface TokenArgs {
/**
* When this token will expire. Personal Access Tokens cannot be renewed, so after this time the token will be completely unusable and a new token will need to be generated. Tokens may be created with 'null' as their expiry and will never expire unless revoked.
*/
expiry?: pulumi.Input<string>;
/**
* A label for the Token.
*/
label?: pulumi.Input<string>;
/**
* The scopes this token was created with. These define what parts of the Account the token can be used to access. Many command-line tools, such as the Linode CLI, require tokens with access to *. Tokens with more restrictive scopes are generally more secure. All scopes can be viewed in [the Linode API documentation](https://techdocs.akamai.com/linode-api/reference/get-started#oauth-reference).
*/
scopes: pulumi.Input<string>;
}