@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
160 lines • 6.61 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.User = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Linode User.
* For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-user).
*
* ## Example Usage
*
* Create an unrestricted user:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const john = new linode.User("john", {
* username: "john123",
* email: "john@acme.io",
* });
* ```
*
* Create a restricted user with grants:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const fooser = new linode.User("fooser", {
* username: "cooluser123",
* email: "cool@acme.io",
* restricted: true,
* globalGrants: {
* addLinodes: true,
* addImages: true,
* },
* linodeGrants: [{
* id: 12345,
* permissions: "read_write",
* }],
* });
* ```
*
* ## Global Grants
*
* * `accountAccess` - (optional) The level of access this User has to Account-level actions, like billing information. (`readOnly`, `readWrite`)
*
* * `addDomains` - (optional) If true, this User may add Domains.
*
* * `addDatabases` - (optional) If true, this User may add Databases.
*
* * `addFirewalls` - (optional) If true, this User may add Firewalls.
*
* * `addImages` - (optional) If true, this User may add Images.
*
* * `addLinodes` - (optional) If true, this User may create Linodes.
*
* * `addLongview` - (optional) If true, this User may create Longview clients and view the current plan.
*
* * `addNodebalancers` - (optional) If true, this User may add NodeBalancers.
*
* * `addPlacementGroups` - (optional) If true, this User may add Placement Groups.
*
* * `addStackscripts` - (optional) If true, this User may add StackScripts.
*
* * `addVpcs` - (optional) If true, this User may add Virtual Private Clouds (VPCs).
*
* * `cancelAccount` - (optional) If true, this User may cancel the entire Account.
*
* * `longviewSubscription` - (optional) If true, this User may manage the Account’s Longview subscription.
*
* ## Entity Grants
*
* * `id` - (required) The ID of the entity this grant applies to.
*
* * `permissions` - (required) The level of access this User has to this entity. (`readOnly`, `readWrite`)
*/
class User extends pulumi.CustomResource {
/**
* Get an existing User 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 User(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of User. 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'] === User.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["domainGrants"] = state?.domainGrants;
resourceInputs["email"] = state?.email;
resourceInputs["firewallGrants"] = state?.firewallGrants;
resourceInputs["globalGrants"] = state?.globalGrants;
resourceInputs["imageGrants"] = state?.imageGrants;
resourceInputs["linodeGrants"] = state?.linodeGrants;
resourceInputs["longviewGrants"] = state?.longviewGrants;
resourceInputs["nodebalancerGrants"] = state?.nodebalancerGrants;
resourceInputs["placementGroupGrants"] = state?.placementGroupGrants;
resourceInputs["restricted"] = state?.restricted;
resourceInputs["sshKeys"] = state?.sshKeys;
resourceInputs["stackscriptGrants"] = state?.stackscriptGrants;
resourceInputs["tfaEnabled"] = state?.tfaEnabled;
resourceInputs["userType"] = state?.userType;
resourceInputs["username"] = state?.username;
resourceInputs["volumeGrants"] = state?.volumeGrants;
resourceInputs["vpcGrants"] = state?.vpcGrants;
}
else {
const args = argsOrState;
if (args?.email === undefined && !opts.urn) {
throw new Error("Missing required property 'email'");
}
if (args?.username === undefined && !opts.urn) {
throw new Error("Missing required property 'username'");
}
resourceInputs["domainGrants"] = args?.domainGrants;
resourceInputs["email"] = args?.email;
resourceInputs["firewallGrants"] = args?.firewallGrants;
resourceInputs["globalGrants"] = args?.globalGrants;
resourceInputs["imageGrants"] = args?.imageGrants;
resourceInputs["linodeGrants"] = args?.linodeGrants;
resourceInputs["longviewGrants"] = args?.longviewGrants;
resourceInputs["nodebalancerGrants"] = args?.nodebalancerGrants;
resourceInputs["placementGroupGrants"] = args?.placementGroupGrants;
resourceInputs["restricted"] = args?.restricted;
resourceInputs["stackscriptGrants"] = args?.stackscriptGrants;
resourceInputs["username"] = args?.username;
resourceInputs["volumeGrants"] = args?.volumeGrants;
resourceInputs["vpcGrants"] = args?.vpcGrants;
resourceInputs["sshKeys"] = undefined /*out*/;
resourceInputs["tfaEnabled"] = undefined /*out*/;
resourceInputs["userType"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(User.__pulumiType, name, resourceInputs, opts);
}
}
exports.User = User;
/** @internal */
User.__pulumiType = 'linode:index/user:User';
//# sourceMappingURL=user.js.map
;