@lbrlabs/pulumi-harness
Version:
A Pulumi package for creating and managing Harness resources.
85 lines • 3.32 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.AddUserToGroup = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Resource for adding a user to a group.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as harness from "@lbrlabs/pulumi-harness";
* import * as harness from "@pulumi/harness";
*
* const exampleUser = harness.getUser({
* email: "testuser@example.com",
* });
* const admin = new harness.UserGroup("admin", {});
* const exampleAddUserToGroups = new harness.AddUserToGroup("exampleAddUserToGroups", {
* groupId: admin.id,
* userId: data.harness_user.test.id,
* });
* ```
*
* ## Import
*
* Import using the Harness user and user group id
*
* ```sh
* $ pulumi import harness:index/addUserToGroup:AddUserToGroup example_admin <user_id>/<group_id>
* ```
*/
class AddUserToGroup extends pulumi.CustomResource {
/**
* Get an existing AddUserToGroup 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 AddUserToGroup(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of AddUserToGroup. 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'] === AddUserToGroup.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["groupId"] = state ? state.groupId : undefined;
resourceInputs["userId"] = state ? state.userId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.groupId === undefined) && !opts.urn) {
throw new Error("Missing required property 'groupId'");
}
if ((!args || args.userId === undefined) && !opts.urn) {
throw new Error("Missing required property 'userId'");
}
resourceInputs["groupId"] = args ? args.groupId : undefined;
resourceInputs["userId"] = args ? args.userId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AddUserToGroup.__pulumiType, name, resourceInputs, opts);
}
}
exports.AddUserToGroup = AddUserToGroup;
/** @internal */
AddUserToGroup.__pulumiType = 'harness:index/addUserToGroup:AddUserToGroup';
//# sourceMappingURL=addUserToGroup.js.map